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 and a Semgrep-compatible Boolean Engine 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: 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.
  • Semgrep-Compatible Boolean Engine (v0.110.0): Supports complex rule definitions using:
    • patterns: Logical AND across multiple patterns.
    • pattern-either: Logical OR for alternative matching.
    • pattern-not: Logical NOT to exclude specific cases (e.g., test code or known safe patterns).
    • Metavariable Unification: Real $X metavariable matching that ensures multiple occurrences of the same variable name refer to the same AST node.
  • Industrial-Grade Precision:
    • Constant Propagation: Automatically identifies and tracks hardcoded values and safe string concatenations, drastically reducing false positives by ignoring safe "sinks".
    • Scope Management: Understands local and global scopes, preventing variable name collisions between functions.
    • AST Sanitizers: Recognizes security controls (e.g., escape(), prepareStatement, int()).
  • 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.
  • Professional Knowledge Base: Highly configurable YAML-based rules engine with support for configuration overlays (Default, User, Project, CLI).

Supported Languages & Frameworks

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

Boolean Rule Example

DRSource allows defining sophisticated logic directly in YAML:

SELF_COMPARISON:
  description: "Comparing a variable to itself is usually a bug."
  severity: "LOW"
  language_specific:
    python:
      patterns:
        - pattern: "$X == $X"
        - pattern-not: "1 == 1"

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
dr_source --show-trace /path/to/codebase

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

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.110.0.tar.gz (38.1 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.110.0-py3-none-any.whl (45.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dr_source-0.110.0.tar.gz
  • Upload date:
  • Size: 38.1 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.110.0.tar.gz
Algorithm Hash digest
SHA256 ab5b5ebd6b68f374c331a0a387402efec755cef7a91a155efb88ffbfd242b9ec
MD5 aa3bd8ea7f1a670b620f0dce1ce16510
BLAKE2b-256 8400f6f0ff7532eed76fe97e9afee46c1a2a4bfea1353d5c3208e39aa0117613

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dr_source-0.110.0-py3-none-any.whl
  • Upload date:
  • Size: 45.5 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.110.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ce1add938186eb9e9b2d8bea2befd4e7b327d2b9862d52738109477df5e1397
MD5 ef0eecd433985af9cc38173fc366c8e5
BLAKE2b-256 53e2c94e6bc5e3228081bee88257fae50ba796cad9e91498ffb597e179fc7719

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