securenow 5.11.0 → 5.11.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.
Files changed (2) hide show
  1. package/nextjs.js +22 -2
  2. package/package.json +1 -1
package/nextjs.js CHANGED
@@ -521,8 +521,8 @@ function registerSecureNow(options = {}) {
521
521
  } catch (_) {}
522
522
 
523
523
  // Graceful shutdown for logs
524
- process.on('SIGTERM', async () => { try { await loggerProvider.shutdown(); } catch (_) {} });
525
- process.on('SIGINT', async () => { try { await loggerProvider.shutdown(); } catch (_) {} });
524
+ process.on('SIGTERM', async () => { try { await loggerProvider.shutdown(); } catch (_) {} try { require('./firewall').shutdown(); } catch (_) {} });
525
+ process.on('SIGINT', async () => { try { await loggerProvider.shutdown(); } catch (_) {} try { require('./firewall').shutdown(); } catch (_) {} });
526
526
  } catch (e) {
527
527
  console.warn('[securenow] ⚠️ Logging setup failed (missing @opentelemetry/exporter-logs-otlp-http or @opentelemetry/sdk-logs):', e.message);
528
528
  }
@@ -541,6 +541,26 @@ function registerSecureNow(options = {}) {
541
541
  }
542
542
  } catch (_) {}
543
543
 
544
+ // Firewall — auto-activates when SECURENOW_API_KEY is set
545
+ const firewallApiKey = env('SECURENOW_API_KEY');
546
+ if (firewallApiKey && env('SECURENOW_FIREWALL_ENABLED') !== '0') {
547
+ try {
548
+ require('./firewall').init({
549
+ apiKey: firewallApiKey,
550
+ apiUrl: env('SECURENOW_API_URL') || 'https://api.securenow.ai',
551
+ syncInterval: parseInt(env('SECURENOW_FIREWALL_SYNC_INTERVAL'), 10) || 60,
552
+ failMode: env('SECURENOW_FIREWALL_FAIL_MODE') || 'open',
553
+ statusCode: parseInt(env('SECURENOW_FIREWALL_STATUS_CODE'), 10) || 403,
554
+ log: env('SECURENOW_FIREWALL_LOG') !== '0',
555
+ tcp: env('SECURENOW_FIREWALL_TCP') === '1',
556
+ iptables: env('SECURENOW_FIREWALL_IPTABLES') === '1',
557
+ cloud: env('SECURENOW_FIREWALL_CLOUD') || null,
558
+ });
559
+ } catch (e) {
560
+ console.warn('[securenow] Firewall init failed:', e.message);
561
+ }
562
+ }
563
+
544
564
  console.log('[securenow] ✅ OpenTelemetry started for Next.js → %s', tracesUrl);
545
565
  console.log('[securenow] 📊 Auto-capturing comprehensive request metadata:');
546
566
  console.log('[securenow] • IP addresses (x-forwarded-for, x-real-ip, socket)');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securenow",
3
- "version": "5.11.0",
3
+ "version": "5.11.1",
4
4
  "description": "OpenTelemetry instrumentation for Node.js, Next.js, and Nuxt - Send traces and logs to any OTLP-compatible backend",
5
5
  "type": "commonjs",
6
6
  "main": "register.js",