Repository navigation
fix: SDK credential hygiene in HTTP wrappers and tools client [SAP-4383] - #1267
antoine-berger wants to merge 21 commits into
Conversation
…4383] Sapiom-Identity is only attached over https (or http to a loopback host), and the shared cross-origin drop list now includes it. Adds fetchDroppingIdentityCrossOrigin, sanitizeFactHeaders and redactUrlForFacts for the HTTP wrappers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Resolve the target with getUri, honour __sapiom.enabled === false, drop Sapiom-Identity on cross-origin redirects, and record transaction facts through the shared redaction helpers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…in [SAP-4383] Read __sapiom from the Request or init before copying the request, so the documented per-request opt-out and overrides take effect. Send through fetchDroppingIdentityCrossOrigin, including the paid retry, and record transaction facts through the shared redaction helpers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… [SAP-4383] Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…t [SAP-4383] Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
/devin review |
|
Caution Review failedThe pull request is closed. Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…he identity path [SAP-4383] Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…383] Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ts new destination [SAP-4383] Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…383] Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…entity path [SAP-4383] The first hop is now the caller's Request itself with `redirect: "manual"`, so its body streams and keepalive works as with `fetch`. Only a redirect rebuilds the request; a 307/308 resends the body from the clone already taken for the 402 retry. Integrity is checked on the final response. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…p [SAP-4383] A non-empty init resets a Request's referrer and referrer policy, so the first hop now passes them back explicitly. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…URL [SAP-4383] Through a forward proxy the absolute target URL is in `path`, so a caller hook that rewrites only `path` now counts as a retarget. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Thanks for the thorough work on this, Antoine. We're going to pass on this one for now. The gap is real but narrow: it needs a user to open or run a project they chose to clone, on a surface (Studio / the local dev tooling) that isn't core product today. Against that, the change adds behaviour developers and customers will notice, and the cost of reviewing, releasing and supporting it is higher than the risk it removes. We'd rather keep the security effort on the server-side gaps (billing scope, payment replay, OAuth, auth claims), which are approved. Please close this PR and move the ticket to Canceled with a one-line note pointing here. If this area becomes core, or we see the gap exploited, we'll reopen it from the ticket. Specific to this one: 2,343 lines for a ticket rated Low, and two customer-visible failure modes (identity dropped silently over non-loopback http, ignoring |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Primary change type
Problem and motivation
Credential hygiene pass over the HTTP wrappers and the tools client: tighten where the SDK attaches or records credentials, so each one stays on the channel and host it was meant for and out of serialized or recorded data.
Summary and scope
Sapiom-Identityis attached only over https (or http to loopback). New shared helpers:sanitizeFactHeaders/redactUrlForFacts/redactSearchfor transaction facts, andfetchDroppingIdentityCrossOrigin, which dropsSapiom-Identityon a cross-origin redirect.sapiom-identityjoins the cross-origin drop list.getUri(config), the URL axios actually requests.__sapiom.enabled: falsealso skips identity. A chainedbeforeRedirectdrops the header on a cross-origin hop. Facts go through the shared redaction.__sapiomis read frominitas well as from aRequest(the opt-out and per-request metadata now work in both places). Identity is dropped on cross-origin redirects. Facts are redacted.Transportkeeps the API key and resume token in runtime-private fields and serializes and logs only non-secret settings.encodeSegmentrejects"",.and..for ids used as path segments.Out of scope:
credentialFetchitself is unchanged, and so are sandbox filesystem paths (they keep their own check).Related work
Related issue or discussion: SAP-4383 (internal tracker)
Validation
Tests and documentation
New or extended tests:
identity.test.ts, with local http servers for the redirect cases.__sapiomhandling and redirects.transport-serialization.spec.ts,path-segment.spec.tsandtrusted-url.spec.ts, plus llm redeem, content-generation poll and Google bare-path cases.The fetch README documents
init.__sapiom.Compatibility and release impact
"",.and..now throwTypeErrorbefore any request.CredentialChannelError.llm.redeemtakes an optional trailingbaseUrl.sdk-credential-hygiene.md, patch for core, analytics-core, axios, fetch, node-http, tools).Security
will follow the
Security Policy for
private reporting.
AI assistance
Claude Code (Opus) wrote the implementation and tests from an approved plan. The result was verified with the build, typecheck, lint and test commands above, plus independent review before marking ready.
Checklist
CONTRIBUTING.md, and this contribution follows the direct-PR or issue-first policy.any N/A checks above.
🤖 Generated with Claude Code