Skip to main content

AI-assisted code sanitization scanner with OWASP ASVS, NIST 800-53, and ASD STIG compliance mapping.

Reason this release was yanked:

temporarily private

Project description

Sanicode

Sanicode scans Python codebases for input validation and sanitization gaps, builds a knowledge graph of data flow (entry points, sanitizers, sinks), and maps every finding to OWASP ASVS 5.0, NIST 800-53, and ASD STIG v4r11 controls. Output formats include SARIF (for GitHub Code Scanning integration), JSON, and Markdown.

Unlike pattern-only tools like Bandit or Semgrep, sanicode constructs a data flow graph so findings carry context about how tainted data reaches a sink and whether sanitization exists along the path.

Install

pip install sanicode

Requires Python 3.10+.

Quick start

Scan a codebase and generate a Markdown report:

sanicode scan .

Generate SARIF output for CI integration:

sanicode scan . -f sarif

Reports are written to sanicode-reports/ by default.

API server

Start the FastAPI server for remote or hybrid scan mode:

sanicode serve

This starts on port 8080 with Prometheus metrics at /metrics.

Endpoints

POST /api/v1/scan              Submit a scan (async)
GET  /api/v1/scan/{id}         Poll scan status
GET  /api/v1/scan/{id}/findings   Retrieve findings (JSON or ?format=sarif)
GET  /api/v1/scan/{id}/graph      Retrieve knowledge graph
POST /api/v1/analyze           Instant snippet analysis
GET  /api/v1/compliance/map    Compliance framework lookup
GET  /api/v1/health            Liveness check
GET  /metrics                  Prometheus metrics

CLI commands

sanicode scan .                       # Scan codebase, generate reports
sanicode scan . -f sarif              # SARIF output
sanicode scan . -f json -f sarif      # Multiple formats
sanicode serve                        # Start API server on :8080
sanicode report scan-result.json      # Re-generate reports from saved results
sanicode report scan-result.json -s high   # Filter by severity
sanicode report scan-result.json --cwe 89  # Filter by CWE
sanicode config --show                # Show resolved configuration
sanicode config --init                # Create starter sanicode.toml
sanicode graph . --export graph.json  # Export knowledge graph

Detection rules

Rule Description CWE
SC001 eval() CWE-78
SC002 exec() CWE-78
SC003 os.system() CWE-78
SC004 subprocess with shell=True CWE-78
SC005 pickle.loads() CWE-502
SC006 SQL string formatting CWE-89
SC007 __import__() CWE-94
SC008 yaml.load() without Loader CWE-502

Each finding is enriched with CWE metadata and mapped to the active compliance profiles.

Compliance frameworks

Sanicode maps findings to three frameworks out of the box:

  • OWASP ASVS 5.0 -- V1: Encoding and Sanitization requirements (L1/L2/L3)
  • NIST 800-53 -- SI-10 (Information Input Validation), SI-15 (Information Output Filtering), and related controls
  • ASD STIG v4r11 -- APSC-DV-002510 (CAT I), APSC-DV-002520 (CAT II), APSC-DV-002530 (CAT II), and related checks

Configuration

Create a config file:

sanicode config --init

This writes a sanicode.toml in the current directory. Config is loaded from (in order):

  1. --config flag
  2. sanicode.toml in the current directory
  3. ~/.config/sanicode/config.toml

Sanicode works fully without any configuration. LLM tiers are optional -- without them, the tool runs in degraded mode using AST pattern matching, knowledge graph construction, and compliance lookups. LLM integration adds context-aware reasoning on top of these.

LLM tiers (optional)

The config supports three tiers for different task complexities, each pointing at any OpenAI-compatible endpoint (Ollama, vLLM, OpenShift AI):

Tier Purpose Recommended model
fast Classification, severity scoring Granite Nano, Mistral 7B
analysis Data flow reasoning Granite Code 8B
reasoning Compliance mapping, reports Llama 3.1 70B

Current status

Phase 1 MVP: Python-only scanning, 8 detection rules, local and API server modes. LLM integration is planned but not yet wired; the tool operates in degraded mode with AST patterns and compliance mapping.

License

Apache-2.0

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

sanicode-0.1.0.tar.gz (86.1 kB view details)

Uploaded Source

Built Distribution

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

sanicode-0.1.0-py3-none-any.whl (46.7 kB view details)

Uploaded Python 3

File details

Details for the file sanicode-0.1.0.tar.gz.

File metadata

  • Download URL: sanicode-0.1.0.tar.gz
  • Upload date:
  • Size: 86.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sanicode-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9819e8950d821f0ca56cf88e672065ff480a3c470389db02609d79fe767a83c9
MD5 99d1291fe2f3d6d531b9f1b79516b450
BLAKE2b-256 474b154fecd5387a075edf2bd741278fdbb66df1f31a88ed562f63504b79e110

See more details on using hashes here.

Provenance

The following attestation bundles were made for sanicode-0.1.0.tar.gz:

Publisher: release.yml on rdwj/sanicode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: sanicode-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 46.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sanicode-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6b9478ea9eddb459f2a9e2afcc4be0f3f2c922fd254e99cdb8fe2186de53ce6
MD5 ff9e8a2fc090259aed8e3c2e3175ffc7
BLAKE2b-256 4db157e051ac7c62fdff8c84d0c8f632277433919472fe572b83096fc3586e62

See more details on using hashes here.

Provenance

The following attestation bundles were made for sanicode-0.1.0-py3-none-any.whl:

Publisher: release.yml on rdwj/sanicode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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