Skip to content

💚 fix(test): clear gitleaks generic-api-key false-positive on main (wantKey→wantEnvVar) - #170

Merged
konih merged 1 commit into
mainfrom
fix/gitleaks-fp-wantkey
Aug 2, 2026
Merged

konih merged 1 commit into
mainfrom
fix/gitleaks-fp-wantkey

Conversation

@konih

@konih konih commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Red main fix-forward — gitleaks false-positive

The REL-01 merge (#169) introduced const wantKey = "KOLLECT_TEST_FLAG=1" in internal/sink/git/cli_env_test.go:214. gitleaks' generic-api-key rule matches the ...Key = "..." identifier pattern → flagged as a leak (RuleID generic-api-key, fingerprint internal/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 in cli_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.

Copilot AI review requested due to automatic review settings August 2, 2026 11:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 → wantEnvVar in TestApplyCLIEnvAndPrependGitArgs.
  • 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.

@konih
konih merged commit 2155e27 into main Aug 2, 2026
27 checks passed
@konih
konih deleted the fix/gitleaks-fp-wantkey branch August 2, 2026 11:26
@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sonarqubecloud

sonarqubecloud Bot commented Aug 2, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants