@@ -15,21 +15,33 @@ provider:
15
15
patternNot :
16
16
- " (\\ w)\\ 1{5,}"
17
17
- " (?i)test|abcd|1234"
18
- - " (?i)\
19
- YOURTENANTNAME|\
20
- mycompany|\
21
- yourorg|\
22
- team[_-]?name|\
23
- example|\
24
- contoso|\
25
- acmecorp"
18
+ - " (?i)YOURTENANTNAME|mycompany|yourorg|(s|ex)ample"
19
+ - " (?i)team[_-]?name"
20
+ - " contoso|acmecorp"
26
21
27
22
rules :
28
23
- rspecKey : S6721
29
24
id : ms-teams-webhook-urls
30
25
metadata :
31
26
name : Microsoft Teams Webhook Urls
27
+ detection :
28
+ matching :
29
+ # Structure:
30
+ # https://tenant-name.webhook.office.com/webhookb2/guid@guid/IncomingWebhook/connectorId/guid
31
+ # An MS GUID is in the following format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX where X is a hex digit
32
+ pattern : " ((?:https://)?\
33
+ [a-z0-9_-]{1,50}\\ .webhook\\ .office\\ .com/webhookb2/\
34
+ [a-z0-9\\ -]{1,50}@[a-z0-9\\ -]{1,50}/IncomingWebhook/[a-z0-9]{1,50}/[a-z0-9\\ -]{1,50})"
32
35
examples :
36
+ - text : |
37
+ # Noncompliant code example
38
+ props.set("teams_webhook_url", "https://sonarcompany.webhook.office.com/webhookb2/52feb105-fe74-52b9-8e90-5d165916fe22@61c6aa5a3-6531-4e28-9c0b-33ba1a8aa1ff/IncomingWebhook/f7fb2308e5f14431ace5b7cd0e670e42/4563618c-b03b-4e80-b093-28bb4ff11de8")
39
+ containsSecret: true
40
+ match: https://sonarcompany.webhook.office.com/webhookb2/52feb105-fe74-52b9-8e90-5d165916fe22@61c6aa5a3-6531-4e28-9c0b-33ba1a8aa1ff/IncomingWebhook/f7fb2308e5f14431ace5b7cd0e670e42/4563618c-b03b-4e80-b093-28bb4ff11de8
41
+ - text : |
42
+ # Compliant solution
43
+ props.set("teams_webhook_url", System.getenv("TEAMS_WEBHOOK_URL"))
44
+ containsSecret: false
33
45
- text : |
34
46
var webhookUrl = "https://companyname.webhook.office.com/webhookb2/5bf015e2-ce92-42a8-8e90-92552d6ef161@0c6aa5a3-6531-4e28-9c0b-33ba1a8aa1ff/IncomingWebhook/f7fb2308e5f14431ace5b7cd0e670e42/4563618c-b03b-4e80-b093-28bb4ff11de8";
35
47
var client = new HttpClient();
@@ -53,9 +65,4 @@ provider:
53
65
'1': 'https://mycompany.webhook.office.com/webhookb2/f49c28c6-d10b-412c-b961-fge456bd@c1a7fa9b-90b3-49ab-b5e2-345HG88c/IncomingWebhook/b43c20SDSGFG56712d848bc1cebb17/53ee2e22-a867-4e74-868a-F3fs3935',
54
66
}
55
67
containsSecret: false
56
- detection :
57
- matching :
58
- # Structure:
59
- # https://tenant-name.webhook.office.com/webhookb2/guid@guid/IncomingWebhook/connectorId/guid
60
- # An MS GUID is in the following format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX where X is a hex digit
61
- pattern : " ((https://)?[a-z0-9_-]{1,50}\\ .webhook\\ .office\\ .com/webhookb2/[a-z0-9\\ -]{1,50}@[a-z0-9\\ -]{1,50}/IncomingWebhook/[a-z0-9]{1,50}/[a-z0-9\\ -]{1,50})"
68
+
0 commit comments