cloud / patches / @cloudflare__workers-oauth-provider@1.2.4.patchmain at aacbc74
diff --git a/dist/oauth-provider.js b/dist/oauth-provider.js
index aaf2a96399dde60629487889449d2364f2ac74ab..27f9dac1373495cef9db1ba87050eb08502cb717 100644
--- a/dist/oauth-provider.js
+++ b/dist/oauth-provider.js
@@ -959,6 +959,10 @@ async function verifySignature(args) {
function isLoopbackHostname(hostname) {
const host = hostname.toLowerCase();
if (host === "localhost" || host === "::1" || host === "[::1]") return true;
+ // iterate patch: a `*.localhost` name is loopback too (RFC 6761 §6.3), and browsers resolve it
+ // there. Local dev serves the platform and each project's apps on `<name>.localhost` ports, and
+ // registers `http://<slug>.localhost:<port>/.auth/callback` (core/lib/src/app-session.ts).
+ if (host.endsWith(".localhost")) return true;
const ipv4 = /^127\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(host);
return ipv4 !== null && ipv4.slice(1).every((octet) => Number(octet) <= 255);
}