[object Object]

← back to Model Arena

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

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

Files touched

Diff

commit 0cb68642205e6d26fc52ff320ac7a7081893ffc4
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/arcade.html | 25 +++++++++++++++++++++++++
 public/suite.html  | 25 +++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/public/arcade.html b/public/arcade.html
index 7d3d7dc..c91a1bd 100644
--- a/public/arcade.html
+++ b/public/arcade.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">
 <title>Model Arena — Games Arcade</title>
diff --git a/public/suite.html b/public/suite.html
index cac8521..0116371 100644
--- a/public/suite.html
+++ b/public/suite.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">
 <title>Designer Wallcoverings — Digital Suite</title>

← cf520e6 auto-data-snapshot: 2026-08-30T07:15:22 (4 data files) — dat  ·  back to Model Arena  ·  auto-data-snapshot: 2026-08-31T07:38:15 (4 data files) — dat 5cf8d32 →