[object Object]

← back to Blockprintedwallpaper

fix: safeImg allow same-origin /img/ proxy urls (vendor-neutral image proxy 2026-06-03) — product cards were falling back to hero-bg (images all wrong)

1ab1ba572102ecff52664618f43598fad014584e · 2026-06-18 09:04:24 -0700 · SteveStudio2

Files touched

Diff

commit 1ab1ba572102ecff52664618f43598fad014584e
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Thu Jun 18 09:04:24 2026 -0700

    fix: safeImg allow same-origin /img/ proxy urls (vendor-neutral image proxy 2026-06-03) — product cards were falling back to hero-bg (images all wrong)
---
 public/index.html | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/public/index.html b/public/index.html
index 3b99fc4..5d159e8 100644
--- a/public/index.html
+++ b/public/index.html
@@ -575,8 +575,10 @@ const HOSTKEY = location.hostname.replace(/\./g, '_');
 const LABELS = {"hand-block":"Hand block"};
 
 function escAttr(s) { return String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;' }[c])); }
-// Image-URL allowlist: only DW Shopify CDN + designerwallcoverings.com (defends against XSS via crafted products.json)
-function safeImg(u) { return /^https:\/\/(?:cdn\.shopify\.com|designerwallcoverings\.com)\//.test(u || '') ? u : '/hero-bg.jpg'; }
+// Image-URL allowlist: same-origin proxied /img/ (vendor-neutral image proxy, 2026-06-03) +
+// DW Shopify CDN + designerwallcoverings.com (defends against XSS via crafted products.json).
+// /img/ is server-controlled same-origin (not protocol-relative, not a javascript: URI) so it's safe.
+function safeImg(u) { u = u || ''; return (/^\/img\//.test(u) || /^https:\/\/(?:cdn\.shopify\.com|designerwallcoverings\.com)\//.test(u)) ? u : '/hero-bg.jpg'; }
 function cardHTML(p) {
   const eager = state.page === 1;
   return '<img loading="' + (eager ? 'eager' : 'lazy') + '"' + (eager ? ' fetchpriority="high"' : '') + ' src="' + escAttr(safeImg(p.image_url)) + '" alt="' + escAttr(p.title) + '">'

← 108b6ec step2 vendor-leak fix: dual-key /sample resolver + handle_di  ·  back to Blockprintedwallpaper  ·  Mount new-arrivals promo strip (Tier B): require ../_shared/ a2ba05e →