Skip to content
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

compute checksum of binary downloads #1065

Closed
hohwille opened this issue Mar 7, 2023 · 3 comments · Fixed by #1093
Closed

compute checksum of binary downloads #1065

hohwille opened this issue Mar 7, 2023 · 3 comments · Fixed by #1093
Assignees
Labels
enhancement New feature or request security related to IT-Security (e.g. vulnerability) software software-package with 3rd party products

Comments

@hohwille
Copy link
Member

hohwille commented Mar 7, 2023

With epic #941 we are redesigning our downloads and introducing ide-urls repo.
The idea of this story is to improve security and prevent man-in-the-middle or other attacks that may lead to downloads of evil content and therefore remote-code-execution.
To archive this, we will introduce checksum files (e.g. sha or md5) for all our downloads in ide-urls.
So in addition to downloading the actual package, we would also download the corresponding checksum file.
Then we would compute the checksum locally using an according tool (e.g. sha256sum or md5sum) and compare the result with the content of the downloaded checksum file.
If they match, we continue as before, but otherwise, we would fail with an according error and a link with further instructions (AsciiDoc file with hints and link to report a security issue so we can also check if the vendor has actually changed the binary after releasing on purpose what is an anti-pattern but might also happen in rare cases).

NOTE: even though the feature is released with 2023.04.001 the actual verification of checksums is not yet implemented and will come with a following release. To track all this watch the epic #941.

@hohwille hohwille added enhancement New feature or request software software-package with 3rd party products security related to IT-Security (e.g. vulnerability) labels Mar 7, 2023
@hohwille
Copy link
Member Author

hohwille commented Mar 7, 2023

For the record: Maven is already following this best practice approach as you can see here:

I would consider sha1 as obsolete and insecure. sha256 is most probably a perfect choice from security point of view but we would have to consider the following:

  • is the checksum tool present on every target environment (MacOS, Windows + GitBash, Linux, Github-Actions aka Linux)? I would assume for md5sum this is given, but we need to check this for sha256sum.
  • how long will the signature be and how big will our repository grow just due to bigger signatures? If it is just 1kB+ we should be fine, but if we add megabytes, we should be a little bit more concerned and consider a trade-off between security and sustainability.

@alfeilex alfeilex self-assigned this Mar 7, 2023
@alfeilex
Copy link
Member

alfeilex commented Mar 7, 2023

We can probably also use the command shasum -a 256 <file>. This command should be available for all platforms.

I tested that command on

  • Windows
  • MacOS (m1)
  • Linux

@alfeilex
Copy link
Member

alfeilex commented Mar 8, 2023

Currently, there are ~8000 .urls files in ide-urls. If we use something like this as checksum file

ca78815afd657f887de7f9b74014dc4bddffe80fd28028179b271a3c4f64f29a terraform_1.3.9_darwin_amd64.zip

then each of these files has a size of 100bytes. This would increase the size of repository to 781.25KB. That should be fine.

@alfeilex alfeilex linked a pull request Mar 30, 2023 that will close this issue
@alfeilex alfeilex linked a pull request Apr 3, 2023 that will close this issue
@hohwille hohwille added this to the release:2023.04.001 milestone Apr 14, 2023
@hohwille hohwille changed the title checksum verification of binary downloads compute checksum of binary downloads Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request security related to IT-Security (e.g. vulnerability) software software-package with 3rd party products
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants