Skip to main content

Sentro by Solvyx - scan Python packages for malicious code, typosquatting, obfuscated payloads, and supply-chain attacks before they ever install.

Project description

sentro

Built by Solvyx.dev — a pip wrapper that scans Python packages for malicious code before installing them.

sentro install requests
╭──────────────────────── sentro scan ─────────────────────────╮
│   Package : requests 2.31.0                                     │
│   PyPI    : verified                                            │
│   Risk    : SAFE  (score 0/100)                                 │
╰─────────────────────────────────────────────────────────────────╯
  No issues found.

Why

Supply-chain attacks on PyPI are getting more frequent. Attackers publish packages with names one typo away from requests or numpy, or shadow internal package names to trigger dependency confusion. The malicious code runs at install time inside setup.py, or silently on first import.

sentro downloads and scans a package before pip ever touches it.


What it detects

Check Examples
Malicious code eval() / exec() at module level, os.system(), subprocess(shell=True), socket connections to hardcoded IPs
Install hooks Dangerous calls in setup.py that run unconditionally at install time, cmdclass overrides, dynamic install_requires
Obfuscation exec(base64.b64decode(...)) chains, high-entropy string constants, marshal.loads payloads
Typosquatting Names similar to popular packages (reqeusts, numpy-dev), Unicode homoglyphs
Dependency confusion Package names that shadow Python stdlib modules (json, os, urllib)
Metadata signals Package age under 7 days, very low download count, missing author/homepage

Each finding contributes to a risk score (0–100). The overall verdict is SAFE, WARNING, or DANGER.


Install

pip install sentro

Requires Python 3.11+.


Usage

# Scan and install
sentro install requests

# Scan only — don't install
sentro install requests --no-install

# Block installation if anything scores DANGER
sentro install requests --strict

# Pin a version
sentro install "requests==2.28.0"

# Multiple packages
sentro install requests flask sqlalchemy

# JSON output (for CI pipelines)
sentro install requests --no-install --output-format json

# See which installer was detected
sentro detect-installer

Flags

Flag Description
--strict Exit 1 and block install if any package scores DANGER
--no-install Scan only, don't install
--skip-scan Skip scanning, forward directly to the installer
--output-format text|json Output format (default: text)
--installer pip|uv|conda|mamba|poetry|pipenv|pdm|auto Installer to use (default: auto)
--config PATH Path to a TOML config file

Installer detection

sentro auto-detects your package manager so the install step uses the right tool.

Installer Detected when
uv uv is on PATH and a virtual env is active
conda / mamba CONDA_DEFAULT_ENV or CONDA_PREFIX is set
poetry pyproject.toml has [tool.poetry] and poetry is on PATH
pipenv Pipfile exists and pipenv is on PATH
pdm pyproject.toml has [tool.pdm] and pdm is on PATH
pip Fallback

Override with --installer pip or set SENTRO_INSTALLER=pip.


Configuration

Create a .sentro.toml in your project root (or add [tool.sentro] to pyproject.toml):

[sentro]
strict = true

[sentro.thresholds]
warning = 30
danger  = 70

whitelist_packages  = ["requests", "numpy"]
scanners_disabled   = ["metadata"]

Config is merged from multiple sources in this order (last wins):

  1. ~/.config/sentro/config.toml — user-level defaults
  2. pyproject.toml [tool.sentro] in the current directory
  3. .sentro.toml in the current directory
  4. --config PATH flag
  5. SENTRO_* environment variables
  6. CLI flags

Environment variables

Variable Effect
SENTRO_STRICT=true Enable strict mode
SENTRO_INSTALLER=pip Force a specific installer
SENTRO_OUTPUT_FORMAT=json JSON output
SENTRO_DANGER_THRESHOLD=50 Override the DANGER score threshold
SENTRO_WARNING_THRESHOLD=20 Override the WARNING score threshold
SENTRO_WHITELIST=requests,numpy Comma-separated whitelist

CI usage

# GitHub Actions example
- name: Scan dependencies
  run: |
    pip install sentro
    sentro install -r requirements.txt --strict --output-format json > scan.json

The --strict flag makes the step fail if any package scores DANGER. The JSON output can be parsed or stored as an artifact.


False positives

Some legitimate packages use dynamic imports or eval() inside functions (template engines, plugin loaders, REPLs). sentro tries to distinguish:

  • eval() / exec() at module level → DANGER (runs unconditionally on import)
  • eval() / exec() inside a function → WARNING (may be legitimate)
  • __import__() inside a function → not flagged (standard plugin-loader pattern)

If a package you trust keeps triggering warnings, add it to whitelist_packages in your config.


Development

git clone https://github.com/solvyx-dev/sentro
cd sentro
pip install -e ".[dev]"

# Run tests (no network required)
pytest -m "not integration"

# Run with coverage
pytest --cov=sentro --cov-report=term-missing

# Run integration tests (requires internet)
pytest -m integration

Roadmap

  • requirements.txt file scanning (sentro install -r requirements.txt)
  • Support for other languages (npm, cargo, gem)
  • GitHub Action
  • Cache scan results to avoid re-scanning unchanged packages

License

MIT - built and maintained by Solvyx.dev

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

sentro-0.1.1.tar.gz (68.0 kB view details)

Uploaded Source

Built Distribution

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

sentro-0.1.1-py3-none-any.whl (34.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sentro-0.1.1.tar.gz
  • Upload date:
  • Size: 68.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for sentro-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2c646d60a07ad05c2f29a26df745fbf355a53b10364a78e3694e116527229b60
MD5 0436877e5e0d38221d7e578e8565b3e8
BLAKE2b-256 a54641a5a2556bd4677214ef72f6e345f8fed01ed96775fcce99f9109c4b07ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sentro-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 34.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for sentro-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b451b4174acc8742c06a1ad84e86f7204d21c1e3aa9b887656bc1f3af98afeb7
MD5 77f6d03f282a966865c64b55bc202d42
BLAKE2b-256 103cd9e5d9de2b1ee9e2dbaac1fbca6a69e20a7967bbdba6eb2c6f28ebc73767

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