← back to Agent Ad Network
add creds-in-URL fetch guard to gated pages (TK-10984)
c065b88e1254972a2066a8bdd1a80a93795a7038 · 2026-08-30 22:58:27 -0700 · Steve Abrams
Files touched
M admin.htmlM display-admin.html
Diff
commit c065b88e1254972a2066a8bdd1a80a93795a7038
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Sun Aug 30 22:58:27 2026 -0700
add creds-in-URL fetch guard to gated pages (TK-10984)
---
admin.html | 26 +++++++++++++++++++++++++-
display-admin.html | 24 ++++++++++++++++++++++++
2 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/admin.html b/admin.html
index c90d80a..b0300e6 100644
--- a/admin.html
+++ b/admin.html
@@ -1,5 +1,29 @@
<!doctype html>
-<html><head><meta charset="utf-8"><title>Agent Ad Network — Admin</title>
+<html><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"><title>Agent Ad Network — Admin</title>
<style>
:root { --fg:#e6e6e6; --bg:#101216; --card:#181b21; --line:#2a2f38; --accent:#4fd1c5;
--imp:#4fd1c5; --clk:#f472b6; --usr:#a78bfa; }
diff --git a/display-admin.html b/display-admin.html
index d8d9448..b229c0d 100644
--- a/display-admin.html
+++ b/display-admin.html
@@ -1,5 +1,29 @@
<!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">
<meta name="robots" content="noindex,nofollow">
<title>DW Display Network — Ad Admin</title>
← ae1dde9 Add DW Display Network admin UI (/admin/display): KPIs, live
·
back to Agent Ad Network
·
add .deploy.conf (data-excluded) for guard deploy (TK-10984) bc7c166 →