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:
    • Field-Sensitive Taint Tracking: Differentiates between fields in an object (e.g., flagging user.name but ignoring user.id), reducing noise in ORM/DTO-heavy modern code.
    • 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.170.0.tar.gz (45.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.170.0-py3-none-any.whl (57.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dr_source-0.170.0.tar.gz
  • Upload date:
  • Size: 45.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.170.0.tar.gz
Algorithm Hash digest
SHA256 3d5530893fe8be6d2d88ccf547da64b7cf8147fe90f8a8d8a3ba3f324d9b5589
MD5 1dd9a310b41c3880b1a7872363af675f
BLAKE2b-256 1b8cf453252346f1ee509faf43394880eb6fde901209afb5c15c8b34dc08837d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dr_source-0.170.0-py3-none-any.whl
  • Upload date:
  • Size: 57.6 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.170.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc403a5fba12a6217f019231631575941c7a8c46e20ff155ff1778860d8bf3a5
MD5 407237020cb187d9e01ff2367dd81e7b
BLAKE2b-256 d26659c6f3c8bd5058c18a50d545e3acea8c77af4c452c85d1f16e08e8d40802

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