Repository navigation
Commit 2378d37
feat(prompts): per-prompt rug-pull baseline MVP (spec 100) (#1010)
Implements the core of spec 100 (merged in #1009): the tool-quarantine
(Spec 032) analogue for aggregated upstream prompts. A trusted server that
passes admission with a benign prompt and later mutates its advertised metadata
is now caught and the changed prompt is WITHHELD from prompts/list until
approved — closing the last F2 gap from the PR #973 review.
Scope (metadata only): the baseline hashes advertised LIST metadata
(name + description + arguments); get-time prompts/get message content is
inherently not baselineable here (spec Non-Goals) and stays defended by the
existing F2 sanitisation + F12 caps.
- storage: parallel PromptApprovalRecord + prompt_approvals bucket + CRUD
(+ Manager wrappers), mirroring the tool ops 1:1 — NOT a ToolApprovalRecord
overload (the server:tool / server:prompt key spaces would collide).
- engine (internal/server/prompt_quarantine.go): calculatePromptApprovalHash
(sha256(name|desc|normalizeJSON(args)), excludes Meta/Title), checkPromptApprovals
with the pending/changed/approved state machine + baseline-pass + QuarantineEnabled
kill-switch + TrustMode/AutoApproveToolChanges reuse, a fail-closed
enforcePromptInvariant transition spine, filterBlockedPrompts, and the
ApprovePrompt/ApproveAllPrompts mutators (which re-baseline + RefreshPrompts()).
- hook: checkPromptApprovals + filterBlockedPrompts run in RefreshPrompts after
the TPA scan-and-drop, before registration. Withholding IS the block — a prompt
never passed to SetPrompts is absent from prompts/list and fails prompts/get
natively, so there is no runtime get-time gate.
Tests: hash stability/change, fail-closed invariant, first-seen→pending,
approve→registered, rug-pull change→withheld→revert→re-approved, trust=auto
auto-approve, ApproveAllPrompts, and a full-RefreshPrompts withholding integration
test. Existing aggregation tests set quarantine off (they verify aggregation, not
the baseline).
Deferred to a follow-up: the quarantine_security MCP ops
(inspect_prompts/approve_prompt/approve_all_prompts), REST twins, and the Vue
review banner — the approve API (ApprovePrompt/ApproveAllPrompts) is ready to
wire. Adding the MCP tool-schema op requires regenerating the 3 frozen
tool-surface goldens, done deliberately in that PR.
Claude-Session: https://claude.ai/code/session_01H7J8Yv5zr4tMQZaY3ot3Za
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent b46505a commit 2378d37
7 files changed
Lines changed: 740 additions & 2 deletions
File tree
- internal
- server
- storage
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
795 | 795 | | |
796 | 796 | | |
797 | 797 | | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
798 | 805 | | |
799 | 806 | | |
800 | 807 | | |
801 | | - | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
802 | 811 | | |
803 | 812 | | |
804 | 813 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
948 | 948 | | |
949 | 949 | | |
950 | 950 | | |
| 951 | + | |
| 952 | + | |
951 | 953 | | |
952 | 954 | | |
953 | 955 | | |
| |||
975 | 977 | | |
976 | 978 | | |
977 | 979 | | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
978 | 1020 | | |
979 | 1021 | | |
980 | 1022 | | |
| |||
1028 | 1070 | | |
1029 | 1071 | | |
1030 | 1072 | | |
| 1073 | + | |
| 1074 | + | |
1031 | 1075 | | |
1032 | 1076 | | |
1033 | 1077 | | |
| |||
1085 | 1129 | | |
1086 | 1130 | | |
1087 | 1131 | | |
| 1132 | + | |
| 1133 | + | |
1088 | 1134 | | |
1089 | 1135 | | |
1090 | 1136 | | |
| |||
0 commit comments