secretshield 0.1.2__tar.gz → 0.2.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.
Files changed (25) hide show
  1. {secretshield-0.1.2 → secretshield-0.2.0}/PKG-INFO +95 -11
  2. secretshield-0.1.2/secretshield.egg-info/PKG-INFO → secretshield-0.2.0/README.md +355 -297
  3. {secretshield-0.1.2 → secretshield-0.2.0}/pyproject.toml +1 -1
  4. {secretshield-0.1.2 → secretshield-0.2.0}/secretshield/__init__.py +1 -1
  5. secretshield-0.2.0/secretshield/cli.py +415 -0
  6. secretshield-0.1.2/README.md → secretshield-0.2.0/secretshield.egg-info/PKG-INFO +381 -271
  7. {secretshield-0.1.2 → secretshield-0.2.0}/secretshield.egg-info/SOURCES.txt +1 -0
  8. secretshield-0.2.0/tests/test_scan.py +294 -0
  9. secretshield-0.1.2/secretshield/cli.py +0 -168
  10. {secretshield-0.1.2 → secretshield-0.2.0}/LICENSE +0 -0
  11. {secretshield-0.1.2 → secretshield-0.2.0}/secretshield/config.py +0 -0
  12. {secretshield-0.1.2 → secretshield-0.2.0}/secretshield/detector.py +0 -0
  13. {secretshield-0.1.2 → secretshield-0.2.0}/secretshield/guardian.py +0 -0
  14. {secretshield-0.1.2 → secretshield-0.2.0}/secretshield/notifications.py +0 -0
  15. {secretshield-0.1.2 → secretshield-0.2.0}/secretshield/patterns.py +0 -0
  16. {secretshield-0.1.2 → secretshield-0.2.0}/secretshield/redactor.py +0 -0
  17. {secretshield-0.1.2 → secretshield-0.2.0}/secretshield.egg-info/dependency_links.txt +0 -0
  18. {secretshield-0.1.2 → secretshield-0.2.0}/secretshield.egg-info/entry_points.txt +0 -0
  19. {secretshield-0.1.2 → secretshield-0.2.0}/secretshield.egg-info/requires.txt +0 -0
  20. {secretshield-0.1.2 → secretshield-0.2.0}/secretshield.egg-info/top_level.txt +0 -0
  21. {secretshield-0.1.2 → secretshield-0.2.0}/setup.cfg +0 -0
  22. {secretshield-0.1.2 → secretshield-0.2.0}/tests/test_detector.py +0 -0
  23. {secretshield-0.1.2 → secretshield-0.2.0}/tests/test_logging.py +0 -0
  24. {secretshield-0.1.2 → secretshield-0.2.0}/tests/test_redactor.py +0 -0
  25. {secretshield-0.1.2 → secretshield-0.2.0}/tests/test_stdout.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: secretshield
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: Detect and redact likely secrets before they reach Python's terminal output or logging system.
5
5
  Author: Samarth Chugh (Sam3360)
6
6
  License: MIT
@@ -152,20 +152,104 @@ useful for wrapping an existing script without editing its source.
152
152
  ```bash
153
153
  secretshield scan .
154
154
  secretshield scan path/to/file.py
155
+ secretshield scan src/ --json
155
156
  ```
156
157
 
157
- Scans a file, or recursively scans a directory of text-like files
158
- (`.py`, `.txt`, `.md`, `.env`, `.yml`, `.json`, `.ini`, `.toml`, `.sh`,
159
- `.js`, `.ts`, etc.), reporting the *kind* and *location* of any likely
160
- secrets found. `scan` does **not** execute any code and does **not**
161
- print the secret values themselves — only where they were found. It
162
- exits with status `1` if anything was found, `0` otherwise, so it can be
163
- used as a pre-commit or CI check.
158
+ `scan` recursively scans a directory (or a single file) of text-based
159
+ project files, reporting the *kind* and *location* of any likely secrets
160
+ found. It does **not** execute or import anything it scans, and it never
161
+ prints the secret values themselves — only which file, which line, and
162
+ what kind of credential it looks like.
163
+
164
+ **Supported file types** include Python, JavaScript/JSX, TypeScript/TSX,
165
+ HTML, CSS/SCSS, Vue, Svelte, JSON/JSONC, YAML, TOML/INI/CFG/CONF, `.env`
166
+ and `.env.*` variants, shell scripts (`.sh`/`.bash`/`.zsh`), Windows
167
+ scripts (`.ps1`/`.bat`/`.cmd`), XML, Markdown/plain text, SQL, and
168
+ GraphQL. Extensionless files (`Dockerfile`, `Makefile`, etc.) are also
169
+ scanned as long as they're actually text, not binary. Files are treated
170
+ purely as text — the same `detect()` engine used for runtime protection
171
+ does the work, regardless of which language the file is written in.
172
+
173
+ By default, `scan` skips common non-source directories: `.git/`,
174
+ `node_modules/`, `__pycache__/`, `.venv/`/`venv/`, `dist/`, `build/`,
175
+ `coverage/`, and a few similar cache directories. It also skips binary
176
+ files automatically (detected by sniffing for null bytes / invalid
177
+ UTF-8), so pointing it at a directory containing images, compiled
178
+ artifacts, etc. is safe.
179
+
180
+ **Example output:**
181
+
182
+ ```text
183
+ SecretShield scan
184
+
185
+ ✗ src/app.js:82
186
+ Potential secret: Bearer token
187
+ Type: token
188
+
189
+ ✓ 143 files scanned
190
+ ✗ 1 potential secret(s) found
191
+
192
+ Exit code: 1
193
+ ```
194
+
195
+ If nothing is found:
196
+
197
+ ```text
198
+ SecretShield scan
199
+
200
+ ✓ 143 files scanned
201
+ ✓ No potential secrets found
202
+
203
+ Exit code: 0
204
+ ```
205
+
206
+ **Options:**
207
+
208
+ | Flag | Purpose |
209
+ |---|---|
210
+ | `--json` | Machine-readable JSON output instead of the text report (see below). Safe to pipe into CI — never contains secret values, matched text, or surrounding lines. |
211
+ | `--include PATTERN` | Only scan files matching a glob pattern (filename or relative path). Repeatable. |
212
+ | `--exclude PATTERN` | Skip files matching a glob pattern. Repeatable. Always wins over `--include` and the defaults. |
213
+ | `--no-ignore` | Don't skip the default-ignored directories (`.git`, `node_modules`, etc.). |
214
+ | `--entropy-threshold FLOAT` | Shannon entropy threshold for generic high-entropy detection (default `4.2`). |
215
+
216
+ **`--json` output shape:**
217
+
218
+ ```json
219
+ {
220
+ "files_scanned": 143,
221
+ "matches": [
222
+ {"file": "src/app.js", "line": 82, "kind": "bearer_token"}
223
+ ],
224
+ "secrets_found": 1
225
+ }
226
+ ```
227
+
228
+ Exit code is `1` if `secrets_found > 0`, `0` otherwise — identical logic
229
+ to the text output, so `scan` works the same way as a CI gate either way.
230
+
231
+ Obvious documentation placeholders (`your_api_key_here`, `changeme`,
232
+ `xxxxxxxx`, and similar) are filtered out of scan results so they don't
233
+ create noise — this filtering is narrow and only applies to `scan`
234
+ output, not to runtime redaction, so it never risks hiding a real secret
235
+ just because it resembles a placeholder pattern.
236
+
237
+ ---
164
238
 
165
239
  **`scan` is static analysis; `run` (and the automatic protection on
166
- import) is runtime redaction.** They are separate features: `scan`
167
- looks at file contents on disk, `run`/import-time protection looks at
168
- what a running program actually writes out.
240
+ import) is runtime redaction.** They are separate, complementary
241
+ features:
242
+
243
+ ```text
244
+ Runtime protection:
245
+ Protects what a running Python application writes to stdout,
246
+ stderr, and logging, live, as it happens.
247
+
248
+ Static scanning:
249
+ Searches source/configuration files on disk -- in any of the
250
+ supported languages -- for likely exposed secrets without
251
+ executing or importing them.
252
+ ```
169
253
 
170
254
  ## Configuration
171
255