Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
babenek committed Dec 2, 2024
1 parent 0ee4652 commit e5e0c5d
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 10 deletions.
1 change: 1 addition & 0 deletions credsweeper/rules/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,7 @@
- (?<![.0-9A-Za-z_-])(?P<value>[0-9A-Za-z_-]{14}\.atlasv1\.[0-9A-Za-z_-]{67})(?![0-9A-Za-z_-])
filter_type:
- ValuePatternCheck
- ValueEntropyBase64Check
min_line_len: 90
required_substring:
- .atlasv1.
Expand Down
8 changes: 4 additions & 4 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
NEGLIGIBLE_ML_THRESHOLD = 0.0001

# credentials count after scan
SAMPLES_CRED_COUNT: int = 411
SAMPLES_CRED_LINE_COUNT: int = 429
SAMPLES_CRED_COUNT: int = 412
SAMPLES_CRED_LINE_COUNT: int = 430

# credentials count after post-processing
SAMPLES_POST_CRED_COUNT: int = 368
SAMPLES_POST_CRED_COUNT: int = 369

# with option --doc
SAMPLES_IN_DOC = 447
SAMPLES_IN_DOC = 448

# archived credentials that are not found without --depth
SAMPLES_IN_DEEP_1 = SAMPLES_POST_CRED_COUNT + 29
Expand Down
31 changes: 29 additions & 2 deletions tests/data/depth_3.json
Original file line number Diff line number Diff line change
Expand Up @@ -7831,8 +7831,8 @@
{
"line": "Z28P3STmkBQi1Y.atlasv1.YE7RBqu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0",
"line_num": 1,
"path": "./tests/samples/hashicorp_terraform",
"info": "./tests/samples/hashicorp_terraform|RAW",
"path": "./tests/samples/hashicorp",
"info": "./tests/samples/hashicorp|RAW",
"value": "Z28P3STmkBQi1Y.atlasv1.YE7RBqu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0",
"value_start": 0,
"value_end": 90,
Expand All @@ -7847,6 +7847,33 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
"ml_probability": null,
"rule": "Hashicorp Vault Token",
"severity": "high",
"confidence": "strong",
"line_data_list": [
{
"line": "hvs.atlasv1-Z28P3STmkBQi1Y-YE7RBqu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0",
"line_num": 2,
"path": "./tests/samples/hashicorp",
"info": "./tests/samples/hashicorp|RAW",
"value": "hvs.atlasv1-Z28P3STmkBQi1Y-YE7RBqu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0",
"value_start": 0,
"value_end": 94,
"variable": null,
"variable_start": -2,
"variable_end": -2,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 5.346321090472658,
"valid": true
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
Expand Down
31 changes: 29 additions & 2 deletions tests/data/doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11987,8 +11987,8 @@
{
"line": "Z28P3STmkBQi1Y.atlasv1.YE7RBqu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0",
"line_num": 1,
"path": "./tests/samples/hashicorp_terraform",
"info": "./tests/samples/hashicorp_terraform|RAW",
"path": "./tests/samples/hashicorp",
"info": "./tests/samples/hashicorp|RAW",
"value": "Z28P3STmkBQi1Y.atlasv1.YE7RBqu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0",
"value_start": 0,
"value_end": 90,
Expand All @@ -12003,6 +12003,33 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
"ml_probability": null,
"rule": "Hashicorp Vault Token",
"severity": "high",
"confidence": "strong",
"line_data_list": [
{
"line": "hvs.atlasv1-Z28P3STmkBQi1Y-YE7RBqu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0",
"line_num": 2,
"path": "./tests/samples/hashicorp",
"info": "./tests/samples/hashicorp|RAW",
"value": "hvs.atlasv1-Z28P3STmkBQi1Y-YE7RBqu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0",
"value_start": 0,
"value_end": 94,
"variable": null,
"variable_start": -2,
"variable_end": -2,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 5.346321090472658,
"valid": true
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
Expand Down
29 changes: 28 additions & 1 deletion tests/data/ml_threshold.json
Original file line number Diff line number Diff line change
Expand Up @@ -8465,7 +8465,7 @@
{
"line": "8d92cc575673b937117a0bc2d9933296bc82695b5edfce134b6f4742d26132c5",
"line_num": 1,
"path": "./tests/samples/hashicorp_terraform",
"path": "./tests/samples/hashicorp",
"info": "",
"value": "8d92cc575673b937117a0bc2d9933296bc82695b5edfce134b6f4742d26132c5",
"value_start": 0,
Expand All @@ -8481,6 +8481,33 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
"ml_probability": null,
"rule": "Hashicorp Vault Token",
"severity": "high",
"confidence": "strong",
"line_data_list": [
{
"line": "ab065aa9aa644f0c7b24030e33468fcacd6c7f20140af08249fb744b1bbb7ccc",
"line_num": 2,
"path": "./tests/samples/hashicorp",
"info": "",
"value": "ab065aa9aa644f0c7b24030e33468fcacd6c7f20140af08249fb744b1bbb7ccc",
"value_start": 0,
"value_end": 94,
"variable": null,
"variable_start": -2,
"variable_end": -2,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 5.346321090472658,
"valid": true
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
Expand Down
29 changes: 28 additions & 1 deletion tests/data/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -7412,7 +7412,7 @@
{
"line": "Z28P3STmkBQi1Y.atlasv1.YE7RBqu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0",
"line_num": 1,
"path": "./tests/samples/hashicorp_terraform",
"path": "./tests/samples/hashicorp",
"info": "",
"value": "Z28P3STmkBQi1Y.atlasv1.YE7RBqu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0",
"value_start": 0,
Expand All @@ -7428,6 +7428,33 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
"ml_probability": null,
"rule": "Hashicorp Vault Token",
"severity": "high",
"confidence": "strong",
"line_data_list": [
{
"line": "hvs.atlasv1-Z28P3STmkBQi1Y-YE7RBqu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0",
"line_num": 2,
"path": "./tests/samples/hashicorp",
"info": "",
"value": "hvs.atlasv1-Z28P3STmkBQi1Y-YE7RBqu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0",
"value_start": 0,
"value_end": 94,
"variable": null,
"variable_start": -2,
"variable_end": -2,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 5.346321090472658,
"valid": true
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
Expand Down
2 changes: 2 additions & 0 deletions tests/samples/hashicorp
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
Z28P3STmkBQi1Y.atlasv1.YE7RBqu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0
hvs.atlasv1-Z28P3STmkBQi1Y-YE7RBqu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0

FalseCase:iOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Imk2bEdrM0ZaenhSY1ViMkMzbkVu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0RN3N5SEpsWSIsImtpZCI6Imk2bEdrM0ZaenhSY1ViMkMzbkVRN3N5SEpsWSJ9/hvs.u6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0/iOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Imk2bEdrM0ZaenhSY1ViMu6VVyQIOq9a1eC3YFU5Elt7ToIr6OwzKAWlCTQ7N4gElXaWou6aPpOIwGCoc0kMzbkVRN3N5SEpsWSIsImtpZCI6Imk2bEdrM0ZaenhSY1ViMkMzbkVRN3N5SEpsWSJ9

0 comments on commit e5e0c5d

Please sign in to comment.