credsweeper.rules package

Submodules

credsweeper.rules.rule module

class credsweeper.rules.rule.Rule(config, rule_dict)[source]

Bases: object

Regular expression to detect some credential type.

Class contains regular expression to detect some credential type, credential name, assumed severity

and details on how detection should be processed

Parameters:
  • rule_name – Name displayed if rule

  • rule_type – RuleType used for this rule

  • severity – critical/high/medium/low

  • filters – List of Filter OR _one_ filter Group that can be used to filters False detections based on rules

  • patterns – Regular expressions that can be used for detection

  • use_ml – Should ML work on this credential or not. If not prediction based on regular expression and filter only

  • validations – List of Validation objects that can check this credential using external API

  • required_substrings – Optional list of substrings. Scanner would only apply this rule if line contain at least one of this substrings

  • min_line_len – Optional minimal line length. Scanner would only apply this rule if line is equal or longer

  • usage_list – List of analyze types. There are 2 different analyze type now (“src”, “doc”)

CONFIDENCE = 'confidence'
DOC_AVAILABLE = 'doc_available'
DOC_ONLY = 'doc_only'
FILTER_TYPE = 'filter_type'
MIN_LINE_LEN = 'min_line_len'
NAME = 'name'
REQUIRED_REGEX = 'required_regex'
REQUIRED_SUBSTRINGS = 'required_substrings'
SEVERITY = 'severity'
TYPE = 'type'
USE_ML = 'use_ml'
VALIDATIONS = 'validations'
VALUES = 'values'
property confidence: Confidence

confidence getter

property doc_available: bool

doc_available getter

property doc_only: bool

doc_only getter

property filters: List[Filter]

filters getter

property has_required_substrings: bool

has_required_substrings getter for speedup

property min_line_len: int

min_line_len getter

property patterns: List[Pattern]

patterns getter

property required_regex: Pattern | None

required_regex getter

property required_substrings: Set[str]

required_substrings getter

property rule_name: str

rule_name getter

property rule_type: RuleType

rule_type getter

property severity: Severity

severity getter

property use_ml: bool

use_ml getter

property validations: List[Validation]

validations getter

Module contents