← back to Pattern Vault
add creds-in-URL fetch guard to gated pages (TK-10984)
5c14b4ce69998111150f387456a60fe567137efa · 2026-08-30 22:57:38 -0700 · Steve Abrams
Files touched
M public/handoff.htmlM public/setup.htmlM public/trends.html
Diff
commit 5c14b4ce69998111150f387456a60fe567137efa
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Sun Aug 30 22:57:38 2026 -0700
add creds-in-URL fetch guard to gated pages (TK-10984)
---
public/handoff.html | 25 ++++++++++++++++++++++++-
public/setup.html | 25 ++++++++++++++++++++++++-
public/trends.html | 25 ++++++++++++++++++++++++-
3 files changed, 72 insertions(+), 3 deletions(-)
diff --git a/public/handoff.html b/public/handoff.html
index 8867895..41e3788 100644
--- a/public/handoff.html
+++ b/public/handoff.html
@@ -1,4 +1,27 @@
-<!doctype html><html lang="en"><head>
+<!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>Pattern Vault — Manual Handoff</title>
<style>
diff --git a/public/setup.html b/public/setup.html
index 1cfcd04..4024635 100644
--- a/public/setup.html
+++ b/public/setup.html
@@ -1,5 +1,28 @@
<!doctype html>
-<html lang="en"><head>
+<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>Pattern Vault — Setup Guide</title>
<style>
diff --git a/public/trends.html b/public/trends.html
index b122c18..e979bfa 100644
--- a/public/trends.html
+++ b/public/trends.html
@@ -1,5 +1,28 @@
<!doctype html>
-<html lang="en"><head>
+<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>Trend Board — The Pattern Vault</title>
<style>
← 8219cd5 creds-safe fetch guard: resolve relative fetch vs credential
·
back to Pattern Vault
·
Trend board 2026-08-31 refresh: 8th pass, CoY-hardened palet 403653c →