secretshield 0.3.2__tar.gz → 0.4.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 (43) hide show
  1. {secretshield-0.3.2 → secretshield-0.4.0}/LICENSE +1 -1
  2. {secretshield-0.3.2 → secretshield-0.4.0}/PKG-INFO +128 -1
  3. secretshield-0.3.2/secretshield.egg-info/PKG-INFO → secretshield-0.4.0/README.md +616 -515
  4. {secretshield-0.3.2 → secretshield-0.4.0}/pyproject.toml +4 -2
  5. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/__init__.py +1 -1
  6. secretshield-0.4.0/secretshield/baseline.py +56 -0
  7. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/cli.py +335 -42
  8. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/git/__init__.py +2 -0
  9. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/git/hooks.py +19 -0
  10. secretshield-0.4.0/secretshield/project_config.py +121 -0
  11. secretshield-0.3.2/README.md → secretshield-0.4.0/secretshield.egg-info/PKG-INFO +642 -490
  12. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield.egg-info/SOURCES.txt +6 -1
  13. secretshield-0.4.0/secretshield.egg-info/requires.txt +6 -0
  14. secretshield-0.4.0/tests/test_baseline.py +58 -0
  15. secretshield-0.4.0/tests/test_project_config.py +75 -0
  16. secretshield-0.4.0/tests/test_v040_cli_integration.py +219 -0
  17. secretshield-0.3.2/secretshield.egg-info/requires.txt +0 -3
  18. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/autofix/__init__.py +0 -0
  19. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/autofix/env.py +0 -0
  20. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/autofix/fixer.py +0 -0
  21. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/autofix/gitignore.py +0 -0
  22. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/autofix/python.py +0 -0
  23. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/config.py +0 -0
  24. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/detector.py +0 -0
  25. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/github/__init__.py +0 -0
  26. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/github/actions.py +0 -0
  27. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/guardian.py +0 -0
  28. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/notifications.py +0 -0
  29. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/patterns.py +0 -0
  30. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield/redactor.py +0 -0
  31. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield.egg-info/dependency_links.txt +0 -0
  32. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield.egg-info/entry_points.txt +0 -0
  33. {secretshield-0.3.2 → secretshield-0.4.0}/secretshield.egg-info/top_level.txt +0 -0
  34. {secretshield-0.3.2 → secretshield-0.4.0}/setup.cfg +0 -0
  35. {secretshield-0.3.2 → secretshield-0.4.0}/tests/test_autofix.py +0 -0
  36. {secretshield-0.3.2 → secretshield-0.4.0}/tests/test_detector.py +0 -0
  37. {secretshield-0.3.2 → secretshield-0.4.0}/tests/test_git_hooks.py +0 -0
  38. {secretshield-0.3.2 → secretshield-0.4.0}/tests/test_github_action.py +0 -0
  39. {secretshield-0.3.2 → secretshield-0.4.0}/tests/test_logging.py +0 -0
  40. {secretshield-0.3.2 → secretshield-0.4.0}/tests/test_redactor.py +0 -0
  41. {secretshield-0.3.2 → secretshield-0.4.0}/tests/test_scan.py +0 -0
  42. {secretshield-0.3.2 → secretshield-0.4.0}/tests/test_stdout.py +0 -0
  43. {secretshield-0.3.2 → secretshield-0.4.0}/tests/test_v030_cli_integration.py +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Sam3360
3
+ Copyright (c) 2026 Samarth Chugh (Sam3360)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: secretshield
3
- Version: 0.3.2
3
+ Version: 0.4.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-Expression: MIT
@@ -19,6 +19,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
19
  Requires-Python: >=3.10
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
+ Requires-Dist: tomli>=2.0; python_version < "3.11"
22
23
  Provides-Extra: dev
23
24
  Requires-Dist: pytest>=7.0; extra == "dev"
24
25
  Dynamic: license-file
@@ -242,6 +243,62 @@ create noise — this filtering is narrow and only applies to `scan`
242
243
  output, not to runtime redaction, so it never risks hiding a real secret
243
244
  just because it resembles a placeholder pattern.
244
245
 
246
+ While a scan runs, a live `Scanning... N files scanned` indicator is
247
+ shown on stderr (only in an interactive terminal — never in CI logs or
248
+ `--json` output, and it never touches the actual result output).
249
+
250
+ ### Scanning a subset of files: `--staged` and `--diff`
251
+
252
+ ```bash
253
+ secretshield scan --staged
254
+ secretshield scan --diff HEAD~1
255
+ secretshield scan --diff origin/main...HEAD
256
+ ```
257
+
258
+ `--staged` scans exactly what's staged for the next commit — the real
259
+ Git *index* content, correct even if a file is only partially staged
260
+ (so it can't be fooled by working-tree edits made after `git add`).
261
+ Answers: *"would this commit introduce a secret?"*
262
+
263
+ `--diff REF` scans the current on-disk content of files that differ
264
+ from `REF` (any Git revision or range Git itself understands). Answers:
265
+ *"did my changes introduce a secret?"*
266
+
267
+ Both require running inside a Git repository and support all the usual
268
+ flags (`--json`, `--include`, `--exclude`, `--entropy-threshold`).
269
+
270
+ ### Adopting SecretShield in an existing repo: `--baseline`
271
+
272
+ A repo with a backlog of existing findings shouldn't have to fix all of
273
+ them just to turn SecretShield on:
274
+
275
+ ```bash
276
+ secretshield scan . --baseline
277
+ ```
278
+
279
+ writes `.secretshield-baseline.json`, capturing every current finding
280
+ as a hash of `(file, kind, value)` — never the plaintext secret itself,
281
+ so the baseline file is safe to commit. From then on, ordinary scans
282
+ automatically ignore anything already in the baseline and only fail on
283
+ genuinely new findings:
284
+
285
+ ```text
286
+ SecretShield scan
287
+
288
+ ✗ src/config.py:82
289
+ Potential secret: API token
290
+ Type: token
291
+
292
+ ✓ 412 existing finding(s) ignored by baseline
293
+ ✓ 413 files scanned
294
+ ✗ 1 potential secret(s) found
295
+
296
+ Exit code: 1
297
+ ```
298
+
299
+ Re-run `scan . --baseline` any time to refresh it after intentionally
300
+ fixing or accepting findings.
301
+
245
302
  ---
246
303
 
247
304
  **`scan` is static analysis; `run` (and the automatic protection on
@@ -259,6 +316,74 @@ supported languages -- for likely exposed secrets without
259
316
  executing or importing them.
260
317
  ```
261
318
 
319
+ ## Project setup: `secretshield init`
320
+
321
+ ```bash
322
+ secretshield init
323
+ ```
324
+
325
+ An interactive wizard for setting a project up in one step instead of
326
+ discovering `install-hook`, `github-action`, and configuration
327
+ separately:
328
+
329
+ ```text
330
+ SecretShield project setup
331
+
332
+ ✓ Detected Python project
333
+ ✓ Detected Git repository
334
+
335
+ Create a secretshield.toml configuration file? [Y/n]:
336
+ Install Git pre-commit hook? [Y/n]:
337
+ Generate GitHub Actions workflow? [Y/n]:
338
+
339
+ Apply this setup? [Y/n]:
340
+
341
+ ✓ Created secretshield.toml
342
+ ✓ SecretShield pre-commit hook installed.
343
+ ✓ Created .github/workflows/secretshield.yml
344
+
345
+ SecretShield is ready.
346
+ ```
347
+
348
+ Requires a real interactive terminal — like `--fix`, it refuses to run
349
+ (and makes no changes) in CI or any non-interactive environment.
350
+
351
+ ## Configuration file
352
+
353
+ Project-wide `scan` settings can live in `secretshield.toml` at the
354
+ project root, so `--entropy-threshold`, `--include`, and `--exclude`
355
+ don't need to be retyped on every invocation (`secretshield init` can
356
+ generate a starting file for you):
357
+
358
+ ```toml
359
+ [scan]
360
+ entropy_threshold = 4.2
361
+
362
+ [scan.ignore]
363
+ paths = [
364
+ "tests/fixtures/",
365
+ "docs/examples/",
366
+ ]
367
+
368
+ [scan.include]
369
+ patterns = [
370
+ "*.py",
371
+ "*.js",
372
+ ]
373
+
374
+ [output]
375
+ format = "text"
376
+ ```
377
+
378
+ `secretshield scan .` reads this file automatically if it's present.
379
+ **Explicit CLI flags always override it** — e.g. `--json` wins over
380
+ `format = "text"` in the file, and `--entropy-threshold 3.0` wins over
381
+ whatever the file says. Paths under `[scan.ignore]` ending in `/` are
382
+ treated as "this directory and everything under it," same as the
383
+ `--exclude` flag. On Python 3.10 this needs the small `tomli` package
384
+ (installed automatically as a conditional dependency); 3.11+ uses the
385
+ standard library's `tomllib` with no extra dependency at all.
386
+
262
387
  ## Configuration
263
388
 
264
389
  ```python
@@ -405,6 +530,8 @@ secretshield/
405
530
  ├── notifications.py # safe, secret-free console/desktop warnings
406
531
  ├── guardian.py # stdout/stderr wrapping + logging record-factory hook
407
532
  ├── cli.py # `secretshield` command-line entry point
533
+ ├── project_config.py # secretshield.toml loading
534
+ ├── baseline.py # --baseline: hashed findings, no plaintext
408
535
  ├── autofix/ # interactive scan --fix
409
536
  │ ├── fixer.py # orchestration, atomic writes, rollback
410
537
  │ ├── python.py # ast-based safe-assignment detection