Metadata-Version: 2.4
Name: plysec
Version: 0.1.0
Summary: Zero-Trust CBOM & Post-Quantum Crypto-Agility Scanner + Policy-Driven Matryoshka AEAD Vault SDK
Author: PlySec Security
License: Apache-2.0
Keywords: cryptography,post-quantum,cbom,cyclonedx,crypto-agility,security-scanner,aead,sarif
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: cryptography>=42.0.0
Requires-Dist: rich>=13.7.0
Requires-Dist: typer>=0.12.0
Requires-Dist: pyyaml>=6.0.1
Requires-Dist: fastapi>=0.111.0
Requires-Dist: pydantic>=2.7.0
Provides-Extra: dev
Requires-Dist: pytest>=8.2.0; extra == "dev"
Requires-Dist: httpx>=0.27.0; extra == "dev"
Requires-Dist: uvicorn>=0.30.0; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"

# PlySec

**Stop Hardcoding Math That Breaks. Audit Your Repo's Crypto-Agility in 10 Seconds.**

PlySec is an open-source **Zero-Trust CBOM Scanner, Post-Quantum Exposure Auditor, and Policy-Driven "Matryoshka" Crypto-Agility SDK**.

Modern breaches and cryptographic failures don't just come from `MD5` or `RSA-1024`. Following **November 2026 CIRG & Post-Quantum Crypto-Agility advisories**, deploying un-hybridized Post-Quantum primitives (`ML-KEM` / `Kyber` without classical `X25519`/`ECDH` fallback) creates a dangerous **PQC Single-Point-of-Failure**â€”while scattering raw cryptographic library imports across business logic creates crippling **Agility Debt**.

PlySec solves both in one workflow:
1. **Audit (`plysec scan`)**: AST + multi-language scanner computes your **Crypto-Agility Score (0â€“100)**, estimates remediation engineering hours, and exports a **CycloneDX 1.6 CBOM JSON**.
2. **Abstract (`plysec.Vault`)**: Write `Vault.protect(data)` and `Vault.unprotect(token)` once. Hot-swap nested AEAD layers (`AES-256-GCM` braided with `ChaCha20-Poly1305` via `HKDF-SHA256`) and rotate key versions declaratively in `plysec.yaml`â€”zero business-logic rewrites.

---

## Quickstart

### 1. Install the CLI & SDK

```bash
pip install plysec
```

*(For local development from source: `pip install -e ".[dev]"`)*

### 2. Audit a Repository

```bash
plysec scan ./demo_vulnerable_app
```

Export a CycloneDX-compatible Cryptographic Bill of Materials (CBOM) and enforce CI gates:

```bash
plysec scan ./demo_vulnerable_app --cbom cbom.json --fail-under 70
```

### 3. Replace Hardcoded Crypto with `plysec.Vault`

Create a `plysec.yaml` policy (`plysec init`):

```yaml
version: 1
active_key_version: "v2"
layers:
  - "aes-256-gcm"
  - "chacha20-poly1305"
keys:
  v1: "env:PLYSEC_MASTER_KEY_V1"
  v2: "env:PLYSEC_MASTER_KEY_V2"
```

Use the SDK once in application code:

```python
from plysec import Vault

vault = Vault.from_yaml("plysec.yaml")
token = vault.protect(b"sensitive customer payload")
plaintext = vault.unprotect(token)
```

Need to rotate keys (`v2` â†’ `v3`) or reverse/upgrade the cipher braid? Update `plysec.yaml`â€”`Vault.unprotect()` automatically inspects the authenticated envelope header to peel legacy layers and key versions with zero downtime.

---

## What PlySec Detects

| Severity | Category | Examples |
|---|---|---|
| **CRITICAL** | Broken Primitives & Hardcoded Secrets | `MD5`, `SHA1`, `DES`, `3DES`, `RC4`, `RSA-1024`, hardcoded PEM private keys & literal AES/JWT secrets |
| **HIGH** | PQC Single-Point-of-Failure & Legacy Asymmetric | Standalone `ML-KEM` / `Kyber` without `X25519`/`ECDH` hybrid fallback (CIRG Nov 2026), `RSA-2048`, static `ECDSA` |
| **AGILITY_DEBT** | Scattered Crypto Coupling | Direct `hashlib`/`cryptography`/`node:crypto` imports spread across multiple business-logic files |

Supported languages & configs: **Python (AST + rules), TypeScript/JavaScript, Go, Java, Rust, YAML, JSON, and `.env`**.

---

## Web App & Interactive Scanner

PlySec also ships a FastAPI serverless backend (`api/index.py`) and dark-mode interactive browser scanner (`public/index.html`) ready for Vercel deployment:

- `POST /api/scan` â€” Instant browser-based Crypto-Agility Score + CycloneDX CBOM export
- `GET /api/samples` â€” Pre-loaded vulnerable microservices for instant testing
- `GET /api/health` â€” Service health & engine metadata

Run locally:

```bash
uvicorn api.index:app --reload
```

---

## License

Apache-2.0
