Repository navigation
fix(proxy): claim a rule domain only on a DNS label boundary - #15303
Conversation
isAppwriteOwned matched the platform domain with a bare str_ends_with, so a sibling name like `<x>fallback.localhost` was treated as Appwrite-owned and stored verified with owner=Appwrite, skipping DNS validation. Require the domain to equal the platform domain or be a subdomain of it, and assert a lookalike is not auto-verified in the Proxy e2e.
|
Review complete. 🟡 1 medium 📍 Findings outside the diff (1) — 🟡 1 medium — defects on lines GitHub can't attach comments to🟡 Medium — Sibling-domain suffix match remains in SSL task · src/Appwrite/Platform/Tasks/SSL.php The PR fixes the This PR hardens
Reviewed commit: 4fa4def |
🟢 Tier S · Ready to merge
Proxy rule ownership now requires an exact configured platform domain or a domain suffix separated by a DNS label boundary. The Proxy E2E test covers both a genuine fallback subdomain and a lookalike sibling that must take the normal DNS-verification path. Latest changes: The new commits make the lookalike test use a valid sibling label (
📂 Walkthrough · 2
Merged |
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
The 2-label sibling was rejected by the level restriction before reaching the ownership check; <uniq>.xfallback.localhost passes the restriction yet is not a subdomain of fallback.localhost.
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
fix(proxy): claim a rule domain only on a DNS label boundary (cherry picked from commit ecc65c0)
What
Proxy\Action::isAppwriteOwned()decided whether a requested custom domain belongs to the platform with a barestr_ends_with($domain, $appwriteDomain). That matches sibling names that merely end with the configured site/function domain string but are not subdomains of it — e.g. with_APP_DOMAIN_FUNCTIONS_FALLBACK=fallback.localhost, the nameevilfallback.localhostpassed.A project holding
rules.writecould therefore submit such a domain and have the rule stored inverifiedstatus withowner = Appwrite, which makes the certificate worker skip DNS validation. The rule is the record the edge uses to route a hostname to a project's site/function.Fix
Match on a DNS label boundary: the domain must equal the platform domain, or end with
.+ the platform domain (a real subdomain). Lookalike siblings now take the normal DNS-verification path like any other custom domain.Finding
Strix #4 (low, CVSS 3.1). Suffix check treats any domain ending with the platform domain string as Appwrite-owned.
Test
Extended
testCreateRuleOnFunctionsFallbackDomain: a<uniq>fallback.localhostlookalike creates201but is notverified(it is not claimed as Appwrite-owned), alongside the existing real-subdomain success and the rejected exact/nested cases.composer lintandcomposer analyzepass.Part of appwrite-labs/infrastructure#1013