script/seccomp.sh: check tarball sha256#3482
Merged
kolyshkin merged 1 commit intoopencontainers:mainfrom May 27, 2022
Merged
Conversation
Contributor
Author
|
1.1 backport: #3481 |
tianon
reviewed
May 24, 2022
| # Download and extract. | ||
| # Download, check, and extract. | ||
| wget "https://github.com/seccomp/libseccomp/releases/download/v${ver}/${tar}"{,.asc} | ||
| if ! sha256sum "${tar}" | grep -E "^${SECCOMP_SHA256[${ver}]}\s+${tar}$"; then |
Member
There was a problem hiding this comment.
Not a maintainer (so take this for what it's worth), but given this is Bash, I think this would be more reliable something like this:
Suggested change
| if ! sha256sum "${tar}" | grep -E "^${SECCOMP_SHA256[${ver}]}\s+${tar}$"; then | |
| if ! sha256sum --strict --check - <<<"${SECCOMP_SHA256[${ver}]} *${tar}"; then |
Member
There was a problem hiding this comment.
Yeah I agree that's more readable.
Contributor
Author
There was a problem hiding this comment.
Yes, thanks @tianon. I have also removed the if since now we have the proper error message printed by sha256 sum itself.
Member
|
It'd be nice to also verify the signature (which would be a better check than just the checksum) but it would require us to store the seccomp signing key in our repo (then again that's not too big of a deal). |
Add checking of downloaded tarball checksum.
In case it doesn't match the hardcoded value, the error is like this:
libseccomp-2.5.4.tar.gz: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match
In case the checksum for a particular version is not specified in the
script, the error will look like this:
./script/seccomp.sh: line 29: SECCOMP_SHA256[${ver}]: unbound variable
In case the the hardcoded value in the file is of wrong format/length,
we'll get:
sha256sum: 'standard input': no properly formatted SHA256 checksum lines found
In any of these cases, the script aborts (due to set -e).
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
AkihiroSuda
approved these changes
May 26, 2022
mrunalp
approved these changes
May 27, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add checking of downloaded tarball checksum.
In case it doesn't match the hardcoded value, the error is like this:
In case the checksum for a particular version is not specified in the
script, the error will look like this:
In case the the hardcoded value in the file is of wrong format/length,
we'll get:
In any of these cases, the script aborts (due to set -e).
Addresses #3480 (review)