Skip to content

Commit 1a9ce43

Browse files
Modify S6722(planetscale): improve tests and pattern (#272)
1 parent 7e3eb29 commit 1a9ce43

File tree

1 file changed

+10
-1
lines changed
  • sonar-text-plugin/src/main/resources/org/sonar/plugins/secrets/configuration

1 file changed

+10
-1
lines changed

sonar-text-plugin/src/main/resources/org/sonar/plugins/secrets/configuration/planetscale.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,17 @@ provider:
1919
name: Planetscale database passwords should not be disclosed
2020
detection:
2121
matching:
22-
pattern: "(\\bpscale_pw_[a-zA-Z0-9\\-_\\.]{43})"
22+
pattern: "(?i)\\b(pscale_pw_[\\w\\-\\.]{43})"
2323
examples:
24+
- text: |
25+
# Noncompliant code example
26+
props.set("planetscale_password", "pscale_pw_hatgoG_EprhgnblWotaJGbeOeFE7q9BwW0_g5ML486D")
27+
containsSecret: true
28+
match: pscale_pw_hatgoG_EprhgnblWotaJGbeOeFE7q9BwW0_g5ML486D
29+
- text: |
30+
# Compliant solution
31+
props.set("planetscale_password", System.getenv("PLANETSCALE_PASSWORD"))
32+
containsSecret: false
2433
- text: |
2534
spring.datasource.username=user
2635
spring.datasource.password=pscale_pw_CoNLTwSMJwvKspy89_2JdSoxmGWaElypgmlzel5KolA

0 commit comments

Comments
 (0)