← back to Stack Map Viewer
TK-12268: add creds-in-URL fetch guard (fleet pattern) to gated page
d8cbff8473c17f75a7125bff70182ba121583dbd · 2026-09-25 13:56:01 -0700 · Steve Abrams
Relative fetch() on a Basic-Auth page threw on user:pass@host bookmarks.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D7LB6rCwpA7ubJTqYzqXEX
Files touched
Diff
commit d8cbff8473c17f75a7125bff70182ba121583dbd
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Fri Sep 25 13:56:01 2026 -0700
TK-12268: add creds-in-URL fetch guard (fleet pattern) to gated page
Relative fetch() on a Basic-Auth page threw on user:pass@host bookmarks.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D7LB6rCwpA7ubJTqYzqXEX
---
index.html | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/index.html b/index.html
index 235fdb9..bfe0f7b 100644
--- a/index.html
+++ b/index.html
@@ -1,4 +1,29 @@
-<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
+<!doctype html><html><head><meta charset="utf-8">
+<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 name="viewport" content="width=device-width,initial-scale=1">
<title>Stack Interconnection Map</title>
<style>
:root{--bg:#0f1117;--panel:#12151f;--ink:#eef1f7;--dim:#7d8aa5}
← 80c1277 add README (durability doc: keep-alive covers it by default;
·
back to Stack Map Viewer
·
(newest)