Skip to content

Verify JDK downloads with vendor checksums - #1167

Merged
brunoborges merged 8 commits into
mainfrom
brunoborges-verify-jdk-checksums
Jul 29, 2026
Merged

Verify JDK downloads with vendor checksums#1167
brunoborges merged 8 commits into
mainfrom
brunoborges-verify-jdk-checksums

Conversation

@brunoborges

@brunoborgesbrunoborges commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Description:
Downloaded JDK archives were extracted and cached without a common integrity check even when vendors published authoritative digests. This adds automatic streaming SHA-256/SHA-512 verification before extraction, removes failed downloads, and keeps diagnostics free of signed URL credentials.

Checksum metadata is sourced from authoritative vendor APIs or checksum siblings for Temurin, Semeru, Adopt, Corretto, Dragonwell, Kona, SapMachine, GraalVM, GraalVM Community, Zulu, Oracle, Oracle OpenJDK, Microsoft, and JetBrains. Distributions or releases without a strong authoritative digest continue normally with debug-level visibility. Existing opt-in GPG verification for Temurin and Microsoft remains complementary and unchanged.

The change also adds unit and distributor contract coverage, a forced-download Corretto E2E path, user documentation, and a rebuilt action bundle.

Related issue:
Fixes: #1166

Check list:

  • Ran npm run check locally (format, lint, build, test) and all checks pass.
  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a800a031-600e-4d28-b23e-be309555d38d
CopilotAI review requested due to automatic review settings July 29, 2026 05:11
@brunoborges
brunoborges requested a review from a team as a code ownerJuly 29, 2026 05:11

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds shared, automatic integrity verification for downloaded JDK archives by propagating vendor-provided checksum metadata through the download model and verifying the archive digest (SHA-256/SHA-512) before extraction/caching. This strengthens download integrity across multiple supported distributions while keeping existing GPG signature verification unchanged.

Changes:

  • Extend JavaDownloadRelease with optional checksum metadata and introduce a shared downloadAndVerify path in the base installer.
  • Implement streaming checksum calculation/verification with sanitized error messages and cleanup of failed downloads.
  • Add unit + distributor contract tests, an E2E forced-download path (Corretto), and update docs/action metadata; rebuild the bundled dist output.
Show a summary per file
FileDescription
src/distributions/zulu/installer.tsSwitch download flow to shared download+verification helper.
src/distributions/temurin/installer.tsPopulate checksum metadata from vendor API; use shared download+verification.
src/distributions/semeru/installer.tsPopulate checksum metadata from vendor API; use shared download+verification.
src/distributions/sapmachine/installer.tsAttach checksum metadata and use shared download+verification.
src/distributions/oracle/installer.tsSwitch download flow to shared download+verification helper.
src/distributions/openjdk/installer.tsSwitch download flow to shared download+verification helper.
src/distributions/microsoft/installer.tsSwitch download flow to shared download+verification helper (signature flow remains).
src/distributions/liberica/installer.tsSwitch download flow to shared download+verification helper.
src/distributions/liberica-nik/installer.tsSwitch download flow to shared download+verification helper.
src/distributions/kona/installer.tsAdd checksum metadata sourced from Kona releases JSON; use shared download+verification.
src/distributions/jetbrains/installer.tsSwitch download flow to shared download+verification helper.
src/distributions/graalvm/installer.tsSwitch download flow to shared download+verification helper.
src/distributions/dragonwell/installer.tsAttach checksum metadata when present; use shared download+verification.
src/distributions/corretto/installer.tsAdd checksum metadata sourced from Corretto versions JSON; use shared download+verification.
src/distributions/base-models.tsAdd checksum types and optional checksum field on releases.
src/distributions/base-installer.tsAdd downloadAndVerify helper integrating checksum verification + cleanup.
src/checksum.tsNew checksum calculation/verification implementation with sanitized source handling.
README.mdDocument automatic checksum verification behavior and relationship to signatures.
dist/setup/index.jsRebuilt bundle including checksum logic and updated installers.
action.ymlClarify signature verification as complementary to automatic checksum verification.
.github/workflows/e2e-versions.ymlAdd E2E job that forces a Corretto download to exercise verification path.
tests/distributors/temurin-installer.test.tsAssert Temurin checksum metadata is sourced from vendor response.
tests/distributors/semeru-installer.test.tsAssert Semeru checksum metadata is sourced from vendor response.
tests/distributors/sapmachine-installer.test.tsAssert SapMachine checksum shape/format is present.
tests/distributors/kona-installer.test.tsAssert Kona checksum metadata when present (incl. source URL).
tests/distributors/dragonwell-installer.test.tsAssert Dragonwell checksum shape/format is present.
tests/distributors/corretto-installer.test.tsAssert Corretto checksum metadata includes expected source URL.
tests/distributors/base-installer.test.tsAdd unit coverage for download+verify success, mismatch cleanup, and “no checksum” debug behavior.
tests/distributors/adopt-installer.test.tsAssert Adopt checksum metadata is sourced from vendor response.
tests/checksum.test.tsAdd unit coverage for sha256/sha512 success, mismatch messaging, malformed metadata, source sanitization, and read errors.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 30/31 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment threadsrc/distributions/base-installer.ts
Comment threadsrc/checksum.ts Outdated
brunoborgesand others added 7 commits July 29, 2026 01:17
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a800a031-600e-4d28-b23e-be309555d38d
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a800a031-600e-4d28-b23e-be309555d38d
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a800a031-600e-4d28-b23e-be309555d38d
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a800a031-600e-4d28-b23e-be309555d38d
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a800a031-600e-4d28-b23e-be309555d38d
JetBrains publishes a single, generically-named ".checksum" sibling
whose digest algorithm isn't disclosed by the filename. Older JBR 11
builds (e.g. jbrsdk_nomod-11_0_16-*-b2043.64.tar.gz) publish a SHA-256
digest there, while newer builds publish SHA-512. The JetBrains
installer previously assumed SHA-512 unconditionally, so verification
failed with "Malformed sha512 checksum metadata ... expected a
128-character hexadecimal digest" for those older builds, breaking the
jetbrains 11 e2e job on macOS and Windows.
fetchChecksum now accepts a list of candidate algorithms and infers
the actual algorithm from the returned digest's length, preferring the
strongest match. The JetBrains installer passes ['sha512', 'sha256'];
all other callers are unaffected since they already pass a single,
vendor-disclosed algorithm.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a800a031-600e-4d28-b23e-be309555d38d
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a800a031-600e-4d28-b23e-be309555d38d
@brunoborges
brunoborges merged commit 27f2c62 into mainJul 29, 2026
444 checks passed
@brunoborges
brunoborges deleted the brunoborges-verify-jdk-checksums branch July 29, 2026 08:43
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify downloaded JDK archives with vendor-provided checksums

2 participants

@brunoborges