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.104.0.tar.gz (35.2 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.104.0-py3-none-any.whl (42.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dr_source-0.104.0.tar.gz
  • Upload date:
  • Size: 35.2 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.104.0.tar.gz
Algorithm Hash digest
SHA256 cf34b7bdf8da012f3b128aa9219a49e627166583515f3e6cd4f727497a10525f
MD5 e0889c6f059a826858fd57c9435db425
BLAKE2b-256 09cada03ed34cd6e29c856377f722d895b0cbee107639eee25807021b5bda30f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dr_source-0.104.0-py3-none-any.whl
  • Upload date:
  • Size: 42.2 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.104.0-py3-none-any.whl
Algorithm Hash digest
SHA256 511c77922f71593d0b313b71d00a687bdcaeef3d7f77e029f273d60c8539c053
MD5 e29d343cae4e4913b69ca511ef05f2a1
BLAKE2b-256 de4936497384caa70c808a6d948e60738611505a13f7e3d6f77cd13a68f97d5d

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