Commit 70e452f
committed
fix(approval): neutralize attach markers in /approvals listing [ANAI-82]
Folds in the live twin security-openfang traced during the ad01939 re-read.
`list_approvals_text` built the queue listing from raw agent-controlled fields
(agent_id, tool_name, action_summary) and returns through send_parsed →
outbound_attach::parse — the same sink as the proactive prompt. A pending
request carrying an `<openfang:attach …/>` marker in its summary would be
stripped-and-caption-promoted at the exact moment an operator runs /approvals
to decide. Same integrity hole, pull instead of push.
- Extracted the composition into a pure `render_pending_approvals(&[..])` (no
kernel/IO) so the invariant is unit-testable, mirroring the kernel-side
approval_push_target/surface split.
- Runs the three agent-controlled fields through the shared
outbound_attach::neutralize_markers (landed in ad01939). id_short / risk_level
/ age are system-controlled and left as-is.
- list_approvals_text is now a one-line delegate.
Test (1 new): approvals_listing_neutralizes_attach_markers — a queued request
with a marker+caption in action_summary → render → parse asserts NoMarkers and
the opener stays escaped (verbatim, not stripped/promoted).
Both attach-marker surfaces (proactive push + pull listing) are now closed by
the one shared neutralizer.
Verified: clippy -p openfang-api -D warnings clean; the new test green; my
lines fmt-clean. Held for security-openfang's mechanical re-read before merge.1 parent ad01939 commit 70e452f
1 file changed
Lines changed: 70 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
681 | 681 | | |
682 | 682 | | |
683 | 683 | | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
| 684 | + | |
708 | 685 | | |
709 | 686 | | |
710 | 687 | | |
| |||
2034 | 2011 | | |
2035 | 2012 | | |
2036 | 2013 | | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
2037 | 2053 | | |
2038 | 2054 | | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
2039 | 2085 | | |
2040 | 2086 | | |
2041 | 2087 | | |
| |||
0 commit comments