Use SHA-256 for runtime telemetry package checksums#18846
Open
iblancasa wants to merge 2 commits into
Open
Conversation
Signed-off-by: Israel Blancas <iblancasa@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR upgrades runtime telemetry package checksums from SHA-1 to SHA-256 across the jar analysis pipeline and its tests.
Changes:
- Switch checksum computation in
JarDetailsfrom SHA-1 to SHA-256 and adjust formatting to 64 hex chars. - Update
JarAnalyzeremitted attributes to report algorithm"SHA-256"and use the new SHA-256 checksum method. - Update related tests to validate SHA-256 output shape (64 lowercase hex characters).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| instrumentation/runtime-telemetry/testing/src/test/java/io/opentelemetry/javaagent/instrumentation/runtimetelemetry/JarDetailsTest.java | Updates assertions to validate SHA-256 checksum format. |
| instrumentation/runtime-telemetry/testing/src/test/java/io/opentelemetry/javaagent/instrumentation/runtimetelemetry/JarAnalyzerTest.java | Updates expected checksum algorithm and checksum format to SHA-256/64-hex. |
| instrumentation/runtime-telemetry/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/runtimetelemetry/JarAnalyzerInstallerTest.java | Updates expected log attributes and checksum regex to SHA-256/64-hex. |
| instrumentation/runtime-telemetry/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/runtimetelemetry/JarDetails.java | Implements SHA-256 digest computation and exposes computeSha256(). |
| instrumentation/runtime-telemetry/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/runtimetelemetry/JarAnalyzer.java | Emits SHA-256 checksum and algorithm attribute. |
Comment on lines
210
to
+213
| byte[] buffer = new byte[8192]; | ||
| while (dis.read(buffer) != -1) {} | ||
| byte[] digest = md.digest(); | ||
| return String.format(Locale.ROOT, "%040x", new BigInteger(1, digest)); | ||
| return String.format(Locale.ROOT, "%064x", new BigInteger(1, digest)); |
| /** Returns the SHA1 hash of this file, e.g. {@code 30d16ec2aef6d8094c5e2dce1d95034ca8b6cb42}. */ | ||
| String computeSha1() { | ||
| return sha1Checksum; | ||
| /** Returns the SHA-256 hash of this file. */ |
| while (dis.read(buffer) != -1) {} | ||
| byte[] digest = md.digest(); | ||
| return String.format(Locale.ROOT, "%040x", new BigInteger(1, digest)); | ||
| return String.format(Locale.ROOT, "%064x", new BigInteger(1, digest)); |
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.
Fixes #18845
This change updates runtime telemetry package checksums from SHA-1 to SHA-256. Some FIPS-enabled environments disallow SHA-1 for this use. Using SHA-256 makes runtime telemetry package checksum generation compatible with stricter cryptographic policies.
Changes: