Skip to content

Commit

Permalink
added exit code for custom regex scan failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Bowden committed Jun 26, 2024
1 parent f7a5ba1 commit fdf4192
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .secureli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ repo_files:
- .png
- .jpg
max_file_size: 1000000
scan_patterns:
custom_scan_patterns:
- foo
telemetry:
api_url: https://log-api.newrelic.com/log/v1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from pathlib import Path
import pydantic

from secureli.modules.shared.models.exit_codes import ExitCode
import secureli.modules.shared.models.scan as scan
from secureli.modules.shared.abstractions.echo import EchoAbstraction
from secureli.modules.shared.abstractions.version_control_repo import (
Expand Down Expand Up @@ -140,7 +141,10 @@ def _generate_scan_failures(
for file in custom_regex_found_files:
failures.append(
scan.ScanFailure(
id="custom_regex_scan", file=file, repo=SECURELI_GITHUB
id="custom_regex_scan",
file=file,
repo=SECURELI_GITHUB,
exitCode=ExitCode.CUSTOM_REGEX_SCAN_ISSUES_DETECTED.name,
)
)
return failures
Expand Down
3 changes: 2 additions & 1 deletion secureli/modules/custom_scanners/pii_scanner/pii_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from pathlib import Path
import pydantic

from secureli.modules.shared.models.exit_codes import ExitCode
import secureli.modules.shared.models.scan as scan
from secureli.modules.shared.abstractions.echo import EchoAbstraction
from secureli.modules.shared.abstractions.version_control_repo import (
Expand Down Expand Up @@ -154,7 +155,7 @@ def _generate_scan_failures(
id="pii_scan",
file=pii_found_file,
repo=SECURELI_GITHUB,
exitCode="PII_SCAN_ISSUES_DETECTED",
exitCode=ExitCode.PII_SCAN_ISSUES_DETECTED.name,
)
)
return failures
Expand Down
1 change: 1 addition & 0 deletions secureli/modules/shared/models/exit_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ class ExitCode(Enum):
CONFIG_ERROR = 8
DICT_ERROR = 9
MISSING_ERROR = 10
CUSTOM_REGEX_SCAN_ISSUES_DETECTED = 11

0 comments on commit fdf4192

Please sign in to comment.