@tokenoftrust/storefront-runner 4.3.3 → 4.3.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/storefront-runner",
3
- "version": "4.3.3",
3
+ "version": "4.3.4",
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",
@@ -23,6 +23,8 @@ export interface CspOptions {
23
23
  styleSrc?: readonly string[];
24
24
  fontSrc?: readonly string[];
25
25
  imgSrc?: readonly string[];
26
+ /** `<video>`/`<audio>` sources (`media-src`). */
27
+ mediaSrc?: readonly string[];
26
28
  connectSrc?: readonly string[];
27
29
  /** Sandboxed-widget origins. */
28
30
  frameSrc?: readonly string[];
@@ -68,6 +70,9 @@ export function buildCsp(opts: CspOptions): string {
68
70
  // so allowing `data:` here is the same tolerated relaxation as img-src.
69
71
  "font-src": ["'self'", "data:", ...(opts.fontSrc ?? [])],
70
72
  "img-src": ["'self'", "data:", ...(opts.imgSrc ?? [])],
73
+ // Without an explicit media-src, `<video>`/`<audio>` fall back to
74
+ // `default-src 'self'` and every cross-origin clip is refused.
75
+ "media-src": ["'self'", ...(opts.mediaSrc ?? [])],
71
76
  "connect-src": ["'self'", ...(opts.connectSrc ?? [])],
72
77
  "frame-src": ["'self'", ...(opts.frameSrc ?? [])],
73
78
  };
@@ -98,6 +103,10 @@ export const STOREFRONT_CSP_ALLOWLIST = {
98
103
  fontSrc: [],
99
104
  // Product imagery is rehosted to R2 or served from remote CDNs.
100
105
  imgSrc: ["https:"],
106
+ // Tenant video and audio stay at their source URLs (the tenant repo holds no
107
+ // media binaries), so media is granted over https exactly like imagery. Media
108
+ // cannot execute script, so this is the same tolerated relaxation as img-src.
109
+ mediaSrc: ["https:"],
101
110
  connectSrc: [],
102
111
  } as const;
103
112