Skip to main content

A plugin-driven, multi-language SAST.

Project description

DRSource

DRSource is a professional, extensible, multi-language Static Application Security Testing (SAST) tool. It combines high-speed regex pattern matching with advanced AST-based Inter-File Taint Analysis to identify complex vulnerabilities across entire codebases.

DRSource doesn't just look for "bad strings"; it understands the data flow of your application, tracking user input from entry points (Sources) through logic layers, respecting sanitization functions (Sanitizers), until it reaches dangerous execution points (Sinks).

Key Features

  • Advanced Inter-File Taint Analysis (v0.102.0): Tracks data flow across different files and modules. It can follow a tainted variable from a web controller in one file to a database helper in another.
  • Context-Aware Precision:
    • Scope Management: Understands local and global scopes, preventing variable name collisions between functions.
    • AST Sanitizers: Recognizes security controls (e.g., escape(), prepareStatement, int()). If data is cleaned, the alert is suppressed, drastically reducing false positives.
    • Sink Argument Tracking: Only flags a vulnerability if the tainted data reaches a specific, dangerous argument of a function (e.g., the query string in db.execute(), but not the parameters list).
  • Multi-Engine Analysis:
    • Tree-sitter Powered: Uses industrial-grade parsers for Java and JavaScript/TypeScript for robust analysis of modern syntax.
    • Native Python AST: Deep integration with Python's native AST for precise data-flow tracking.
    • Regex Engine: High-entropy secret scanning (AWS, GitHub, Stripe) and legacy pattern detection.
  • Professional Knowledge Base: Highly configurable YAML-based rules engine with support for configuration overlays (Default, User, Project, CLI).
  • SARIF Support: Export results in the standard format for integration with GitHub Security Tab, GitLab, or SonarQube.

Supported Languages & Frameworks

  • Java: Spring, Servlets, JDBC.
  • Python: Flask, Django, standard library.
  • JavaScript/TypeScript: Node.js (Express), Sequelize, Prisma, Axios, Browser-side JS.

Knowledge Base Example

DRSource uses a professional schema to define vulnerabilities:

SQL_INJECTION:
  description: "Building SQL queries with unvalidated user input."
  severity: "HIGH"
  language_specific:
    javascript:
      ast_sources: ["req.query", "req.body"]
      ast_sinks: 
        - name: "db.query"
          args: [0] # Only the first argument is vulnerable
      ast_sanitizers: ["escape", "validator.escape"]

Installation

Clone the repository and install in editable mode:

git clone https://github.com/thesp0nge/dr_source.git
cd dr_source
pip install --editable .

Usage

# Standard scan of a directory
dr_source /path/to/codebase

# View full data-flow traces (including inter-file hops)
dr_source --show-trace /path/to/codebase

# Set a per-file timeout (e.g., 30 seconds)
dr_source --timeout 30 /path/to/codebase

# Export to SARIF for CI/CD integration
dr_source --export sarif --output report.sarif /path/to/codebase

# Initialize or reset the local scan database
dr_source --init-db /path/to/codebase

Configuration Overlays

Rules are prioritized from highest to lowest:

  1. CLI Override: --config /path/to/rules.yaml
  2. Project Local: ./.dr_source_rules.yaml
  3. User Home: ~/.config/dr_source/knowledge_base.yaml
  4. Factory Default: Internal ruleset.

License

DRSource is licensed under the MIT License.

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

dr_source-0.103.0.tar.gz (35.0 kB view details)

Uploaded Source

Built Distribution

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

dr_source-0.103.0-py3-none-any.whl (42.0 kB view details)

Uploaded Python 3

File details

Details for the file dr_source-0.103.0.tar.gz.

File metadata

  • Download URL: dr_source-0.103.0.tar.gz
  • Upload date:
  • Size: 35.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for dr_source-0.103.0.tar.gz
Algorithm Hash digest
SHA256 6d025dec71df90bab3ab96d2c7fc5c9c9dcef343ebf9ad6ed1da33f7b17810c9
MD5 63ea82b71ab6a86679d2eb6b65c09178
BLAKE2b-256 c6b02151d040fcb8a6b5a69b54fdf893216e1a86fb58784480e3b770fe1e572b

See more details on using hashes here.

File details

Details for the file dr_source-0.103.0-py3-none-any.whl.

File metadata

  • Download URL: dr_source-0.103.0-py3-none-any.whl
  • Upload date:
  • Size: 42.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for dr_source-0.103.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8fc0001727eb602fb1e507bf1f8467a296b80c18472ad2f12a7111706802cbca
MD5 cc0918a703ce1d6d94bd52ac7ea187b6
BLAKE2b-256 f3ae8721cbe232bff89b1a0330d042cd9fa90bd01154c2d90e24bd536ab7a5bc

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