Repository navigation
security: audit wave 2 — x402 underpayment guard, SSRF DNS-rebinding pin - #314
Merged
Merged
Conversation
…S-rebinding pin - x402-server: on the optional facilitator path, when the facilitator echoes the paid amount, re-check it covers the required amount server-side. A misconfigured/compromised facilitator can no longer approve an underpayment; the default (no-facilitator) path already does full on-chain parsing. - ssrf: assertPublicUrl now returns the validated resolved addresses, and a new safeFetch() pins the connection to a vetted IP via an undici dispatcher whose lookup ignores DNS. This closes the TOCTOU/DNS-rebinding gap where a hostname validated as public could rebind to 127.0.0.1 / 169.254.169.254 at fetch time. - agents/register: the endpoint health-check fetch now uses safeFetch with the addresses validated by assertPublicUrl, so registration can no longer be used as an SSRF probe into internal services. Deferred (tracked in docs/SECURITY_AUDIT.md): wallet-signature replay nonce cache and off-chain dispute griefing — both meaningful once AUTH_ENFORCED is on and need a durable store / redesign.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
7 tasks
This branch was successfully deployed
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.
Audit wave 2 — two contained, high-value off-chain fixes
x402 facilitator underpayment guard (
app/lib/x402-server.ts)On the optional facilitator verification path, when the facilitator echoes the paid amount we now re-check server-side that it covers the required amount. A misconfigured/compromised facilitator can no longer approve an underpayment. The default (no-facilitator) path already does full on-chain parsing (amount/mint/recipient/confirmed).
SSRF DNS-rebinding / TOCTOU pin (
app/lib/ssrf.ts,app/app/api/agents/register/route.ts)assertPublicUrlnow returns the validated resolved addresses, and a newsafeFetch()pins the connection to a vetted IP via an undici dispatcher whoselookupignores DNS. This closes the gap where a hostname validated as public could rebind to127.0.0.1/169.254.169.254between the check and the fetch. Agent registration's endpoint health-check now usessafeFetch, so it can't be used as an SSRF probe into internal services.Deferred (tracked in
docs/SECURITY_AUDIT.md/ SEC issues)Both become meaningful once
AUTH_ENFORCED=true; they need a durable store / redesign and are scoped to the frontend-signing milestone.Test plan
amountAtomic < requiredis rejected withunderpaid: ….safeFetchto a hostname that resolves public but rebinds to a private IP connects only to the pinned public address.