Skip to main content

Split-key reverse proxy that makes leaked API keys worthless

Project description

Worthless

Make leaked API keys worthless.

Python 3.10+ License: AGPL-3.0 Tests

Your API key is split into two pieces. Neither piece is useful on its own. Every request goes through a proxy that enforces a hard spend cap before the key ever reconstructs. Budget blown = key never forms = request never reaches the provider.

Every secrets tool protects the key until your app uses it. Worthless protects you after it leaks.

Quickstart

pipx install worthless
cd your-project
worthless

That's it. Worthless detects API keys in your .env, splits them, starts a local proxy, and you're protected.

$ worthless

  Found 2 API keys:
    OPENAI_API_KEY      openai
    ANTHROPIC_API_KEY   anthropic

  Lock these keys? [y/N] y

  Protecting OPENAI_API_KEY...      done
  Protecting ANTHROPIC_API_KEY...   done

  Starting proxy on 127.0.0.1:8787...   healthy

  Proxy healthy on 127.0.0.1:8787

Your code doesn't change. The proxy handles everything.

Alternative install

pip install worthless        # in a virtualenv

How it works

  1. worthless lock splits each API key into two shards using XOR
  2. Shard A stays on your machine (encrypted). Shard B goes to the proxy database.
  3. Your .env is rewritten with shard-A (format-preserving — looks like a real key but is cryptographically useless alone)
  4. The proxy reconstructs the key only when the rules engine approves the request
  5. Spend cap blown? The key never forms. The request never reaches the provider.

Commands

worthless              # Auto-detect, lock, start proxy (the magic)
worthless lock         # Lock keys in .env
worthless unlock       # Restore original keys
worthless scan         # Detect exposed keys without locking
worthless status       # Show proxy and key status
worthless up           # Start proxy (foreground)
worthless up -d        # Start proxy (background daemon)
worthless down         # Stop the proxy
worthless wrap <cmd>   # Run a command through the proxy
worthless revoke       # Revoke enrolled keys

Undo everything

$ worthless unlock
1 key(s) restored.

Original key is back. No trace.

Pre-commit hook

repos:
  - repo: https://github.com/shacharm2/worthless
    rev: main
    hooks:
      - id: worthless-scan

For AI coding agents

Worthless ships a SKILL.md that tells Claude Code, Cursor, and Windsurf what commands are available. Agents use --json for structured output:

worthless status --json

Development

git clone https://github.com/shacharm2/worthless && cd worthless
uv sync --extra dev --extra test
uv run pytest

Learn more

Contributing

PRs welcome. Read SECURITY_RULES.md first.

License

AGPL-3.0

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

worthless-0.3.0.tar.gz (254.4 kB view details)

Uploaded Source

Built Distribution

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

worthless-0.3.0-py3-none-any.whl (93.4 kB view details)

Uploaded Python 3

File details

Details for the file worthless-0.3.0.tar.gz.

File metadata

  • Download URL: worthless-0.3.0.tar.gz
  • Upload date:
  • Size: 254.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for worthless-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e9999f341f52fb57646cc3546ddfb3f81c4663efb4493e8a5788112ff8d63cb1
MD5 535beb32b2e243ad8f2a42178f4c3c1f
BLAKE2b-256 27860497d2a6f284368aa06a789de397bea661d8deea6bbfe1f7f27ddf589b62

See more details on using hashes here.

Provenance

The following attestation bundles were made for worthless-0.3.0.tar.gz:

Publisher: publish.yml on shacharm2/worthless

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

File details

Details for the file worthless-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: worthless-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 93.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for worthless-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 394dbf797fa11b0e9bb2f9bf58ac03dcf021ede5cfc121ad99f43f2831826c52
MD5 4c251469a77941ef8a3b61b3ad9362c8
BLAKE2b-256 9268c0f8cfee33fc4da4ef4ce34e031d51e3c035a75e8357ccc50c0d4225b563

See more details on using hashes here.

Provenance

The following attestation bundles were made for worthless-0.3.0-py3-none-any.whl:

Publisher: publish.yml on shacharm2/worthless

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