fix: harden Anthropic proxy shape guard - #32
Merged
Conversation
Caller-audit: Sources/PastewatchCLI/LaunchCommand.swift:216 -- updated Sources/PastewatchCLI/LaunchCommand.swift:277 -- updated Tests/PastewatchTests/LaunchCommandTests.swift:60 -- unaffected default quiet argument preserves direct test call Sources/PastewatchCore/ProxyServer.swift:738 -- updated Sources/PastewatchCore/ProxyServer.swift:743 -- updated Tests/PastewatchTests/ProxyAlertTests.swift:222 -- updated Tests/PastewatchTests/ProxyAlertTests.swift:242 -- updated Sources/PastewatchCore/ProxyServer.swift:119 -- unaffected additive stats field Sources/PastewatchCore/ProxyServer.swift:695 -- updated Tests/PastewatchTests/ProxyRealServerTests.swift:572 -- updated
Caller-audit: Sources/PastewatchCore/ProxyServer.swift:707 -- updated Sources/PastewatchCore/ProxyServer.swift:1127 -- unaffected Sources/PastewatchCore/ProxyServer.swift:1204 -- updated Tests/PastewatchTests/ProxyBodyShapeGuardTests.swift:24 -- updated Tests/PastewatchTests/ProxyRealServerTests.swift:685 -- updated
Caller-audit: Sources/Pastewatch/ClipboardMonitor.swift:126 -- unaffected Sources/PastewatchCLI/GuardCommand.swift:43 -- unaffected Sources/PastewatchCLI/ScanCommand.swift:155 -- unaffected Sources/PastewatchCore/SocketHelpers.swift:117 -- unaffected Sources/PastewatchCore/ProxyServer.swift:750 -- updated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary\n- fail closed on unsupported methods and malformed request shapes while preserving valid Anthropic-compatible gateway paths\n- treat model identity as advisory so any provider speaking the Anthropic wire shape remains supported\n- route request mutation through one evidence-aware gateway: exact provider formats, known values, and operator rules authorize replacement\n- scan contract fields without rewriting uncertain built-in matches; scan tool input examples and stop sequences under the same policy\n- detect standalone provider tokens and contain complete structured secrets without overcapturing adjacent content\n- tighten legacy Vault token grammar so code-like dotted identifiers are never mutated\n- fail closed on malformed private-key containers, invalid routed-proxy custom rules, and request-body serialization failures\n- let non-routed agents launch without validating proxy rules they do not consume\n- harden launch loopback cleanup, termination handling, refusal accounting, and disconnect logging\n- document evidence-based mutation scope and one-way proxy versus reversible MCP behavior\n\n## Work orders\nImplemented: WO-275, WO-410, WO-419, WO-422-WO-430, WO-436-WO-458, WO-461-WO-463, WO-465-WO-470, WO-472, WO-473, WO-478-WO-488, WO-491, WO-494, WO-495.\n\nReviewed and rejected as invalid or already covered: WO-489, WO-490, WO-492, WO-493, WO-496, WO-497, WO-498.\n\n## Verification\n- 954 Swift tests pass locally\n- mutation authorization, provider-pattern, containment, shape-guard, launch, and real-TCP regressions pass\n- debug build passes\n- SwiftLint strict reports 0 violations\n- GitHub CI is running on the current head\n