-
Notifications
You must be signed in to change notification settings - Fork 163
docs: rewrite about-checksums.md to STE rules #2024
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8ba34d7
docs: rewrite about-checksums.md to STE rules
elharo e849eb6
Merge branch 'master' into update-about-checksums-ste
elharo 9ee6386
merge
elharo c6fecf6
merge
elharo 24de4e5
merge
elharo af34fea
merge
elharo c722382
Update src/site/markdown/about-checksums.md
elharo 2c43397
Update about-checksums.md
elharo 891be83
docs: rewrite api-compatibility.md to STE rules (#2026)
elharo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -18,65 +18,62 @@ specific language governing permissions and limitations | |||||
| under the License. | ||||||
| --> | ||||||
|
|
||||||
| Maven Resolver uses checksums to verify the integrity of downloaded artifacts and | ||||||
| metadata. Checksums are usually placed in repositories next to the file in question, with the file | ||||||
| extension indicating the checksum algorithm that produced the given file. Currently, | ||||||
| most Maven repositories contain SHA-1 and MD5 checksums as they are produced by Resolver by default. | ||||||
|
|
||||||
| Historically, Maven Resolver used `java.security.MessageDigest` to implement checksums. Secure one-way | ||||||
| hashes provided by the Java Cryptography Architecture were (mis)used to implement checksums for transport integrity | ||||||
| validation. Secure hashes MAY be used as checksums, as there is quite some | ||||||
| overlap between checksums and hashes in general. But this simplicity comes at a price: cryptographically safe | ||||||
| algorithms require way more CPU cycles to compute than a simple checksum. However, the purpose of a checksum is just | ||||||
| integrity validation, nothing more. There is no security or trust implied or expected from | ||||||
| them. Checksums do not protect against man-in-the-middle or supply chain attacks. | ||||||
|
|
||||||
| To actually trust that artifacts have not been tampered with, you need signatures such as | ||||||
| Maven Resolver uses checksums to verify the integrity of downloaded artifacts and metadata. | ||||||
| Checksums exist in repositories next to the target file. | ||||||
| The file extension identifies the checksum algorithm that produced the checksum. | ||||||
| Most Maven repositories contain SHA-1 and MD5 checksums by default. | ||||||
| Maven Resolver also produces these checksums by default. | ||||||
| Checksums only provide integrity verification. They do not provide security or trust. | ||||||
| They do not protect against man-in-the-middle or supply chain attacks. | ||||||
|
|
||||||
| In the past, Maven Resolver used `java.security.MessageDigest` to calculate checksums. | ||||||
| The Java Cryptography Architecture provides secure one-way hashes. | ||||||
| Maven Resolver used these secure hashes to verify transport integrity. | ||||||
| Secure hashes work as checksums, but cryptographically safe algorithms | ||||||
| require many more CPU cycles to calculate than a simple checksum. | ||||||
|
|
||||||
| Some users state that specific algorithms are unsafe or deprecated. | ||||||
| This argument does not apply to Maven Resolver because checksums do not provide security. | ||||||
| This fact is true for the SHA-1 algorithm and the MD5 algorithm. | ||||||
| Industry still uses both algorithms today to verify transport integrity and to detect errors. | ||||||
|
|
||||||
| To prove that artifacts have not been tampered with, you need signatures such as | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: "prove" is stronger than the original "trust." GPG signatures provide cryptographic assurance from a trusted signer — they establish trust, not mathematical proof. The original word was more precise.
Suggested change
|
||||||
| those provided by the | ||||||
| [Maven GPG Plugin](https://maven.apache.org/plugins/maven-gpg-plugin/). | ||||||
|
|
||||||
| Hence, the usual argument that "XXX algorithm is unsafe, deprecated, not secure anymore" does not apply in the case | ||||||
| of Maven Resolver. Moreover, this is true not only for SHA-1 | ||||||
| algorithm, but even for its "elder brother" MD5. A checksum is not intended to be secure. Both algorithms are still widely used today as "transport integrity | ||||||
| validation" or "error detection" (a.k.a. "bit-rot detection"). | ||||||
| ## Checksum Algorithms Service Provider Interface (SPI) | ||||||
|
|
||||||
| ## Checksum Algorithms SPI | ||||||
| System properties enable users to specify arbitrary checksum algorithms, | ||||||
| even if they are not part of the standard Maven process. | ||||||
| Users can also register an alternate provider for Java Cryptography that | ||||||
| supplies a broader set of message digests for checksums. | ||||||
| The Maven Resolver team discourages this. | ||||||
|
|
||||||
| From a technical perspective, the above facts imply the following consequences: because checksum algorithms are exposed | ||||||
| to the user, one can set them via configuration, and thus users are not prevented from asking for SHA-256 or even SHA-512, even if | ||||||
| these algorithms are not part of standard Maven process. Moreover, nothing prevents users (integrating | ||||||
| Maven Resolver) registering an alternate Java Cryptography Provider and using even broader (or exotic) | ||||||
| message digest algorithms for checksums. While this is not wrong, we do consider this as a | ||||||
| bad use case. The notion of transport validation and secure hashes are being constantly mixed up due to historical | ||||||
| reasons explained above. | ||||||
|
|
||||||
| Hence, the Maven Resolver team decided to make the supported set of checksum algorithms more controlled. Instead of directly exposing | ||||||
| `MessageDigest` algorithms, we introduced an SPI around checksums. This not only prevents incorrect use cases by not | ||||||
| exposing all supported algorithms of `MessageDigest` to users, but also makes it possible to introduce real checksum | ||||||
| algorithms. Finally, the set of supported checksum algorithms remains extensible: if some required algorithm is | ||||||
| not provided by Resolver, it can easily be added by creating a factory component for it. | ||||||
|
|
||||||
| We are aware that users started using "better SHA" algorithms, and we do not want to break them. Nothing for them | ||||||
| changes (configuration and everything basically remains the same). But we do want to prevent any possible further | ||||||
| proliferation of non-standard checksums. | ||||||
|
|
||||||
| ## Implemented Checksum Algorithms | ||||||
|
|
||||||
| Resolver out of the box provides the following checksum algorithms (important: algorithm names are case sensitive): | ||||||
| To control the supported set of checksums, the Maven Resolver team introduced an SPI for checksums. | ||||||
| We no longer expose `MessageDigest` algorithms directly. | ||||||
| Instead, the SPI supports four checksum algorithms: | ||||||
|
|
||||||
| * MD5 | ||||||
| * SHA-1 | ||||||
| * SHA-256 | ||||||
| * SHA-512 | ||||||
|
|
||||||
| The algorithms above are provided by Resolver, by default. Still, using the SPI, anyone can extend | ||||||
| Resolver with new types of Checksum Algorithms. | ||||||
|
|
||||||
| To see how and when checksums are used in Resolver, continue on [Expected Checksums](expected-checksums.html) | ||||||
| page. | ||||||
| The names of these algorithms are case-sensitive. | ||||||
|
|
||||||
| You can use the SPI to extend Maven Resolver with other checksum algorithms. | ||||||
| If Maven Resolver does not provide a required algorithm, you can create a | ||||||
| factory component for the new algorithm to add it. | ||||||
|
|
||||||
| We know that users use stronger SHA algorithms. | ||||||
| We do not want to break these configurations. | ||||||
| Configuration and operations remain the same for these users. | ||||||
| However, we want to prevent the future addition of non-standard checksums. | ||||||
|
|
||||||
| The [Expected Checksums](expected-checksums.html) page explains how and when Maven Resolver uses checksums. | ||||||
|
|
||||||
| Links: | ||||||
|
|
||||||
| * [SHA-1](https://en.wikipedia.org/wiki/SHA-1) (see "Data Integrity" section) | ||||||
| * [MD5](https://en.wikipedia.org/wiki/MD5) (see "Applications" section, especially about error checking functionality) | ||||||
| * [SHA-1](https://en.wikipedia.org/wiki/SHA-1) (The "Data Integrity" section explains this concept.) | ||||||
| * [MD5](https://en.wikipedia.org/wiki/MD5) (The "Applications" section explains the error verification function.) | ||||||
|
|
||||||
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
Oops, something went wrong.
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.
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.
The original's "(mis)used" was intentional editorial commentary — it acknowledged that applying cryptographic hash functions as transport checksums was a design shortcut, which motivates the SPI section that follows. Dropping it entirely loses that context. Consider preserving the nuance, e.g.: