Repository navigation
ci(security): allow the model-name and runtime-key test fixtures gitleaks reports as API keys - #1001
jussielo-amd wants to merge 1 commit into
Conversation
…eaks reports as API keys The generic-api-key rule fires on identifiers that contain the word key. The unit tests of serve_summary.rs and runtime_install_finalize.rs assign model names and a made-up runtime key to runtime_key and api_model, and gitleaks reports them on every pull request whose branch point contains those lines. Allowlist the two field names, anchored on the assignment, in the same way as the existing entries for dummy variable names. Signed-off-by: Jussi Elo <jussi.elo@amd.com>
Security scan found no critical or high findings on lines changed by this pull requestView the security scan run for complete reports. “New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the gitleaks allowlist change targeting recurring test-fixture false positives.
No open issues 🎉
What changed in this PR
This PR adds a gitleaks allowlist entry to suppress recurring false positives for model-name and runtime-key test fixtures in security scans.
Changes:
- Matches assignments to the exact identifiers
runtime_keyandapi_model, rather than commit-specific fingerprints. - Documents the exception without changing security workflows or other scanner configurations.
| File | Description |
|---|---|
.github/scan_tools_configs/gitleaks.toml |
Adds and explains the identifier-based allowlist entry. |
Review effort: Balanced
|
Closing as a duplicate of #1000, which opened three minutes earlier and is the narrower change (Rust files only, exact assignment shape). The points from this PR that are worth taking over, including a wider pattern that also covers nine sibling lines on main, are in a comment on #1000: #1000 (comment) |
Summary
The
Security scan / gitleakscheck, and its aggregateSecurity scan / Security scanners, fail on most open pull requests with threegeneric-api-keyfindings that are not secrets. This adds one allowlist entry to.github/scan_tools_configs/gitleaks.tomlso they are no longer reported. No workflow file is touched.What fails and why
The findings are unit-test fixture lines in two files, for example run 42698640628 on #984:
apps/rocm/src/runtime_install_finalize.rs:1315runtime_key: "wheel-gfx942-7.13.0".to_owned(),apps/rocm/src/serve_summary.rs:521lemonade.api_model = "Qwen3-0.6B-GGUF".to_owned();apps/rocm/src/serve_summary.rs:549summary.api_model = "Qwen3-4B-Instruct-2507-GGUF".to_owned();The
generic-api-keyrule fires on any identifier that containskeyand is followed by a value that looks random. These values are model names and a runtime key, not credentials. The same three lines were flagged in 9 different PR runs, and on current main the twoserve_summary.rslines have moved to 557 and 585.Why a fingerprint list in
.gitleaksignorewould not workThe scan range explains it. The reusable security workflow checks the pull request out with
fetch-depthset to the number of PR commits plus two, fetches the PR base with depth 1, and runsgitleaks detect --log-opts base..head. The checkout is shallow, so gitleaks cannot see that the commit the branch started from is an ancestor of the base. That branch-point commit is therefore treated as a root commit that adds its whole tree, and everygeneric-api-keylook-alike in that tree is reported, under a fingerprint that contains that commit's sha. In the runs I read, nine different branch-point commits produced the same three findings, so each new pull request would need its own fingerprints. A fingerprint entry would fix only the runs already seen and none that follow, which is why this uses the allowlist mechanism the config file describes for recurring patterns.The change
One entry in the existing style of "Test fixtures using well-known dummy variable names": it is matched against the rule match, anchored on the identifier and the assignment, and covers only the field names
runtime_keyandapi_model. A name such asapi_key,OPENAI_API_KEY,secret_keyorruntime_key_secretis still reported. Both field names hold identifiers by definition:api_modelis a model name andruntime_keynames an installed runtime.What I verified and what only CI can show
api_key = "...",OPENAI_API_KEY = "...",secret_key: "..."orruntime_key_secret = "...".Follow-up
If other
generic-api-keylook-alikes appear in later changes, extend the same allowlist entry with the identifier, not with fingerprints. The scan-range behaviour above belongs in the reusable security workflow; I did not change it here.