ShieldEnv 🛡️
Local-First Secret Scanning & Pre-Commit Guardraill
ShieldEnv is an open-source security engine designed to eliminate accidental credential leaks, API key exposures, and compliance violations before code ever hits version control.
Why Local-First?
Unlike cloud-based PR scanners that analyze your code after it leaves your machine, ShieldEnv runs entirely local-first. Zero code, environment variables, or tokens ever leave your local environment.
Features
- Regex detection for OpenAI, Anthropic, Google, AWS, GitHub, Slack, database URLs, private keys, and generic secret assignments.
- Provider rules include confidence levels (
highormedium). - Entropy-based detection for literal custom tokens.
- Built-in filtering for placeholders, environment substitutions, templates, and common generated/UI syntax.
- Project and user-level
.shieldignoresupport. - Text, JSON, and SARIF output for local and CI use.
- Optional Git pre-commit hook installation.
- Redacted findings that never print complete secret values.
Installation
Create an environment and install ShieldEnv:
python -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"
On Windows PowerShell, activate with:
.\.venv\Scripts\Activate.ps1
Usage
Scan the current repository:
shieldenv scan
Scan another path or emit machine-readable JSON:
shieldenv scan --path ./src --format json
Generate GitHub Code Scanning-compatible SARIF:
shieldenv scan --path . --format sarif > shieldenv.sarif
Use verbose mode to inspect scan coverage and ignored paths:
shieldenv scan --verbose
shieldenv scan --audit --format json
Exit codes:
0: no findings and no scan errors.1: one or more potential secrets were found.2: one or more files could not be read.
Install a Git pre-commit hook from the repository root:
shieldenv install
ShieldEnv will not overwrite an existing hook unless explicitly requested:
shieldenv install --force
With --force, an existing hook is saved as .git/hooks/pre-commit.shieldenv-backup.
Ignore rules
ShieldEnv skips common dependency, build, cache, and lock-file paths by default. Add a project-level .shieldignore at the root being scanned, or a global ~/.shieldignore, with one rule per line:
# Exact directory name anywhere in the tree
generated
# Relative path or glob
backend/app/api/
frontend/generated/**
Blank lines and lines beginning with # are ignored. Use ignore rules carefully: excluded files are not scanned. --verbose lists ignored paths so exclusions can be reviewed.
To suppress a deliberate test value on one line, use the explicit marker:
TEST_TOKEN = "not-a-credential" # shieldenv: ignore
Suppressions are recorded in audit JSON output. Keep suppressions rare and review them during code review.
Development
python -m pytest
ruff check .
ShieldEnv is heuristic-based and should complement, not replace, secret rotation and incident-response procedures. Review findings and maintain project-specific ignore rules for generated code.
ShieldEnv cannot guarantee detection of every secret format. It combines provider signatures, structured assignment patterns, and entropy heuristics, so unusual encodings may be missed and generated or identifier-like values may still require review. The scanner intentionally reports findings without exposing full values. Run it in CI on Linux, Windows, and macOS; the included workflow tests Python 3.9 through 3.13.
Provider signatures are high-confidence indicators; generic assignments and entropy findings are medium-confidence heuristics. A clean scan means no supported rule matched, not that the repository is guaranteed secret-free. Rotate any credential that may have been exposed, and use code review and repository access controls alongside ShieldEnv.
License
Distributed under the MIT License. See LICENSE for details.
Metadata
Release files for shieldenv 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| shieldenv-1.0.0.tar.gz | 13.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shieldenv-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.7 kB
Release files / shieldenv-1.0.0.tar.gz
| Download URL | shieldenv-1.0.0.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9167e4dad795bec2aec5fcb8684dfaf55f8b1387c57447d6d8822ce60eeceab3
|
|
BLAKE2b-256 checksum How to use checksums |
0ff27bab61f924a24c560636fd2b8d7f6cc5d8af4f224b5b1da23a8ff1ccb892
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Release files / shieldenv-1.0.0-py3-none-any.whl
| Download URL | shieldenv-1.0.0-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd024df63d15f59f55494d271ea594a3494a1563268a5f9b1c13d15370bd42bd
|
|
BLAKE2b-256 checksum How to use checksums |
a00516862c68979a4ffb611742b870d75e5164db82a26033e1a630868c4c437b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Security for shieldenv 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.