[AI] Address review feedback

- sync-server CSP: drop 'unsafe-eval' from the production script-src;
  the bundle has no genuine eval/new Function usage (only a defensive
  branch in setimmediate's polyfill that's never hit). Keep it on the
  dev branch where Vite's HMR runtime relies on it. Add a comment so
  it's obvious which branch needs it and why.
- bank-factory: widen the loader glob to ./banks/*_*.{ts,js} so
  TypeScript handlers are discovered too, mirroring migrations.ts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
github-actions[bot]
2026-05-05 21:04:34 +01:00
parent 9513c1e160
commit 145868f9da
2 changed files with 7 additions and 4 deletions

View File

@@ -1,8 +1,8 @@
import IntegrationBank from './banks/integration-bank';
// Filename convention: <name>_<bic>.js (skips bank.interface, integration-bank,
// and any other helper without an underscore).
const bankLoaders = import.meta.glob('./banks/*_*.js');
// Filename convention: <name>_<bic>.{ts,js} (skips bank.interface,
// integration-bank, and any other helper without an underscore).
const bankLoaders = import.meta.glob('./banks/*_*.{ts,js}');
async function loadBanks() {
const imports = await Promise.all(

View File

@@ -127,10 +127,13 @@ app.get('/metrics', (_req, res) => {
// The web frontend.
// Dev mode proxies to Vite, which injects inline preamble scripts and uses
// a websocket for HMR. Loosen script-src and connect-src accordingly.
// `'unsafe-eval'` is dev-only (Vite's HMR runtime needs it). Re-introduce
// it in the non-dev branch only if a runtime dependency genuinely needs
// `eval` / `new Function` — the bundle currently doesn't.
const isDev = process.env.NODE_ENV === 'development';
const scriptSrc = isDev
? "'self' 'unsafe-inline' 'unsafe-eval' blob:"
: "'self' 'unsafe-eval' blob:";
: "'self' blob:";
const connectSrc = isDev ? "'self' ws: wss: http: https:" : 'http: https:';
const csp = [
"default-src 'self' blob:",