Skip to content

Commit 97cf527

Browse files
Two more allow rules plus updated negative sample
1 parent bb1c871 commit 97cf527

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

assets/queries/common/passwords_and_secrets/regex_rules.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@
8787
{
8888
"description": "Allow secrets retrieved from Bicep getSecret built in function",
8989
"regex": "(?i)['\"]?secret[_]?(key|value)?['\"]?\\s*(:|=)\\s*[a-zA-Z]*\\.getSecret\\(\\s*[\"']([A-Za-z0-9/~^_!@#&%(){};=?*+-<>,:;[\\]%$]+)[\"']\\)"
90+
},
91+
{
92+
"description": "Avoiding Proto File fields",
93+
"regex": "(?i)secret[_]?(key|value)?\\s*=\\s*[1-9][0-9]{0,8}\\s*;"
9094
}
9195
],
9296
"specialMask": "(?i)['\"]?secret[_]?(key)?['\"]?\\s*(:|=)\\s*"
@@ -267,7 +271,13 @@
267271
{
268272
"id": "7f370dd5-eea3-4e5f-8354-3cb2506f9f13",
269273
"name": "Generic Access Key",
270-
"regex": "(?i)^\\s*['\"]?(access)[_]?key['\"]?\\s*[:=]\\s*['\"]?([[A-Za-z0-9\/~^_!@&%()=?*+-]+)['\"]?",
274+
"regex": "(?i)^\\s*['\"]?access[_]?key['\"]?\\s*[:=]\\s*['\"]?([[A-Za-z0-9\/~^_!@&%()=?*+-]+)['\"]?",
275+
"allowRules": [
276+
{
277+
"description": "Avoiding Proto File fields",
278+
"regex": "(?i)access[_]?key\\s*=\\s*[1-9][0-9]{0,8}\\s*;"
279+
}
280+
],
271281
"specialMask": "(?i)['\"]?access[_]?key['\"]?\\s*[:=]\\s*"
272282
},
273283
{

assets/queries/common/passwords_and_secrets/test/negative60.proto

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@ package com.example.security_test.v1;
77

88
import "google/protobuf/wrappers.proto";
99

10-
message ResultsThatFlag {
10+
message SampleMessageNegative {
11+
string the_secret = 15; //Generic Secret
12+
string another_secret_ = 16; //Generic Secret
13+
string the_secret_key = 17; //Generic Secret
14+
string a_secret_value = 18; //Generic Secret
15+
string another_secretvalue = 19; //Generic Secret
16+
string another_secretkey = 31; //Generic Secret
17+
double accesskey = 1212; //Generic Access Key
18+
string access_key = 1313; //Generic Access Key
1119
google.protobuf.StringValue refresh_token = 536870911; // if value is larger - out of range error "Field numbers cannot be greater than 536870911." - Generic Token
1220
google.protobuf.StringValue access_token= 1; // Generic Token
1321
google.protobuf.StringValue id_token = 3; // Generic Token
@@ -18,12 +26,6 @@ message ResultsThatFlag {
1826
google.protobuf.StringValue sas_token = 12; // Generic Token
1927
google.protobuf.StringValue auth_token = 13; // Generic Token
2028
google.protobuf.StringValue bot_token = 14; // Generic Token
21-
google.protobuf.StringValue verification_token=15; // Generic Token
22-
google.protobuf.StringValue oauth_access_token = 16; // Generic Token
23-
google.protobuf.StringValue app_token = 17; // Generic Token
24-
google.protobuf.StringValue personal_access_token = 18; // Generic Token
25-
google.protobuf.StringValue service_account_token = 29; // Generic Token
26-
google.protobuf.StringValue webhook_verification_token = 31; // Generic Token
2729
google.protobuf.StringValue callback_token = 32; // Generic Token
2830
google.protobuf.StringValue k8s_service_account_token = 33; // Generic Token
2931
google.protobuf.StringValue registry_token = 34; // Generic Token

0 commit comments

Comments
 (0)