Skip to content

Commit 5b5dd76

Browse files
authored
PostHog,Netlify,Vercel credentials patterns (#819)
* PostHog,Netlify,Vercel credentials patterns * crc fix
1 parent b08eb6a commit 5b5dd76

File tree

12 files changed

+840
-8
lines changed

12 files changed

+840
-8
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
run: |
9494
banner="$(python -m credsweeper --banner | grep CredSweeper | head -1)"
9595
echo "banner = '${banner}'"
96-
if [ "CredSweeper 1.14.8 crc32:a6e1804e" != "${banner}" ]; then
96+
if [ "CredSweeper 1.14.8 crc32:8a4b3391" != "${banner}" ]; then
9797
echo "Update the check for '${banner}'"
9898
exit 1
9999
fi

credsweeper/rules/config.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,6 +1469,52 @@
14691469
- code
14701470
- doc
14711471

1472+
- name: Vercel Token
1473+
severity: medium
1474+
confidence: weak
1475+
type: pattern
1476+
values:
1477+
- (?:^|/|[^\\0-9A-Za-z+_-]|\\[0abfnrtv]|(?:%|\\x)[0-9A-Fa-f]{2}|\\[0-7]{3}|\\[Uu][0-9A-Fa-f]{4}|\x1B\[[0-9;]{0,80}m)(?P<value>vcp_[0-9A-Za-z]{56})(?![0-9A-Za-z_-])
1478+
min_line_len: 60
1479+
filter_type: TokenPattern
1480+
required_substrings:
1481+
- vcp_
1482+
target:
1483+
- code
1484+
- doc
1485+
1486+
- name: Netlify Token
1487+
severity: medium
1488+
confidence: weak
1489+
type: pattern
1490+
values:
1491+
- (?:^|/|[^\\0-9A-Za-z+_-]|\\[0abfnrtv]|(?:%|\\x)[0-9A-Fa-f]{2}|\\[0-7]{3}|\\[Uu][0-9A-Fa-f]{4}|\x1B\[[0-9;]{0,80}m)(?P<value>nfp_[0-9A-Za-z]{36})(?![0-9A-Za-z_-])
1492+
min_line_len: 40
1493+
filter_type: TokenPattern
1494+
required_substrings:
1495+
- nfp_
1496+
target:
1497+
- code
1498+
- doc
1499+
1500+
- name: PostHog Credentials
1501+
severity: medium
1502+
confidence: weak
1503+
type: pattern
1504+
values:
1505+
- (?:^|/|[^\\0-9A-Za-z+_-]|\\[0abfnrtv]|(?:%|\\x)[0-9A-Fa-f]{2}|\\[0-7]{3}|\\[Uu][0-9A-Fa-f]{4}|\x1B\[[0-9;]{0,80}m)(?P<value>ph[acrsx]_[0-9A-Za-z]{40,60})(?![0-9A-Za-z_-])
1506+
min_line_len: 44
1507+
filter_type: TokenPattern
1508+
required_substrings:
1509+
- phx_
1510+
- phs_
1511+
- phr_
1512+
- pha_
1513+
- phc_
1514+
target:
1515+
- code
1516+
- doc
1517+
14721518
- name: Tencent WeChat API App ID
14731519
severity: medium
14741520
confidence: weak

tests/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pathlib import Path
22

33
# total number of files in test samples
4-
SAMPLES_FILES_COUNT = 175
4+
SAMPLES_FILES_COUNT = 178
55

66
# ML_DELTA for different platforms which may produce a dribbling in ml_probability
77
ML_DELTA = 0.0001
@@ -10,16 +10,16 @@
1010
ZERO_ML_THRESHOLD = 0.0
1111

1212
# with option --doc & NEGLIGIBLE_ML_THRESHOLD
13-
SAMPLES_IN_DOC = 927
13+
SAMPLES_IN_DOC = 934
1414

1515
# credentials count after scan without filters and ML validations
16-
SAMPLES_REGEX_COUNT = 661
16+
SAMPLES_REGEX_COUNT = 670
1717

1818
# credentials count after scan with filters and without ML validation
19-
SAMPLES_FILTERED_COUNT = 547
19+
SAMPLES_FILTERED_COUNT = 554
2020

2121
# credentials count after default post-processing
22-
SAMPLES_POST_CRED_COUNT = 501
22+
SAMPLES_POST_CRED_COUNT = 508
2323

2424
# archived credentials that are not found without --depth
2525
SAMPLES_IN_DEEP_1 = SAMPLES_POST_CRED_COUNT + 138

tests/data/depth_3_pedantic.json

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8119,6 +8119,27 @@
81198119
}
81208120
]
81218121
},
8122+
{
8123+
"rule": "Netlify Token",
8124+
"severity": "medium",
8125+
"confidence": "weak",
8126+
"ml_probability": null,
8127+
"line_data_list": [
8128+
{
8129+
"line": "nfp_0i5OM4MV7L02wV3E6rrwiTwhvEkkkPJ9C3EP",
8130+
"line_num": 1,
8131+
"path": "./tests/samples/netlify",
8132+
"info": "FILE:./tests/samples/netlify|RAW",
8133+
"variable": null,
8134+
"variable_start": -2,
8135+
"variable_end": -2,
8136+
"value": "nfp_0i5OM4MV7L02wV3E6rrwiTwhvEkkkPJ9C3EP",
8137+
"value_start": 0,
8138+
"value_end": 40,
8139+
"entropy": 4.61531
8140+
}
8141+
]
8142+
},
81228143
{
81238144
"rule": "NKEY Seed",
81248145
"severity": "high",
@@ -11827,6 +11848,111 @@
1182711848
}
1182811849
]
1182911850
},
11851+
{
11852+
"rule": "PostHog Credentials",
11853+
"severity": "medium",
11854+
"confidence": "weak",
11855+
"ml_probability": null,
11856+
"line_data_list": [
11857+
{
11858+
"line": "phc_cJMqv5nG7Qtd0sfIwasTG87lgnDfJVbrcOOAZMOf",
11859+
"line_num": 1,
11860+
"path": "./tests/samples/posthog",
11861+
"info": "FILE:./tests/samples/posthog|RAW",
11862+
"variable": null,
11863+
"variable_start": -2,
11864+
"variable_end": -2,
11865+
"value": "phc_cJMqv5nG7Qtd0sfIwasTG87lgnDfJVbrcOOAZMOf",
11866+
"value_start": 0,
11867+
"value_end": 44,
11868+
"entropy": 4.86251
11869+
}
11870+
]
11871+
},
11872+
{
11873+
"rule": "PostHog Credentials",
11874+
"severity": "medium",
11875+
"confidence": "weak",
11876+
"ml_probability": null,
11877+
"line_data_list": [
11878+
{
11879+
"line": "phs_dNrZRd5etgv1B1gRTkfUrTJnf0EaZ5r6hUouJgXtWwFTrq",
11880+
"line_num": 2,
11881+
"path": "./tests/samples/posthog",
11882+
"info": "FILE:./tests/samples/posthog|RAW",
11883+
"variable": null,
11884+
"variable_start": -2,
11885+
"variable_end": -2,
11886+
"value": "phs_dNrZRd5etgv1B1gRTkfUrTJnf0EaZ5r6hUouJgXtWwFTrq",
11887+
"value_start": 0,
11888+
"value_end": 50,
11889+
"entropy": 4.89366
11890+
}
11891+
]
11892+
},
11893+
{
11894+
"rule": "PostHog Credentials",
11895+
"severity": "medium",
11896+
"confidence": "weak",
11897+
"ml_probability": null,
11898+
"line_data_list": [
11899+
{
11900+
"line": "phr_dNrZRd5etgv1B1gRTKedUjAkFCcvNdBLoQz4W8GCYEVUySGUt",
11901+
"line_num": 3,
11902+
"path": "./tests/samples/posthog",
11903+
"info": "FILE:./tests/samples/posthog|RAW",
11904+
"variable": null,
11905+
"variable_start": -2,
11906+
"variable_end": -2,
11907+
"value": "phr_dNrZRd5etgv1B1gRTKedUjAkFCcvNdBLoQz4W8GCYEVUySGUt",
11908+
"value_start": 0,
11909+
"value_end": 53,
11910+
"entropy": 5.07217
11911+
}
11912+
]
11913+
},
11914+
{
11915+
"rule": "PostHog Credentials",
11916+
"severity": "medium",
11917+
"confidence": "weak",
11918+
"ml_probability": null,
11919+
"line_data_list": [
11920+
{
11921+
"line": "pha_BkeaIpOESh8OGcD1bhPGh6kH9UjVGp6nnaC6vF4E7q9TcJr7GapdQMVDX",
11922+
"line_num": 4,
11923+
"path": "./tests/samples/posthog",
11924+
"info": "FILE:./tests/samples/posthog|RAW",
11925+
"variable": null,
11926+
"variable_start": -2,
11927+
"variable_end": -2,
11928+
"value": "pha_BkeaIpOESh8OGcD1bhPGh6kH9UjVGp6nnaC6vF4E7q9TcJr7GapdQMVDX",
11929+
"value_start": 0,
11930+
"value_end": 61,
11931+
"entropy": 5.03312
11932+
}
11933+
]
11934+
},
11935+
{
11936+
"rule": "PostHog Credentials",
11937+
"severity": "medium",
11938+
"confidence": "weak",
11939+
"ml_probability": null,
11940+
"line_data_list": [
11941+
{
11942+
"line": "phx_5nYpKltuz4gvt7LessoO3swaOH41RJh6pzT1x1NoeTrKbTuAaxtVMA7JmMxp",
11943+
"line_num": 5,
11944+
"path": "./tests/samples/posthog",
11945+
"info": "FILE:./tests/samples/posthog|RAW",
11946+
"variable": null,
11947+
"variable_start": -2,
11948+
"variable_end": -2,
11949+
"value": "phx_5nYpKltuz4gvt7LessoO3swaOH41RJh6pzT1x1NoeTrKbTuAaxtVMA7JmMxp",
11950+
"value_start": 0,
11951+
"value_end": 64,
11952+
"entropy": 5.04657
11953+
}
11954+
]
11955+
},
1183011956
{
1183111957
"rule": "Postman Credentials",
1183211958
"severity": "medium",
@@ -16859,6 +16985,27 @@
1685916985
}
1686016986
]
1686116987
},
16988+
{
16989+
"rule": "Vercel Token",
16990+
"severity": "medium",
16991+
"confidence": "weak",
16992+
"ml_probability": null,
16993+
"line_data_list": [
16994+
{
16995+
"line": "vcp_5G8LQP7fmw80eG7W8y0sWO1QFPuhsYUuLEqyd1ialdvz9r6pL4vzxkC3",
16996+
"line_num": 1,
16997+
"path": "./tests/samples/vercel",
16998+
"info": "FILE:./tests/samples/vercel|RAW",
16999+
"variable": null,
17000+
"variable_start": -2,
17001+
"variable_end": -2,
17002+
"value": "vcp_5G8LQP7fmw80eG7W8y0sWO1QFPuhsYUuLEqyd1ialdvz9r6pL4vzxkC3",
17003+
"value_start": 0,
17004+
"value_end": 60,
17005+
"entropy": 5.23581
17006+
}
17007+
]
17008+
},
1686217009
{
1686317010
"rule": "Tencent WeChat API App ID",
1686417011
"severity": "medium",

0 commit comments

Comments
 (0)