Skip to content

Commit 7abbe4e

Browse files
committed
TASK-059: sha256-pin PMD analyzer download in CI
Add integrity verification for the pmd-dist-7.24.0-bin.zip artifact downloaded by the lint lane of verify-build.yml. Introduces a pinned PMD_SHA256 alongside the existing PMD_VERSION and pipes the pair into `sha256sum -c -` immediately after the curl invocation, so a tampered or substituted zip aborts the step before unzip/install. A rotation-procedure comment block is added above the run: scalar so future PRs that bump PMD_VERSION are reminded to update PMD_SHA256 in the same change. No TODO comment existed on this step to remove. Local falsification rehearsal (Step A of the plan): - Wrong digest (all zeros) on real zip: sha256sum -c - -> FAILED, exit=1 - Tampered zip (one byte flipped at offset 1000) against the real digest: sha256sum -c - -> FAILED, exit=1 - Pristine zip against real digest: -> OK, exit=0 Real digest sourced by `shasum -a 256` of a freshly downloaded pmd-dist-7.24.0-bin.zip from the GitHub release page (the upstream .sha256 companion file is not published for this release; the download-and-hash fallback documented in the plan was used). Out of scope: the unrelated IWYU clang_18-branch TODO (~line 467) and the libcurl-tarball SHA-256 TODO (~line 502) in the same file are deliberately left untouched per the plan.
1 parent 36416af commit 7abbe4e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

.github/workflows/verify-build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,18 @@ jobs:
440440
# CPD is shipped as part of the PMD distribution. The apt package
441441
# is pinned to PMD 6.x; we want the modern PMD 7 CLI (`pmd cpd ...`)
442442
# to match the script. Java is pre-installed on ubuntu-latest.
443+
#
444+
# Supply-chain: pmd.zip is sha256-pinned. To rotate PMD, update
445+
# BOTH PMD_VERSION and PMD_SHA256 in the same PR. Obtain the new
446+
# digest from the GitHub release page's pmd-dist-<ver>-bin.zip
447+
# asset (or `sha256sum` the freshly downloaded zip and commit
448+
# the resulting value here).
443449
run: |
444450
PMD_VERSION=7.24.0
451+
PMD_SHA256=110934b36d39c19094d1b77386931978093f238f2c2f1851748822b69c7367ac
445452
curl -fsSL -o /tmp/pmd.zip \
446453
"https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-dist-${PMD_VERSION}-bin.zip"
454+
echo "${PMD_SHA256} /tmp/pmd.zip" | sha256sum -c -
447455
sudo unzip -q -o /tmp/pmd.zip -d /opt
448456
sudo ln -sf "/opt/pmd-bin-${PMD_VERSION}/bin/pmd" /usr/local/bin/pmd
449457
pmd --version

0 commit comments

Comments
 (0)