← back to Consulting Intake
Fix creds-in-URL fetch guard on both gated pages (portal/admin) — byte-exact fleet drop-in, standalone files patched directly (TK-22)
19e3da0b52839df1faea0f8c7c2fb1e8e4267019 · 2026-08-30 13:33:29 -0700 · Steve Abrams
Files touched
M public/admin/index.htmlM public/portal.html
Diff
commit 19e3da0b52839df1faea0f8c7c2fb1e8e4267019
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Sun Aug 30 13:33:29 2026 -0700
Fix creds-in-URL fetch guard on both gated pages (portal/admin) — byte-exact fleet drop-in, standalone files patched directly (TK-22)
---
public/admin/index.html | 24 ++++++++++++++++++++++++
public/portal.html | 24 ++++++++++++++++++++++++
2 files changed, 48 insertions(+)
diff --git a/public/admin/index.html b/public/admin/index.html
index d6ac709..39c0872 100644
--- a/public/admin/index.html
+++ b/public/admin/index.html
@@ -1,6 +1,30 @@
<!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>Consulting Intake · Growth & Social Command Center</title>
<style>
diff --git a/public/portal.html b/public/portal.html
index 01c6a6e..affaca2 100644
--- a/public/portal.html
+++ b/public/portal.html
@@ -1,6 +1,30 @@
<!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>Consulting Intake · Deliverable</title>
<style>
← 412a186 creds-safe fetch guard: resolve relative fetch vs credential
·
back to Consulting Intake
·
deploy-safety: exclude data/ from rsync so deploys never clo 5027e89 →