Skip to content

Commit 5477bd8

Browse files
sarg3ntclaude
andcommitted
test(crypto): mark deterministic test fixtures gitleaks:allow
The gitleaks "generic-api-key" rule was matching three hard-coded test fixtures in aead_test.go (lines 249, 355, 378): plainSecret := "abcdef0123456789..." // 64 hex chars apiKey := "abcdef1234567890..." // 64 hex chars (x2) These are deterministic fixtures used to exercise the secret-file round-trip, not real credentials — but they trip the rule because the variable names include "secret"/"key" and the values are 32+ chars of [a-z0-9]. Added //gitleaks:allow inline comments rather than broadening the global path allowlist so future test files don't get an accidental free pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6e48567 commit 5477bd8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

gearbox-agent/internal/framework/crypto/aead_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func TestLoadOrCreateSecret_AutoMigratesPlaintext(t *testing.T) {
246246
path := filepath.Join(t.TempDir(), "secret")
247247

248248
// Write a valid plaintext secret.
249-
plainSecret := "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"
249+
plainSecret := "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789" //gitleaks:allow — deterministic test fixture
250250
if err := os.WriteFile(path, []byte(plainSecret), 0600); err != nil {
251251
t.Fatalf("write plaintext: %v", err)
252252
}
@@ -352,7 +352,7 @@ func TestReadSecret_Missing(t *testing.T) {
352352
func TestWriteAPIKey_EncryptsWhenKeySet(t *testing.T) {
353353
withProvider(t, &staticKeyProvider{key: validTestKey()})
354354
path := filepath.Join(t.TempDir(), "api-key")
355-
apiKey := "abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
355+
apiKey := "abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890" //gitleaks:allow — deterministic test fixture
356356

357357
if err := WriteAPIKey(path, apiKey); err != nil {
358358
t.Fatalf("WriteAPIKey error: %v", err)
@@ -375,7 +375,7 @@ func TestWriteAPIKey_EncryptsWhenKeySet(t *testing.T) {
375375
func TestWriteAPIKey_PlaintextWhenNoKey(t *testing.T) {
376376
withProvider(t, &staticKeyProvider{key: nil})
377377
path := filepath.Join(t.TempDir(), "api-key")
378-
apiKey := "abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
378+
apiKey := "abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890" //gitleaks:allow — deterministic test fixture
379379

380380
if err := WriteAPIKey(path, apiKey); err != nil {
381381
t.Fatalf("WriteAPIKey error: %v", err)

0 commit comments

Comments
 (0)