fix(ipc): require RX4_IPC_TOKEN for every non-ping method - #188
Merged
Merged
Conversation
Reject non-http(s) schemes, abbreviated/decimal IPv4 loopback, IPv6-mapped addresses, CGNAT, unique-local IPv6, and DNS-resolved private targets. Bound marketplace fetch timeouts/redirects. Enable rustls on the providers feature, bump rustls past RUSTSEC-2026-0285, allow CDLA-Permissive-2.0 for webpki-roots, and run cargo-deny in CI. Amp-Thread-ID: https://ampcode.com/threads/T-01a0a5f1-67fb-76fe-ac75-eae1b8f3a08a Co-authored-by: Max Carter <undivisible@vk.com>
state, messages, get_policy, and tools leaked agent/session data when the token env var was unset. Ping remains the only unauthenticated liveness method. Amp-Thread-ID: https://ampcode.com/threads/T-01a0a5f1-67fb-76fe-ac75-eae1b8f3a08a Co-authored-by: Max Carter <undivisible@vk.com>
|
Capy couldn't review this pull request because Max's workspace is out of credits, add credits or enable auto-reload to resume automatic reviews. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_2d3dbfcc-fe73-4ae3-9e6e-34b452530e9e) |
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.
Why
Unauthenticated Unix-socket IPC still served
state,messages,get_policy, andtoolswhenRX4_IPC_TOKENwas unset. Those methods leak policy, model, and conversation content to any local process that can open the 0600 socket.What
pingrequires a configured token.set_model,state,messages,get_policy, andtools.Tests
cargo test --no-default-features --features ipc --lib ipcNot merged: auth change; needs review. Rollback is a one-file revert.
Note
High Risk
Changes authentication on IPC, SSRF egress controls on web_fetch, and TLS/dependency policy for provider HTTP—areas where mistakes directly affect confidentiality and network safety.
Overview
This PR tightens several security-sensitive surfaces: Unix-socket IPC, agent
web_fetch, and outbound HTTP used by providers/marketplace.IPC now fails closed when
RX4_IPC_TOKENis unset: onlypingworks without a token; read-only methods likestate,messages,get_policy, andtoolsare rejected alongside mutators. Tests cover the expanded denial set.web_fetchgets a dedicatedreqwestclient with timeouts, a five-hop redirect cap, and redirect targets re-validated against the same blocklist. URLs must behttp/https; hosts are parsed with userinfo stripped correctly; literal and DNS-resolved addresses block loopback, private/link-local, metadata, CGNAT, abbreviated IPv4, and IPv6-mapped loopback. Unit tests exercise the new rules.Providers enable
reqwestrustls TLS (previously no TLS backend on that feature). Marketplace index fetch adds a 30s timeout and limited redirects. CI runscargo deny check;deny.tomlallows an extra license and documents a transitive unmaintained advisory.Breaking for local IPC hosts: anything that relied on unauthenticated read-only IPC must set
RX4_IPC_TOKENand passtokenin params.Reviewed by Cursor Bugbot for commit acef1e0. Configure here.