Skip to main content

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

Version Python Dependencies License Rules


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:42

FixMove 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!

  1. Fork this repo
  2. Add a new rule to shieldscan/scanner.py
  3. Test it: shieldscan scan . --format json
  4. Open a PR

Adding a Rule

Rules are regex patterns in scanner.py. Each rule has:

  • id: Unique identifier
  • pattern: Compiled regex
  • severity: critical / high / medium / low
  • title: Human-readable name
  • cwe: CWE reference
  • fix: Remediation suggestion
  • languages: Which file types to check

License

MIT โ€” see LICENSE


Made with ๐Ÿ›ก๏ธ by the ShieldScan team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

forj_shieldscan-0.1.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

forj_shieldscan-0.1.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

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

Hashes for forj_shieldscan-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2ee69d345561ff5f4925f2fbc26df758e78d613a340232b7a0dff5bc220456f9
MD5 8fb0c211c3672fca8ea6e56ae537228d
BLAKE2b-256 fcd6e9f36244a20911cecd7e977b3e7425d254925b05c2327084c40c19b210ce

See more details on using hashes here.

File details

Details for the file forj_shieldscan-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for forj_shieldscan-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66dbd51ad74336c29a3d733c925ad61fcce25573b79d999fa05486f0e11def14
MD5 12a5d24b6037a46842ab76a332f8212e
BLAKE2b-256 59c50d50c2a423b00125417ed1c4611c148ae3f6583efce685f2ffbfee3d8860

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page