deepsecrets 2.1.1__tar.gz → 2.3.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-2.3.0/LICENSE +235 -0
- deepsecrets-2.3.0/NOTICE +10 -0
- deepsecrets-2.3.0/PKG-INFO +338 -0
- deepsecrets-2.1.1/PKG-INFO → deepsecrets-2.3.0/README.md +61 -52
- deepsecrets-2.3.0/deepsecrets/cli.py +574 -0
- deepsecrets-2.3.0/deepsecrets/config.py +181 -0
- deepsecrets-2.3.0/deepsecrets/core/engines/regex.py +90 -0
- deepsecrets-2.3.0/deepsecrets/core/engines/semantic.py +131 -0
- deepsecrets-2.3.0/deepsecrets/core/helpers/confidence.py +18 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/helpers/content_analyzer.py +2 -2
- deepsecrets-2.3.0/deepsecrets/core/helpers/encoding.py +151 -0
- deepsecrets-2.3.0/deepsecrets/core/helpers/finding_tags.py +113 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/helpers/naturalness_scorer.py +17 -10
- deepsecrets-2.3.0/deepsecrets/core/helpers/regex_candidate_evaluator.py +78 -0
- deepsecrets-2.3.0/deepsecrets/core/helpers/value_shape.py +74 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/helpers/variable_evaluator.py +36 -13
- deepsecrets-2.3.0/deepsecrets/core/model/finding.py +131 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/internal/processing.py +10 -0
- deepsecrets-2.3.0/deepsecrets/core/model/regex_candidate.py +98 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/response/dojo_sarif.py +52 -45
- deepsecrets-2.3.0/deepsecrets/core/model/rules/regex.py +195 -0
- deepsecrets-2.3.0/deepsecrets/core/model/rules/regex_candidate_scoring.py +147 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/rules/rule.py +5 -2
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/rules/variable_scoring.py +13 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/semantic.py +4 -0
- deepsecrets-2.3.0/deepsecrets/core/modes/iscan_mode.py +723 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/rulesets/ibuilder.py +1 -0
- deepsecrets-2.3.0/deepsecrets/core/rulesets/regex_candidate_scoring.py +7 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/cheap_var_search.py +10 -1
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/helpers/semantic/deep_analyzer.py +36 -5
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/helpers/semantic/language.py +2 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/helpers/semantic/var_detection/detector.py +3 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/helpers/semantic/var_detection/rules.py +63 -4
- deepsecrets-2.3.0/deepsecrets/core/tokenizers/helpers/single_token_improver.py +88 -0
- deepsecrets-2.3.0/deepsecrets/core/tokenizers/helpers/token_table.py +99 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/helpers/type_stream.py +49 -1
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/lexer.py +37 -28
- deepsecrets-2.3.0/deepsecrets/core/utils/environment.py +37 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/utils/file_analyzer.py +16 -4
- deepsecrets-2.3.0/deepsecrets/core/utils/gc_freeze.py +7 -0
- deepsecrets-2.3.0/deepsecrets/core/utils/lexer_finder.py +148 -0
- deepsecrets-2.3.0/deepsecrets/core/utils/multiprocessing_setup.py +142 -0
- deepsecrets-2.3.0/deepsecrets/rules/excluded_bundles.json +5 -0
- deepsecrets-2.3.0/deepsecrets/rules/regex_candidate_scoring_rules.json +206 -0
- deepsecrets-2.3.0/deepsecrets/rules/regexes.json +677 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/rules/variable_scoring_rules.json +63 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/scan_modes/cli.py +36 -7
- deepsecrets-2.3.0/pyproject.toml +119 -0
- deepsecrets-2.1.1/LICENSE +0 -21
- deepsecrets-2.1.1/README.md +0 -248
- deepsecrets-2.1.1/deepsecrets/cli.py +0 -481
- deepsecrets-2.1.1/deepsecrets/config.py +0 -138
- deepsecrets-2.1.1/deepsecrets/core/engines/regex.py +0 -39
- deepsecrets-2.1.1/deepsecrets/core/engines/semantic.py +0 -115
- deepsecrets-2.1.1/deepsecrets/core/model/finding.py +0 -119
- deepsecrets-2.1.1/deepsecrets/core/model/rules/regex.py +0 -118
- deepsecrets-2.1.1/deepsecrets/core/modes/iscan_mode.py +0 -520
- deepsecrets-2.1.1/deepsecrets/core/tokenizers/helpers/single_token_improver.py +0 -104
- deepsecrets-2.1.1/deepsecrets/core/utils/lexer_finder.py +0 -133
- deepsecrets-2.1.1/deepsecrets/diagnostics/__init__.py +0 -5
- deepsecrets-2.1.1/deepsecrets/diagnostics/__main__.py +0 -62
- deepsecrets-2.1.1/deepsecrets/diagnostics/trace.py +0 -405
- deepsecrets-2.1.1/deepsecrets/diagnostics/worker.py +0 -39
- deepsecrets-2.1.1/deepsecrets/rules/regexes.json +0 -237
- deepsecrets-2.1.1/pyproject.toml +0 -93
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/__init__.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/__main__.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/engines/__init__.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/engines/hashed_secret.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/engines/iengine.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/helpers/entropy.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/__init__.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/file.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/response/base.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/response/builtin.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/rules/__init__.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/rules/exlcuded_path.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/rules/false_finding.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/rules/hashed_secret.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/rules/hashing.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/token.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/model/tokenized_region.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/rulesets/excluded_paths.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/rulesets/false_findings.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/rulesets/hashed_secrets.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/rulesets/regex.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/rulesets/variable_scoring.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/__init__.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/full_content.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/helpers/__init__.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/helpers/cheap_var_search/__init__.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/helpers/semantic/__init__.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/helpers/semantic/var_detection/__init__.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/helpers/subfile_regions_helper.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/itokenizer.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/per_line.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/tokenizers/per_word.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/ui/floating_header.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/ui/progress_bar.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/ui/time_remaining_column.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/utils/__init__.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/utils/cpu.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/utils/exceptions.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/utils/finding_merger.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/utils/fs.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/utils/guess_filetype.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/utils/hashing.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/utils/lifecycle_hooks.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/utils/log.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/utils/progress.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/core/utils/string.py +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/rules/excluded_paths.json +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/rules/value_scoring_model.json +0 -0
- {deepsecrets-2.1.1 → deepsecrets-2.3.0}/deepsecrets/utils.py +0 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
203
|
+
|
|
204
|
+
--------------------------------------------------------------------------------
|
|
205
|
+
|
|
206
|
+
PORTIONS UNDER THE MIT LICENSE
|
|
207
|
+
|
|
208
|
+
DeepSecrets was first released at https://github.com/avito-tech/deepsecrets
|
|
209
|
+
under the MIT License below. Code from that release, and contributions made
|
|
210
|
+
to the project under the MIT License before version 2.3.0, remain available
|
|
211
|
+
under it; the rest of DeepSecrets is licensed under the Apache License,
|
|
212
|
+
Version 2.0, above. See NOTICE.
|
|
213
|
+
|
|
214
|
+
MIT License
|
|
215
|
+
|
|
216
|
+
Copyright (c) 2023 Avito
|
|
217
|
+
Copyright (c) 2023-2026 Nikolai Khechumov
|
|
218
|
+
|
|
219
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
220
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
221
|
+
in the Software without restriction, including without limitation the rights
|
|
222
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
223
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
224
|
+
furnished to do so, subject to the following conditions:
|
|
225
|
+
|
|
226
|
+
The above copyright notice and this permission notice shall be included in all
|
|
227
|
+
copies or substantial portions of the Software.
|
|
228
|
+
|
|
229
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
230
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
231
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
232
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
233
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
234
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
235
|
+
SOFTWARE.
|
deepsecrets-2.3.0/NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
DeepSecrets
|
|
2
|
+
Copyright 2023-2026 Nikolai Khechumov
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0, from version 2.3.0; see LICENSE.
|
|
5
|
+
|
|
6
|
+
This product includes software written by Nikolai Khechumov at Avito and first
|
|
7
|
+
released at https://github.com/avito-tech/deepsecrets, Copyright (c) 2023 Avito,
|
|
8
|
+
and contributions made to the project before version 2.3.0. Those portions are
|
|
9
|
+
licensed under the MIT License, whose text is at the end of LICENSE. Releases up
|
|
10
|
+
to and including 2.2.0 were published under the MIT License alone.
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deepsecrets
|
|
3
|
+
Version: 2.3.0
|
|
4
|
+
Summary: Offline secrets scanner that understands code: credentials found by variable names, entropy and provider formats, with confidence tiers, tags and SARIF output
|
|
5
|
+
License-Expression: Apache-2.0 AND MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
License-File: NOTICE
|
|
8
|
+
Keywords: secrets,secret-scanning,secrets-detection,credentials,api-keys,passwords,leak-detection,security,appsec,devsecops,sast,static-analysis,sarif,owasp
|
|
9
|
+
Author: Nikolai Khechumov
|
|
10
|
+
Author-email: khechumov@gmail.com
|
|
11
|
+
Maintainer: Nikolai Khechumov
|
|
12
|
+
Maintainer-email: khechumov@gmail.com
|
|
13
|
+
Requires-Python: >=3.11,<4.0.0
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: Information Technology
|
|
18
|
+
Classifier: Intended Audience :: System Administrators
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
|
+
Classifier: Topic :: Security
|
|
27
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
28
|
+
Requires-Dist: aenum (==3.1.17)
|
|
29
|
+
Requires-Dist: jschema-to-python (==1.2.3)
|
|
30
|
+
Requires-Dist: mmh3 (==5.3.0)
|
|
31
|
+
Requires-Dist: ordered-set (==4.1.0)
|
|
32
|
+
Requires-Dist: puppetparser (==0.2.14)
|
|
33
|
+
Requires-Dist: pydantic (==2.13.5)
|
|
34
|
+
Requires-Dist: pygments (==2.21.0)
|
|
35
|
+
Requires-Dist: pyyaml (==6.0.3)
|
|
36
|
+
Requires-Dist: regex (==2026.9.3)
|
|
37
|
+
Requires-Dist: rich (==15.0.0)
|
|
38
|
+
Requires-Dist: sarif-om (==1.0.4)
|
|
39
|
+
Project-URL: Changelog, https://github.com/ntoskernel/deepsecrets/releases
|
|
40
|
+
Project-URL: Documentation, https://github.com/ntoskernel/deepsecrets#readme
|
|
41
|
+
Project-URL: Docker image, https://hub.docker.com/r/ntoskernel/deepsecrets
|
|
42
|
+
Project-URL: Homepage, https://owasp.org/projects/deepsecrets
|
|
43
|
+
Project-URL: Issues, https://github.com/ntoskernel/deepsecrets/issues
|
|
44
|
+
Project-URL: Source, https://github.com/ntoskernel/deepsecrets
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
|
|
47
|
+
# [OWASP](https://owasp.org/projects/deepsecrets) DeepSecrets — a better tool for secrets scanning
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
## What is it? Another token-wasting CLI proxy to an AI API?
|
|
53
|
+
|
|
54
|
+
Absolutely not!
|
|
55
|
+
|
|
56
|
+
In our LLM-hype era, DeepSecrets still runs entirely on your machine — giving you great results offline, securely, and for free.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## So why yet another tool?
|
|
60
|
+
Most existing scanners don't actually "understand" code. Instead, they just parse texts and have bad coverage.
|
|
61
|
+
|
|
62
|
+
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.
|
|
63
|
+
Secret candidates come from what the code says, its names, assignments and calls, not from text alone. DeepSecrets reads code with lexers for about 600 languages and formats (Pygments), and finds variables with detection rules for 14 languages and a generic rule for the rest.
|
|
64
|
+
|
|
65
|
+
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.
|
|
66
|
+
|
|
67
|
+
### Performance & Benchmarks (SecretBench)
|
|
68
|
+
|
|
69
|
+
DeepSecrets 2.3 was evaluated (November 2026) on the **SecretBench** benchmark: every file scanned, every labelled row counted.
|
|
70
|
+
|
|
71
|
+
* **93% Recall** and **91% Precision** (2.2: 93% and 86%)
|
|
72
|
+
* **1.6% False Positive Rate** on SecretBench scope (2.2: 2.7%)
|
|
73
|
+
* About **2,000 more secrets** that SecretBench does not label, among its findings outside the labels
|
|
74
|
+
|
|
75
|
+
Counted the way the June 2026 evaluation counted, on its own set of rows, 2.3 has 94% recall and 85% precision (2.0 in June 2026: 93% and 67%).
|
|
76
|
+
|
|
77
|
+
#### Reproduce these numbers
|
|
78
|
+
|
|
79
|
+
The figures come from [dsbench](https://github.com/ntoskernel/dsbench), an open-source benchmark harness that runs a scanner as a black box over a labelled corpus and counts what it reports. With SecretBench (available from [its authors](https://github.com/setu1421/SecretBench) on request) and dsbench, anyone can reproduce the per-row figures above and the comparison below:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
dsbench prepare # load SecretBench's labels and the corpus listing
|
|
83
|
+
dsbench run --tool-ref v2.3.0 # DeepSecrets 2.3.0 from its tag, in a venv from its own poetry.lock
|
|
84
|
+
dsbench tools fetch # the pinned gitleaks and Betterleaks releases, checked by SHA-256
|
|
85
|
+
dsbench run --tool gitleaks
|
|
86
|
+
dsbench run --tool betterleaks
|
|
87
|
+
dsbench compare RUN RUN ... # side by side, with 95% intervals
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Every run scans every file, with each tool's path exclusions turned off. The June-way figures also need the June 2026 evaluation's table of rows, and the count of secrets beyond the labels needs our judged verdicts; neither is published, because both point at leaked credentials.
|
|
91
|
+
|
|
92
|
+
*(You can read the full under-the-hood story and benchmark breakdown in my HackerNoon article [here](https://hackernoon.com/deepsecrets-20-catching-93percent-of-secretbenchs-valids-while-filtering-92percent-of-noise-and-10k-extra))*
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
# Quick Start Guide
|
|
96
|
+
|
|
97
|
+
## Installation
|
|
98
|
+
|
|
99
|
+
From Github via pip
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
$ pip install git+https://github.com/ntoskernel/deepsecrets.git
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
From PyPi
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
$ pip install deepsecrets
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
DeepSecrets needs Python 3.11 or later.
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## Scanning
|
|
115
|
+
The easiest way to run a scan:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
$ deepsecrets --target-dir /path/to/your/code --outformat dojo-sarif --outfile report.json
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
This will run a scan against `/path/to/your/code` using the default configuration:
|
|
122
|
+
- Regex using the built-in ruleset
|
|
123
|
+
- Semantic checks (variable detection, entropy checks)
|
|
124
|
+
|
|
125
|
+
A report in SARIF format (compatible with DefectDojo and GitHub Security) will be saved to report.json.
|
|
126
|
+
|
|
127
|
+
### Fine-Tuning
|
|
128
|
+
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:
|
|
129
|
+
* `--regex-rules /path/to/rules.json`: Supply your own custom regex ruleset.
|
|
130
|
+
* `--hashed-values /path/to/hashes.json`: Provide a list of pre-hashed known production secrets to search for them securely.
|
|
131
|
+
* `--excluded-paths /path/to/exclusions.json`: Override or extend the default paths ignored during scanning.
|
|
132
|
+
* `--deep-max-size BYTES`: Files larger than this (default 250,000 bytes) get the fast analysis: the regex rules and the variable search, without the language lexer. Big files are mostly generated or minified, the lexer costs most of the scan time on them and rarely finds more there. `0` gives every file the full analysis.
|
|
133
|
+
* `--skip-bundles`: Skip minified JavaScript, source maps and bundles (`*.min.js`, `*.map`, `*.bundle.js`) entirely, on top of the other path exclusions.
|
|
134
|
+
* `--confidence-level {all,low,medium,high,very-high}`: The lowest confidence to report (default `low`, every finding). `medium`, `high` and `very-high` keep confidence 5, 6 and 9 or more, the findings of the SARIF tiers of the same names and above; `all` also reports the regex matches the scanner judged not to be secrets (placeholders, examples), with an `-INFO` rule id.
|
|
135
|
+
* `--min-confidence N`: Report findings of confidence `N` or more, `N` from 0 to 10: any cut, where `--confidence-level` offers the floors of the tiers. Like every level but `all`, it leaves out the regex matches judged not to be secrets. Use one flag or the other, not both.
|
|
136
|
+
* `--exclude-tags TAG [TAG ...]`: Leave out the findings that carry any of these tags. A tag says what sort of secret a finding is, where its confidence says how likely it is one: `weak-password` (a weak value under a password-like name), `publishable` (a key made to ship to clients: reCAPTCHA and other site keys, Stripe `pk_` keys, Mapbox `pk.` tokens, player, analytics and maps keys), `test-context` (a test, spec, fixture, mock, example or sample path, relative to the target directory), `recorded-traffic` (VCR cassettes, session recordings, HAR files), `identifier` (an AWS id of a user, role or policy, which grants nothing) and `web-page` (an HTML page). Every finding is still reported by default; e.g. `--exclude-tags test-context` when you hunt live secrets.
|
|
137
|
+
* `--report-diagnostics`: Add every file found under the target to the SARIF report, with its status, scan time, skip reason and analysis depth.
|
|
138
|
+
* `--regex-candidate-scoring-rules /path/to/rules.json`: Supply your own rules for judging regex matches before they are reported. Give the flag no value to report regex matches unjudged.
|
|
139
|
+
* `--multiprocessing-context {forkserver,spawn,fork}`: How worker processes start. The default is `forkserver` where the platform has it (Linux, macOS): workers share the scanner already loaded in a server process. Windows uses `spawn`. All three give the same findings.
|
|
140
|
+
* `--disable-masking`: Keep potential secrets unmasked in the output report *(see caution below)*.
|
|
141
|
+
* `--ci` / `--no-ci`: Turn CI mode on or off. CI mode prints a plain progress line every 30 seconds instead of the live progress display. It turns on by itself inside CI services (GitHub Actions, GitLab CI, Jenkins and others) and whenever the output is not a terminal.
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
### Github Actions Integration
|
|
145
|
+
|
|
146
|
+
eq. `.github/workflows/deepsecrets.yml`
|
|
147
|
+
|
|
148
|
+
```yaml
|
|
149
|
+
name: DeepSecrets Scan
|
|
150
|
+
on: [push, pull_request]
|
|
151
|
+
|
|
152
|
+
jobs:
|
|
153
|
+
scan:
|
|
154
|
+
runs-on: ubuntu-latest
|
|
155
|
+
steps:
|
|
156
|
+
- name: Checkout code
|
|
157
|
+
uses: actions/checkout@v4
|
|
158
|
+
|
|
159
|
+
- name: Set up Python
|
|
160
|
+
uses: actions/setup-python@v5
|
|
161
|
+
with:
|
|
162
|
+
python-version: '3.14'
|
|
163
|
+
|
|
164
|
+
- name: Install DeepSecrets
|
|
165
|
+
run: pip install deepsecrets
|
|
166
|
+
|
|
167
|
+
- name: Run Scan
|
|
168
|
+
run: deepsecrets --target-dir . --outformat dojo-sarif --outfile report.sarif
|
|
169
|
+
continue-on-error: true
|
|
170
|
+
|
|
171
|
+
- name: Upload SARIF report
|
|
172
|
+
uses: github/codeql-action/upload-sarif@v3
|
|
173
|
+
with:
|
|
174
|
+
sarif_file: report.sarif
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Masking Secrets in Reports
|
|
178
|
+
|
|
179
|
+
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.
|
|
180
|
+
|
|
181
|
+
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.
|
|
182
|
+
|
|
183
|
+
> [!Caution]
|
|
184
|
+
> If you integrate DeepSecrets into your CI pipeline with masking disabled, you will likely re-leak your secrets inside your CI logs and artifacts.
|
|
185
|
+
|
|
186
|
+
### SARIF Reports & Dynamic Confidence
|
|
187
|
+
|
|
188
|
+
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:
|
|
189
|
+
|
|
190
|
+
* **Virtual Subrules (`rules[]`)**: Dynamically generates rules by confidence tier, from `S105-LOW` (confidence 0 to 4) through `-MEDIUM` (5) and `-HIGH` (6 to 8) to `S105-VERY-HIGH` (9 and 10), and `-INFO` for the rejected matches `--confidence-level all` reports. This forces GitHub Security and DefectDojo to map semantic precision variance properly without breaking native parsers.
|
|
191
|
+
|
|
192
|
+
* **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.
|
|
193
|
+
|
|
194
|
+
* **Tags**: Each result carries its tags, if it has any, in SARIF's standard `properties.tags` array (`weak-password`, `publishable`, `test-context`, `recorded-traffic`, `identifier`, `web-page`). Rule ids, severity and fingerprints do not depend on them.
|
|
195
|
+
|
|
196
|
+
* **Contextual Messages**: Injects the raw numeric confidence score natively into `result.message.text` so security analysts see it immediately on their dashboards.
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
## Building rulesets
|
|
200
|
+
|
|
201
|
+
### Regex
|
|
202
|
+
|
|
203
|
+
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.
|
|
204
|
+
|
|
205
|
+
### HashedSecret (Zero-Knowledge Scanning)
|
|
206
|
+
|
|
207
|
+
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.
|
|
208
|
+
|
|
209
|
+
#### HashedSecret Ruleset Example
|
|
210
|
+
|
|
211
|
+
To look for known production secrets without exposing them in plaintext inside your repository, provide a JSON containing their hashes:
|
|
212
|
+
|
|
213
|
+
```json
|
|
214
|
+
[
|
|
215
|
+
{
|
|
216
|
+
"name": "KNOWN-PROD-DATABASE-PASSWORD",
|
|
217
|
+
"hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
|
218
|
+
"length": 12,
|
|
219
|
+
"algorithm": "sha1"
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
```
|
|
223
|
+
Run with `--hashed-values /path/to/hashes.json`. DeepSecrets will automatically hash string candidates on the fly during its lexing stage to match them.
|
|
224
|
+
|
|
225
|
+
## Contacts
|
|
226
|
+
|
|
227
|
+
- Nikolai Khechumov ([@ntoskernel](https://github.com/ntoskernel)) — creator and maintainer
|
|
228
|
+
|
|
229
|
+
## FAQ
|
|
230
|
+
> Pff, is it still regex-based?
|
|
231
|
+
|
|
232
|
+
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.
|
|
233
|
+
|
|
234
|
+
> But what about Semgrep Secrets? Looks like you're cloning their thing.
|
|
235
|
+
|
|
236
|
+
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.
|
|
237
|
+
|
|
238
|
+
### DeepSecrets vs. Other Scanners
|
|
239
|
+
|
|
240
|
+
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.
|
|
241
|
+
|
|
242
|
+
#### Tool comparison based on SecretBench Results
|
|
243
|
+
|
|
244
|
+
| Feature / Capability | **DeepSecrets 2.3** | **Gitleaks 8.30** | **Betterleaks 1.8** | **TruffleHog** | **Semgrep Secrets** |
|
|
245
|
+
| :--- | :---: | :---: | :---: | :---: | :---: |
|
|
246
|
+
| **SecretBench Accuracy** | **93% Recall<br>91% Precision** | 85% Recall<br>70% Precision | 85% Recall<br>61% Precision | *Not re-measured* | *Not Evaluated* |
|
|
247
|
+
| **Price & Licensing** | **Free / Open-Source** | Free / Open-Source | Free / Open-Source | Free / Open-Source | Commercial / Paid |
|
|
248
|
+
| **Analysis Type** | **Semantic / Regex** | Flat-text Regex / Entropy | Flat-text Regex / Entropy | Flat-text Regex / Entropy | Semantic |
|
|
249
|
+
| **Language Support** | **~600 lexed<br>(variables in 14)** | Context-agnostic (Text) | Context-agnostic (Text) | Context-agnostic (Text) | Limited subset |
|
|
250
|
+
| **Pre-hashed Validation** | **Yes (via Hashed Engine)** | No | No | No | No |
|
|
251
|
+
| **Context-Aware Entropy**| **Yes (Assigned values)** | No (Entire file text) | No (Entire file text) | No (Entire file text) | Yes |
|
|
252
|
+
| **Advanced SARIF Output**| **Yes (Confidence tiers and tags)** | Basic | Basic | Basic | Yes |
|
|
253
|
+
|
|
254
|
+
_SecretBench, every file scanned, every labelled row counted, with [dsbench](https://github.com/ntoskernel/dsbench) (see [Reproduce these numbers](#reproduce-these-numbers)). DeepSecrets 2.3, Gitleaks 8.30.1 and Betterleaks 1.8.1 measured on the same harness in October and November 2026, Gitleaks and Betterleaks with their default rules and their global path allowlist removed so that every file is scanned, as for DeepSecrets. TruffleHog was measured in June 2026 by another method (52% recall, 6% precision) and not since._
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
> Why don't you build true abstract syntax trees? It's academically more correct!
|
|
259
|
+
|
|
260
|
+
DeepSecrets tries to keep a balance between complexity and effectiveness. Building a true AST across hundreds of 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.
|
|
261
|
+
|
|
262
|
+
> I'd like to build my own semantic rules. How do I do that?
|
|
263
|
+
|
|
264
|
+
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).
|
|
265
|
+
|
|
266
|
+
> I still have a question
|
|
267
|
+
|
|
268
|
+
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)
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
## Contributing & Core Concepts
|
|
272
|
+
|
|
273
|
+
### Under the hood
|
|
274
|
+
There are several core concepts:
|
|
275
|
+
|
|
276
|
+
- `File`
|
|
277
|
+
- `Tokenizer`
|
|
278
|
+
- `Token`
|
|
279
|
+
- `Engine`
|
|
280
|
+
- `Finding`
|
|
281
|
+
- `ScanMode`
|
|
282
|
+
|
|
283
|
+
### File
|
|
284
|
+
Just a pythonic representation of a file with all needed methods for management.
|
|
285
|
+
|
|
286
|
+
### Tokenizer
|
|
287
|
+
Breaks the content of a file into pieces - Tokens - by its logic. There are four types of tokenizers available:
|
|
288
|
+
|
|
289
|
+
- `FullContentTokenizer`: treats all content as a single token. Useful for regex-based search.
|
|
290
|
+
- `PerWordTokenizer`: breaks given content by words and line breaks.
|
|
291
|
+
- `LexerTokenizer`: uses language-specific smarts to break code into semantically correct pieces with additional context for each token.
|
|
292
|
+
- `CheapVarDetectorTokenizer`: uses tight regexes to cover limitations of semantic variable detection.
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
### Token
|
|
296
|
+
A string with additional information about its semantic role, corresponding file, and location inside it.
|
|
297
|
+
|
|
298
|
+
### Engine
|
|
299
|
+
A component performing secrets search for a single token by its own logic. Returns a set of Findings. There are three engines available:
|
|
300
|
+
|
|
301
|
+
- `RegexEngine`: checks tokens' values through a special ruleset
|
|
302
|
+
- `SemanticEngine`: checks tokens produced by the LexerTokenizer using additional context - variable names and values
|
|
303
|
+
- `HashedSecretEngine`: checks tokens' values by hashing them and trying to find coinciding hashes inside a special ruleset
|
|
304
|
+
|
|
305
|
+
### Finding
|
|
306
|
+
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.
|
|
307
|
+
|
|
308
|
+
### ScanMode
|
|
309
|
+
This component is responsible for the scan process.
|
|
310
|
+
|
|
311
|
+
- Defines the scope of analysis for a given work directory respecting exceptions
|
|
312
|
+
- 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.
|
|
313
|
+
- Runs the scan: a multiprocessing pool analyzes every file in parallel.
|
|
314
|
+
- Prepares results for output and outputs them.
|
|
315
|
+
|
|
316
|
+
The current implementation has a `CliScanMode` built by the user-provided config through the cli args.
|
|
317
|
+
|
|
318
|
+
### Local development
|
|
319
|
+
|
|
320
|
+
The project is supposed to be developed using VSCode and 'Remote containers' feature.
|
|
321
|
+
|
|
322
|
+
Steps:
|
|
323
|
+
1. Clone the repository
|
|
324
|
+
2. Open the cloned folder with VSCode
|
|
325
|
+
3. Select "Reopen in Container" when prompted
|
|
326
|
+
4. Wait for the automated environment build to complete. You are ready to develop.
|
|
327
|
+
|
|
328
|
+
## History and license
|
|
329
|
+
|
|
330
|
+
DeepSecrets was created by Nikolai Khechumov at Avito in 2022 and open-sourced in April 2023 at
|
|
331
|
+
[avito-tech/deepsecrets](https://github.com/avito-tech/deepsecrets). It has been an OWASP project since 2023 and has
|
|
332
|
+
been developed in this repository since November 2023.
|
|
333
|
+
|
|
334
|
+
From version 2.3.0 DeepSecrets is licensed under the [Apache License 2.0](LICENSE). Code from the original release
|
|
335
|
+
and contributions made before 2.3.0 remain available under the MIT License, whose text is at the end of
|
|
336
|
+
[LICENSE](LICENSE); [NOTICE](NOTICE) says which is which. Releases up to and including 2.2.0 were published under the
|
|
337
|
+
MIT License.
|
|
338
|
+
|