From 39ce2a5817edbf0a0ef1b62e75043dba11f8d92c Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 4 Sep 2026 14:53:34 +0100 Subject: [PATCH] test: keep CNAME target lookups inside the fixture resolver When a fixture answers with a CNAME, unbound chases the target through its resolver path, which skips local-zone data and asks the forwarder. On the CI runner Docker DNS answers any *.localhost with ::1, which is _APP_DOMAIN_TARGET_AAAA, so the API rule on the site fixture verified instead of failing on the wrong CNAME. An empty authoritative localhost. zone that the resolver path consults makes every target NXDOMAIN locally, and the wrong CNAME fixture now points under localhost too so nothing leaves the container. --- tests/resources/dns/localhost.zone | 3 +++ tests/resources/dns/zones.conf | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/resources/dns/localhost.zone diff --git a/tests/resources/dns/localhost.zone b/tests/resources/dns/localhost.zone new file mode 100644 index 0000000000..544aa59ade --- /dev/null +++ b/tests/resources/dns/localhost.zone @@ -0,0 +1,3 @@ +$TTL 60 +localhost. IN SOA ns.localhost. hostmaster.localhost. 1 3600 600 86400 60 +localhost. IN NS ns.localhost. diff --git a/tests/resources/dns/zones.conf b/tests/resources/dns/zones.conf index 4fae5b04c3..5a9882ec87 100644 --- a/tests/resources/dns/zones.conf +++ b/tests/resources/dns/zones.conf @@ -29,7 +29,7 @@ local-data: "stage-function.webapp.com. 60 IN CNAME cname.localhost." # Verification must reject a CNAME pointing somewhere else. local-zone: "stage-wrong-cname.webapp.com." redirect -local-data: "stage-wrong-cname.webapp.com. 60 IN CNAME cname-wrong.tests.appwrite.io." +local-data: "stage-wrong-cname.webapp.com. 60 IN CNAME cname-wrong.localhost." # An A record matching the expected target. local-zone: "correct-a.webapp.com." redirect @@ -51,3 +51,17 @@ local-data: 'stage-correct-caa.webapp.com. 60 IN CAA 0 issue "digicert.com"' local-zone: "wrong-a-webapp.com." redirect local-data: "wrong-a-webapp.com. 60 IN SOA ns.wrong-a-webapp.com. hostmaster.wrong-a-webapp.com. 1 3600 600 86400 60" local-data: "wrong-a-webapp.com. 60 IN A 203.0.0.5" + +# The platform targets the fixtures point at live under localhost. When a +# fixture answers with a CNAME, unbound chases the target through its resolver +# path, which skips local-zone data and would otherwise ask the forwarder. The +# runner's Docker DNS answers any *.localhost with 127.0.0.1 and ::1, and ::1 +# is _APP_DOMAIN_TARGET_AAAA, so a wrong CNAME would verify. An auth-zone is +# consulted by that path: the empty zone makes every target NXDOMAIN with an +# SOA, locally. +auth-zone: + name: "localhost." + zonefile: "/mnt/resources/localhost.zone" + for-downstream: yes + for-upstream: yes + fallback-enabled: no