Skip to content

Commit

Permalink
tests updated
Browse files Browse the repository at this point in the history
  • Loading branch information
babenek committed Dec 8, 2023
1 parent 964a9ce commit 00a55eb
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 9 deletions.
4 changes: 2 additions & 2 deletions credsweeper/rules/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -622,12 +622,12 @@
severity: high
type: pattern
values:
- (^|[^.0-9A-Za-z_/+-])(?P<value>cmVmdGtuO[A-Za-z0-9_=-]{50,60})([^=0-9A-Za-z_/+-]|$)
- (^|[^.0-9A-Za-z_/+-])(?P<value>cmVmdGtuO[A-Za-z0-9_-]{55})([^=0-9A-Za-z_/+-]|$)
filter_type:
- ValueJfrogTokenCheck
required_substrings:
- cmVmdGtuO
min_line_len: 60
min_line_len: 64

- name: Azure Access Token
severity: high
Expand Down
10 changes: 5 additions & 5 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
from pathlib import Path

# total number of files in test samples
SAMPLES_FILES_COUNT: int = 121
SAMPLES_FILES_COUNT: int = 123

# credentials count after scan
SAMPLES_CRED_COUNT: int = 380
SAMPLES_CRED_LINE_COUNT: int = 392
SAMPLES_CRED_COUNT: int = 381
SAMPLES_CRED_LINE_COUNT: int = 393

# credentials count after post-processing
SAMPLES_POST_CRED_COUNT: int = 299
SAMPLES_POST_CRED_COUNT: int = 300

# with option --doc
SAMPLES_IN_DOC = 391
SAMPLES_IN_DOC = 392

# archived credentials that are not found without --depth
SAMPLES_IN_DEEP_1 = SAMPLES_POST_CRED_COUNT + 22
Expand Down
24 changes: 24 additions & 0 deletions tests/data/depth_3.json
Original file line number Diff line number Diff line change
Expand Up @@ -6020,6 +6020,30 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
"ml_probability": null,
"rule": "Jfrog reference token",
"severity": "high",
"line_data_list": [
{
"line": "cmVmdGtuOjAxOjAxMjM0NTY3ODk6QWJjZGVmR2hpamtsbW5vUHFyc3R1dnd4eXow",
"line_num": 1,
"path": "tests/samples/jfrog_p",
"info": "tests/samples/jfrog_p|RAW",
"value": "cmVmdGtuOjAxOjAxMjM0NTY3ODk6QWJjZGVmR2hpamtsbW5vUHFyc3R1dnd4eXow",
"value_start": 0,
"value_end": 64,
"variable": null,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 5.288909765557392,
"valid": true
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
Expand Down
24 changes: 24 additions & 0 deletions tests/data/doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9806,6 +9806,30 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
"ml_probability": null,
"rule": "Jfrog reference token",
"severity": "high",
"line_data_list": [
{
"line": "cmVmdGtuOjAxOjAxMjM0NTY3ODk6QWJjZGVmR2hpamtsbW5vUHFyc3R1dnd4eXow",
"line_num": 1,
"path": "tests/samples/jfrog_p",
"info": "tests/samples/jfrog_p|RAW",
"value": "cmVmdGtuOjAxOjAxMjM0NTY3ODk6QWJjZGVmR2hpamtsbW5vUHFyc3R1dnd4eXow",
"value_start": 0,
"value_end": 64,
"variable": null,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 5.288909765557392,
"valid": true
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
Expand Down
24 changes: 24 additions & 0 deletions tests/data/ml_threshold_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -7748,6 +7748,30 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
"ml_probability": null,
"rule": "Jfrog reference token",
"severity": "high",
"line_data_list": [
{
"line": "cmVmdGtuOjAxOjAxMjM0NTY3ODk6QWJjZGVmR2hpamtsbW5vUHFyc3R1dnd4eXow",
"line_num": 1,
"path": "tests/samples/jfrog_p",
"info": "",
"value": "cmVmdGtuOjAxOjAxMjM0NTY3ODk6QWJjZGVmR2hpamtsbW5vUHFyc3R1dnd4eXow",
"value_start": 0,
"value_end": 64,
"variable": null,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 5.288909765557392,
"valid": true
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
Expand Down
24 changes: 24 additions & 0 deletions tests/data/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -5876,6 +5876,30 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
"ml_probability": null,
"rule": "Jfrog reference token",
"severity": "high",
"line_data_list": [
{
"line": "cmVmdGtuOjAxOjAxMjM0NTY3ODk6QWJjZGVmR2hpamtsbW5vUHFyc3R1dnd4eXow",
"line_num": 1,
"path": "tests/samples/jfrog_p",
"info": "",
"value": "cmVmdGtuOjAxOjAxMjM0NTY3ODk6QWJjZGVmR2hpamtsbW5vUHFyc3R1dnd4eXow",
"value_start": 0,
"value_end": 64,
"variable": null,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 5.288909765557392,
"valid": true
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
Expand Down
2 changes: 1 addition & 1 deletion tests/samples/jfrog_n
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cmVmdGtuOlRoZXJlIGFyZW4ndCB0aGUgdG9rZW5zIHlvdSBhcmUgbG9va2luZyA0Cg
cmVmdGtuOlRoZXJlIGFyZSBub3QgdGhlIHRva2VucyB5b3UncmUgbG9va2luZyA0
2 changes: 1 addition & 1 deletion tests/samples/jfrog_p
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cmVmdGtuOjAxOjAxMjM0NTY3ODk6YWJjZGVmR2hpamtsbW5vUHFyc3R1Vnd4eXowCg
cmVmdGtuOjAxOjAxMjM0NTY3ODk6QWJjZGVmR2hpamtsbW5vUHFyc3R1dnd4eXow

0 comments on commit 00a55eb

Please sign in to comment.