Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/scan_tools_configs/gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,30 @@ regexes = [
'''[A-Z][A-Z0-9_]*SHA512\s*[=:]''',
'''[A-Z][A-Z0-9_]*MD5\s*[=:]''',
]

[[allowlists]]
description = "Model names and runtime keys assigned in first-party Rust code"
# The generic-api-key rule fires on `api_model = "Qwen3-0.6B-GGUF"` and
# `runtime_key: "wheel-gfx942-7.13.0"` because the variable name contains
# "key" or "api" and the value is a short mixed-case identifier. Both are
# public identifiers (a model repository name, a runtime install key), not
# credentials. Matched against the rule's own match, not the whole line, so
# a real credential on the same line is still reported under its own match.
# Only the two names `api_model` and `runtime_key` are listed, so an
# `api_key = "..."` assignment is still scanned; the Rust-only path limit keeps
# the exception out of other file types. Both `:` (struct field) and `=`
# (assignment) are accepted for both names, and the value may hold the
# characters a model name or a runtime key uses (`Qwen3-0.6B-GGUF`,
# `therock-release:gfx120X-all`), up to 64 characters, so a long token
# assigned to one of the two names is still reported. A JSON-style quoted key
# such as `"runtime_key": "..."` is not covered.
# `condition = "AND"` is load-bearing: under the default OR, the `paths` entry
# alone would allowlist every rule in every `.rs` file. Do not remove it.
condition = "AND"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

condition = "AND" is what keeps this to Rust files; under the default OR the path alone would allowlist every rule in .rs files. Please run gitleaks 8.30.1 on a throwaway .rs holding a random api_key next to an api_model line before merge, and consider noting in the comment that AND is load-bearing.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, and the comment above the entry now says plainly that condition = "AND" is load-bearing: under the default OR the paths entry alone would allowlist every rule in every .rs file, so it must not be removed. I could not run gitleaks 8.30.1 locally, because the binary is not installed in my environment and I was not able to fetch it. Instead the check is being run through the CI scan on a throwaway probe branch holding a .rs file with a random api_key next to an api_model line and a mixed line with both a runtime_key and a random api_key; the result will be posted here, and the probe branch will never be merged.

Result of the check: I ran the repository's PR-time scan, with this branch's config, on a throwaway draft pull request (#1008, closed after reading it) whose probe file holds a random 40-character api_key literal, an api_model = "Qwen3-0.6B-GGUF" line, and a mixed line with a runtime_key field next to a second random api_key. gitleaks reported exactly two findings, both generic-api-key: the standalone api_key literal and the api_key on the mixed line. The api_model line and the runtime_key field were not reported. So the path and pattern are combined with AND (a Rust file with a real-looking key is still scanned) and the match-level scoping holds on a mixed line.

paths = [
'''.*\.rs$''',
]
regexTarget = "match"
regexes = [
'''\b(api_model|runtime_key)\s*[:=]\s*"[A-Za-z0-9._/:-]{1,64}"''',
]
Loading