piton-cli 0.4.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,192 @@
1
+ Metadata-Version: 2.4
2
+ Name: piton-cli
3
+ Version: 0.4.2
4
+ Summary: Piton — Lockfile and static supply-chain scanner for MCP servers, Claude Code hooks, and Cursor rules
5
+ Author: Bright Onwe
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Tony-Stark2025/piton
8
+ Project-URL: Repository, https://github.com/Tony-Stark2025/piton
9
+ Project-URL: Issues, https://github.com/Tony-Stark2025/piton/issues
10
+ Keywords: piton,mcp,ai-agents,claude-code,cursor,security,envoy,ext-proc,supply-chain,ci-cd
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: pydantic>=2.6.0
15
+ Requires-Dist: pyyaml>=6.0.1
16
+ Provides-Extra: dev
17
+ Requires-Dist: pytest>=8.1.0; extra == "dev"
18
+ Requires-Dist: pytest-asyncio>=0.23.5; extra == "dev"
19
+ Dynamic: license-file
20
+
21
+ # Piton
22
+
23
+ **Lockfile and static supply-chain scanner for MCP servers, Claude Code hooks, and Cursor rules.**
24
+
25
+ > Don't wrap your agents in a probabilistic prompt firewall. Hammer deterministic split-hash pins into every MCP tool, Claude/Cursor hook, and schema.
26
+
27
+ ![Piton CLI Live Demo — piton scan, piton init, piton lock --diff, and piton replay exporting Cedar](docs/piton_demo.gif)
28
+
29
+ Every AI coding agent (`Claude Code`, `Cursor`, `Claude Desktop`, `OpenCode`) now pulls unpinned third-party MCP tool descriptions, executes `.claude/settings.json` shell hooks, and ingests `.cursor/rules` / skill markdown files straight into privileged developer sessions. One silent upstream description edit (an MCP rug pull) or a malicious PR hook turns your repo into instant RCE.
30
+
31
+ **Piton** gives you a 30-second deterministic lockfile and PR gate—and scales all the way to shadow-to-enforce policy replay (`CEL`/`Cedar` export) and a production Go Envoy v3 `ext_proc` sidecar.
32
+
33
+ ---
34
+
35
+ ## 30-Second Quickstart
36
+
37
+ Slim Python CLI — **only 2 runtime dependencies (`pydantic` + `pyyaml`)**:
38
+
39
+ ```bash
40
+ # Zero-install instant scan (works anywhere with uv):
41
+ uvx piton-cli scan --repo .
42
+
43
+ # Or install permanently via pipx / pip:
44
+ pipx install piton-cli # or: pip install piton-cli
45
+
46
+ # 1. Zero-config scan: catches .claude/settings.json hook RCE, .vscode/tasks.json folderOpen autorun,
47
+ # malicious STDIO MCP commands, and hidden-Unicode / prompt-injection poisoning in .cursor/rules & CLAUDE.md
48
+ piton scan --repo .
49
+
50
+ # 2. Pin every MCP server with split SHA-256 hashes (probing live HTTP/SSE & STDIO servers)
51
+ # Quarantines Day-1 poisoned tools before writing piton.yaml + piton.lock
52
+ piton init --repo . --probe
53
+
54
+ # 3. Wrap any local STDIO MCP server in Cursor / Claude Code to block live rug pulls & over-bounds calls
55
+ piton wrap --enforce --server github -- npx -y @modelcontextprotocol/server-github
56
+ ```
57
+
58
+ ### Drop Into Any Repo in 5 Lines of GitHub Actions
59
+
60
+ ```yaml
61
+ - name: Piton — AI Agent Supply-Chain & MCP Lockfile Gate
62
+ uses: Tony-Stark2025/piton@v0.4.2
63
+ with:
64
+ scan-only: "true" # or `probe: "true"` / `manifest: observed_tools.json` for MCP lockfile diffs
65
+ ```
66
+
67
+ Fails pull requests loudly on:
68
+ - **Third-party MCP rug pulls** (`description_sha256` drift on `third_party` servers)
69
+ - **Structural `inputSchema` drift** (`structural_sha256` drift on **all** servers—while `internal` docstring edits only warn so you never break deploys)
70
+ - **Cross-server tool shadowing** (duplicate tool names across distinct MCP servers)
71
+ - **Day-1 MCP tool poisoning** (NFKC homoglyphs, zero-width/bidi Unicode, covert tags, exfil directives)
72
+ - **Coding-agent config RCE** (`.claude/settings.json` `curl|sh` / reverse shell / credential-harvesting hooks, unsafe `Bash(*)` wildcards, `.vscode/tasks.json` `folderOpen` autorun, poisoned `.cursor/rules` & skill files)
73
+
74
+ ---
75
+
76
+ ## Why Split-Hash Pinning + Shadow Replay?
77
+
78
+ 1. **Split-Hash Lockfiles (`structural_sha256` vs `description_sha256`)** — Naive single-hash pinning breaks CI every time an internal team fixes a typo in a docstring. Piton separates machine contract hashes (`name` + structural `inputSchema`, always hard-blocked) from prose hashes (`description` + property descriptions: hard-blocked on `third_party` MCPs, warning-only on `internal` MCPs unless poisoning lint triggers).
79
+ 2. **Shadow-to-Enforce Policy Calibration (`piton replay`)** — The #1 reason teams disable agent security proxies is false blocks and hand-writing policy. Piton records **PII-preserving tokenized traces** (`alice@acme.com` → `tok_8f1a2b3c@acme.com`, keeping domains and numeric ceilings replayable without storing raw PII) OR ingests existing **OpenTelemetry (OTel) JSONL spans**, replays them offline to compute exact false-block rates, and exports calibrated policies straight to your existing gateway:
80
+
81
+ ```bash
82
+ # Calibrate bounds offline against shadow traces or OTel spans until false-block rate = 0%
83
+ piton replay --config piton.yaml --traces .piton/traces.jsonl --simulate-enforce
84
+
85
+ # Export calibrated policies directly to agentgateway (CEL) or ToolHive / AWS AgentCore (Cedar)
86
+ piton replay --config piton.yaml --traces .piton/traces.jsonl --export cel
87
+ piton replay --config piton.yaml --traces .piton/traces.jsonl --export cedar
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Try the 60-Second End-to-End Local Demo
93
+
94
+ Runs live Day-1 poisoning quarantine, zero-secret `/gw` egress key swapping + chunk-boundary response secret scrubbing, shadow recording, Go↔Python HMAC ledger verification, and `replay` calibration with zero external API keys:
95
+
96
+ ```bash
97
+ git clone https://github.com/Tony-Stark2025/piton.git
98
+ cd piton
99
+ python3 -m venv .venv && source .venv/bin/activate
100
+ pip install -e ".[dev]"
101
+ bash examples/quickstart-billing-agent/run_demo.sh
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Enterprise Runtime & Gateway Integration
107
+
108
+ When you move from local coding agents and CI gates into production multi-agent Kubernetes fleets, Piton includes a **hardened static Go sidecar** (`sidecar/`, prebuilt multi-arch binaries + distroless GHCR image) and a **zero-dependency Control Plane**:
109
+
110
+ ```text
111
+ [ Repo / CI ] ──► piton scan + piton init --probe ──► piton.yaml + piton.lock
112
+ │
113
+ [ Envoy / agentgateway / Agent ] ◄──► [ Go Sidecar (Envoy v3 ext_proc gRPC + /mcp + /gw) ]
114
+ • RS256/ES256 OIDC JWKS + RFC 8693 OBO (`sub`/`act`)
115
+ • Live tools/list Rug-Pull Pin (`BodyMutation` -32001)
116
+ • Declarative Response Projection (token & exfil reduction)
117
+ • MCP 2026-07-28 MRTR `input_required` + signed approval retry
118
+ • Optional Redis/Valkey shared 1h budgets across K8s replicas
119
+ • Sliding-window multi-encoding secret scrubber
120
+ │
121
+ ▼
122
+ [ Piton Control Plane (`piton control-plane`) ]
123
+ • Slack Block Kit & Web UI MRTR Approval Bridge
124
+ • Multi-Pod Signed Ledger Collector (Go↔Python HMAC)
125
+ • Per-Agent Shadow→Enforce Readiness Scorecards
126
+ • Tamper-Evident Signed SOC2 / EU AI Act Audit Export
127
+ ```
128
+
129
+ ### Kubernetes + Envoy Gateway Deployment (Helm)
130
+
131
+ ```bash
132
+ helm install piton-sidecar ./deploy/helm/piton-sidecar \
133
+ --set image.repository=ghcr.io/tony-stark2025/piton-sidecar \
134
+ --set secrets.existingSecret=piton-sidecar-keys \
135
+ --set redis.enabled=true \
136
+ --set redis.addr=redis-master.default.svc.cluster.local:6379 \
137
+ --set controlPlane.collectorUrl=http://piton-control-plane:8090 \
138
+ --set envoyGateway.enabled=true \
139
+ --set envoyGateway.targetRef.name=mcp-agents-route
140
+ ```
141
+
142
+ ### Real Envoy Proxy v1.33 Wire E2E Harness
143
+
144
+ Every commit is verified in CI against a live `envoyproxy/envoy:v1.33-latest` container wired to our distroless Go sidecar over HTTP/2 gRPC `ext_proc`:
145
+
146
+ ```bash
147
+ cd deploy/envoy-e2e
148
+ docker compose up -d --build
149
+ python3 verify_envoy_e2e.py
150
+ docker compose down -v
151
+ ```
152
+
153
+ ### Enterprise Control Plane (MRTR Slack/Web Approval Bridge + Fleet Ledger)
154
+
155
+ ```bash
156
+ # Terminal 1: Start central Governance UI, Fleet Ledger Collector & MRTR Slack/Web Approval Bridge
157
+ PITON_LEDGER_SIGNING_KEY="dev-secret-key-32-bytes-minimum" \
158
+ piton control-plane --host 127.0.0.1 --port 8090
159
+
160
+ # Terminal 2: Run agent with zero real secrets in env, streaming telemetry & escalations to Control Plane
161
+ PITON_LEDGER_SIGNING_KEY="dev-secret-key-32-bytes-minimum" \
162
+ piton run --collector-url http://127.0.0.1:8090 -- python my_agent.py
163
+ ```
164
+
165
+ ---
166
+
167
+ ## CLI Reference
168
+
169
+ ```bash
170
+ piton scan --repo . # Scan Claude/Cursor hooks, tasks, rules & skills
171
+ piton init --repo . [--probe] [--manifest tools.json] # Generate piton.yaml (shadow), piton.lock & .env.agent
172
+ piton lock --diff [--probe | --manifest tools.json] # PR gate: split-hash drift + shadowing + hook RCE
173
+ piton lock --update [--probe | --manifest tools.json] # Refresh approved lockfile hashes after review
174
+ piton wrap --server <name> -- <stdio-mcp-cmd> # Runtime STDIO pin & bounds for Cursor / Claude Code
175
+ piton replay --simulate-enforce [--export cel|cedar] # Calibrate bounds from ledger or OTel spans
176
+ piton run [--collector-url URL] -- <agent-cmd> # Zero-secret local agent runner (auto-fetches sidecar)
177
+ piton top --traces .piton/traces.jsonl [--follow] # Live PII-tokenized flight recorder
178
+ piton ledger-verify --traces .piton/traces.jsonl # Verify Go↔Python HMAC chain integrity
179
+ piton control-plane --host 127.0.0.1 --port 8090 # Fleet ledger collector, MRTR bridge & SOC2 export UI
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Running All Tests
185
+
186
+ ```bash
187
+ # Go sidecar race tests (Envoy v3 gRPC ext_proc, OIDC RS256/ES256, Redis store, Response Projection)
188
+ (cd sidecar && go test -race -v ./...)
189
+
190
+ # Python supply-chain, live MCP probe/wrap, Control Plane E2E & cross-language Go↔Python suites
191
+ pytest tests/ -v
192
+ ```
@@ -0,0 +1,19 @@
1
+ piton/__init__.py,sha256=MMoeaOhhyi-P_w-zAFOi9N6GB-3wViphpkFhKZrNfwI,139
2
+ piton/cli.py,sha256=jV5RnnxH12Gg0JzV6tUlkfG_n0E2e_lEqUton9MOA2A,31369
3
+ piton/control_plane/__init__.py,sha256=JXmxvB4i0EoO1RYTyKrBGlLmlWjMdFmmQ7HU3-Z9xyU,477
4
+ piton/control_plane/server.py,sha256=Ip6i9sv8-7sHa33kvn1RuDWe3vkVFCa4PpauPR497hI,19287
5
+ piton/control_plane/store.py,sha256=Ipqon-GyZDgEiy2SmCrIU837Cq0P681Oc4LniLuz9Ic,21229
6
+ piton/iac/__init__.py,sha256=WL9rutTGNEvrHF1AtHWc44BedOlNlUan4_tdYsFMe9M,784
7
+ piton/iac/agent_config_lint.py,sha256=oWWT-y14uUc45wdgIpd13UYEWkOJmUhtdRVwN8FIHzE,17744
8
+ piton/iac/lockfile.py,sha256=rpmDU37y9dJZRVfHmU_mi27-lzw_tumhqKuibsIdtWU,18025
9
+ piton/iac/mcp_probe.py,sha256=8TW3JVqhuzWHm4cVUP9p39UIXqQzxm05TGjWzyXOmMk,21242
10
+ piton/iac/poisoning_lint.py,sha256=YF5t0G79NMoX7dTSJsru42fULvz_Jik53cO2pqYqevE,7989
11
+ piton/iac/replay.py,sha256=SESx96wCcpD4Nji7723Dwh4t4Y52tAMGr-HGJaz61Xo,38960
12
+ piton/iac/scanner.py,sha256=fOaPGmiMdpPohG1qB15tkgRdp4jVoRPrZtmBc9Ogpss,13596
13
+ piton/iac/schema.py,sha256=f4ioieOUVFoVWgoxh2C0mbl98OXBbrHD6RzVKXJFBKE,10016
14
+ piton_cli-0.4.2.dist-info/licenses/LICENSE,sha256=qcnMe3nUMSe0FTeDstmhX2lvR6tn3-bVNrY3TJ085A0,1085
15
+ piton_cli-0.4.2.dist-info/METADATA,sha256=2b3GL0D4464DAetnXUbPN0f2XtJCpERKqFr3uGrZbU8,10084
16
+ piton_cli-0.4.2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
17
+ piton_cli-0.4.2.dist-info/entry_points.txt,sha256=bo6udY1PBfK15hgPr0mP_H7b0cuZDQk_a3SQYOYrwr0,68
18
+ piton_cli-0.4.2.dist-info/top_level.txt,sha256=Mme-cLjBKsrAtBEAWplEls7qrCnz4f1z4PfNmFyk8wg,6
19
+ piton_cli-0.4.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ piton = piton.cli:main
3
+ piton-cli = piton.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bright Onwe (Tony-Stark2025)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ piton