-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performing checksum comparison on downloaded databases in CLI #160
Conversation
BE-2235 Perform checksum comparison on downloaded databases in CLI
We currently download free databases in the IPinfo CLI with a URL like We have an endpoint that is the same as the above but with a
We should perform a local sha256 checksum against the downloaded file and then check against this endpoint to compare the checksums, to ensure there was no error while downloading. This is an idea from BE-2208 cc abdullah |
ipinfo/cmd_download.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
defer resp.Body.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually I put this right above the actual readall call instead of after a successful fetch, since we sometimes don't even read the body after a fetch as we may check for HTTP error codes / etc.
So:
resp, err := get()
if err != nil {
}
defer resp.Body.Close()
io.ReadAll()
ipinfo/cmd_download.go
Outdated
if localChecksum != checksumResponse.Checksums.SHA256 { | ||
return errors.New("checksums do not match. File might be corrupted") | ||
} | ||
|
||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error was supposed to be connected to the download step but now it's hanging out here
Co-authored-by: Uman Shahzad <[email protected]>
No description provided.