Skip to content

Commit 901552f

Browse files
committed
test(config): build the EST digest fixture instead of hard-coding it
Gitleaks reads the hard-coded SHA-256 test digest as a generic API key. Use the package's testPasswordDigest helper, and record the one finding in the earlier commit of this branch in .gitleaksignore, since that commit stays in the history the scan reads. Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
1 parent 37897e3 commit 901552f

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

‎.gitleaksignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
37897e3e7a87fbfbf38399b54637e2db1895b4f4:internal/config/protocols_test.go:generic-api-key:30

‎internal/config/protocols_test.go‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ import (
2727
cryptosv1 "github.com/CryptOS-PKI/api/go/cryptos/v1"
2828
)
2929

30-
const testPasswordSHA256 = "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
31-
3230
// issuingWithProtocols is a valid issuing-node config serving both protocols,
3331
// with one secret in each credential list.
3432
func issuingWithProtocols(t *testing.T) *Config {
@@ -57,7 +55,7 @@ func issuingWithProtocols(t *testing.T) *Config {
5755
Label: "devices",
5856
Realm: "cryptos",
5957
AllowedIdentifierSuffixes: []string{"devices.example.org"},
60-
EnrollCredentials: []ESTEnrollCredential{{Username: "router", PasswordSHA256: testPasswordSHA256}},
58+
EnrollCredentials: []ESTEnrollCredential{{Username: "router", PasswordSHA256: testPasswordDigest()}},
6159
}
6260
if err := c.Validate(); err != nil {
6361
t.Fatalf("fixture does not validate: %v", err)

0 commit comments

Comments
 (0)