[object Object]

← back to Greenland Onboard

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

79e25d1a43f489e81ae8c219a3bfc9dc20ab9026 · 2026-08-30 22:57:39 -0700 · Steve Abrams

Files touched

Diff

commit 79e25d1a43f489e81ae8c219a3bfc9dc20ab9026
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Sun Aug 30 22:57:39 2026 -0700

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

diff --git a/public/full-preview.html b/public/full-preview.html
index ec056d5..38829e3 100644
--- a/public/full-preview.html
+++ b/public/full-preview.html
@@ -1,4 +1,27 @@
-<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
+<!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">
 <title>Phillipe Romano — Full Line (staging preview)</title>
 <style>
 :root{--cols:6}

← 20e37e6 TK-10434: regenerate cork enrichment (213/213 tags+colors+he  ·  back to Greenland Onboard  ·  deploy-safety: exclude data/ from rsync (TK-10984) 24d5c84 →