-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
script/seccomp.sh: check tarball sha256 #3482
Conversation
1.1 backport: #3481 |
script/seccomp.sh
Outdated
wget "https://github.com/seccomp/libseccomp/releases/download/v${ver}/${tar}"{,.asc} | ||
if ! sha256sum "${tar}" | grep -E "^${SECCOMP_SHA256[${ver}]}\s+${tar}$"; then |
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.
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:
if ! sha256sum "${tar}" | grep -E "^${SECCOMP_SHA256[${ver}]}\s+${tar}$"; then | |
if ! sha256sum --strict --check - <<<"${SECCOMP_SHA256[${ver}]} *${tar}"; then |
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.
Yeah I agree that's more readable.
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.
Yes, thanks @tianon. I have also removed the if
since now we have the proper error message printed by sha256 sum itself.
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>
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.
👀
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)