Repository navigation
💚 fix(test): clear gitleaks generic-api-key false-positive on main (wantKey→wantEnvVar) - #170
Merged
Merged
Conversation
…key false-positive on main
There was a problem hiding this comment.
Pull request overview
This PR fixes a gitleaks generic-api-key false-positive introduced by a test constant named wantKey, by renaming it to wantEnvVar without changing behavior. This restores green CI on main while keeping the test’s “don’t print cmd.Env (may contain secrets)” safety guard intact.
Changes:
- Renamed
wantKey→wantEnvVarinTestApplyCLIEnvAndPrependGitArgs. - Updated the related failure message/comment to match the new identifier.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
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.



Red main fix-forward — gitleaks false-positive
The REL-01 merge (#169) introduced
const wantKey = "KOLLECT_TEST_FLAG=1"ininternal/sink/git/cli_env_test.go:214. gitleaks'generic-api-keyrule matches the...Key = "..."identifier pattern → flagged as a leak (RuleID generic-api-key, fingerprintinternal/sink/git/cli_env_test.go:generic-api-key:214), turning the required gitleaks check red on main (run 30745258887). The value is not a secret — it's a test env-var literal; the identifier name tripped the rule. (It slipped through because #169 was admin-merged while its own gitleaks check was pending.)Fix
Rename
wantKey→wantEnvVar(3 occurrences) so the identifier no longer matches the generic-api-key keyword pattern. No behavior change.Verify
gitleaks detect --config .github/gitleaks.toml --redact --no-git→ 0 findings incli_env_test.go(the 7 remaining hits are untracked local junk —.cache/.envrc/artifacts/lab/kollect-repos— outside the repo; CI's clean checkout scans only tracked files, which are now clean).go test ./internal/sink/git/+go build ./...pass.