securenow 5.18.0 → 6.0.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.
- package/LICENSE +15 -0
- package/README.md +40 -239
- package/cli.js +455 -415
- package/console-instrumentation.js +136 -147
- package/docs/ALL-FRAMEWORKS-QUICKSTART.md +455 -1339
- package/docs/ARCHITECTURE.md +3 -3
- package/docs/AUTO-BODY-CAPTURE.md +1 -1
- package/docs/AUTO-SETUP.md +4 -4
- package/docs/AUTOMATIC-IP-CAPTURE.md +5 -5
- package/docs/BODY-CAPTURE-QUICKSTART.md +2 -2
- package/docs/CHANGELOG-NEXTJS.md +35 -1
- package/docs/CUSTOMER-GUIDE.md +16 -16
- package/docs/EASIEST-SETUP.md +5 -5
- package/docs/ENVIRONMENT-VARIABLES.md +652 -880
- package/docs/EXPRESS-BODY-CAPTURE.md +12 -13
- package/docs/EXPRESS-SETUP-GUIDE.md +720 -719
- package/docs/INDEX.md +4 -22
- package/docs/LOGGING-GUIDE.md +708 -701
- package/docs/LOGGING-QUICKSTART.md +255 -234
- package/docs/NEXTJS-BODY-CAPTURE.md +2 -2
- package/docs/NEXTJS-GUIDE.md +14 -14
- package/docs/NEXTJS-QUICKSTART.md +1 -1
- package/docs/NEXTJS-WRAPPER-APPROACH.md +1 -1
- package/docs/QUICKSTART-BODY-CAPTURE.md +2 -2
- package/docs/REDACTION-EXAMPLES.md +1 -1
- package/docs/REQUEST-BODY-CAPTURE.md +10 -19
- package/docs/VERCEL-OTEL-MIGRATION.md +3 -3
- package/examples/README.md +6 -6
- package/examples/instrumentation-with-auto-capture.ts +1 -1
- package/examples/nextjs-env-example.txt +2 -2
- package/examples/nextjs-instrumentation.js +1 -1
- package/examples/nextjs-instrumentation.ts +1 -1
- package/examples/nextjs-with-logging-example.md +6 -6
- package/examples/nextjs-with-options.ts +1 -1
- package/examples/test-nextjs-setup.js +1 -1
- package/nextjs-auto-capture.js +207 -199
- package/nextjs-middleware.js +181 -186
- package/nextjs-webpack-config.js +53 -88
- package/nextjs-wrapper.js +158 -158
- package/nextjs.d.ts +1 -1
- package/nextjs.js +198 -186
- package/package.json +45 -67
- package/postinstall.js +6 -6
- package/register.d.ts +1 -1
- package/register.js +4 -39
- package/tracing.d.ts +1 -2
- package/tracing.js +26 -286
- package/web-vite.mjs +156 -239
- package/CONSUMING-APPS-GUIDE.md +0 -455
- package/NPM_README.md +0 -1933
- package/SKILL-API.md +0 -600
- package/SKILL-CLI.md +0 -409
- package/cidr.js +0 -83
- package/cli/apps.js +0 -585
- package/cli/auth.js +0 -280
- package/cli/client.js +0 -115
- package/cli/config.js +0 -173
- package/cli/firewall.js +0 -100
- package/cli/fp.js +0 -638
- package/cli/init.js +0 -201
- package/cli/monitor.js +0 -440
- package/cli/run.js +0 -133
- package/cli/security.js +0 -1064
- package/cli/ui.js +0 -386
- package/docs/API-KEYS-GUIDE.md +0 -233
- package/docs/AUTO-SETUP-SUMMARY.md +0 -331
- package/docs/BODY-CAPTURE-FIX.md +0 -261
- package/docs/COMPLETION-REPORT.md +0 -408
- package/docs/FINAL-SOLUTION.md +0 -335
- package/docs/FIREWALL-GUIDE.md +0 -426
- package/docs/IMPLEMENTATION-SUMMARY.md +0 -410
- package/docs/NEXTJS-BODY-CAPTURE-COMPARISON.md +0 -323
- package/docs/NEXTJS-SETUP-COMPLETE.md +0 -795
- package/docs/NUXT-GUIDE.md +0 -166
- package/docs/SOLUTION-SUMMARY.md +0 -312
- package/firewall-cloud.js +0 -212
- package/firewall-iptables.js +0 -139
- package/firewall-only.js +0 -38
- package/firewall-tcp.js +0 -74
- package/firewall.js +0 -720
- package/free-trial-banner.js +0 -174
- package/nuxt-server-plugin.mjs +0 -423
- package/nuxt.d.ts +0 -60
- package/nuxt.mjs +0 -75
- package/resolve-ip.js +0 -77
package/nuxt.mjs
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SecureNow Nuxt 3 Module
|
|
3
|
-
*
|
|
4
|
-
* Usage in nuxt.config.ts:
|
|
5
|
-
*
|
|
6
|
-
* export default defineNuxtConfig({
|
|
7
|
-
* modules: ['securenow/nuxt'],
|
|
8
|
-
* securenow: { // optional overrides
|
|
9
|
-
* serviceName: 'my-nuxt-app',
|
|
10
|
-
* },
|
|
11
|
-
* });
|
|
12
|
-
*
|
|
13
|
-
* Environment variables (same as all SecureNow integrations):
|
|
14
|
-
* SECURENOW_APPID, SECURENOW_INSTANCE, SECURENOW_LOGGING_ENABLED, etc.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { defineNuxtModule, createResolver, addServerPlugin } from '@nuxt/kit';
|
|
18
|
-
|
|
19
|
-
const OTEL_EXTERNALS = [
|
|
20
|
-
'securenow',
|
|
21
|
-
'@opentelemetry/api',
|
|
22
|
-
'@opentelemetry/api-logs',
|
|
23
|
-
'@opentelemetry/sdk-node',
|
|
24
|
-
'@opentelemetry/sdk-logs',
|
|
25
|
-
'@opentelemetry/auto-instrumentations-node',
|
|
26
|
-
'@opentelemetry/instrumentation',
|
|
27
|
-
'@opentelemetry/instrumentation-http',
|
|
28
|
-
'@opentelemetry/exporter-trace-otlp-http',
|
|
29
|
-
'@opentelemetry/exporter-logs-otlp-http',
|
|
30
|
-
'@opentelemetry/resources',
|
|
31
|
-
'@opentelemetry/semantic-conventions',
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
export default defineNuxtModule({
|
|
35
|
-
meta: {
|
|
36
|
-
name: 'securenow',
|
|
37
|
-
configKey: 'securenow',
|
|
38
|
-
compatibility: { nuxt: '>=3.0.0' },
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
defaults: {
|
|
42
|
-
serviceName: undefined,
|
|
43
|
-
endpoint: undefined,
|
|
44
|
-
noUuid: undefined,
|
|
45
|
-
captureBody: undefined,
|
|
46
|
-
logging: undefined,
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
setup(options, nuxt) {
|
|
50
|
-
const { resolve } = createResolver(import.meta.url);
|
|
51
|
-
|
|
52
|
-
// ── Externalize OTel packages so Nitro doesn't bundle them ──
|
|
53
|
-
nuxt.hook('nitro:config', (nitroConfig) => {
|
|
54
|
-
nitroConfig.externals = nitroConfig.externals || {};
|
|
55
|
-
nitroConfig.externals.external = [
|
|
56
|
-
...(nitroConfig.externals.external || []),
|
|
57
|
-
...OTEL_EXTERNALS,
|
|
58
|
-
];
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
// ── Pass module options to the server plugin via runtimeConfig ──
|
|
62
|
-
nuxt.options.runtimeConfig.securenow = {
|
|
63
|
-
serviceName: options.serviceName,
|
|
64
|
-
endpoint: options.endpoint,
|
|
65
|
-
noUuid: options.noUuid,
|
|
66
|
-
captureBody: options.captureBody,
|
|
67
|
-
logging: options.logging,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// ── Register Nitro server plugin ──
|
|
71
|
-
addServerPlugin(resolve('./nuxt-server-plugin'));
|
|
72
|
-
|
|
73
|
-
console.log('[securenow] Nuxt module loaded — server plugin registered');
|
|
74
|
-
},
|
|
75
|
-
});
|
package/resolve-ip.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const os = require('os');
|
|
4
|
-
|
|
5
|
-
const LOOPBACK_RE = /^(127\.|::1$|::ffff:127\.)/;
|
|
6
|
-
const PRIVATE_IP_RE = /^(127\.|::1$|::ffff:127\.|10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.|f[cd][0-9a-f]{2}:)/;
|
|
7
|
-
|
|
8
|
-
const trustedProxyCsv = (process.env.SECURENOW_TRUSTED_PROXIES || '').trim();
|
|
9
|
-
const trustedProxySet = trustedProxyCsv
|
|
10
|
-
? new Set(trustedProxyCsv.split(',').map(s => s.trim()).filter(Boolean))
|
|
11
|
-
: null;
|
|
12
|
-
|
|
13
|
-
let _hostIp = null;
|
|
14
|
-
function getHostIp() {
|
|
15
|
-
if (_hostIp !== null) return _hostIp;
|
|
16
|
-
try {
|
|
17
|
-
const ifaces = os.networkInterfaces();
|
|
18
|
-
for (const name of Object.keys(ifaces)) {
|
|
19
|
-
for (const iface of ifaces[name]) {
|
|
20
|
-
if (!iface.internal && iface.family === 'IPv4') { _hostIp = iface.address; return _hostIp; }
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
} catch (_) {}
|
|
24
|
-
_hostIp = '';
|
|
25
|
-
return _hostIp;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function isFromTrustedProxy(socketIp) {
|
|
29
|
-
if (!socketIp) return false;
|
|
30
|
-
const normalized = socketIp.replace(/^::ffff:/, '');
|
|
31
|
-
if (trustedProxySet && trustedProxySet.has(normalized)) return true;
|
|
32
|
-
return PRIVATE_IP_RE.test(socketIp);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Resolve the real client IP from an HTTP request, respecting trusted proxies.
|
|
37
|
-
* Reads X-Forwarded-For / X-Real-IP only when the direct connection comes
|
|
38
|
-
* from a private/trusted proxy IP. Prevents client-side IP spoofing.
|
|
39
|
-
*/
|
|
40
|
-
function resolveClientIp(request) {
|
|
41
|
-
const socketIp = request.socket?.remoteAddress || '';
|
|
42
|
-
if (!isFromTrustedProxy(socketIp)) return socketIp;
|
|
43
|
-
|
|
44
|
-
const fwd = request.headers['x-forwarded-for'];
|
|
45
|
-
if (fwd) {
|
|
46
|
-
const chain = String(fwd).split(',').map(s => s.trim()).filter(Boolean);
|
|
47
|
-
for (let i = chain.length - 1; i >= 0; i--) {
|
|
48
|
-
if (!isFromTrustedProxy(chain[i])) return chain[i];
|
|
49
|
-
}
|
|
50
|
-
return socketIp;
|
|
51
|
-
}
|
|
52
|
-
const headerIp = request.headers['x-real-ip'];
|
|
53
|
-
if (headerIp) return headerIp;
|
|
54
|
-
|
|
55
|
-
if (LOOPBACK_RE.test(socketIp)) {
|
|
56
|
-
const hostIp = getHostIp();
|
|
57
|
-
if (hostIp) return hostIp;
|
|
58
|
-
}
|
|
59
|
-
return socketIp;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Resolve IP from a raw TCP socket (no HTTP headers available).
|
|
64
|
-
* Normalizes IPv6-mapped IPv4 addresses.
|
|
65
|
-
*/
|
|
66
|
-
function resolveSocketIp(socket) {
|
|
67
|
-
const raw = socket?.remoteAddress || '';
|
|
68
|
-
return raw.replace(/^::ffff:/, '');
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
module.exports = {
|
|
72
|
-
resolveClientIp,
|
|
73
|
-
resolveSocketIp,
|
|
74
|
-
isFromTrustedProxy,
|
|
75
|
-
LOOPBACK_RE,
|
|
76
|
-
PRIVATE_IP_RE,
|
|
77
|
-
};
|