Skip to content

guard json schema ref retrieval against internal targets#2269

Open
uwezkhan wants to merge 1 commit into
confluentinc:masterfrom
uwezkhan:json-schema-ssrf-guard
Open

guard json schema ref retrieval against internal targets#2269
uwezkhan wants to merge 1 commit into
confluentinc:masterfrom
uwezkhan:json-schema-ssrf-guard

Conversation

@uwezkhan

@uwezkhan uwezkhan commented Jun 8, 2026

Copy link
Copy Markdown

The JSON deserializer resolves a $ref the schema registry doesn't know about by handing the raw URI to httpx.get in _retrieve_via_httpx. The writer schema is selected by the schema id embedded in the consumed message, so a producer can register a schema whose $ref points at http://169.254.169.254/..., loopback, or an RFC1918 host, and the consumer fetches it during deserialization and parses the response as a schema.

Before, any scheme and any address were fetched. After, the helper requires http/https, resolves the host, and refuses private, loopback, link-local, reserved, multicast, or unspecified targets (including IPv4-mapped IPv6); public URLs still resolve as they did. The check lives in the retrieve callback because that is the single point every $ref lookup passes through, so the sync and async paths are both covered without each caller repeating it. Tradeoff: a schema legitimately served from an internal host is now rejected and has to be reachable at a public address or registered as a named reference.

@uwezkhan uwezkhan requested review from a team and Matthew Seal (MSeal) as code owners June 8, 2026 15:07
@confluent-cla-assistant

confluent-cla-assistant Bot commented Jun 8, 2026

Copy link
Copy Markdown

🎉 All Contributor License Agreements have been signed. Ready to merge.
✅ uwezkhan
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

@rayokota Robert Yokota (rayokota) added the component:schema-registry Any schema registry related isues rather than kafka isolated ones label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component:schema-registry Any schema registry related isues rather than kafka isolated ones

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants