Skip to content

Commit

Permalink
rule fix
Browse files Browse the repository at this point in the history
  • Loading branch information
babenek committed Aug 2, 2023
1 parent dcb52b9 commit 5f923ef
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 5 deletions.
2 changes: 1 addition & 1 deletion credsweeper/filters/value_iban_check.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import contextlib

from schwifty import IBAN
from schwifty.exceptions import SchwiftyException

from credsweeper.config import Config
from credsweeper.credentials import LineData
from credsweeper.file_handler.analysis_target import AnalysisTarget
from credsweeper.filters import Filter
from schwifty import IBAN


class ValueIbanCheck(Filter):
Expand Down
2 changes: 1 addition & 1 deletion credsweeper/rules/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
severity: info
type: pattern
values:
- (^|[^.0-9A-Za-z_/+-])(?P<value>[A-Z]{2}[A-Z0-9]{14,32})([^=0-9A-Za-z_/+-]|$)
- (^|[^0-9A-Za-z])(?P<value>[A-Z]{2}[0-9]{2}[A-Z0-9]{12,30})([^=0-9A-Za-z]|$)
filter_type:
- ValueIbanCheck
min_line_len: 16
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"PyYAML", #
"requests", #
"scipy", #
"schwifty", #
"typing_extensions", #
"whatthepatch", #
"numpy", #
Expand Down
6 changes: 3 additions & 3 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
SAMPLES_FILES_COUNT: int = 107

# credentials count after scan
SAMPLES_CRED_COUNT: int = 103
SAMPLES_CRED_LINE_COUNT: int = 114
SAMPLES_CRED_COUNT: int = 104
SAMPLES_CRED_LINE_COUNT: int = 115

# credentials count after post-processing
SAMPLES_POST_CRED_COUNT: int = 97
SAMPLES_POST_CRED_COUNT: int = 98

# with option --doc
SAMPLES_IN_DOC = 86
Expand Down
22 changes: 22 additions & 0 deletions tests/data/depth_3.json
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,28 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
"ml_probability": null,
"rule": "IBAN",
"severity": "info",
"line_data_list": [
{
"line": "\u041f\u0440\u0438\u043a\u043b\u0430\u0434 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e IBAN: https://api.accountants/iban/UA893206490000026007052606100/",
"line_num": 3,
"path": "tests/samples/iban",
"info": "tests/samples/iban|RAW",
"value": "UA893206490000026007052606100",
"variable": null,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 2.86575901199594,
"valid": false
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "VALIDATED_KEY",
Expand Down
22 changes: 22 additions & 0 deletions tests/data/ml_threshold_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,28 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
"ml_probability": null,
"rule": "IBAN",
"severity": "info",
"line_data_list": [
{
"line": "\u041f\u0440\u0438\u043a\u043b\u0430\u0434 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e IBAN: https://api.accountants/iban/UA893206490000026007052606100/",
"line_num": 3,
"path": "tests/samples/iban",
"info": "",
"value": "UA893206490000026007052606100",
"variable": null,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 2.86575901199594,
"valid": false
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
Expand Down
22 changes: 22 additions & 0 deletions tests/data/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,28 @@
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "NOT_AVAILABLE",
"ml_probability": null,
"rule": "IBAN",
"severity": "info",
"line_data_list": [
{
"line": "\u041f\u0440\u0438\u043a\u043b\u0430\u0434 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e IBAN: https://api.accountants/iban/UA893206490000026007052606100/",
"line_num": 3,
"path": "tests/samples/iban",
"info": "",
"value": "UA893206490000026007052606100",
"variable": null,
"entropy_validation": {
"iterator": "BASE64_CHARS",
"entropy": 2.86575901199594,
"valid": false
}
}
]
},
{
"api_validation": "NOT_AVAILABLE",
"ml_validation": "VALIDATED_KEY",
Expand Down

0 comments on commit 5f923ef

Please sign in to comment.