Skip to main content

Open-source CLI for analyzing Python apps and generating Dockerfile + SBOM

Project description

Harden (OSS Core)

Minimal open‑source subset of Harden. It only provides:

  • analyze — static risk report
  • lock — deterministic dependency lock
  • generate — Dockerfile‑only + SBOM

No runtime loop, no deploy/export, no enterprise features.

Enterprise Edition

The Enterprise Edition extends Harden with:

  • Runtime profiling + policy tightening
  • Deployment artifacts (K8s, CI/CD, auth, etc.)
  • Enterprise buyer workflows and reporting

If you need those capabilities, request access to the Enterprise Edition.

Installation

pip install -e .

Or run directly:

python3 -m harden [command]

Commands

analyze

harden analyze <path>

Produces:

  • Terminal report
  • JSON report at <path>/.harden/state/harden-report.json

Highlights:

  • Framework + entrypoint detection
  • Entry command inference (best‑effort) — shown in terminal and JSON report
  • Python version detection
  • Secrets scanning (regex + entropy)
  • Dependency listing (requirements/pyproject/bare imports)
  • OSV CVE checks with severity
  • AI usage + external services detection
  • Risk score (0–100)

lock

harden lock <path> [--strategy auto|uv|pip-compile|pip-freeze]

Produces:

  • <path>/requirements.lock
  • <path>/build_report.json

If no manifest exists, lock infers dependencies from imports and writes .harden/state/requirements.inferred.txt as the lock input.

generate

harden generate <path> [--fail-on-critical]

Produces:

  • <path>/.harden/Dockerfile
  • <path>/.harden/sbom.json
  • <path>/.dockerignore (only if missing)

Behavior:

  • Uses requirements.lock when present (preferred)
  • Falls back to requirements.txt
  • If only pyproject.toml exists, installs the project (pip install .)

--fail-on-critical exits non‑zero if critical CVEs are detected.

OSV Cache Behavior

OSV responses are cached at: <path>/.harden/state/osv_cache.json

Default TTL: 24 hours. Override with:

export HARDEN_OSV_CACHE_TTL_SECONDS=0   # disable cache

Risk Scoring (high‑level)

  • Critical secrets: +20 each
  • Hardcoded AI keys: +25 each
  • Critical CVEs: +15 each
  • High‑severity issues: +8–10 each
  • Unpinned dependencies: +2 each

Risk levels:

  • 0–24: LOW
  • 25–49: MEDIUM
  • 50–74: HIGH
  • 75+: CRITICAL

Project Structure (OSS)

harden/
├── __init__.py
├── __main__.py
├── cli.py
├── locker.py
├── pipeline.py
├── analyzer/
│   ├── models.py
│   ├── detector.py
│   ├── secrets.py
│   ├── dependencies.py
│   ├── ai_usage.py
│   └── report.py
└── generators/
    ├── dockerfile.py
    └── sbom.py

Requirements

  • Python 3.8+
  • click >= 8.0.0
  • pyyaml >= 6.0
  • rich >= 13.0.0

License

Apache-2.0. See 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

harden-0.1.2.tar.gz (116.8 kB view details)

Uploaded Source

Built Distribution

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

harden-0.1.2-py3-none-any.whl (63.6 kB view details)

Uploaded Python 3

File details

Details for the file harden-0.1.2.tar.gz.

File metadata

  • Download URL: harden-0.1.2.tar.gz
  • Upload date:
  • Size: 116.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for harden-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e2fc1ed0605cf4b1c6872ecc8508cdb62c9f90fa100871ca232f733df1b16095
MD5 328a469df7bb69ec068f7f0e4fa6ede3
BLAKE2b-256 2ed434b2ee2fb33ae15536b2b4c89ee9f65e5bcd9e4e38d2a44bac65957e962a

See more details on using hashes here.

Provenance

The following attestation bundles were made for harden-0.1.2.tar.gz:

Publisher: publish.yml on vizopsai/harden

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file harden-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: harden-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 63.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for harden-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fb06dc6707495e46e2b55e4600687c01a7080ad51bb61e57590488902178bfc9
MD5 125dbaa55b183f3e1d8c7494dac455ff
BLAKE2b-256 ea7a6714bea9e52cfe89984f061cb2f4a99d535c848303c4b69b45453fa41d0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for harden-0.1.2-py3-none-any.whl:

Publisher: publish.yml on vizopsai/harden

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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