Skip to content

Commit 2043337

Browse files
Modify S6710(FCM): Improve regex, name and pattern (#271)
1 parent f270bd4 commit 2043337

File tree

1 file changed

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

1 file changed

+13
-4
lines changed

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
provider:
22
metadata:
3-
name: Firebase
3+
name: Firebase Cloud Messaging
44
category: Messaging System
5-
message: Make sure this Firebase key gets revoked, changed, and removed from the code.
5+
message: Make sure this FCM key gets revoked, changed, and removed from the code.
66
detection:
77
pre:
88
include:
@@ -16,11 +16,20 @@ provider:
1616
- id: legacy-fcm-api-key
1717
rspecKey: S6710
1818
metadata:
19-
name: Legacy Firebase Cloud Messaging API Key
19+
name: Legacy Firebase Cloud Messaging API Keys
2020
detection:
2121
matching:
22-
pattern: "(?i)\\b([a-z0-9\\-_]{11}:apa91b[a-z0-9\\-_+]{134})\\b"
22+
pattern: "(?i)\\b([\\w\\-]{11}:apa91b[\\w\\-+]{134})\\b"
2323
examples:
24+
- text: |
25+
# Noncompliant code example
26+
props.set("fcm_key", "cfUDlZL9YBQ:APA91bJxU9oMf3RbiyqnmUO60KU_JLawjf2yrTfSs3_ZAp3dxZS0J88G5P5AoKWoviAdUK5i-2SB7iHcb4Wd38EMsZXBAAb6GZMaSOeKfaI0DuLxAFTOgGNKRSmj2R9gIQyzpjoThmqe")
27+
containsSecret: true
28+
match: "cfUDlZL9YBQ:APA91bJxU9oMf3RbiyqnmUO60KU_JLawjf2yrTfSs3_ZAp3dxZS0J88G5P5AoKWoviAdUK5i-2SB7iHcb4Wd38EMsZXBAAb6GZMaSOeKfaI0DuLxAFTOgGNKRSmj2R9gIQyzpjoThmqe"
29+
- text: |
30+
# Compliant solution
31+
props.set("fcm_key", System.getenv("FCM_KEY"))
32+
containsSecret: false
2433
- text: |
2534
self.current_datetime = strftime("%Y-%m-%d %H:%M:%S", gmtime())
2635
self.firebase = "kCIN6c4oo49:APA91bJxU9oMf3RbiyqnmUO60KU_JLawjf2yrTfSs3_ZAp3dxZS0J88G5P5AoKWoviAdUK5i-2SB7iHcb4Wd38EMsZXBAAb6GZMaSOeKfaI0DuLxAFTOgGNKRSmj2R9gIQyzpjoThmqe"

0 commit comments

Comments
 (0)