Skip to content

Commit f270bd4

Browse files
Modify Zapier secret: Add tests and improve pattern (#279)
1 parent 9a015ae commit f270bd4

File tree

1 file changed

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

1 file changed

+29
-14
lines changed

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

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,58 @@ provider:
33
name: Zapier Webhook Url
44
category: Workflow Automation
55
message: Make sure this Zapier Webhook Url gets revoked, changed, and removed from the code.
6+
detection:
7+
pre:
8+
include:
9+
content:
10+
- "zapier.com/hooks/catch"
11+
post:
12+
# Avoid matching values found on SourceGraph that look like dummy passwords or insertions like:
13+
# - https://hooks.zapier.com/hooks/catch/123456/XXXXXXXX
14+
# - https://hooks.zapier.com/hooks/catch/123456/abcde/
15+
# - https://zapier.com/hooks/catch/000000/xxxxxxx/
16+
patternNot:
17+
- "(\\w)\\1{6,}"
18+
- "123456"
19+
- "(?i)abcde"
620

721
rules:
822
- rspecKey: S6720
923
id: zapier-webhook-urls
1024
metadata:
1125
name: Zapier Webhook Urls
26+
detection:
27+
matching:
28+
pattern: "(?:https://)?(?:hooks\\.)?zapier\\.com/hooks/catch/([0-9]{3,}/[0-9a-zA-Z,]{3,})"
1229
examples:
30+
- text: |
31+
# Noncompliant code example
32+
props.set("zapier_webhook_url", "https://hooks.zapier.com/hooks/catch/3017724/t0q8ed/")
33+
containsSecret: true
34+
match: 3017724/t0q8ed
35+
- text: |
36+
# Compliant solution
37+
props.set("zapier_webhook_url", System.getenv("ZAPIER_WEBHOOK_URL"))
38+
containsSecret: false
1339
- text: |
1440
var webhookURL = "https://hooks.zapier.com/hooks/catch/192840272/anwidh83";
1541
var data = {
1642
"First Name" : userName.value,
1743
"Email" : userEmail.value,
1844
};
1945
containsSecret: true
20-
match: https://hooks.zapier.com/hooks/catch/192840272/anwidh83
46+
match: 192840272/anwidh83
2147
- text: |
2248
var webhookURL = "https://hooks.zapier.com/hooks/catch/192840272/anwid,asne8,wod28";
2349
var data = {
2450
"First Name" : userName.value,
2551
"Email" : userEmail.value,
2652
};
2753
containsSecret: true
28-
match: https://hooks.zapier.com/hooks/catch/192840272/anwid,asne8,wod28
54+
match: 192840272/anwid,asne8,wod28
2955
- text: |
3056
const NETWORKS = {
3157
'1': 'https://hooks.zapier.com/hooks/catch/xxxx/xxxxx',
3258
}
3359
containsSecret: false
34-
detection:
35-
matching:
36-
pattern: "((https://)?(hooks\\.)?zapier\\.com/hooks/catch/[0-9]{3,}/[0-9a-zA-Z,]{3,})"
37-
post:
38-
# Avoid matching values found on SourceGraph that look like dummy passwords or insertions like:
39-
# - https://hooks.zapier.com/hooks/catch/123456/XXXXXXXX
40-
# - https://hooks.zapier.com/hooks/catch/123456/abcde/
41-
# - https://zapier.com/hooks/catch/000000/xxxxxxx/
42-
patternNot:
43-
- "(\\w)\\1{6,}"
44-
- "123456"
45-
- "(?i)abcde"
60+

0 commit comments

Comments
 (0)