panel-firewall 0.1.0__tar.gz

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.
Files changed (92) hide show
  1. panel_firewall-0.1.0/FIREWALL.md +70 -0
  2. panel_firewall-0.1.0/GUARD_README.md +926 -0
  3. panel_firewall-0.1.0/KNOWN_ISSUES.md +54 -0
  4. panel_firewall-0.1.0/LICENSE +21 -0
  5. panel_firewall-0.1.0/MANIFEST.in +9 -0
  6. panel_firewall-0.1.0/PKG-INFO +106 -0
  7. panel_firewall-0.1.0/README.md +79 -0
  8. panel_firewall-0.1.0/SHOPIFY.md +161 -0
  9. panel_firewall-0.1.0/examples/mcp.json +12 -0
  10. panel_firewall-0.1.0/examples/policy.filesystem.yaml +16 -0
  11. panel_firewall-0.1.0/examples/policy.native.yaml +23 -0
  12. panel_firewall-0.1.0/examples/policy.sqlite-upstream.yaml +10 -0
  13. panel_firewall-0.1.0/panel_firewall/__init__.py +2 -0
  14. panel_firewall-0.1.0/panel_firewall/battery.py +137 -0
  15. panel_firewall-0.1.0/panel_firewall/chart.py +50 -0
  16. panel_firewall-0.1.0/panel_firewall/client.py +48 -0
  17. panel_firewall-0.1.0/panel_firewall/execute/__init__.py +1 -0
  18. panel_firewall-0.1.0/panel_firewall/execute/approval_page.py +106 -0
  19. panel_firewall-0.1.0/panel_firewall/execute/executor.py +258 -0
  20. panel_firewall-0.1.0/panel_firewall/execute/handoff.py +94 -0
  21. panel_firewall-0.1.0/panel_firewall/execute/store.py +112 -0
  22. panel_firewall-0.1.0/panel_firewall/execute/wiring.py +19 -0
  23. panel_firewall-0.1.0/panel_firewall/firewall/__init__.py +1 -0
  24. panel_firewall-0.1.0/panel_firewall/firewall/__main__.py +3 -0
  25. panel_firewall-0.1.0/panel_firewall/firewall/claims.py +335 -0
  26. panel_firewall-0.1.0/panel_firewall/firewall/cli.py +147 -0
  27. panel_firewall-0.1.0/panel_firewall/firewall/config.py +62 -0
  28. panel_firewall-0.1.0/panel_firewall/firewall/connector.py +34 -0
  29. panel_firewall-0.1.0/panel_firewall/firewall/connectors/__init__.py +0 -0
  30. panel_firewall-0.1.0/panel_firewall/firewall/connectors/mcp_upstream.py +114 -0
  31. panel_firewall-0.1.0/panel_firewall/firewall/connectors/shopify.py +75 -0
  32. panel_firewall-0.1.0/panel_firewall/firewall/connectors/sqlite_db.py +94 -0
  33. panel_firewall-0.1.0/panel_firewall/firewall/connectors/stripe.py +111 -0
  34. panel_firewall-0.1.0/panel_firewall/firewall/engine.py +212 -0
  35. panel_firewall-0.1.0/panel_firewall/firewall/gateway.py +466 -0
  36. panel_firewall-0.1.0/panel_firewall/firewall/init.py +133 -0
  37. panel_firewall-0.1.0/panel_firewall/firewall/ledger.py +184 -0
  38. panel_firewall-0.1.0/panel_firewall/firewall/policy.py +214 -0
  39. panel_firewall-0.1.0/panel_firewall/firewall/receipts.py +169 -0
  40. panel_firewall-0.1.0/panel_firewall/firewall/sqlguard.py +168 -0
  41. panel_firewall-0.1.0/panel_firewall/firewall/types.py +87 -0
  42. panel_firewall-0.1.0/panel_firewall/firewall/ui.py +135 -0
  43. panel_firewall-0.1.0/panel_firewall/guard/__init__.py +0 -0
  44. panel_firewall-0.1.0/panel_firewall/guard/_graph.py +194 -0
  45. panel_firewall-0.1.0/panel_firewall/guard/check.py +115 -0
  46. panel_firewall-0.1.0/panel_firewall/guard/data/orders_fictional.json +16 -0
  47. panel_firewall-0.1.0/panel_firewall/guard/data/policy_fictional_store.toml +98 -0
  48. panel_firewall-0.1.0/panel_firewall/guard/extract.py +277 -0
  49. panel_firewall-0.1.0/panel_firewall/guard/extract_v2.py +170 -0
  50. panel_firewall-0.1.0/panel_firewall/guard/extract_v31.py +228 -0
  51. panel_firewall-0.1.0/panel_firewall/guard/guard.py +100 -0
  52. panel_firewall-0.1.0/panel_firewall/guard/orders.py +42 -0
  53. panel_firewall-0.1.0/panel_firewall/guard/policy.py +93 -0
  54. panel_firewall-0.1.0/panel_firewall/guard/policy_form.py +171 -0
  55. panel_firewall-0.1.0/panel_firewall/guard/prove.py +64 -0
  56. panel_firewall-0.1.0/panel_firewall/guard/prove_compare.py +175 -0
  57. panel_firewall-0.1.0/panel_firewall/guard/prove_hosted.py +119 -0
  58. panel_firewall-0.1.0/panel_firewall/guard/prove_v5.py +53 -0
  59. panel_firewall-0.1.0/panel_firewall/guard/prove_v6.py +53 -0
  60. panel_firewall-0.1.0/panel_firewall/guard/prove_v7.py +130 -0
  61. panel_firewall-0.1.0/panel_firewall/guard/proxy.py +375 -0
  62. panel_firewall-0.1.0/panel_firewall/guard/server.py +174 -0
  63. panel_firewall-0.1.0/panel_firewall/guard/static/playground.html +105 -0
  64. panel_firewall-0.1.0/panel_firewall/guard/static/policy_form.html +121 -0
  65. panel_firewall-0.1.0/panel_firewall/guard/static/store.html +31 -0
  66. panel_firewall-0.1.0/panel_firewall/guard/static/widget.js +46 -0
  67. panel_firewall-0.1.0/panel_firewall/guard/v5.py +213 -0
  68. panel_firewall-0.1.0/panel_firewall/guard/v6.py +321 -0
  69. panel_firewall-0.1.0/panel_firewall/guard/v61.py +78 -0
  70. panel_firewall-0.1.0/panel_firewall/guard/v62.py +200 -0
  71. panel_firewall-0.1.0/panel_firewall/guard/v63.py +206 -0
  72. panel_firewall-0.1.0/panel_firewall/guard/v64.py +125 -0
  73. panel_firewall-0.1.0/panel_firewall/guard/v65.py +102 -0
  74. panel_firewall-0.1.0/panel_firewall/guard/v7.py +341 -0
  75. panel_firewall-0.1.0/panel_firewall/items.py +132 -0
  76. panel_firewall-0.1.0/panel_firewall/parse.py +25 -0
  77. panel_firewall-0.1.0/panel_firewall/pressure.py +66 -0
  78. panel_firewall-0.1.0/panel_firewall/run.py +57 -0
  79. panel_firewall-0.1.0/panel_firewall/shopify/__init__.py +2 -0
  80. panel_firewall-0.1.0/panel_firewall/shopify/actions.py +95 -0
  81. panel_firewall-0.1.0/panel_firewall/shopify/client.py +98 -0
  82. panel_firewall-0.1.0/panel_firewall/shopify/config.py +88 -0
  83. panel_firewall-0.1.0/panel_firewall/shopify/orders.py +93 -0
  84. panel_firewall-0.1.0/panel_firewall/web.py +156 -0
  85. panel_firewall-0.1.0/panel_firewall.egg-info/PKG-INFO +106 -0
  86. panel_firewall-0.1.0/panel_firewall.egg-info/SOURCES.txt +90 -0
  87. panel_firewall-0.1.0/panel_firewall.egg-info/dependency_links.txt +1 -0
  88. panel_firewall-0.1.0/panel_firewall.egg-info/entry_points.txt +2 -0
  89. panel_firewall-0.1.0/panel_firewall.egg-info/requires.txt +13 -0
  90. panel_firewall-0.1.0/panel_firewall.egg-info/top_level.txt +1 -0
  91. panel_firewall-0.1.0/pyproject.toml +41 -0
  92. panel_firewall-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,70 @@
1
+ # Panel action firewall: quickstart
2
+
3
+ Panel sits between an AI agent and its tools. Every tool call goes **intercept → verify → consent → execute (once) → log → receipt**.
4
+ The allow / needs_consent / block decision is plain deterministic code reading your YAML policy and the ledger. No model is
5
+ consulted when deciding.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ cd products/panel
11
+ python3.11 -m venv .venv && .venv/bin/pip install -e . pytest numpy
12
+ .venv/bin/usepanel keygen # Ed25519 receipt key -> ~/.config/panel/receipt_ed25519.pem (mode 600, refused inside a git repo)
13
+ ```
14
+ Panel **refuses to start without that key**. There is no default secret.
15
+
16
+ ## Wrap an existing MCP server with no code changes
17
+
18
+ ```bash
19
+ # 1. let Panel inspect the server and write a starter policy
20
+ .venv/bin/usepanel init --out policy.yaml -- npx -y @modelcontextprotocol/server-filesystem /srv/data
21
+ # 2. REVIEW policy.yaml (it is a heuristic: reads allowed, writes need approval, destructive/unknown blocked, money caps = 0)
22
+ # 3. run the proxy; point your MCP client at this command instead of at the server
23
+ .venv/bin/usepanel proxy --policy policy.yaml -- npx -y @modelcontextprotocol/server-filesystem /srv/data
24
+ ```
25
+
26
+ **Claude Code / any MCP client**: use `examples/mcp.json` (stdio `command` + `args`), or
27
+ `claude mcp add fs-via-panel -- /ABS/.venv/bin/usepanel proxy --policy /ABS/policy.yaml -- npx -y @modelcontextprotocol/server-filesystem /srv/data`.
28
+
29
+ ## Serve Panel's own connectors (SQLite, Stripe test mode, Shopify)
30
+
31
+ ```bash
32
+ .venv/bin/usepanel serve --policy examples/policy.native.yaml # tools: sql_query, stripe_refund, stripe_customer_credit
33
+ ```
34
+
35
+ ## Approving held actions (out-of-band only)
36
+
37
+ A call the policy marks `needs_consent` is **held**: it is not executed and the agent is told an approval id. Consent can only
38
+ come from a channel the agent's tool calls cannot reach:
39
+
40
+ ```bash
41
+ .venv/bin/usepanel pending --policy policy.yaml
42
+ .venv/bin/usepanel approve <id> --policy policy.yaml --who alice # or: usepanel deny <id>
43
+ .venv/bin/usepanel ui --policy policy.yaml # http://127.0.0.1:8765/?t=<token>, localhost only
44
+ ```
45
+ After approval the agent repeats the same call and it runs **once**. Fields like `consent: true` or `_meta` in the agent's
46
+ call are ignored (tested). Who and when are recorded in the ledger.
47
+
48
+ **Limit:** `usepanel approve` and the UI token are protected by your OS user, not by cryptography. If the agent has a shell as
49
+ the same user it can run `usepanel approve` itself. Run agents that have a shell under a separate OS user or sandbox.
50
+
51
+ ## Policy file
52
+
53
+ See `examples/` and the docstring at the top of `panel_firewall/firewall/policy.py` (rule keys: `allowed`, `risk`, `required_fields`,
54
+ `amount_field`, `max_amount`, `consent_over_amount`, `max_rows`, `consent_over_rows`, `protected`, `consent_if`, `block_if`,
55
+ `rate_limit`, `max_total_amount`, `sql_arg`, `path_args`, `allowed_roots`). Typos in rule keys are errors, not silent no-ops.
56
+ Unlisted tools are blocked. Modes: `dry_run` (nothing executes), `approval` (every non-read action needs a human), `auto`.
57
+
58
+ ## Receipts
59
+
60
+ Each executed or blocked action gets a signed receipt in the ledger. `usepanel export-receipts --out r.json`, then
61
+ `usepanel verify-receipt one.json --pubkey ~/.config/panel/receipt_ed25519.pem.pub --policy policy.yaml`.
62
+ A receipt proves **what Panel checked and decided** and that the record **was not altered**. It is **not** a proof the action was safe.
63
+
64
+ ## Idempotency
65
+
66
+ Key = the explicit `_meta["panel/idempotency_key"]` if the client sends one, else `sha256(session + tool + arguments)`.
67
+ The same key never executes twice; a repeat returns the recorded result. Only a successful upstream call is recorded as executed;
68
+ failed calls can be retried; a timeout (outcome unknown) is **not** retried automatically. Read tools (`risk: read`) are never deduplicated.
69
+ Consequence to know about: an *intentionally* repeated identical write in one session looks like a retry. Give such calls different
70
+ idempotency keys.