[object Object]

← back to Catalog Crawl Atlas

add creds-in-URL fetch guard to gated pages (TK-10984)

f76d1c79cfccc7c0b08162d6521030a415916521 · 2026-08-30 22:58:53 -0700 · Steve Abrams

Files touched

Diff

commit f76d1c79cfccc7c0b08162d6521030a415916521
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Sun Aug 30 22:58:53 2026 -0700

    add creds-in-URL fetch guard to gated pages (TK-10984)
---
 public/index.html | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/public/index.html b/public/index.html
index 321400e..9d61a1f 100644
--- a/public/index.html
+++ b/public/index.html
@@ -1,6 +1,31 @@
 <!DOCTYPE html>
 <html lang="en">
 <head>
+<script>
+// Credential-safe fetch guard (fleet drop-in) — if this page is opened with
+// credentials in the URL (a saved bookmark / Chrome-remembered basic-auth:
+// https://user:pass@host/…), the browser poisons document.baseURI, so any
+// relative or root-relative fetch('/api/…') throws "Request cannot be constructed
+// from a URL that includes credentials" and callers silently fall to an empty
+// state. Resolve every non-absolute request URL against the credential-free
+// location instead of baseURI. Placed first so it wraps window.fetch before any
+// app script runs. Ref: creds-in-url-fetch-guard-fleet-pattern.
+(function () {
+  var _fetch = window.fetch.bind(window);
+  var cleanBase = function () { return location.origin + location.pathname; };
+  window.fetch = function (input, init) {
+    try {
+      if (typeof input === 'string' && !/^[a-z]+:\/\//i.test(input) && input.indexOf('//') !== 0) {
+        input = new URL(input, cleanBase()).href;
+      } else if (input instanceof Request && !/^[a-z]+:\/\//i.test(input.url)) {
+        input = new Request(new URL(input.url, cleanBase()).href, input);
+      }
+    } catch (_) { /* fall through to native */ }
+    return _fetch(input, init);
+  };
+})();
+</script>
+
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>Crawl Atlas · TK-135 — Color / Style / Motif</title>

← e186ce8 nav-agent: sync v1.3 (host left-sidebar collapse on load)  ·  back to Catalog Crawl Atlas  ·  add .deploy.conf (data-excluded) for guard deploy (TK-10984) 940b040 →