Skip to content

Commit 4d58f86

Browse files
authored
Corrections (#240)
* test for byte array in decimal * Some corrections
1 parent 35f4574 commit 4d58f86

File tree

6 files changed

+35
-19
lines changed

6 files changed

+35
-19
lines changed

.ci/benchmark.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
META MD5 585d6a68182d9c155072fe3b04024dcc
2-
DATA MD5 258ca468615cefd52ab83ee9b7fdaa9e
1+
META MD5 50ed3ef305ad91f334214db4eb3e152d
2+
DATA MD5 dac0c4d817dcc1dc209724af30e2053d
33
DATA: 16720463 interested lines. MARKUP: 61437 items
44
FileType FileNumber ValidLines Positives Negatives
55
--------------- ------------ ------------ ----------- -----------
6-
677 69567 134 488
6+
677 69567 133 489
77
.04 2 149 4
88
.1 2 641 2 8
99
.admx 1 26 1
@@ -66,7 +66,7 @@ FileType FileNumber ValidLines Positives Negatives
6666
.gd 1 37 1
6767
.gml 3 3075 16
6868
.gni 3 5017 19
69-
.go 1278 718729 1514 4856
69+
.go 1278 718729 1508 4862
7070
.golden 5 1168 1 42
7171
.gradle 50 4295 8 189
7272
.graphql 8 454 2 13
@@ -118,7 +118,7 @@ FileType FileNumber ValidLines Positives Negatives
118118
.markdown 38 5862 69 4
119119
.markerb 3 12 3
120120
.marko 1 21 2
121-
.md 781 185010 1041 2890
121+
.md 781 185010 1040 2891
122122
.mdx 3 549 7
123123
.mjml 1 18 1
124124
.mjs 22 4424 101 369
@@ -232,17 +232,17 @@ FileType FileNumber ValidLines Positives Negatives
232232
.yml 555 54516 1870 1227
233233
.zsh 6 872 12
234234
.zsh-theme 1 97 1
235-
TOTAL: 11516 16720463 16213 50377
235+
TOTAL: 11516 16720463 16205 50385
236236
credsweeper result_cnt : 0, lost_cnt : 0, true_cnt : 0, false_cnt : 0
237237
Rules Positives Negatives Reported TP FP TN FN FPR FNR ACC PRC RCL F1
238238
------------------------------ ----------- ----------- ---------- ---- ---- ----- ----- -------- -------- -------- ----- -------- ----
239-
API 241 3367 0 0 3367 241 0.000000 1.000000 0.933204 0.000000
239+
API 240 3368 0 0 3368 240 0.000000 1.000000 0.933481 0.000000
240240
AWS Client ID 191 19 0 0 19 191 0.000000 1.000000 0.090476 0.000000
241241
AWS Multi 82 10 0 0 10 82 0.000000 1.000000 0.108696 0.000000
242242
AWS S3 Bucket 67 23 0 0 23 67 0.000000 1.000000 0.255556 0.000000
243243
Akamai Credentials 6 2 0 0 2 6 0.000000 1.000000 0.250000 0.000000
244244
Atlassian Old PAT token 5 8 0 0 8 5 0.000000 1.000000 0.615385 0.000000
245-
Auth 1130 2843 0 0 2843 1130 0.000000 1.000000 0.715580 0.000000
245+
Auth 1126 2847 0 0 2847 1126 0.000000 1.000000 0.716587 0.000000
246246
Azure Access Token 21 0 0 0 0 21 1.000000 0.000000 0.000000
247247
BASE64 Private Key 22 4 0 0 4 22 0.000000 1.000000 0.153846 0.000000
248248
BASE64 encoded PEM Private Key 12 0 0 0 0 12 1.000000 0.000000 0.000000
@@ -254,7 +254,7 @@ CMD ConvertTo-SecureString 13 4 0 0
254254
CMD Password 33 137 0 0 137 33 0.000000 1.000000 0.805882 0.000000
255255
CMD Secret 1 17 0 0 17 1 0.000000 1.000000 0.944444 0.000000
256256
CMD Token 6 2 0 0 2 6 0.000000 1.000000 0.250000 0.000000
257-
Credential 99 498 0 0 498 99 0.000000 1.000000 0.834171 0.000000
257+
Credential 98 499 0 0 499 98 0.000000 1.000000 0.835846 0.000000
258258
Docker Swarm Token 2 0 0 0 0 2 1.000000 0.000000 0.000000
259259
Dropbox App secret 73 144 0 0 144 73 0.000000 1.000000 0.663594 0.000000
260260
Facebook Access Token 0 1 0 0 1 0 0.000000 1.000000
@@ -280,12 +280,12 @@ Password 2497 9982 0 0
280280
SQL Password 44 14 0 0 14 44 0.000000 1.000000 0.241379 0.000000
281281
Salesforce Credentials 6 0 0 0 0 6 1.000000 0.000000 0.000000
282282
Salt 85 75 0 0 75 85 0.000000 1.000000 0.468750 0.000000
283-
Secret 1502 2378 0 0 2378 1502 0.000000 1.000000 0.612887 0.000000
283+
Secret 1501 2379 0 0 2379 1501 0.000000 1.000000 0.613144 0.000000
284284
Slack Token 4 1 0 0 1 4 0.000000 1.000000 0.200000 0.000000
285285
Stripe Credentials 2 0 0 0 0 2 1.000000 0.000000 0.000000
286286
Tencent WeChat API App ID 47 0 0 0 0 47 1.000000 0.000000 0.000000
287-
Token 950 4639 0 0 4639 950 0.000000 1.000000 0.830023 0.000000
287+
Token 949 4640 0 0 4640 949 0.000000 1.000000 0.830202 0.000000
288288
Twilio Credentials 30 39 0 0 39 30 0.000000 1.000000 0.565217 0.000000
289289
URL Credentials 220 379 0 0 379 220 0.000000 1.000000 0.632721 0.000000
290290
UUID 1866 265 0 0 265 1866 0.000000 1.000000 0.124355 0.000000
291-
16213 50377 0 0 0 50377 16213 0.000000 1.000000 0.756525 0.000000
291+
16205 50385 0 0 0 50385 16205 0.000000 1.000000 0.756645 0.000000

meta/28728ab4.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ Id,FileID,Domain,RepoName,FilePath,LineStart,LineEnd,GroundTruth,ValueStart,Valu
397397
31743,53ca930b,GitHub,28728ab4,data/28728ab4/docs/53ca930b.md,34,34,T,12,20,,,Password
398398
31744,4a3581e9,GitHub,28728ab4,data/28728ab4/_/4a3581e9.toml,27,27,T,33,97,,,Bitbucket Client Secret:Credential:Secret
399399
31745,53ca930b,GitHub,28728ab4,data/28728ab4/docs/53ca930b.md,43,43,T,33,97,,,Bitbucket Client Secret:Credential:Secret
400-
31746,53ca930b,GitHub,28728ab4,data/28728ab4/docs/53ca930b.md,42,42,T,29,61,,,Credential
400+
31746,53ca930b,GitHub,28728ab4,data/28728ab4/docs/53ca930b.md,42,42,F,29,61,ID,,Credential
401401
31750,5b6711fe,GitHub,28728ab4,data/28728ab4/docs/5b6711fe.md,26,26,T,18,39,,,Password
402402
31751,b57a8b5d,GitHub,28728ab4,data/28728ab4/_/b57a8b5d.toml,10,10,T,18,39,,,Password
403403
31752,b2b7d93c,GitHub,28728ab4,data/28728ab4/docs/b2b7d93c.md,20,20,T,19,64,,,API:Key

meta/6c73b80a.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ Id,FileID,Domain,RepoName,FilePath,LineStart,LineEnd,GroundTruth,ValueStart,Valu
245245
32183,69abb428,GitHub,6c73b80a,data/6c73b80a/test/server/69abb428.go,10648,10648,X,38,41,,,Password
246246
32417,8bf97fa3,GitHub,6c73b80a,data/6c73b80a/test/8bf97fa3.go,173,173,T,26,48,,,Auth:Password
247247
32418,8bf97fa3,GitHub,6c73b80a,data/6c73b80a/test/8bf97fa3.go,208,208,T,27,49,,,Auth:Token
248-
32419,8bf97fa3,GitHub,6c73b80a,data/6c73b80a/test/8bf97fa3.go,209,209,T,32,92,,,Auth:Token
248+
32419,8bf97fa3,GitHub,6c73b80a,data/6c73b80a/test/8bf97fa3.go,209,209,F,32,92,HASH,,Auth:Token
249249
32432,adb4a090,GitHub,6c73b80a,data/6c73b80a/test/client/adb4a090.go,65,65,T,19,79,,,Token
250250
32464,dc47d09f,GitHub,6c73b80a,data/6c73b80a/test/server/dc47d09f.go,3801,3801,T,39,47,,,URL Credentials
251251
32584,dc47d09f,GitHub,6c73b80a,data/6c73b80a/test/server/dc47d09f.go,3622,3622,T,37,45,,,URL Credentials

meta/b42cbed0.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,5 @@ Id,FileID,Domain,RepoName,FilePath,LineStart,LineEnd,GroundTruth,ValueStart,Valu
101101
1340840,f80bc58f,GitHub,b42cbed0,data/b42cbed0/util/f80bc58f.patch,99813,99813,T,56,92,,,UUID
102102
1479518,bec315d5,GitHub,b42cbed0,data/b42cbed0/init/bec315d5,193,193,F,26,39,,,CMD Password
103103
1494636,3bfa3e18,GitHub,b42cbed0,data/b42cbed0/_/3bfa3e18,13,13,T,22,86,,,Salt
104-
1494637,fe12936a,GitHub,b42cbed0,data/b42cbed0/modul/fe12936a,27,27,T,18,58,,,API
104+
1494637,fe12936a,GitHub,b42cbed0,data/b42cbed0/modul/fe12936a,27,27,F,18,58,VERSION,,API
105105
1495015,3bfa3e18,GitHub,b42cbed0,data/b42cbed0/_/3bfa3e18,7,7,T,22,58,,,UUID

meta/fc8343f4.csv

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ Id,FileID,Domain,RepoName,FilePath,LineStart,LineEnd,GroundTruth,ValueStart,Valu
8484
1495342,89dc8839,GitHub,fc8343f4,data/fc8343f4/resource/vendor/89dc8839.go,1354,1354,T,15,51,,,UUID
8585
1495343,89dc8839,GitHub,fc8343f4,data/fc8343f4/resource/vendor/89dc8839.go,1388,1388,T,15,51,,,UUID
8686
1495344,89dc8839,GitHub,fc8343f4,data/fc8343f4/resource/vendor/89dc8839.go,1788,1788,T,5,41,,,UUID
87-
1495368,969ed3f4,GitHub,fc8343f4,data/fc8343f4/pkg/969ed3f4.go,52,52,T,31,43,,,Secret
88-
1495369,969ed3f4,GitHub,fc8343f4,data/fc8343f4/pkg/969ed3f4.go,69,69,T,71,83,,,Auth
89-
1495370,969ed3f4,GitHub,fc8343f4,data/fc8343f4/pkg/969ed3f4.go,70,70,T,71,83,,,Auth
90-
1495371,969ed3f4,GitHub,fc8343f4,data/fc8343f4/pkg/969ed3f4.go,71,71,T,71,83,,,Auth
87+
1495368,969ed3f4,GitHub,fc8343f4,data/fc8343f4/pkg/969ed3f4.go,52,52,F,31,43,HASH,,Secret
88+
1495369,969ed3f4,GitHub,fc8343f4,data/fc8343f4/pkg/969ed3f4.go,69,69,F,71,83,HASH,,Auth
89+
1495370,969ed3f4,GitHub,fc8343f4,data/fc8343f4/pkg/969ed3f4.go,70,70,F,71,83,HASH,,Auth
90+
1495371,969ed3f4,GitHub,fc8343f4,data/fc8343f4/pkg/969ed3f4.go,71,71,F,71,83,HASH,,Auth
9191
1495398,9ef5cc8c,GitHub,fc8343f4,data/fc8343f4/vendor/9ef5cc8c.go,25,25,T,18,54,,,UUID
9292
1495789,c8567725,GitHub,fc8343f4,data/fc8343f4/src/util/pkg/api/c8567725.yaml,24,24,T,7,43,,,UUID
9393
1495790,c8567725,GitHub,fc8343f4,data/fc8343f4/src/util/pkg/api/c8567725.yaml,233,233,T,12,48,,,UUID

test_obfuscate_creds.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,19 @@ def test_gen_random_value(self):
8585
random.seed(seed)
8686
actual = gen_random_value(value)
8787
self.assertEqual(expected, actual, (seed, value, expected, actual))
88+
89+
def test_dec(self):
90+
original_data = random.randbytes(1000)
91+
dec_string = ''
92+
for i in original_data:
93+
if dec_string:
94+
dec_string += ' ' * random.randint(0, 4)
95+
dec_string += ','
96+
dec_string += ' ' * random.randint(0, 4)
97+
dec_string += str(i)
98+
print(dec_string)
99+
obfuscated_string = gen_random_value(dec_string)
100+
for i in obfuscated_string.split(','):
101+
d = int(i.strip())
102+
self.assertLessEqual(0, d)
103+
self.assertGreaterEqual(255, d)

0 commit comments

Comments
 (0)