4bnode 4.1.6 → 4.1.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/skeleton/index.js +20 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "4bnode",
3
- "version": "4.1.6",
3
+ "version": "4.1.7",
4
4
  "description": "4bnode is a CLI-powered backend development platform with a built-in visual dashboard to generate, manage, and test Node.js/Express APIs faster.",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/skeleton/index.js CHANGED
@@ -50,13 +50,31 @@ app.use(cors({ origin: "*" }));
50
50
  // ── Security (built-in by default) ───────────────────
51
51
  // Mounted AFTER the /_dev dashboard so its CDN/inline scripts aren't blocked by
52
52
  // helmet's CSP and the dashboard isn't throttled by the rate limiter.
53
- app.use(helmet());
53
+ // helmet() defaults to a strict Content-Security-Policy (script-src 'self',
54
+ // etc.) that blocks CDN-loaded scripts, inline <script> blocks, and cross-origin
55
+ // assets. We widen the policy so a typical frontend/docs page works while keeping
56
+ // the rest of helmet's protections. Tighten these directives for production.
57
+ app.use(helmet({
58
+ contentSecurityPolicy: {
59
+ directives: {
60
+ defaultSrc: ["'self'"],
61
+ scriptSrc: ["'self'", 'https:', "'unsafe-inline'"],
62
+ styleSrc: ["'self'", 'https:', "'unsafe-inline'"],
63
+ imgSrc: ["'self'", 'data:', 'https:'],
64
+ connectSrc: ["'self'"],
65
+ },
66
+ },
67
+ crossOriginEmbedderPolicy: false,
68
+ // Allow other origins (e.g. a separate frontend host) to load assets served
69
+ // by this app. Default is 'same-origin'. Tighten to 'same-site' for production.
70
+ crossOriginResourcePolicy: { policy: 'cross-origin' },
71
+ }));
54
72
 
55
73
  // ── Rate limiting ────────────────────────────────────
56
74
  // Tune via .env: RATE_LIMIT_WINDOW_MS (ms) and RATE_LIMIT_MAX (per window).
57
75
  const apiLimiter = rateLimit({
58
76
  windowMs: Number(process.env.RATE_LIMIT_WINDOW_MS) || 15 * 60 * 1000,
59
- max: Number(process.env.RATE_LIMIT_MAX) || 100,
77
+ max: Number(process.env.RATE_LIMIT_MAX) || 500,
60
78
  standardHeaders: true,
61
79
  legacyHeaders: false,
62
80
  });