Context
AdCP 3.1 defines a normative fetch contract for format_schema references and shares the same URI+digest shape with platform_extensions. The conformance/storyboard work is tracked in adcontextprotocol/adcp#4591 and adcontextprotocol/adcp#4623, but the reusable SDK helper belongs here so Python adopters do not hand-roll SSRF-prone schema fetching.
This is the Python SDK implementation tracker for the SDK half of adcontextprotocol/adcp#4623. The sibling TypeScript SDK tracker is adcontextprotocol/adcp-client#2063.
Required behavior
Add a reusable helper for resolving immutable uri@sha256:<digest> references used by format_schema and platform_extensions:
- HTTPS-only fetches.
- Public-network SSRF guard: reject loopback, link-local, RFC1918, CGNAT, cloud metadata, and RFC6761/special-use hosts.
- DNS rebinding defense by resolving and pinning, or re-validating the resolved address used for the request.
- Redirects disabled.
- 5 second default timeout, configurable by caller.
- 1 MiB streaming body cap, configurable by caller.
- Digest verification with
sha256: plus 64 lowercase hex characters.
- Cache keyed by
uri@digest, treating digest references as immutable.
- Negative-result handling that degrades gracefully for transient network/server failures but treats digest mismatch as a substitution-attack signal.
- Structured result/status that distinguishes resolved, unresolvable network failure, invalid schema, digest mismatch, and blocked unsafe URL.
For format_schema, also validate the fetched body as JSON Schema and enforce safe $ref behavior:
- Accept Draft 2019-09 and Draft-07 schema documents.
$ref sandbox allows intra-document refs, same-origin refs, and trusted AgenticAdvertising.org mirror refs only.
- Reject off-origin refs,
file://, http://, loopback/private/metadata refs, and excessive ref depth/count.
- Enforce schema-compile bounds such as ref depth <= 8, total refs <= 256, and a keyword/size bound to avoid compile-time DoS.
Acceptance criteria
- Public API is documented and usable by callers that need to resolve canonical
format_schema and platform_extensions references.
- Tests cover digest match, digest mismatch, invalid JSON Schema, off-origin
$ref, file:// $ref, http:// URL rejection, metadata/RFC1918 rejection, redirect rejection, timeout, and body-size cap.
- The helper is usable by adopters and any future Python storyboard harness without process-global mutable configuration.
- Error/result names are stable enough for conformance diagnostics and do not leak sensitive internal network details.
Related
Context
AdCP 3.1 defines a normative fetch contract for
format_schemareferences and shares the same URI+digest shape withplatform_extensions. The conformance/storyboard work is tracked in adcontextprotocol/adcp#4591 and adcontextprotocol/adcp#4623, but the reusable SDK helper belongs here so Python adopters do not hand-roll SSRF-prone schema fetching.This is the Python SDK implementation tracker for the SDK half of adcontextprotocol/adcp#4623. The sibling TypeScript SDK tracker is adcontextprotocol/adcp-client#2063.
Required behavior
Add a reusable helper for resolving immutable
uri@sha256:<digest>references used byformat_schemaandplatform_extensions:sha256:plus 64 lowercase hex characters.uri@digest, treating digest references as immutable.For
format_schema, also validate the fetched body as JSON Schema and enforce safe$refbehavior:$refsandbox allows intra-document refs, same-origin refs, and trusted AgenticAdvertising.org mirror refs only.file://,http://, loopback/private/metadata refs, and excessive ref depth/count.Acceptance criteria
format_schemaandplatform_extensionsreferences.$ref,file://$ref,http://URL rejection, metadata/RFC1918 rejection, redirect rejection, timeout, and body-size cap.Related