security: fail-closed binary checksum verification + version-tag validation#362
Open
rafaelfiguereod-stack wants to merge 1 commit into
Open
Conversation
…dation
Two self-contained, backward-compatible hardening changes to the binary
supply chain (Python + TS clients), with new tests.
1. Checksum verification fails CLOSED. _verify_download_checksum /
verifyDownloadChecksum previously warned and ran the binary when
SHA256SUMS was missing or had no entry for the platform archive; they
now raise. The CLOAKBROWSER_SKIP_CHECKSUM=true escape hatch is kept for
custom mirrors. _fetch_checksums skips empty/non-SHA256SUMS bodies (e.g.
a redirect to an HTML 404) and falls through to the next mirror;
_parse_checksums requires a 64-hex digest per line.
2. Version-tag validation. The Chromium version (from the GitHub release
tag) flows into cache paths, URLs, and the Windows PowerShell zip
extraction. Added is_safe_version_tag / isSafeVersionTag
(^\d+(\.\d+){0,9}$); latest-version and cache-marker versions are
validated before use, and TS zip extraction passes paths to PowerShell
via env vars instead of -Command string interpolation.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
Two small, self-contained, backward-compatible hardening changes to the binary supply chain (Python + TS clients), with new tests.
1. Checksum verification fails closed (was fail-open)
_verify_download_checksum/verifyDownloadChecksumpreviously logged a warning and used the binary whenSHA256SUMScould not be fetched, or had no entry for the platform archive. Since every release publishesSHA256SUMS(and there's a build-provenance attestation), the client should enforce it:CLOAKBROWSER_SKIP_CHECKSUM=trueescape hatch is preserved (custom mirrors / offline builds)._fetch_checksumsnow skips an empty parse (e.g. a redirect to an HTML 404 page) and falls through to the next mirror, so a misbehaving primary can't shadow a good fallback or satisfy the check with junk._parse_checksumsrequires a valid 64‑hex digest per line (the TS regex already did).I verified that the live release
SHA256SUMSis reachable and contains each platform's entry, so this does not break installs.2. Version‑tag validation
The Chromium version comes from the GitHub release tag name and flows into cache paths, download URLs, and (Windows, TS client) the PowerShell zip‑extraction command. Added
is_safe_version_tag/isSafeVersionTag(^\d+(\.\d+){0,9}$):_get_latest_chromium_version/getLatestChromiumVersionskip any release whose version isn't plain dotted‑numeric.get_effective_version.-Commandstring, so a path/version containing a quote can't be parsed as code.Tests
tests/test_supplychain_hardening.py(fail‑closed, mirror fall‑through, version validation) — passing.tsc --noEmitclean. (Pre‑existing Windows‑only failures intest_update/test_config/test_extractare unrelated — they hard‑code.tar.gz/POSIX paths.)Deliberately NOT included here (to avoid duplicating existing open PRs)
cloakserveauthentication — already proposed in fix(cloakserve): opt-in --auth-token + explicit --host for the CDP surface (#217) #248.extractTarguard could get the same treatment as a follow‑up.Happy to adjust scope, split, or rename anything if preferred.