tina4-nodejs 3.13.121 → 3.13.122

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.
@@ -6657,6 +6657,9 @@ var init_middleware = __esm({
6657
6657
  `max-age=${hsts}; includeSubDomains`
6658
6658
  );
6659
6659
  }
6660
+ if (process.env.TINA4_CSP === void 0) {
6661
+ _SecurityHeadersMiddleware.warnCspDefaultOnce();
6662
+ }
6660
6663
  res.header(
6661
6664
  "Content-Security-Policy",
6662
6665
  process.env.TINA4_CSP ?? "default-src 'self'"
@@ -6672,6 +6675,30 @@ var init_middleware = __esm({
6672
6675
  );
6673
6676
  return [req2, res];
6674
6677
  }
6678
+ /** Warn-once ledger for the default-CSP heads-up (per process). */
6679
+ static cspDefaultWarned = false;
6680
+ /**
6681
+ * Warn once per process that the default CSP is in force (TINA4_CSP unset).
6682
+ *
6683
+ * Secure-by-default keeps `default-src 'self'` (SECHDR-DEC-01), but that
6684
+ * default is invisible: it blocks runtime-injected inline styles, cross-origin
6685
+ * fonts/scripts/CDNs, `data:` URIs, and cross-origin WebSocket/XHR (a separate
6686
+ * API or LiveKit host) — and the failure surfaces only in the browser at
6687
+ * runtime, long after a deploy has gone green. So the framework says so once,
6688
+ * naming the escape hatch. It NEVER fails the boot or a request — logging a
6689
+ * heads-up must not be the reason the server or a request dies. Fires only when
6690
+ * TINA4_CSP is ABSENT; setting it (even to empty) is an explicit opt-in.
6691
+ */
6692
+ static warnCspDefaultOnce() {
6693
+ if (_SecurityHeadersMiddleware.cspDefaultWarned) return;
6694
+ _SecurityHeadersMiddleware.cspDefaultWarned = true;
6695
+ const message = `TINA4_CSP is not set, so Tina4 is serving the default Content-Security-Policy "default-src 'self'" on every response. That default blocks runtime-injected inline styles, cross-origin fonts/scripts/CDNs, data: URIs, and cross-origin WebSocket/XHR (e.g. a separate API or LiveKit host). If your app uses any of these, set TINA4_CSP to a policy that allows them (see https://tina4.com); to silence this notice without changing behaviour, set TINA4_CSP="default-src 'self'".`;
6696
+ try {
6697
+ Log.warning(message);
6698
+ } catch {
6699
+ console.warn(message);
6700
+ }
6701
+ }
6675
6702
  /**
6676
6703
  * True when the client request is HTTPS. Proxy-aware and byte-parity with
6677
6704
  * Python (request.is_secure_scheme), PHP (Request::isSecureScheme) and Ruby
@@ -303,6 +303,21 @@ export declare class RequestLogger {
303
303
  */
304
304
  export declare class SecurityHeadersMiddleware {
305
305
  static beforeSecurity(req: Tina4Request, res: Tina4Response): [Tina4Request, Tina4Response];
306
+ /** Warn-once ledger for the default-CSP heads-up (per process). */
307
+ private static cspDefaultWarned;
308
+ /**
309
+ * Warn once per process that the default CSP is in force (TINA4_CSP unset).
310
+ *
311
+ * Secure-by-default keeps `default-src 'self'` (SECHDR-DEC-01), but that
312
+ * default is invisible: it blocks runtime-injected inline styles, cross-origin
313
+ * fonts/scripts/CDNs, `data:` URIs, and cross-origin WebSocket/XHR (a separate
314
+ * API or LiveKit host) — and the failure surfaces only in the browser at
315
+ * runtime, long after a deploy has gone green. So the framework says so once,
316
+ * naming the escape hatch. It NEVER fails the boot or a request — logging a
317
+ * heads-up must not be the reason the server or a request dies. Fires only when
318
+ * TINA4_CSP is ABSENT; setting it (even to empty) is an explicit opt-in.
319
+ */
320
+ private static warnCspDefaultOnce;
306
321
  /**
307
322
  * True when the client request is HTTPS. Proxy-aware and byte-parity with
308
323
  * Python (request.is_secure_scheme), PHP (Request::isSecureScheme) and Ruby