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