verify-action-build: tighten JS download heuristic#830
Merged
potiuk merged 1 commit intoMay 11, 2026
Merged
Conversation
…tives graalvm/setup-graalvm v1.5.3 (PR apache#817) flagged 7 "unverified downloads" all of which were false positives: * 2x http.get(url, { accept: 'application/json' }) followed by JSON.parse — JSON metadata calls, not binary downloads. * 1x async function downloadTool(...) — function definition that happens to start with the helper's name. * 4x downloads (across gds.ts/utils.ts) where verification IS in the same file via createHash('sha256') and a custom calculateSHA256 helper, but the regex required crypto. createHash (with module prefix) and missed the bare imported form + custom helper names. Three fixes: 1. Add ``accept: 'application/json'`` (single- or double-quoted) as a data-parse marker. An HTTP call asking for JSON in its own request headers is data, not bytes. 2. Skip lines that look like function definitions in the download-pattern scanner. ``function name(``, ``async function name(``, ``export default async function name(`` and ``function* name(`` all match the new ``_JS_FUNCTION_DEFINITION_RE`` and are excluded. 3. Recognize bare ``createHash('sha…')`` and the conventional ``calculateSHA[256|512|...]`` / ``calculateChecksum`` / ``verifyHash`` / ``computeChecksum`` helper names as verification. 12 new tests pin each fix. Re-running verify-action-build against graalvm/setup-graalvm@bef4b0e9 (the v1.5.3 SHA): exit 0; the 6 remaining findings are recognized as "verification present in file" and reported as warnings rather than failures.
dave2wave
approved these changes
May 11, 2026
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
#817 (
graalvm/setup-graalvm@v1.5.3) flagged 7 "unverified downloads" — all 7 were false positives, surfacing three distinct gaps in the JS download / verification heuristic. Each fix is independent.accept: 'application/json'recognised as data-parse marker —http.get(url, { accept: 'application/json' })followed byJSON.parse(...)is a JSON metadata call. Add the accept-header regex (single- and double-quoted) to_JS_DATA_PARSE_PATTERNS.async function downloadTool(...)matched thedownloadTool(regex literally. Add_JS_FUNCTION_DEFINITION_REcoveringfunction,async function,export [default],function*and skip those lines in_find_binary_downloads_js.createHash+ custom helper names recognised as verification —import { createHash } from 'crypto'thencreateHash('sha256')was missed because the existing pattern requiredcrypto.createHash(. Add barecreateHash\s*\(\s*['"\]shaand helper-function names (calculateSHA[\d+],calculateChecksum,calculateDigest,verifyHash,computeChecksum`).12 new tests in
test_security.pypin each fix.Test plan
uv run pytest utils/tests/— 235/235.prek run --all-filesclean.graalvm/setup-graalvm@bef4b0e9…) — was 7 unverified failures + exit 1; now 6 findings (1 function-def dropped), all marked "verification present in file" → warnings → exit 0.Generated-by Claude Code.