secretscreen 0.4.0__tar.gz → 0.5.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. {secretscreen-0.4.0 → secretscreen-0.5.0}/.github/workflows/codeql.yml +3 -3
  2. {secretscreen-0.4.0 → secretscreen-0.5.0}/.github/workflows/publish.yml +1 -1
  3. {secretscreen-0.4.0 → secretscreen-0.5.0}/.github/workflows/scorecard.yml +1 -1
  4. {secretscreen-0.4.0 → secretscreen-0.5.0}/PKG-INFO +49 -1
  5. {secretscreen-0.4.0 → secretscreen-0.5.0}/README.md +48 -0
  6. {secretscreen-0.4.0 → secretscreen-0.5.0}/pyproject.toml +1 -1
  7. {secretscreen-0.4.0 → secretscreen-0.5.0}/src/secretscreen/__init__.py +1 -1
  8. secretscreen-0.5.0/src/secretscreen/_cli.py +818 -0
  9. secretscreen-0.5.0/src/secretscreen/_config.py +381 -0
  10. {secretscreen-0.4.0 → secretscreen-0.5.0}/src/secretscreen/_core.py +78 -19
  11. {secretscreen-0.4.0 → secretscreen-0.5.0}/tests/test_cli.py +27 -0
  12. secretscreen-0.5.0/tests/test_config.py +642 -0
  13. {secretscreen-0.4.0 → secretscreen-0.5.0}/tests/test_core.py +104 -2
  14. secretscreen-0.4.0/src/secretscreen/_cli.py +0 -438
  15. {secretscreen-0.4.0 → secretscreen-0.5.0}/.github/FUNDING.yml +0 -0
  16. {secretscreen-0.4.0 → secretscreen-0.5.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  17. {secretscreen-0.4.0 → secretscreen-0.5.0}/.github/dependabot.yml +0 -0
  18. {secretscreen-0.4.0 → secretscreen-0.5.0}/.github/pull_request_template.md +0 -0
  19. {secretscreen-0.4.0 → secretscreen-0.5.0}/.github/workflows/ci.yml +0 -0
  20. {secretscreen-0.4.0 → secretscreen-0.5.0}/.github/workflows/dependabot-automerge.yml +0 -0
  21. {secretscreen-0.4.0 → secretscreen-0.5.0}/.gitignore +0 -0
  22. {secretscreen-0.4.0 → secretscreen-0.5.0}/CODE_OF_CONDUCT.md +0 -0
  23. {secretscreen-0.4.0 → secretscreen-0.5.0}/CONTRIBUTING.md +0 -0
  24. {secretscreen-0.4.0 → secretscreen-0.5.0}/LICENSE +0 -0
  25. {secretscreen-0.4.0 → secretscreen-0.5.0}/NOTICE +0 -0
  26. {secretscreen-0.4.0 → secretscreen-0.5.0}/SECURITY.md +0 -0
  27. {secretscreen-0.4.0 → secretscreen-0.5.0}/docs/audits/security-audit-2026-04-05.md +0 -0
  28. {secretscreen-0.4.0 → secretscreen-0.5.0}/src/secretscreen/_entropy.py +0 -0
  29. {secretscreen-0.4.0 → secretscreen-0.5.0}/src/secretscreen/_formats.py +0 -0
  30. {secretscreen-0.4.0 → secretscreen-0.5.0}/src/secretscreen/_keys.py +0 -0
  31. {secretscreen-0.4.0 → secretscreen-0.5.0}/src/secretscreen/_parsers.py +0 -0
  32. {secretscreen-0.4.0 → secretscreen-0.5.0}/src/secretscreen/_urls.py +0 -0
  33. {secretscreen-0.4.0 → secretscreen-0.5.0}/src/secretscreen/gitleaks.toml +0 -0
  34. {secretscreen-0.4.0 → secretscreen-0.5.0}/src/secretscreen/py.typed +0 -0
  35. {secretscreen-0.4.0 → secretscreen-0.5.0}/tests/__init__.py +0 -0
  36. {secretscreen-0.4.0 → secretscreen-0.5.0}/tests/test_architecture.py +0 -0
  37. {secretscreen-0.4.0 → secretscreen-0.5.0}/tests/test_entropy.py +0 -0
  38. {secretscreen-0.4.0 → secretscreen-0.5.0}/tests/test_explain.py +0 -0
  39. {secretscreen-0.4.0 → secretscreen-0.5.0}/tests/test_formats.py +0 -0
  40. {secretscreen-0.4.0 → secretscreen-0.5.0}/tests/test_keys.py +0 -0
  41. {secretscreen-0.4.0 → secretscreen-0.5.0}/tests/test_parsers.py +0 -0
  42. {secretscreen-0.4.0 → secretscreen-0.5.0}/tests/test_urls.py +0 -0
  43. {secretscreen-0.4.0 → secretscreen-0.5.0}/tests/test_yaml_and_prefixes.py +0 -0
@@ -21,12 +21,12 @@ jobs:
21
21
  - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
22
22
 
23
23
  - name: Initialize CodeQL
24
- uses: github/codeql-action/init@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
24
+ uses: github/codeql-action/init@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4
25
25
  with:
26
26
  languages: python
27
27
 
28
28
  - name: Autobuild
29
- uses: github/codeql-action/autobuild@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
29
+ uses: github/codeql-action/autobuild@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4
30
30
 
31
31
  - name: Perform CodeQL Analysis
32
- uses: github/codeql-action/analyze@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
32
+ uses: github/codeql-action/analyze@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4
@@ -25,4 +25,4 @@ jobs:
25
25
  python -m build
26
26
 
27
27
  - name: Publish to PyPI
28
- uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1
28
+ uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
@@ -30,6 +30,6 @@ jobs:
30
30
  publish_results: true
31
31
 
32
32
  - name: Upload to code-scanning
33
- uses: github/codeql-action/upload-sarif@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4.37.3
33
+ uses: github/codeql-action/upload-sarif@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4
34
34
  with:
35
35
  sarif_file: results.sarif
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: secretscreen
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Detect and redact secrets in key-value pairs, dicts, and environment variables. Library and CLI.
5
5
  Project-URL: Homepage, https://github.com/featurecreep-cron/secretscreen
6
6
  Project-URL: Repository, https://github.com/featurecreep-cron/secretscreen
@@ -139,6 +139,54 @@ That stripping is what makes colon-separated detection safe to attempt at all. W
139
139
 
140
140
  One case stays deliberately blunt: a single stream mixing formats, such as `grep -rn` across both `.env` and `.yaml` files, picks the majority format and redacts the rest wholesale. Loud and safe rather than half-parsed.
141
141
 
142
+ ### Config
143
+
144
+ Once you have found a false positive, `--explain` tells you which key it was. A config file stops you diagnosing it again next run.
145
+
146
+ ```toml
147
+ # ~/.config/secretscreen.toml or .secretscreen.toml beside a stack
148
+
149
+ # Never redact these. Exact key names — no wildcards.
150
+ show = ["DEPLOY_PUBLIC_KEY"]
151
+
152
+ # Always redact these. Globs are fine.
153
+ hide = ["*_NOTIFICATION_URL", "*_WEBHOOK_URL"]
154
+
155
+ [detection]
156
+ mode = "normal" # normal | aggressive
157
+ entropy_threshold = 4.5
158
+
159
+ # Applies only while this filename is being processed.
160
+ [files."demo.env"]
161
+ show = ["API_TOKEN"]
162
+ ```
163
+
164
+ Order: user config, then `.secretscreen.toml` files discovered upward from **each input file**, nearest last, then flags. Lists union rather than replace, so a closer file extends the broader one instead of silently discarding it. Discovery runs per input, so `secretscreen a/compose.yaml b/compose.yaml` can pick up a different config beside each. Add `root = true` to stop the upward walk.
165
+
166
+ **`hide` takes globs. `show` does not.** `show = ["*_KEY"]` would print `AWS_SECRET_ACCESS_KEY`, and it would go on matching keys nobody has written yet. Every show entry is a credential you are choosing to print, so every entry gets named in full. `hide` always wins over `show`, at every scope.
167
+
168
+ The same asymmetry decides what a rule can cover in JSON. `hide` names a key and takes whatever that key holds — a string, a port number, a whole object — and replaces all of it, because the shape and key names of a hidden subtree are usually the half worth hiding. `show` is honoured for a string and refused for anything else, with a note on stderr: vouching for one named key is a decision about one value, and vouching for an object is a decision about values nobody has added yet. In a `--format dsn` stream the whole line is the value, and rules match the key `dsn`.
169
+
170
+ **A discovered project config may tighten redaction but not relax it.** A `.secretscreen.toml` can arrive with a repository you cloned five minutes ago, or be dropped in a shared directory by anyone who can write there, so every setting one carries is read as a request to tighten:
171
+
172
+ | setting | from a discovered config |
173
+ |---|---|
174
+ | `hide` | applied |
175
+ | `show` | ignored |
176
+ | `[detection] mode` | only `normal` → `aggressive` |
177
+ | `[detection] entropy_threshold` | only downward |
178
+ | `root` | ignored |
179
+
180
+ `--trust-config` honours all five. Each ignored setting is named on stderr, so a rule that did not fire says so rather than looking like one that did.
181
+
182
+ The three settings below `show` matter as much as `show` does. `show` prints a credential and is the obvious one; `entropy_threshold = 99` and `mode = "normal"` stop a credential being *found*, and `root = true` needs no rules of its own — it ends the upward walk before your own config one directory up is ever read. All four end with a secret on stdout and `--audit` exiting 0.
183
+
184
+ Only your own `~/.config` file, or a file you name yourself with `--config`, can loosen anything.
185
+
186
+ Every loaded config is named on stderr, and a malformed one — bad TOML, an unknown setting, a wildcard where none is allowed — is fatal rather than skipped. A typo that silently disabled a `hide` rule would leave you believing you had configured something you had not.
187
+
188
+ Equivalent flags exist for one-off use: `--show KEY`, `--hide GLOB`, `--entropy-threshold N`, `--no-config`, and `--config FILE` — which uses that file *only*, skipping both discovery and your own `~/.config`, and trusts it because you named it.
189
+
142
190
  ### Knowing what was left alone
143
191
 
144
192
  A missed secret is invisible: the output looks screened and nothing says otherwise. `--explain` writes an account of every value to **stderr**, so stdout stays a usable redacted stream and `secretscreen app.env --explain > clean.env` still works.
@@ -107,6 +107,54 @@ That stripping is what makes colon-separated detection safe to attempt at all. W
107
107
 
108
108
  One case stays deliberately blunt: a single stream mixing formats, such as `grep -rn` across both `.env` and `.yaml` files, picks the majority format and redacts the rest wholesale. Loud and safe rather than half-parsed.
109
109
 
110
+ ### Config
111
+
112
+ Once you have found a false positive, `--explain` tells you which key it was. A config file stops you diagnosing it again next run.
113
+
114
+ ```toml
115
+ # ~/.config/secretscreen.toml or .secretscreen.toml beside a stack
116
+
117
+ # Never redact these. Exact key names — no wildcards.
118
+ show = ["DEPLOY_PUBLIC_KEY"]
119
+
120
+ # Always redact these. Globs are fine.
121
+ hide = ["*_NOTIFICATION_URL", "*_WEBHOOK_URL"]
122
+
123
+ [detection]
124
+ mode = "normal" # normal | aggressive
125
+ entropy_threshold = 4.5
126
+
127
+ # Applies only while this filename is being processed.
128
+ [files."demo.env"]
129
+ show = ["API_TOKEN"]
130
+ ```
131
+
132
+ Order: user config, then `.secretscreen.toml` files discovered upward from **each input file**, nearest last, then flags. Lists union rather than replace, so a closer file extends the broader one instead of silently discarding it. Discovery runs per input, so `secretscreen a/compose.yaml b/compose.yaml` can pick up a different config beside each. Add `root = true` to stop the upward walk.
133
+
134
+ **`hide` takes globs. `show` does not.** `show = ["*_KEY"]` would print `AWS_SECRET_ACCESS_KEY`, and it would go on matching keys nobody has written yet. Every show entry is a credential you are choosing to print, so every entry gets named in full. `hide` always wins over `show`, at every scope.
135
+
136
+ The same asymmetry decides what a rule can cover in JSON. `hide` names a key and takes whatever that key holds — a string, a port number, a whole object — and replaces all of it, because the shape and key names of a hidden subtree are usually the half worth hiding. `show` is honoured for a string and refused for anything else, with a note on stderr: vouching for one named key is a decision about one value, and vouching for an object is a decision about values nobody has added yet. In a `--format dsn` stream the whole line is the value, and rules match the key `dsn`.
137
+
138
+ **A discovered project config may tighten redaction but not relax it.** A `.secretscreen.toml` can arrive with a repository you cloned five minutes ago, or be dropped in a shared directory by anyone who can write there, so every setting one carries is read as a request to tighten:
139
+
140
+ | setting | from a discovered config |
141
+ |---|---|
142
+ | `hide` | applied |
143
+ | `show` | ignored |
144
+ | `[detection] mode` | only `normal` → `aggressive` |
145
+ | `[detection] entropy_threshold` | only downward |
146
+ | `root` | ignored |
147
+
148
+ `--trust-config` honours all five. Each ignored setting is named on stderr, so a rule that did not fire says so rather than looking like one that did.
149
+
150
+ The three settings below `show` matter as much as `show` does. `show` prints a credential and is the obvious one; `entropy_threshold = 99` and `mode = "normal"` stop a credential being *found*, and `root = true` needs no rules of its own — it ends the upward walk before your own config one directory up is ever read. All four end with a secret on stdout and `--audit` exiting 0.
151
+
152
+ Only your own `~/.config` file, or a file you name yourself with `--config`, can loosen anything.
153
+
154
+ Every loaded config is named on stderr, and a malformed one — bad TOML, an unknown setting, a wildcard where none is allowed — is fatal rather than skipped. A typo that silently disabled a `hide` rule would leave you believing you had configured something you had not.
155
+
156
+ Equivalent flags exist for one-off use: `--show KEY`, `--hide GLOB`, `--entropy-threshold N`, `--no-config`, and `--config FILE` — which uses that file *only*, skipping both discovery and your own `~/.config`, and trusts it because you named it.
157
+
110
158
  ### Knowing what was left alone
111
159
 
112
160
  A missed secret is invisible: the output looks screened and nothing says otherwise. `--explain` writes an account of every value to **stderr**, so stdout stays a usable redacted stream and `secretscreen app.env --explain > clean.env` still works.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "secretscreen"
7
- version = "0.4.0"
7
+ version = "0.5.0"
8
8
  description = "Detect and redact secrets in key-value pairs, dicts, and environment variables. Library and CLI."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -37,4 +37,4 @@ __all__ = [
37
37
  "redact_pair",
38
38
  ]
39
39
 
40
- __version__ = "0.4.0"
40
+ __version__ = "0.5.0"