rules package

Submodules

rules.rule module

class credsweeper.rules.rule.Rule(config, rule_template)[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 objects that can be used to filters False detections based on rules

  • patterns – regular expressions that can be used for detection

  • pattern_type – single_pattern/multi_pattern/pem_key_pattern. single_pattern for simple single line credentials multi_pattern for credentials span for rew lines. pem_key_pattern for PEM like credentials

  • 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

MULTI_PATTERN = 'multi_pattern'
PEM_KEY_PATTERN = 'pem_key_pattern'
SINGLE_PATTERN = 'single_pattern'
property filters: List[credsweeper.filters.filter.Filter]
Return type

List[Filter]

property min_line_len: int
Return type

int

property pattern_type: str
Return type

str

property patterns: List[_regex.Pattern]
Return type

List[Pattern]

property required_substrings: List[str]
Return type

List[str]

property rule_name: str
Return type

str

property rule_type: credsweeper.common.constants.RuleType
Return type

RuleType

property severity: credsweeper.common.constants.Severity
Return type

Severity

property use_ml: bool
Return type

bool

property validations: List[credsweeper.validations.validation.Validation]
Return type

List[Validation]

Module contents