Skip to content

Commit dede243

Browse files
uwezkhan“rootvector2”
authored andcommitted
json_schema: chain resolve error and cover mapped/CGNAT in retrieve guard
Signed-off-by: Uwez Khan <uwezkhan053@gmail.com>
1 parent 512f3e2 commit dede243

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/confluent_kafka/schema_registry/common/json_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def _guard_external_uri(uri: str):
7878
try:
7979
infos = socket.getaddrinfo(host, parts.port or (443 if parts.scheme == 'https' else 80))
8080
except socket.gaierror as ex:
81-
raise ValueError("Could not resolve schema URI host {}: {}".format(host, ex))
81+
raise ValueError("Could not resolve schema URI host {}: {}".format(host, ex)) from ex
8282
for info in infos:
8383
if _is_blocked_ip(ipaddress.ip_address(info[4][0])):
8484
raise ValueError("Refusing to retrieve schema from non-public address: {}".format(uri))

tests/schema_registry/test_json_schema_retrieve.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
"http://127.0.0.1:8080/internal",
3131
"http://10.0.0.5/schema",
3232
"http://[::1]/schema",
33+
"http://[::ffff:127.0.0.1]/schema",
34+
"http://100.64.0.1/schema",
3335
"file:///etc/passwd",
3436
"gopher://127.0.0.1/x",
3537
])

0 commit comments

Comments
 (0)