@@ -21,9 +21,15 @@ characters of a value, plus a hash fingerprint.
2121
2222## What it does
2323
24- - ** 94 pattern rules** for known providers and formats (AWS, GitHub,
24+ - ** 99 pattern rules** for known providers and formats (AWS, GitHub,
2525 Stripe, OpenAI, database connection strings, private key blocks, and
2626 many more), each with a severity and a plain-language description.
27+ - ** Zip archive inspection** : archives are opened, not skipped as
28+ opaque binaries. Text entries are scanned with the normal rules
29+ (findings point at ` archive.zip!/entry-name ` ), and an archive that
30+ pairs an executable with a launcher or script file raises a
31+ dedicated warning. That pairing is how a real malware lure hid its
32+ payload from the v1.0 scanner.
2733- ** Entropy detection** : a second, heuristic engine that measures the
2834 Shannon entropy of candidate strings (quoted literals and assignment
2935 values) and flags likely random secrets that no pattern knows about.
@@ -46,7 +52,7 @@ and, for history mode, the `git` CLI.
4652Install from source:
4753
4854``` console
49- cargo install --git https://github.com/RahilSahu/secretsweep --tag v1.0 .0
55+ cargo install --git https://github.com/RahilSahu/secretsweep --tag v1.1 .0
5056```
5157
5258Or build a checkout:
@@ -86,6 +92,9 @@ Worktree mode respects `.gitignore`, skips `.git`, `node_modules`,
8692` vendor ` , ` target ` and similar generated directories, skips binary files
8793and files over 1 MiB (configurable with ` --max-size ` , in KiB), and scans
8894everything else as text, including lockfiles and dotfiles such as ` .env ` .
95+ Zip archives are the one binary-looking exception: they are opened and
96+ inspected as described below, because an opaque archive is exactly
97+ where a payload can hide from a line-based scanner.
8998
9099Git history mode shells out to ` git log -p ` and scans the lines each
91100commit added. It needs ` git ` on the PATH. Merge commits produce no diff
@@ -94,7 +103,7 @@ a merge are found in the branch commits that introduced them.
94103
95104### Rules
96105
97- The registry holds 94 pattern rules. Run ` secretsweep --list-rules ` for
106+ The registry holds 99 pattern rules. Run ` secretsweep --list-rules ` for
98107the full table. Summary by area:
99108
100109| Area | Rules |
@@ -108,12 +117,51 @@ the full table. Summary by area:
108117| Database connection strings | 7 |
109118| Private key blocks | 7 |
110119| Tokens, headers and generic assignments | 9 |
111- | Other platforms (Shopify, Heroku, Cloudflare, Vault, Grafana, and more) | 17 |
112- | ** Total** | ** 94** |
120+ | Other platforms (Shopify, Heroku, Cloudflare, Vault, Grafana, auth.gg, and more) | 18 |
121+ | Cryptocurrency addresses (informational, Low severity) | 2 |
122+ | Malware indicators (private-key persistence, file-host lure links) | 2 |
123+ | ** Total** | ** 99** |
113124
114125Rules are line-based regular expressions (the Rust ` regex ` engine, so no
115126lookahead). Each rule reports the line and column of the secret value.
116127
128+ ### Archive inspection
129+
130+ Zip archives (detected by ` .zip ` extension or by their PK header) are
131+ opened instead of skipped. This exists because a real malware lure
132+ found in the wild hid everything that mattered inside a zip: a
133+ launcher script, a bundled executable, and a script payload disguised
134+ as a text file. A scanner that treats archives as opaque binaries
135+ sees none of that.
136+
137+ What happens inside an archive:
138+
139+ - Text-like entries are scanned with the same pattern and entropy
140+ rules as loose files. Findings are reported with paths like
141+ ` bundle.zip!/inner/config.txt ` , so the entry can be located.
142+ - A structural warning (rule id ` ARCHIVE-EXEC ` ) fires when an archive
143+ contains an executable file (` .exe ` , ` .dll ` , ` .scr ` , ` .com ` ,
144+ ` .msi ` , ` .sys ` ) together with a launcher or script file (` .cmd ` ,
145+ ` .bat ` , ` .ps1 ` , ` .vbs ` , ` .js ` and relatives), or with a large
146+ single-line text file of 50 KB or more, a common disguised-script
147+ shape. Archives of documents or source code, with no executable
148+ inside, do not trigger it.
149+ - An archive that cannot be opened, or whose entries cannot be read
150+ (corrupt, encrypted, or an unsupported compression method), is
151+ reported once as uninspectable (rule id ` ARCHIVE-UNREADABLE ` , Low
152+ severity) instead of failing the scan.
153+
154+ Safety caps, so a hostile or accidental zip bomb cannot exhaust
155+ memory: at most 512 entries are examined, at most the ` --max-size `
156+ cap (1 MiB by default) is extracted per entry, and at most 16 times
157+ that across one archive. Entries are read in memory only; nothing is
158+ written to disk and nothing is executed.
159+
160+ Inspection is one level deep: a zip stored inside another zip is
161+ listed but not opened, and only the ZIP format is inspected. Other
162+ archive formats (` .tar ` , ` .7z ` , ` .rar ` , and similar) are still
163+ skipped as binary files for now.
164+
117165### Entropy detection, honestly
118166
119167Pattern rules only catch secrets that look like something known. The
@@ -182,7 +230,7 @@ jobs:
182230 fetch-depth : 0 # full history if you also scan with --git
183231 - uses : dtolnay/rust-toolchain@stable
184232 - name : Install SecretSweep
185- run : cargo install --git https://github.com/RahilSahu/secretsweep --tag v1.0 .0
233+ run : cargo install --git https://github.com/RahilSahu/secretsweep --tag v1.1 .0
186234 - name : Scan worktree
187235 run : secretsweep --format sarif --fail-on high . > secretsweep.sarif
188236 - name : Upload SARIF
@@ -202,7 +250,7 @@ Framework setup:
202250` ` ` yaml
203251# .pre-commit-config.yaml in your project
204252- repo: https://github.com/RahilSahu/secretsweep
205- rev: v1.0 .0
253+ rev: v1.1 .0
206254 hooks:
207255 - id: secretsweep
208256` ` `
@@ -224,9 +272,17 @@ the fail-on severity exists.
224272
225273- Line-based scanning : a secret split across two lines is not detected.
226274- Worktree mode skips binary files and files over the size cap; both are
227- counted in the summary line.
275+ counted in the summary line. Zip archives are inspected instead of
276+ skipped, within the caps described above.
277+ - Archive inspection covers ZIP only, one level deep. Encrypted
278+ archives and encrypted entries cannot be read and are reported as
279+ uninspectable; their contents are not scanned, and no scanner can
280+ judge the intent of a payload whose strings only decrypt at
281+ runtime.
228282- Git history mode does not cover merge commits (see above) and needs
229- the `git` CLI installed.
283+ the `git` CLI installed. Archives committed to history are not
284+ opened in this mode; history mode scans the text lines each commit
285+ added.
230286- In git history mode, file paths that git quotes (paths with unusual
231287 characters) may be displayed with their quotes.
232288
0 commit comments