Skip to main content

Java and JSP Vulnerability Static Analyzer

Project description

DRSource

DRSource is a static analysis tool designed to detect vulnerabilities in Java and JSP projects. It combines multiple detection techniques—including regex‑based detection and AST‑based taint propagation analysis—to identify security issues such as SQL Injection, Cross‑Site Scripting (XSS), Path Traversal, Command Injection, Serialization Issues, LDAP Injection, XXE, SSRF, and unsafe cryptographic/hashing functions.

Features

  • Regex‑Based Detection
    Utilizes carefully crafted regular expressions to identify known vulnerability patterns in source code.

  • AST‑Based Taint Analysis
    Leverages javalang to parse Java source files into an Abstract Syntax Tree (AST) and performs forward data‑flow analysis to propagate taint from user input sources (e.g., request.getParameter) to sensitive sinks (e.g., executeQuery).

  • Data‑Flow Analysis Framework
    A simplified yet robust framework that tracks tainted variables through declarations and assignments to flag dangerous data flows.

  • Multi‑Detector Support
    Detects various vulnerabilities including:

    • SQL Injection
    • Cross‑Site Scripting (XSS)
    • Path Traversal
    • Command Injection
    • Serialization Issues
    • LDAP Injection
    • XXE (XML External Entity) Attacks
    • SSRF (Server-Side Request Forgery)
    • Unsafe Crypto/Hashing functions
  • Parallel Scanning & Progress Bar
    Files are scanned in parallel with a progress bar for faster analysis on large codebases.

  • Robust CLI
    The command‑line interface offers options to:

    • Initialize the database (--init-db)
    • View scan history (--history)
    • Compare scans (--compare)
    • Export results in SARIF, JSON, or HTML formats (--export)
    • Enable AST‑based detection (--ast)
    • Enable debug logging (--debug)
    • Display version information (--version)

Installation

Clone the repository and navigate to the project root:

git clone https://github.com/thesp0nge/dr_source.git
cd dr_source

Install the package in editable mode:

pip install --editable .

Usage

Run dr_source using the CLI:

dr_source [OPTIONS] TARGET_PATH

Options

  • TARGET_PATH: The path of the codebase (directory containing Java/JSP files) to analyze.
  • --init-db: Initialize the database from scratch (drops and recreates tables).
  • --history: Display the scan history for the project.
  • --compare : Compare the latest scan with a previous scan specified by ID.
  • --export [sarif|json|html]: Export scan results in the specified format.
  • --ast: Enable AST‑based detection (in addition to regex‑based detection).
  • --debug: Enable debug logging.
  • --version: Show DRSource version (as defined in setup.py) and exit.

Examples

  • Scan a Codebase Using AST‑Based Detection with Debug Logging:
dr_source --ast --debug /path/to/codebase
  • Initialize the Database:
dr_source --init-db /path/to/codebase
  • Export Results as SARIF:
dr_source --export sarif /path/to/codebase

Contributing

Contributions are welcome! To contribute:

  • Fork the repository.
  • Create a new branch for your feature or bugfix.
  • Make your changes with clear commit messages.
  • Submit a pull request for review.
  • For major changes, please open an issue first to discuss your proposed changes.

License

dr_source is licensed under the MIT License.

Acknowledgments

Special thanks to the maintainers of javalang for their work on Java AST parsing. Inspired by various static analysis and security tools.

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.71.0.tar.gz (17.9 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.71.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dr_source-0.71.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for dr_source-0.71.0.tar.gz
Algorithm Hash digest
SHA256 41fa73966318953dc5b40c6c270c11d1c6a7d801effba1daa59fc9c5839838f7
MD5 68484c1b36f9070690b29f5f37967a2a
BLAKE2b-256 1c68e33c6aefa6a7b6509f6c64806e901ca441d9cca8c8f5b73ee67a4baf2d83

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dr_source-0.71.0-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for dr_source-0.71.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ef9504d095f2330852aed4ffc09d88f14018ccadaf123e711ee24e129764218
MD5 e3c088c604819b903d2b5d34facd16d5
BLAKE2b-256 a90bbeb528bc08d55a43f9651c2037f915754f1de9f212ac423bc06c15090e53

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