deepsecrets 1.3.0__tar.gz → 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/LICENSE +20 -20
- deepsecrets-2.0.0/PKG-INFO +282 -0
- deepsecrets-2.0.0/README.md +247 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/__init__.py +10 -10
- deepsecrets-2.0.0/deepsecrets/__main__.py +30 -0
- deepsecrets-2.0.0/deepsecrets/cli.py +470 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/config.py +133 -102
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/engines/hashed_secret.py +50 -49
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/engines/iengine.py +36 -42
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/engines/regex.py +39 -39
- deepsecrets-2.0.0/deepsecrets/core/engines/semantic.py +115 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/helpers/content_analyzer.py +39 -39
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/helpers/entropy.py +61 -61
- deepsecrets-2.0.0/deepsecrets/core/helpers/naturalness_scorer.py +143 -0
- deepsecrets-2.0.0/deepsecrets/core/helpers/variable_evaluator.py +134 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/model/__init__.py +3 -3
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/model/file.py +165 -127
- deepsecrets-2.0.0/deepsecrets/core/model/finding.py +119 -0
- deepsecrets-2.0.0/deepsecrets/core/model/internal/processing.py +16 -0
- deepsecrets-2.0.0/deepsecrets/core/model/response/base.py +63 -0
- deepsecrets-2.0.0/deepsecrets/core/model/response/builtin.py +60 -0
- deepsecrets-2.0.0/deepsecrets/core/model/response/dojo_sarif.py +216 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/model/rules/exlcuded_path.py +12 -12
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/model/rules/false_finding.py +5 -5
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/model/rules/hashed_secret.py +54 -54
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/model/rules/hashing.py +7 -7
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/model/rules/regex.py +119 -90
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/model/rules/rule.py +41 -29
- deepsecrets-2.0.0/deepsecrets/core/model/rules/variable_scoring.py +70 -0
- deepsecrets-2.0.0/deepsecrets/core/model/semantic.py +106 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/model/token.py +74 -70
- deepsecrets-2.0.0/deepsecrets/core/model/tokenized_region.py +34 -0
- deepsecrets-2.0.0/deepsecrets/core/modes/iscan_mode.py +387 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/rulesets/excluded_paths.py +7 -7
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/rulesets/false_findings.py +7 -7
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/rulesets/hashed_secrets.py +46 -46
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/rulesets/ibuilder.py +29 -25
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/rulesets/regex.py +7 -7
- deepsecrets-2.0.0/deepsecrets/core/rulesets/variable_scoring.py +7 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/tokenizers/__init__.py +4 -4
- deepsecrets-2.0.0/deepsecrets/core/tokenizers/cheap_var_search.py +45 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/tokenizers/full_content.py +10 -10
- deepsecrets-2.0.0/deepsecrets/core/tokenizers/helpers/semantic/deep_analyzer.py +130 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/tokenizers/helpers/semantic/language.py +36 -30
- deepsecrets-2.0.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection/detector.py +215 -0
- deepsecrets-2.0.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection/rules.py +451 -0
- deepsecrets-2.0.0/deepsecrets/core/tokenizers/helpers/single_token_improver.py +97 -0
- deepsecrets-2.0.0/deepsecrets/core/tokenizers/helpers/subfile_regions_helper.py +161 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/tokenizers/helpers/type_stream.py +68 -62
- deepsecrets-2.0.0/deepsecrets/core/tokenizers/itokenizer.py +68 -0
- deepsecrets-2.0.0/deepsecrets/core/tokenizers/lexer.py +138 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/tokenizers/per_line.py +20 -20
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/tokenizers/per_word.py +32 -32
- deepsecrets-2.0.0/deepsecrets/core/ui/floating_header.py +25 -0
- deepsecrets-2.0.0/deepsecrets/core/ui/progress_bar.py +30 -0
- deepsecrets-2.0.0/deepsecrets/core/ui/time_remaining_column.py +39 -0
- deepsecrets-2.0.0/deepsecrets/core/utils/__init__.py +0 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/utils/cpu.py +65 -65
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/utils/exceptions.py +6 -6
- deepsecrets-2.0.0/deepsecrets/core/utils/file_analyzer.py +111 -0
- deepsecrets-2.0.0/deepsecrets/core/utils/finding_merger.py +25 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/utils/fs.py +21 -21
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/utils/guess_filetype.py +96 -67
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/utils/hashing.py +29 -29
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/utils/lexer_finder.py +133 -102
- deepsecrets-2.0.0/deepsecrets/core/utils/lifecycle_hooks.py +66 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/core/utils/log.py +48 -25
- deepsecrets-2.0.0/deepsecrets/core/utils/progress.py +120 -0
- deepsecrets-2.0.0/deepsecrets/core/utils/string.py +27 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/rules/excluded_paths.json +129 -129
- deepsecrets-2.0.0/deepsecrets/rules/regexes.json +237 -0
- deepsecrets-2.0.0/deepsecrets/rules/value_scoring_model.json +1 -0
- deepsecrets-2.0.0/deepsecrets/rules/variable_scoring_rules.json +135 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/deepsecrets/scan_modes/cli.py +135 -103
- deepsecrets-2.0.0/deepsecrets/utils.py +20 -0
- {deepsecrets-1.3.0 → deepsecrets-2.0.0}/pyproject.toml +93 -94
- deepsecrets-1.3.0/PKG-INFO +0 -176
- deepsecrets-1.3.0/README.md +0 -141
- deepsecrets-1.3.0/deepsecrets/__main__.py +0 -10
- deepsecrets-1.3.0/deepsecrets/cli.py +0 -252
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/__init__.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/__init__.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/__init__.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/hashed_secret.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/hashed_secret.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/hashed_secret.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/iengine.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/iengine.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/iengine.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/regex.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/regex.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/regex.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/semantic.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/semantic.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/__pycache__/semantic.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/engines/semantic.py +0 -166
- deepsecrets-1.3.0/deepsecrets/core/helpers/__pycache__/content_analyzer.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/helpers/__pycache__/content_analyzer.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/helpers/__pycache__/content_analyzer.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/helpers/__pycache__/entropy.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/helpers/__pycache__/entropy.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/helpers/__pycache__/entropy.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/__init__.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/__init__.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/__init__.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/file.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/file.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/file.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/finding.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/finding.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/finding.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/semantic.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/semantic.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/semantic.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/token.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/token.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/__pycache__/token.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/finding.py +0 -252
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/__init__.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/__init__.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/__init__.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/exlcuded_path.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/exlcuded_path.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/exlcuded_path.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/false_finding.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/false_finding.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/false_finding.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/hashed_secret.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/hashed_secret.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/hashed_secret.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/hashing.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/hashing.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/hashing.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/regex.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/regex.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/regex.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/rule.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/rule.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/__pycache__/rule.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/model/rules/semantic.py +0 -5
- deepsecrets-1.3.0/deepsecrets/core/model/semantic.py +0 -14
- deepsecrets-1.3.0/deepsecrets/core/modes/__pycache__/iscan_mode.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/modes/__pycache__/iscan_mode.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/modes/__pycache__/iscan_mode.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/modes/iscan_mode.py +0 -196
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/excluded_paths.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/excluded_paths.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/excluded_paths.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/false_findings.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/false_findings.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/false_findings.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/hashed_secrets.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/hashed_secrets.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/hashed_secrets.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/ibuilder.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/ibuilder.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/ibuilder.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/regex.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/regex.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/rulesets/__pycache__/regex.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/__init__.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/__init__.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/__init__.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/full_content.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/full_content.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/full_content.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/itokenizer.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/itokenizer.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/itokenizer.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/lexer.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/lexer.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/lexer.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/per_line.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/per_line.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/__pycache__/per_line.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/__pycache__/__init__.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/__pycache__/__init__.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/__pycache__/__init__.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/__pycache__/spot_improvements.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/__pycache__/spot_improvements.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/__pycache__/spot_improvements.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/__pycache__/type_stream.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/__pycache__/type_stream.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/__pycache__/type_stream.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/__pycache__/__init__.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/__pycache__/__init__.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/__pycache__/__init__.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/__pycache__/language.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/__pycache__/language.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/__pycache__/language.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection/__pycache__/__init__.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection/__pycache__/__init__.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection/__pycache__/__init__.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection/__pycache__/detector.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection/__pycache__/detector.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection/__pycache__/detector.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection/__pycache__/rules.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection/__pycache__/rules.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection/__pycache__/rules.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection/detector.py +0 -142
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection/rules.py +0 -261
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/spot_improvements.py +0 -58
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/itokenizer.py +0 -26
- deepsecrets-1.3.0/deepsecrets/core/tokenizers/lexer.py +0 -225
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/__init__.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/__init__.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/__init__.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/cpu.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/cpu.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/cpu.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/exceptions.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/exceptions.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/exceptions.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/file_analyzer.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/file_analyzer.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/file_analyzer.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/fs.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/fs.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/fs.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/guess_filetype.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/guess_filetype.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/guess_filetype.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/hashing.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/hashing.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/hashing.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/lexer_finder.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/lexer_finder.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/lexer_finder.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/log.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/log.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/__pycache__/sarif_helper.cpython-313.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/core/utils/file_analyzer.py +0 -104
- deepsecrets-1.3.0/deepsecrets/core/utils/sarif_helper.py +0 -67
- deepsecrets-1.3.0/deepsecrets/rules/regexes.json +0 -169
- deepsecrets-1.3.0/deepsecrets/scan_modes/__pycache__/cli.cpython-311.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/scan_modes/__pycache__/cli.cpython-312.pyc +0 -0
- deepsecrets-1.3.0/deepsecrets/scan_modes/__pycache__/cli.cpython-313.pyc +0 -0
- {deepsecrets-1.3.0/deepsecrets/core/utils → deepsecrets-2.0.0/deepsecrets/core/engines}/__init__.py +0 -0
- {deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection → deepsecrets-2.0.0/deepsecrets/core/model/rules}/__init__.py +0 -0
- {deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers/semantic → deepsecrets-2.0.0/deepsecrets/core/tokenizers/helpers}/__init__.py +0 -0
- {deepsecrets-1.3.0/deepsecrets/core/tokenizers/helpers → deepsecrets-2.0.0/deepsecrets/core/tokenizers/helpers/cheap_var_search}/__init__.py +0 -0
- {deepsecrets-1.3.0/deepsecrets/core/model/rules → deepsecrets-2.0.0/deepsecrets/core/tokenizers/helpers/semantic}/__init__.py +0 -0
- {deepsecrets-1.3.0/deepsecrets/core/engines → deepsecrets-2.0.0/deepsecrets/core/tokenizers/helpers/semantic/var_detection}/__init__.py +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Avito
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Avito
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deepsecrets
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: A better tool for secrets scanning
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: security,secrets,credentials,scanning,appsec,code,search
|
|
8
|
+
Author: Nikolai Khechumov
|
|
9
|
+
Author-email: khechumov@gmail.com
|
|
10
|
+
Maintainer: Nikolai Khechumov
|
|
11
|
+
Maintainer-email: khechumov@gmail.com
|
|
12
|
+
Requires-Python: >=3.10,<4.0.0
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Environment :: Console
|
|
17
|
+
Classifier: Topic :: Security
|
|
18
|
+
Requires-Dist: aenum (==3.1.17)
|
|
19
|
+
Requires-Dist: dotwiz (==0.4.0)
|
|
20
|
+
Requires-Dist: jschema-to-python (==1.2.3)
|
|
21
|
+
Requires-Dist: jsx-lexer (==2.0.1)
|
|
22
|
+
Requires-Dist: mmh3 (==5.2.1)
|
|
23
|
+
Requires-Dist: ordered-set (==4.1.0)
|
|
24
|
+
Requires-Dist: puppetparser (==0.2.14)
|
|
25
|
+
Requires-Dist: pydantic (==2.13.4)
|
|
26
|
+
Requires-Dist: pygments (==2.20.0)
|
|
27
|
+
Requires-Dist: pyyaml (==6.0.3)
|
|
28
|
+
Requires-Dist: regex (==2026.5.9)
|
|
29
|
+
Requires-Dist: rich (==15.0.0)
|
|
30
|
+
Requires-Dist: sarif-om (==1.0.4)
|
|
31
|
+
Project-URL: Bug Tracker, https://github.com/ntoskernel/deepsecrets/issues
|
|
32
|
+
Project-URL: Homepage, https://owasp.org/www-project-deepsecrets/
|
|
33
|
+
Project-URL: Repository, https://github.com/ntoskernel/deepsecrets
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# DeepSecrets 2.0 - a better tool for secrets scanning
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
## What is it? Another token-wasting CLI proxy to an AI API?
|
|
41
|
+
|
|
42
|
+
Absolutely not!
|
|
43
|
+
|
|
44
|
+
In our LLM-hype era, DeepSecrets still runs entirely on your machine — giving you great results offline, securely, and for free.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## So why yet another tool?
|
|
48
|
+
Most existing scanners don't actually "understand" code. Instead, they just parse texts and have bad coverage.
|
|
49
|
+
|
|
50
|
+
DeepSecrets bridges the gap between classic regex scanners and full-scale commercial SAST tools. It extends the classic regex-based scanning strategy by heavily relying on semantic code analysis, dangerous variable detection, and context-aware entropy analysis.
|
|
51
|
+
This means secret candidates are always semantically correct. We achieve true code understanding across 500+ languages and formats using lexing and parsing techniques.
|
|
52
|
+
|
|
53
|
+
DeepSecrets also introduces a new way to find credentials with zero knowledge: the HashedSecret Engine. Just provide the hashed values of your known production secrets, and the tool will find them exposed in plain text within your code.
|
|
54
|
+
|
|
55
|
+
### Performance & Benchmarks (SecretBench)
|
|
56
|
+
|
|
57
|
+
DeepSecrets v2.0 was evaluated (June 2026) against the **SecretBench** benchmark outperforming traditional flat-text scanners:
|
|
58
|
+
|
|
59
|
+
* **93% Recall**
|
|
60
|
+
* **8% False Positive Rate** on SecretBench scope
|
|
61
|
+
* **~9K Extra Findings** *outside* the SecretBench scope
|
|
62
|
+
|
|
63
|
+
*(You can read the full under-the-hood story and benchmark breakdown in my HackerNoon article [here]())*
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# Quick Start Guide
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
From Github via pip
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
$ pip install git+https://github.com/ntoskernel/deepsecrets.git
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
From PyPi
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
$ pip install deepsecrets
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
## Scanning
|
|
84
|
+
The easiest way to run a scan:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
$ deepsecrets --target-dir /path/to/your/code --outformat dojo-sarif --outfile report.json
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This will run a scan against `/path/to/your/code` using the default configuration:
|
|
91
|
+
- Regex using the built-in ruleset
|
|
92
|
+
- Semantic checks (variable detection, entropy checks)
|
|
93
|
+
|
|
94
|
+
A report in SARIF format (compatible with DefectDojo and GitHub Security) will be saved to report.json.
|
|
95
|
+
|
|
96
|
+
### Fine-Tuning
|
|
97
|
+
The `--help` command is always ready to guide you, but here are the key flags you can use to tailor the scan to your environment:
|
|
98
|
+
* `--regex-rules /path/to/rules.json`: Supply your own custom regex ruleset.
|
|
99
|
+
* `--hashed-values /path/to/hashes.json`: Provide a list of pre-hashed known production secrets to search for them securely.
|
|
100
|
+
* `--excluded-paths /path/to/exclusions.json`: Override or extend the default paths ignored during scanning.
|
|
101
|
+
* `--disable-masking`: Keep potential secrets unmasked in the output report *(see caution below)*.
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### Github Actions Integration
|
|
105
|
+
|
|
106
|
+
eq. `.github/workflows/deepsecrets.yml`
|
|
107
|
+
|
|
108
|
+
```yaml
|
|
109
|
+
name: DeepSecrets Scan
|
|
110
|
+
on: [push, pull_request]
|
|
111
|
+
|
|
112
|
+
jobs:
|
|
113
|
+
scan:
|
|
114
|
+
runs-on: ubuntu-latest
|
|
115
|
+
steps:
|
|
116
|
+
- name: Checkout code
|
|
117
|
+
uses: actions/checkout@v4
|
|
118
|
+
|
|
119
|
+
- name: Set up Python
|
|
120
|
+
uses: actions/setup-python@v5
|
|
121
|
+
with:
|
|
122
|
+
python-version: '3.11'
|
|
123
|
+
|
|
124
|
+
- name: Install DeepSecrets
|
|
125
|
+
run: pip install deepsecrets
|
|
126
|
+
|
|
127
|
+
- name: Run Scan
|
|
128
|
+
run: deepsecrets --target-dir . --outformat dojo-sarif --outfile report.sarif
|
|
129
|
+
continue-on-error: true
|
|
130
|
+
|
|
131
|
+
- name: Upload SARIF report
|
|
132
|
+
uses: github/codeql-action/upload-sarif@v3
|
|
133
|
+
with:
|
|
134
|
+
sarif_file: report.sarif
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Masking Secrets in Reports
|
|
138
|
+
|
|
139
|
+
As of v1.3.0, potential secrets are automatically masked inside reports to protect your pipeline artifacts. Turn this off via the `--disable-masking` flag if necessary.
|
|
140
|
+
|
|
141
|
+
Masking doesn't break the deduplication logic of downstream platforms (like Github), as the `partialFingerprints` section in the report is correctly populated based on the raw data.
|
|
142
|
+
|
|
143
|
+
> [!Caution]
|
|
144
|
+
> If you integrate DeepSecrets into your CI pipeline with masking disabled, you will likely re-leak your secrets inside your CI logs and artifacts.
|
|
145
|
+
|
|
146
|
+
### SARIF Reports & Dynamic Confidence
|
|
147
|
+
|
|
148
|
+
Every finding gets a confidence score. However, different security platforms parse SARIF metrics differently. To ensure compatibility across modern ASPM dashboards, DeepSecrets does the following:
|
|
149
|
+
|
|
150
|
+
* **Virtual Subrules (`rules[]`)**: Dynamically generates rules like `S105-LOW` or `S105-CRITICAL`. This forces GitHub Security and DefectDojo to map semantic precision variance properly without breaking native parsers.
|
|
151
|
+
|
|
152
|
+
* **Deterministic Result Level**: The tool always explicitly sets `level: error` in the `results[]` model. This acts as a universal fallback for CI/CD pipelines and older SAST parsers, ensuring that exposed secrets reliably break builds or block Pull Requests regardless of individual rule interpretations.
|
|
153
|
+
|
|
154
|
+
* **Contextual Messages**: Injects the raw numeric confidence score natively into `result.message.text` so security analysts see it immediately on their dashboards.
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
## Building rulesets
|
|
158
|
+
|
|
159
|
+
### Regex
|
|
160
|
+
|
|
161
|
+
The built-in ruleset for regex checks is located in `/deepsecrets/rules/regexes.json`. You're free to follow the format and create a custom ruleset.
|
|
162
|
+
|
|
163
|
+
### HashedSecret (Zero-Knowledge Scanning)
|
|
164
|
+
|
|
165
|
+
Example ruleset for hashed checks is located in `/tests/fixtures/hashed_secrets.json`. You're free to follow the format and create a custom ruleset.
|
|
166
|
+
|
|
167
|
+
#### HashedSecret Ruleset Example
|
|
168
|
+
|
|
169
|
+
To look for known production secrets without exposing them in plaintext inside your repository, provide a JSON containing their hashes:
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
[
|
|
173
|
+
{
|
|
174
|
+
"name": "KNOWN-PROD-DATABASE-PASSWORD",
|
|
175
|
+
"hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
|
176
|
+
"length": 12,
|
|
177
|
+
"algorithm": "sha1"
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
```
|
|
181
|
+
Run with `--hashed-values /path/to/hashes.json`. DeepSecrets will automatically hash string candidates on the fly during its lexing stage to match them.
|
|
182
|
+
|
|
183
|
+
## Contacts
|
|
184
|
+
|
|
185
|
+
- Nikolai Khechumov ([@ntoskernel](https://github.com/ntoskernel)) — creator and maintainer
|
|
186
|
+
|
|
187
|
+
## FAQ
|
|
188
|
+
> Pff, is it still regex-based?
|
|
189
|
+
|
|
190
|
+
Yes and no. Of course, it uses regexes to find typed secrets like any other tool. But language understanding (the lexing stage) and variable detection also use regexes under the hood. Regex is an instrument, not the problem. The problem is applying regex blindly without semantic context.
|
|
191
|
+
|
|
192
|
+
> But what about Semgrep Secrets? Looks like you're cloning their thing.
|
|
193
|
+
|
|
194
|
+
DeepSecrets was originally released in April 2023 — six months before Semgrep Secrets launched. We share similar principles, but DeepSecrets is 100% free/open-source and leverages a significantly broader multi-language tracking surface.
|
|
195
|
+
|
|
196
|
+
### DeepSecrets vs. Other Scanners
|
|
197
|
+
|
|
198
|
+
While other tools scan only what they know, DeepSecrets leverages lexers. This allows it to surface hidden, dangerous credentials in rare configuration formats and custom code blocks that benchmarks may not have datasets for.
|
|
199
|
+
|
|
200
|
+
#### Tool comparison based on SecretBench Results
|
|
201
|
+
|
|
202
|
+
| Feature / Capability | **DeepSecrets 2.0** | **Gitleaks** | **TruffleHog** | **Semgrep Secrets** |
|
|
203
|
+
| :--- | :---: | :---: | :---: | :---: |
|
|
204
|
+
| **SecretBench Accuracy** | **93% Recall<br>69% Precision** | 88% Recall<br>46% Precision | 52% Recall<br>6% Precision | *Not Evaluated* |
|
|
205
|
+
| **Price & Licensing** | **Free / Open-Source** | Free / Open-Source | Free / Open-Source | Commercial / Paid |
|
|
206
|
+
| **Analysis Type** | **Semantic / Regex** | Flat-text Regex / Entropy | Flat-text Regex / Entropy | Semantic |
|
|
207
|
+
| **Language Support** | **500+** | Context-agnostic (Text) | Context-agnostic (Text) | Limited subset |
|
|
208
|
+
| **Pre-hashed Validation** | **Yes (via Hashed Engine)** | No | No | No |
|
|
209
|
+
| **Context-Aware Entropy**| **Yes (Assigned values)** | No (Entire file text) | No (Entire file text) | Yes |
|
|
210
|
+
| **Advanced SARIF Output**| **Yes (Dynamic Confidence)** | Basic | Basic | Yes |
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
> Why don't you build true abstract syntax trees? It's academically more correct!
|
|
215
|
+
|
|
216
|
+
DeepSecrets tries to keep a balance between complexity and effectiveness. Building a true AST across 500+ languages is incredibly complex and simply overkill for the secrets detection. The tool follows the generic SAST approach to code analysis but optimizes the AST stage for maximum speed and width.
|
|
217
|
+
|
|
218
|
+
> I'd like to build my own semantic rules. How do I do that?
|
|
219
|
+
|
|
220
|
+
Semantic rules are now effectively "variable evaluation rules". You can find them [here](https://github.com/ntoskernel/deepsecrets/blob/main/deepsecrets/rules/variable_scoring_rules.json).
|
|
221
|
+
|
|
222
|
+
> I still have a question
|
|
223
|
+
|
|
224
|
+
Feel free to contact the developer directly using the emails listed in [pyproject.toml](https://github.com/ntoskernel/deepsecrets/blob/main/pyproject.toml#L6-L8)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
## Contributing & Core Concepts
|
|
228
|
+
|
|
229
|
+
### Under the hood
|
|
230
|
+
There are several core concepts:
|
|
231
|
+
|
|
232
|
+
- `File`
|
|
233
|
+
- `Tokenizer`
|
|
234
|
+
- `Token`
|
|
235
|
+
- `Engine`
|
|
236
|
+
- `Finding`
|
|
237
|
+
- `ScanMode`
|
|
238
|
+
|
|
239
|
+
### File
|
|
240
|
+
Just a pythonic representation of a file with all needed methods for management.
|
|
241
|
+
|
|
242
|
+
### Tokenizer
|
|
243
|
+
Breaks the content of a file into pieces - Tokens - by its logic. There are four types of tokenizers available:
|
|
244
|
+
|
|
245
|
+
- `FullContentTokenizer`: treats all content as a single token. Useful for regex-based search.
|
|
246
|
+
- `PerWordTokenizer`: breaks given content by words and line breaks.
|
|
247
|
+
- `LexerTokenizer`: uses language-specific smarts to break code into semantically correct pieces with additional context for each token.
|
|
248
|
+
- `CheapVarDetectorTokenizer`: uses tight regexes to cover limitations of semantic variable detection.
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
### Token
|
|
252
|
+
A string with additional information about its semantic role, corresponding file, and location inside it.
|
|
253
|
+
|
|
254
|
+
### Engine
|
|
255
|
+
A component performing secrets search for a single token by its own logic. Returns a set of Findings. There are three engines available:
|
|
256
|
+
|
|
257
|
+
- `RegexEngine`: checks tokens' values through a special ruleset
|
|
258
|
+
- `SemanticEngine`: checks tokens produced by the LexerTokenizer using additional context - variable names and values
|
|
259
|
+
- `HashedSecretEngine`: checks tokens' values by hashing them and trying to find coinciding hashes inside a special ruleset
|
|
260
|
+
|
|
261
|
+
### Finding
|
|
262
|
+
This is a data structure representing a problem detected inside code. Features information about the precise location inside a file and a rule that found it.
|
|
263
|
+
|
|
264
|
+
### ScanMode
|
|
265
|
+
This component is responsible for the scan process.
|
|
266
|
+
|
|
267
|
+
- Defines the scope of analysis for a given work directory respecting exceptions
|
|
268
|
+
- Allows declaring a `PerFileAnalyzer` - the method called against each file, returning a list of findings. The primary usage is to initialize necessary engines, tokenizers, and rulesets.
|
|
269
|
+
- Runs the scan: a multiprocessing pool analyzes every file in parallel.
|
|
270
|
+
- Prepares results for output and outputs them.
|
|
271
|
+
|
|
272
|
+
The current implementation has a `CliScanMode` built by the user-provided config through the cli args.
|
|
273
|
+
|
|
274
|
+
### Local development
|
|
275
|
+
|
|
276
|
+
The project is supposed to be developed using VSCode and 'Remote containers' feature.
|
|
277
|
+
|
|
278
|
+
Steps:
|
|
279
|
+
1. Clone the repository
|
|
280
|
+
2. Open the cloned folder with VSCode
|
|
281
|
+
3. Select "Reopen in Container" when prompted
|
|
282
|
+
4. Wait for the automated environment build to complete. You are ready to develop.
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# DeepSecrets 2.0 - a better tool for secrets scanning
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
## What is it? Another token-wasting CLI proxy to an AI API?
|
|
6
|
+
|
|
7
|
+
Absolutely not!
|
|
8
|
+
|
|
9
|
+
In our LLM-hype era, DeepSecrets still runs entirely on your machine — giving you great results offline, securely, and for free.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## So why yet another tool?
|
|
13
|
+
Most existing scanners don't actually "understand" code. Instead, they just parse texts and have bad coverage.
|
|
14
|
+
|
|
15
|
+
DeepSecrets bridges the gap between classic regex scanners and full-scale commercial SAST tools. It extends the classic regex-based scanning strategy by heavily relying on semantic code analysis, dangerous variable detection, and context-aware entropy analysis.
|
|
16
|
+
This means secret candidates are always semantically correct. We achieve true code understanding across 500+ languages and formats using lexing and parsing techniques.
|
|
17
|
+
|
|
18
|
+
DeepSecrets also introduces a new way to find credentials with zero knowledge: the HashedSecret Engine. Just provide the hashed values of your known production secrets, and the tool will find them exposed in plain text within your code.
|
|
19
|
+
|
|
20
|
+
### Performance & Benchmarks (SecretBench)
|
|
21
|
+
|
|
22
|
+
DeepSecrets v2.0 was evaluated (June 2026) against the **SecretBench** benchmark outperforming traditional flat-text scanners:
|
|
23
|
+
|
|
24
|
+
* **93% Recall**
|
|
25
|
+
* **8% False Positive Rate** on SecretBench scope
|
|
26
|
+
* **~9K Extra Findings** *outside* the SecretBench scope
|
|
27
|
+
|
|
28
|
+
*(You can read the full under-the-hood story and benchmark breakdown in my HackerNoon article [here]())*
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# Quick Start Guide
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
From Github via pip
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
$ pip install git+https://github.com/ntoskernel/deepsecrets.git
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
From PyPi
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
$ pip install deepsecrets
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Scanning
|
|
49
|
+
The easiest way to run a scan:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
$ deepsecrets --target-dir /path/to/your/code --outformat dojo-sarif --outfile report.json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This will run a scan against `/path/to/your/code` using the default configuration:
|
|
56
|
+
- Regex using the built-in ruleset
|
|
57
|
+
- Semantic checks (variable detection, entropy checks)
|
|
58
|
+
|
|
59
|
+
A report in SARIF format (compatible with DefectDojo and GitHub Security) will be saved to report.json.
|
|
60
|
+
|
|
61
|
+
### Fine-Tuning
|
|
62
|
+
The `--help` command is always ready to guide you, but here are the key flags you can use to tailor the scan to your environment:
|
|
63
|
+
* `--regex-rules /path/to/rules.json`: Supply your own custom regex ruleset.
|
|
64
|
+
* `--hashed-values /path/to/hashes.json`: Provide a list of pre-hashed known production secrets to search for them securely.
|
|
65
|
+
* `--excluded-paths /path/to/exclusions.json`: Override or extend the default paths ignored during scanning.
|
|
66
|
+
* `--disable-masking`: Keep potential secrets unmasked in the output report *(see caution below)*.
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Github Actions Integration
|
|
70
|
+
|
|
71
|
+
eq. `.github/workflows/deepsecrets.yml`
|
|
72
|
+
|
|
73
|
+
```yaml
|
|
74
|
+
name: DeepSecrets Scan
|
|
75
|
+
on: [push, pull_request]
|
|
76
|
+
|
|
77
|
+
jobs:
|
|
78
|
+
scan:
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
steps:
|
|
81
|
+
- name: Checkout code
|
|
82
|
+
uses: actions/checkout@v4
|
|
83
|
+
|
|
84
|
+
- name: Set up Python
|
|
85
|
+
uses: actions/setup-python@v5
|
|
86
|
+
with:
|
|
87
|
+
python-version: '3.11'
|
|
88
|
+
|
|
89
|
+
- name: Install DeepSecrets
|
|
90
|
+
run: pip install deepsecrets
|
|
91
|
+
|
|
92
|
+
- name: Run Scan
|
|
93
|
+
run: deepsecrets --target-dir . --outformat dojo-sarif --outfile report.sarif
|
|
94
|
+
continue-on-error: true
|
|
95
|
+
|
|
96
|
+
- name: Upload SARIF report
|
|
97
|
+
uses: github/codeql-action/upload-sarif@v3
|
|
98
|
+
with:
|
|
99
|
+
sarif_file: report.sarif
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Masking Secrets in Reports
|
|
103
|
+
|
|
104
|
+
As of v1.3.0, potential secrets are automatically masked inside reports to protect your pipeline artifacts. Turn this off via the `--disable-masking` flag if necessary.
|
|
105
|
+
|
|
106
|
+
Masking doesn't break the deduplication logic of downstream platforms (like Github), as the `partialFingerprints` section in the report is correctly populated based on the raw data.
|
|
107
|
+
|
|
108
|
+
> [!Caution]
|
|
109
|
+
> If you integrate DeepSecrets into your CI pipeline with masking disabled, you will likely re-leak your secrets inside your CI logs and artifacts.
|
|
110
|
+
|
|
111
|
+
### SARIF Reports & Dynamic Confidence
|
|
112
|
+
|
|
113
|
+
Every finding gets a confidence score. However, different security platforms parse SARIF metrics differently. To ensure compatibility across modern ASPM dashboards, DeepSecrets does the following:
|
|
114
|
+
|
|
115
|
+
* **Virtual Subrules (`rules[]`)**: Dynamically generates rules like `S105-LOW` or `S105-CRITICAL`. This forces GitHub Security and DefectDojo to map semantic precision variance properly without breaking native parsers.
|
|
116
|
+
|
|
117
|
+
* **Deterministic Result Level**: The tool always explicitly sets `level: error` in the `results[]` model. This acts as a universal fallback for CI/CD pipelines and older SAST parsers, ensuring that exposed secrets reliably break builds or block Pull Requests regardless of individual rule interpretations.
|
|
118
|
+
|
|
119
|
+
* **Contextual Messages**: Injects the raw numeric confidence score natively into `result.message.text` so security analysts see it immediately on their dashboards.
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## Building rulesets
|
|
123
|
+
|
|
124
|
+
### Regex
|
|
125
|
+
|
|
126
|
+
The built-in ruleset for regex checks is located in `/deepsecrets/rules/regexes.json`. You're free to follow the format and create a custom ruleset.
|
|
127
|
+
|
|
128
|
+
### HashedSecret (Zero-Knowledge Scanning)
|
|
129
|
+
|
|
130
|
+
Example ruleset for hashed checks is located in `/tests/fixtures/hashed_secrets.json`. You're free to follow the format and create a custom ruleset.
|
|
131
|
+
|
|
132
|
+
#### HashedSecret Ruleset Example
|
|
133
|
+
|
|
134
|
+
To look for known production secrets without exposing them in plaintext inside your repository, provide a JSON containing their hashes:
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
[
|
|
138
|
+
{
|
|
139
|
+
"name": "KNOWN-PROD-DATABASE-PASSWORD",
|
|
140
|
+
"hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
|
141
|
+
"length": 12,
|
|
142
|
+
"algorithm": "sha1"
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
```
|
|
146
|
+
Run with `--hashed-values /path/to/hashes.json`. DeepSecrets will automatically hash string candidates on the fly during its lexing stage to match them.
|
|
147
|
+
|
|
148
|
+
## Contacts
|
|
149
|
+
|
|
150
|
+
- Nikolai Khechumov ([@ntoskernel](https://github.com/ntoskernel)) — creator and maintainer
|
|
151
|
+
|
|
152
|
+
## FAQ
|
|
153
|
+
> Pff, is it still regex-based?
|
|
154
|
+
|
|
155
|
+
Yes and no. Of course, it uses regexes to find typed secrets like any other tool. But language understanding (the lexing stage) and variable detection also use regexes under the hood. Regex is an instrument, not the problem. The problem is applying regex blindly without semantic context.
|
|
156
|
+
|
|
157
|
+
> But what about Semgrep Secrets? Looks like you're cloning their thing.
|
|
158
|
+
|
|
159
|
+
DeepSecrets was originally released in April 2023 — six months before Semgrep Secrets launched. We share similar principles, but DeepSecrets is 100% free/open-source and leverages a significantly broader multi-language tracking surface.
|
|
160
|
+
|
|
161
|
+
### DeepSecrets vs. Other Scanners
|
|
162
|
+
|
|
163
|
+
While other tools scan only what they know, DeepSecrets leverages lexers. This allows it to surface hidden, dangerous credentials in rare configuration formats and custom code blocks that benchmarks may not have datasets for.
|
|
164
|
+
|
|
165
|
+
#### Tool comparison based on SecretBench Results
|
|
166
|
+
|
|
167
|
+
| Feature / Capability | **DeepSecrets 2.0** | **Gitleaks** | **TruffleHog** | **Semgrep Secrets** |
|
|
168
|
+
| :--- | :---: | :---: | :---: | :---: |
|
|
169
|
+
| **SecretBench Accuracy** | **93% Recall<br>69% Precision** | 88% Recall<br>46% Precision | 52% Recall<br>6% Precision | *Not Evaluated* |
|
|
170
|
+
| **Price & Licensing** | **Free / Open-Source** | Free / Open-Source | Free / Open-Source | Commercial / Paid |
|
|
171
|
+
| **Analysis Type** | **Semantic / Regex** | Flat-text Regex / Entropy | Flat-text Regex / Entropy | Semantic |
|
|
172
|
+
| **Language Support** | **500+** | Context-agnostic (Text) | Context-agnostic (Text) | Limited subset |
|
|
173
|
+
| **Pre-hashed Validation** | **Yes (via Hashed Engine)** | No | No | No |
|
|
174
|
+
| **Context-Aware Entropy**| **Yes (Assigned values)** | No (Entire file text) | No (Entire file text) | Yes |
|
|
175
|
+
| **Advanced SARIF Output**| **Yes (Dynamic Confidence)** | Basic | Basic | Yes |
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
> Why don't you build true abstract syntax trees? It's academically more correct!
|
|
180
|
+
|
|
181
|
+
DeepSecrets tries to keep a balance between complexity and effectiveness. Building a true AST across 500+ languages is incredibly complex and simply overkill for the secrets detection. The tool follows the generic SAST approach to code analysis but optimizes the AST stage for maximum speed and width.
|
|
182
|
+
|
|
183
|
+
> I'd like to build my own semantic rules. How do I do that?
|
|
184
|
+
|
|
185
|
+
Semantic rules are now effectively "variable evaluation rules". You can find them [here](https://github.com/ntoskernel/deepsecrets/blob/main/deepsecrets/rules/variable_scoring_rules.json).
|
|
186
|
+
|
|
187
|
+
> I still have a question
|
|
188
|
+
|
|
189
|
+
Feel free to contact the developer directly using the emails listed in [pyproject.toml](https://github.com/ntoskernel/deepsecrets/blob/main/pyproject.toml#L6-L8)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
## Contributing & Core Concepts
|
|
193
|
+
|
|
194
|
+
### Under the hood
|
|
195
|
+
There are several core concepts:
|
|
196
|
+
|
|
197
|
+
- `File`
|
|
198
|
+
- `Tokenizer`
|
|
199
|
+
- `Token`
|
|
200
|
+
- `Engine`
|
|
201
|
+
- `Finding`
|
|
202
|
+
- `ScanMode`
|
|
203
|
+
|
|
204
|
+
### File
|
|
205
|
+
Just a pythonic representation of a file with all needed methods for management.
|
|
206
|
+
|
|
207
|
+
### Tokenizer
|
|
208
|
+
Breaks the content of a file into pieces - Tokens - by its logic. There are four types of tokenizers available:
|
|
209
|
+
|
|
210
|
+
- `FullContentTokenizer`: treats all content as a single token. Useful for regex-based search.
|
|
211
|
+
- `PerWordTokenizer`: breaks given content by words and line breaks.
|
|
212
|
+
- `LexerTokenizer`: uses language-specific smarts to break code into semantically correct pieces with additional context for each token.
|
|
213
|
+
- `CheapVarDetectorTokenizer`: uses tight regexes to cover limitations of semantic variable detection.
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
### Token
|
|
217
|
+
A string with additional information about its semantic role, corresponding file, and location inside it.
|
|
218
|
+
|
|
219
|
+
### Engine
|
|
220
|
+
A component performing secrets search for a single token by its own logic. Returns a set of Findings. There are three engines available:
|
|
221
|
+
|
|
222
|
+
- `RegexEngine`: checks tokens' values through a special ruleset
|
|
223
|
+
- `SemanticEngine`: checks tokens produced by the LexerTokenizer using additional context - variable names and values
|
|
224
|
+
- `HashedSecretEngine`: checks tokens' values by hashing them and trying to find coinciding hashes inside a special ruleset
|
|
225
|
+
|
|
226
|
+
### Finding
|
|
227
|
+
This is a data structure representing a problem detected inside code. Features information about the precise location inside a file and a rule that found it.
|
|
228
|
+
|
|
229
|
+
### ScanMode
|
|
230
|
+
This component is responsible for the scan process.
|
|
231
|
+
|
|
232
|
+
- Defines the scope of analysis for a given work directory respecting exceptions
|
|
233
|
+
- Allows declaring a `PerFileAnalyzer` - the method called against each file, returning a list of findings. The primary usage is to initialize necessary engines, tokenizers, and rulesets.
|
|
234
|
+
- Runs the scan: a multiprocessing pool analyzes every file in parallel.
|
|
235
|
+
- Prepares results for output and outputs them.
|
|
236
|
+
|
|
237
|
+
The current implementation has a `CliScanMode` built by the user-provided config through the cli args.
|
|
238
|
+
|
|
239
|
+
### Local development
|
|
240
|
+
|
|
241
|
+
The project is supposed to be developed using VSCode and 'Remote containers' feature.
|
|
242
|
+
|
|
243
|
+
Steps:
|
|
244
|
+
1. Clone the repository
|
|
245
|
+
2. Open the cloned folder with VSCode
|
|
246
|
+
3. Select "Reopen in Container" when prompted
|
|
247
|
+
4. Wait for the automated environment build to complete. You are ready to develop.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import platform
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
PROFILER_ON = False
|
|
8
|
-
BASE_DIR = os.getcwd()
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import os
|
|
2
|
+
import platform
|
|
3
|
+
from rich.console import Console
|
|
4
|
+
console = Console()
|
|
5
|
+
|
|
6
|
+
MODULE_NAME = 'deepsecrets'
|
|
7
|
+
PROFILER_ON = False
|
|
8
|
+
BASE_DIR = os.getcwd()
|
|
9
|
+
PLATFORM = platform.system()
|
|
10
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
from rich.align import Align
|
|
4
|
+
|
|
5
|
+
from deepsecrets.utils import setup_interrupts
|
|
6
|
+
|
|
7
|
+
setup_interrupts()
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def runnable_entrypoint():
|
|
11
|
+
from deepsecrets.cli import DeepSecretsCliTool
|
|
12
|
+
|
|
13
|
+
return_code = DeepSecretsCliTool(sys.argv).start()
|
|
14
|
+
sys.exit(return_code)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
try:
|
|
18
|
+
if __name__ == '__main__':
|
|
19
|
+
runnable_entrypoint()
|
|
20
|
+
|
|
21
|
+
except KeyboardInterrupt:
|
|
22
|
+
from deepsecrets import console
|
|
23
|
+
|
|
24
|
+
console.rule(style='red')
|
|
25
|
+
console.print(Align('[italic]Feel free to report bugs and difficulties here', align='left'))
|
|
26
|
+
console.print(Align('[italic]https://github.com/ntoskernel/deepsecrets/issues', align='left'))
|
|
27
|
+
console.line()
|
|
28
|
+
console.print(Align('[bold yellow]FINISHED WITH EXIT CODE 130', align='left'))
|
|
29
|
+
console.line()
|
|
30
|
+
sys.exit(130)
|