Skip to main content

Protect your dependencies from supply chain attacks.

Project description

🛡️ SafeDep: Your Dependency Guardian

SafeDep is an open-source tool designed to protect developers from Supply Chain Attacks. It analyzes packages and dependencies for malicious behavior, data exfiltration, and hidden vulnerabilities before you even install them.

"Don't just scan for known vulnerabilities. Detect suspicious behavior."


✨ Why SafeDep?

The package ecosystem (PyPI, NPM, Cargo) is under constant attack from Typosquatting, Dependency Injection, and Trojan Horses. SafeDep goes beyond standard vulnerability databases (CVEs) by analyzing both the static and dynamic behavior of the code.

Key Features

  • 🔍 Pre-install Sandbox: Runs installation scripts in an isolated environment to monitor what they attempt to access.
  • 📡 Network Monitor: Alerts you if a "text processing" package tries to make requests to unknown IP addresses.
  • 🔑 Secret Leak Detection: Identifies if a package attempts to read your environment variables (.env) or API keys.
  • 🏷️ Typosquatting Protection: Checks if a package name is dangerously similar to a popular one.

🛠️ Getting Started

To use SafeDep locally, clone the repository and install it in editable mode:

# create a virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Install SafeDep in editable mode (so code changes are reflected immediately)
pip install -e .

Sandbox Requirements

For behavioral analysis, Docker or Podman must be installed and running.

# Check if docker is available
docker --version

🚀 How to Use (CLI)

SafeDep provides several commands:

1. Check a package before installing

Analyzes a package (remote) for typosquatting and reputation risks.

Python (default):

safedep check <package_name>

Python Typosquatting Example:

# Detects similarity to 'requests'
safedep check requesst

NPM:

safedep check <package_name> --ecosystem npm

Cargo (Rust):

safedep check <package_name> --ecosystem cargo

2. Scan a local directory

Scans local files (Python, JS, TS, NPM, Cargo) for dangerous code patterns or suspicious dependencies (in requirements.txt, package.json, Cargo.toml).

SafeDep automatically excludes common dependency and internal directories like venv, node_modules, and .git to focus on your project's source code.

safedep scan <path_to_directory>

3. Behavioral Analysis (Sandbox)

Runs a package installation in a Docker container and monitors for suspicious system calls.

Python:

safedep check <package_name> --sandbox

NPM:

safedep check <package_name> --ecosystem npm --sandbox

Cargo:

safedep check <package_name> --ecosystem cargo --sandbox

🗺️ Development Roadmap

Phase 1: Foundation (MVP) - "The Scanner" ✅ (Implemented)

  • ✅ Implementation of name similarity analysis (Anti-Typosquatting).
  • ✅ Reputation verification (package creation date, author history).
  • ✅ Static code scanner for dangerous functions.

Phase 2: Intelligence (Beta) - "The Behavioralist" 🧠 ✅ (Implemented)

  • ✅ Sandboxing: Integration with Docker/Podman to run setup.py and monitor system calls (syscalls).
  • ✅ Multi-language Support: Support for NPM (Node.js) and Cargo (Rust) in addition to Python.
  • ✅ CI/CD Integration: GitHub Actions to block PRs with suspicious dependencies.

Phase 3: Community and Sustainability - "The Shield" 🛡️

SafeDep Hub: A community-driven database of "audited and clean" packages. Security Badges: A system for repositories to display security trust seals. Sponsorship Program: Launching the Sponsors program to maintain the heavy analysis infrastructure.


🤝 Contribute & Sponsor

This project is 100% free and community-focused. If you believe in a safer software ecosystem, consider becoming a contributor or sponsor. Give a ⭐ on GitHub Report Bugs Become a Sponsor: GitHub Sponsors / OpenCollective Developed for those who prioritize security.

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

safedep-0.1.1.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

safedep-0.1.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file safedep-0.1.1.tar.gz.

File metadata

  • Download URL: safedep-0.1.1.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for safedep-0.1.1.tar.gz
Algorithm Hash digest
SHA256 76fd36c8a75780addce10d26dba3d6ef98e8918ca0570f7e3644b46025f79bbe
MD5 1c7fab5c6e8259759677cce7225d6575
BLAKE2b-256 1317fe2adbd51087978964b2c82707d8fed0530b614178e0badbe76fb9f0de83

See more details on using hashes here.

File details

Details for the file safedep-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: safedep-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for safedep-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 802decb3ace116e09d73aaba8b23d0575547ff40c4e53f670e5bacfe5ba48e94
MD5 900be2735f62312d2739c3bf7ea446b6
BLAKE2b-256 71f5c828b51cc08fa5ca2d3ad4ea6a08e6c7e47a648f8d3a2f311f2aa69ec8cb

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