Skip to content

Commit 5e12066

Browse files
committed
fix: use glob patterns in sonar exclusion rules
1 parent 741d495 commit 5e12066

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pkg/pki/keymaterial_signer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (s *KeyMaterialSigner) SignDigest(ctx context.Context, digest []byte) ([]by
7373
// widely used in JWT RS256/RS384/RS512. It's distinct from RSA-PKCS1v15 encryption
7474
// which has known vulnerabilities. The signature scheme is secure.
7575
hash := getHashForAlgorithm(s.km.SigningMethod.Alg())
76-
return rsa.SignPKCS1v15(rand.Reader, key, hash, digest) //nolint:gosec //NOSONAR
76+
return rsa.SignPKCS1v15(rand.Reader, key, hash, digest) //nolint:gosec // NOSONAR
7777
default:
7878
return nil, fmt.Errorf("unsupported key type: %T", s.km.PrivateKey)
7979
}

pkg/pki/software.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func (s *SoftwareSigner) SignDigest(ctx context.Context, digest []byte) ([]byte,
7979
// widely used in JWT RS256/RS384/RS512. It's distinct from RSA-PKCS1v15 encryption
8080
// which has known vulnerabilities. The signature scheme is secure.
8181
hash := getHashForAlgorithm(s.algorithm)
82-
return rsa.SignPKCS1v15(rand.Reader, key, hash, digest) //nolint:gosec //NOSONAR
82+
return rsa.SignPKCS1v15(rand.Reader, key, hash, digest) //nolint:gosec // NOSONAR
8383
case *ecdsa.PrivateKey:
8484
// Sign the digest directly using ECDSA
8585
r, sigS, err := ecdsa.Sign(rand.Reader, key, digest)

sonar-project.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ sonar.issue.ignore.multicriteria=e1,e2,e3,e4
3333

3434
# Exclude S5542 from JWE crypto implementation (AES-CBC for content encryption, AES Key Wrap)
3535
sonar.issue.ignore.multicriteria.e1.ruleKey=go:S5542
36-
sonar.issue.ignore.multicriteria.e1.resourceKey=pkg/didcomm/crypto/jwe.go
36+
sonar.issue.ignore.multicriteria.e1.resourceKey=**/didcomm/crypto/jwe.go
3737

3838
# Exclude from test files (test code uses same crypto primitives)
3939
sonar.issue.ignore.multicriteria.e2.ruleKey=go:S5542
@@ -42,7 +42,7 @@ sonar.issue.ignore.multicriteria.e2.resourceKey=**/*_test.go
4242
# Exclude S5542 from PKI signers (RSA-PKCS1v15 SIGNATURE, not encryption)
4343
# SonarCloud incorrectly flags rsa.SignPKCS1v15 as encryption when it's a signature scheme
4444
sonar.issue.ignore.multicriteria.e3.ruleKey=go:S5542
45-
sonar.issue.ignore.multicriteria.e3.resourceKey=pkg/pki/keymaterial_signer.go
45+
sonar.issue.ignore.multicriteria.e3.resourceKey=**/pki/keymaterial_signer.go
4646

4747
sonar.issue.ignore.multicriteria.e4.ruleKey=go:S5542
48-
sonar.issue.ignore.multicriteria.e4.resourceKey=pkg/pki/software.go
48+
sonar.issue.ignore.multicriteria.e4.resourceKey=**/pki/software.go

0 commit comments

Comments
 (0)