@tokenoftrust/storefront-runner 6.17.0 → 6.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -138,15 +138,18 @@ export function buildCspViolationBannerScript(basePath = ""): string {
138
138
  let box = null;
139
139
  const BASE = ${jsonForScript(basePath)};
140
140
  const path = window.location.pathname || "";
141
- const isStyleGuide = /^\\/_?style-guide(?:\\/|$)/.test(
142
- BASE && path.indexOf(BASE + "/") === 0 ? path.slice(BASE.length) : path,
143
- );
141
+ const relPath = BASE && path.indexOf(BASE + "/") === 0 ? path.slice(BASE.length) : path;
142
+ if (/^\\/admin(?:\\/|$)/.test(relPath)) return;
143
+ const isStyleGuide = /^\\/_?style-guide(?:\\/|$)/.test(relPath);
144
144
  const isPreviewInspectionStyle = (directive, uri) =>
145
145
  directive === "style-src-elem" &&
146
146
  (uri === "inline" || uri === "(inline)") &&
147
147
  (window.navigator.userAgent.includes("CodexBrowser") ||
148
148
  new URLSearchParams(window.location.search).has("__preview") ||
149
149
  isStyleGuide);
150
+ const isExtensionOrEvalNoise = (uri, sourceFile) =>
151
+ uri === "eval" ||
152
+ /^(?:chrome|moz|safari(?:-web)?|ms-browser)-extension:/i.test(String(sourceFile || ""));
150
153
  const ensureBox = () => {
151
154
  if (box) return box;
152
155
  box = document.createElement("div");
@@ -167,11 +170,12 @@ export function buildCspViolationBannerScript(basePath = ""): string {
167
170
  (document.body || document.documentElement).appendChild(box);
168
171
  return box;
169
172
  };
170
- const recordViolation = (directive, uri) => {
171
- // Preview inspection tooling injects its own nonce-less overlay stylesheet.
173
+ const recordViolation = (directive, uri, sourceFile) => {
174
+ // Preview inspection tooling injects its own nonce-less overlay stylesheet, and
175
+ // browser extensions routinely trip script-src eval in injected page scripts.
172
176
  // Automated CSP validation remains authoritative for page resources; keep
173
- // every other violation visible, and keep normal public routes diagnostic.
174
- if (isPreviewInspectionStyle(directive, uri)) return;
177
+ // every real resource block visible, and keep normal public routes diagnostic.
178
+ if (isPreviewInspectionStyle(directive, uri) || isExtensionOrEvalNoise(uri, sourceFile)) return;
175
179
  const key = directive + "|" + uri;
176
180
  if (seen.has(key)) return; seen.add(key);
177
181
  const li = document.createElement("li");
@@ -182,7 +186,7 @@ export function buildCspViolationBannerScript(basePath = ""): string {
182
186
  document.addEventListener("securitypolicyviolation", (e) => {
183
187
  const directive = e.effectiveDirective || e.violatedDirective || "";
184
188
  const uri = e.blockedURI || "(inline)";
185
- recordViolation(directive, uri);
189
+ recordViolation(directive, uri, e.sourceFile || "");
186
190
  });
187
191
  })();`;
188
192
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/storefront-runner",
3
- "version": "6.17.0",
3
+ "version": "6.17.1",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "World-shareable storefront runner: multi-tenant renderer on Astro/Cloudflare. No control plane.",
6
6
  "packageManager": "pnpm@11.9.0",