Scan your code for security issues in 30 seconds
Project description
๐ก๏ธ ShieldScan
Scan your code for security issues in 30 seconds.
Quick Start โข What It Finds โข Add to CI โข Output Formats โข Pro Features
ShieldScan finds hardcoded secrets, SQL injection, XSS, command injection, and 35+ other security issues in your code. Zero config. Zero dependencies. Just run it.
Quick Start
pip install shieldscan
shieldscan scan .
That's it. You'll see something like:
๐ก๏ธ ShieldScan v0.1.0
Scanning 142 files...
๐ด CRITICAL: Hardcoded AWS Access Key
src/config.py:42 โ AKIA... pattern detected
CWE-798 | Fix: Move to environment variable
๐ HIGH: SQL String Concatenation
src/db.py:89 โ f-string in SQL query
CWE-89 | Fix: Use parameterized queries
๐ก MEDIUM: Debug Mode Enabled in Production
src/settings.py:12 โ DEBUG = True
CWE-489 | Fix: Set DEBUG = False in production
Score: C (3 issues found)
How It Works
flowchart TD
A["๐ Your Code"] --> B["๐ ShieldScan CLI"]
B --> C{"40 Security Rules"}
C --> D["๐ Secrets Detection\n10 rules"]
C --> E["๐ Injection Patterns\n8 rules"]
C --> F["โ๏ธ Config Issues\n6 rules"]
C --> G["๐ฆ Vulnerable Deps\n5 rules"]
C --> H["๐ Crypto Weaknesses\n4 rules"]
C --> I["๐ Auth Issues\n3 rules"]
C --> J["๐ File Checks\n4 rules"]
D & E & F & G & H & I & J --> K{"Findings"}
K -->|"Text"| L["๐ฅ๏ธ Terminal Output\nColored, graded A-F"]
K -->|"JSON"| M["๐ Structured JSON\nFor automation"]
K -->|"SARIF"| N["๐ GitHub Code Scanning\nNative integration"]
K -->|"Markdown"| O["๐ฌ PR Comments\nBranded reports"]
style A fill:#1a1a2e,stroke:#00e676,color:#fff
style B fill:#16213e,stroke:#00e676,color:#fff
style C fill:#0f3460,stroke:#00e676,color:#fff
style K fill:#0f3460,stroke:#00e676,color:#fff
style L fill:#1a1a2e,stroke:#00e676,color:#fff
style M fill:#1a1a2e,stroke:#00e676,color:#fff
style N fill:#1a1a2e,stroke:#00e676,color:#fff
style O fill:#1a1a2e,stroke:#00e676,color:#fff
What It Finds
| Category | Rules | Examples |
|---|---|---|
| ๐ Secrets | 10 | AWS keys (AKIA...), GitHub tokens, Stripe keys, JWTs, private keys, generic API keys/passwords |
| ๐ Injection | 8 | SQL injection (f-strings, concatenation), command injection (os.system, subprocess), XSS (innerHTML, dangerouslySetInnerHTML), XXE |
| โ๏ธ Config | 6 | Debug mode in production, CORS wildcard, SSL verification disabled, insecure cookies |
| ๐ฆ Dependencies | 5 | Known vulnerable versions of lodash, axios, Django, Flask, jsonwebtoken |
| ๐ Crypto | 4 | Weak hashing (MD5, SHA1), insecure random (Math.random for tokens), hardcoded IVs |
| ๐ Auth | 3 | Hardcoded credentials, weak session config, eval/exec with dynamic input |
| ๐ Files | 4 | .env files committed, private key files, pickle.loads, yaml.load without SafeLoader |
Scan Pipeline
flowchart LR
subgraph Input
A["Developer runs\nshieldscan scan ."]
end
subgraph Scanner["๐ก๏ธ ShieldScan Engine"]
B["Collect Files\n.py .js .ts .env\nDockerfile etc."]
C["Pattern Matching\n40 regex rules\nper file, per line"]
D["False Positive\nSuppression\nskip tests, comments"]
E["Severity Scoring\nCritical โ Low\nCWE mapping"]
end
subgraph Output
F["Grade: A+ to F\nExit code 0 or 1"]
end
A --> B --> C --> D --> E --> F
style Scanner fill:#0d1117,stroke:#00e676,color:#fff
Add to CI
GitHub Actions (30 seconds)
Copy this to .github/workflows/shieldscan.yml:
name: Security Scan
on: [pull_request]
jobs:
shieldscan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pip install shieldscan
- run: shieldscan scan . --format sarif > results.sarif
continue-on-error: true
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
if: always()
This gives you native GitHub Code Scanning โ findings appear directly in your PR diff:
sequenceDiagram
participant Dev as Developer
participant GH as GitHub
participant SS as ShieldScan
Dev->>GH: Opens Pull Request
GH->>SS: Triggers scan workflow
SS->>SS: Scans changed files
SS->>GH: Uploads SARIF results
GH->>Dev: Shows findings in PR diff
Note over Dev,GH: Findings appear inline<br/>with fix suggestions
Other CI Systems
# GitLab CI
shieldscan scan . --format json > shieldscan-report.json
# Jenkins
shieldscan scan . --severity high # Exit code 1 on high+ findings
# Pre-commit hook
shieldscan scan . --severity critical # Block commits with critical issues
Output Formats
Terminal (default)
shieldscan scan .
Colored output with severity badges, file locations, fix suggestions, and an overall grade (A+ to F).
JSON
shieldscan scan . --format json
[
{
"severity": "critical",
"title": "Hardcoded AWS Access Key",
"file": "src/config.py",
"line": 42,
"cwe": "CWE-798",
"fix": "Move to environment variable"
}
]
SARIF (GitHub Code Scanning)
shieldscan scan . --format sarif > results.sarif
SARIF 2.1.0 format compatible with GitHub Code Scanning, VS Code SARIF Viewer, and other security tools.
Markdown (PR Comments)
shieldscan scan . --format markdown
Generates a branded security report ready to paste as a PR comment:
๐ก๏ธ ShieldScan Security Report
Score: B (2 issues found)
๐ด Critical (0) | ๐ High (1) | ๐ก Medium (1) | ๐ต Low (0)
๐ HIGH: Hardcoded API Key โ
src/config.py:42Fix
Move to environment variable using os.getenv()
CLI Options
shieldscan scan <path> # Scan a directory or file
shieldscan scan . --format json # JSON output
shieldscan scan . --format sarif # SARIF for GitHub Code Scanning
shieldscan scan . --format markdown # PR comment format
shieldscan scan . --severity high # Only high+ severity
shieldscan scan . --exclude tests/ # Exclude directories
shieldscan version # Show version
| Flag | Description |
|---|---|
--format |
Output format: text (default), json, sarif, markdown |
--severity |
Minimum severity: critical, high, medium, low |
--exclude |
Directories to skip (comma-separated) |
Exit codes: 0 = clean, 1 = critical/high findings, 2 = error
Python API
from shieldscan import scan_directory, scan_file
# Scan a directory
findings = scan_directory("/path/to/project")
for f in findings:
print(f"{f['severity']}: {f['title']} at {f['file']}:{f['line']}")
# Scan a single file
findings = scan_file("/path/to/file.py")
Architecture
graph TB
subgraph "ShieldScan CLI (Open Source)"
CLI["shieldscan scan ."]
Scanner["Scanner Engine\n40 Rules โข Zero Deps"]
Formatter["Output Formatter\nText โข JSON โข SARIF โข MD"]
CLI --> Scanner --> Formatter
end
subgraph "ShieldScan Pro (SaaS)"
Dashboard["Web Dashboard\nTrend Graphs โข Team View"]
Live["Live Target Scanning\nSSL โข Headers โข OWASP"]
Compliance["Compliance Reports\nSOC 2 โข PCI โข HIPAA"]
AI["AI Remediation\nAuto-fix PRs"]
GitApp["GitHub App\nAuto PR Comments"]
end
Scanner -.->|"Upgrade"| Dashboard
style CLI fill:#0d1117,stroke:#00e676,color:#fff
style Scanner fill:#0d1117,stroke:#00e676,color:#fff
style Formatter fill:#0d1117,stroke:#00e676,color:#fff
style Dashboard fill:#1a1a2e,stroke:#ffd700,color:#fff
style Live fill:#1a1a2e,stroke:#ffd700,color:#fff
style Compliance fill:#1a1a2e,stroke:#ffd700,color:#fff
style AI fill:#1a1a2e,stroke:#ffd700,color:#fff
style GitApp fill:#1a1a2e,stroke:#ffd700,color:#fff
Pro Features
Need more? ShieldScan Pro adds:
| Feature | Free (CLI) | Pro ($49/mo) | Enterprise |
|---|---|---|---|
| Static code scanning | โ 40 rules | โ 100+ rules | โ Custom rules |
| CLI & CI integration | โ | โ | โ |
| GitHub Code Scanning | โ SARIF | โ GitHub App | โ GitHub App |
| Live website scanning | โ | โ SSL, headers, OWASP | โ Full pentest |
| Compliance reports | โ | โ SOC 2, PCI DSS | โ + HIPAA, ISO 27001 |
| AI remediation | โ | โ Fix suggestions | โ Auto-fix PRs |
| Team dashboard | โ | โ 5 repos | โ Unlimited |
| Shareable scorecards | โ | โ | โ |
| Slack/Jira alerts | โ | โ | โ |
| SSO & RBAC | โ | โ | โ |
Contributing
ShieldScan is open source (MIT). We welcome contributions!
- Fork this repo
- Add a new rule to
shieldscan/scanner.py - Test it:
shieldscan scan . --format json - Open a PR
Adding a Rule
Rules are regex patterns in scanner.py. Each rule has:
id: Unique identifierpattern: Compiled regexseverity: critical / high / medium / lowtitle: Human-readable namecwe: CWE referencefix: Remediation suggestionlanguages: Which file types to check
License
MIT โ see LICENSE
Made with ๐ก๏ธ by the ShieldScan team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file forj_shieldscan-0.1.0.tar.gz.
File metadata
- Download URL: forj_shieldscan-0.1.0.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ee69d345561ff5f4925f2fbc26df758e78d613a340232b7a0dff5bc220456f9
|
|
| MD5 |
8fb0c211c3672fca8ea6e56ae537228d
|
|
| BLAKE2b-256 |
fcd6e9f36244a20911cecd7e977b3e7425d254925b05c2327084c40c19b210ce
|
File details
Details for the file forj_shieldscan-0.1.0-py3-none-any.whl.
File metadata
- Download URL: forj_shieldscan-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66dbd51ad74336c29a3d733c925ad61fcce25573b79d999fa05486f0e11def14
|
|
| MD5 |
12a5d24b6037a46842ab76a332f8212e
|
|
| BLAKE2b-256 |
59c50d50c2a423b00125417ed1c4611c148ae3f6583efce685f2ffbfee3d8860
|