securenow 8.11.2 → 8.12.0
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/README.md +7 -8
- package/SKILL-API.md +0 -1
- package/SKILL-CLI.md +624 -632
- package/TELEMETRY-SQL.md +6 -1
- package/app-config.js +10 -7
- package/cidr.js +83 -83
- package/cli/apps.js +36 -8
- package/cli/client.js +102 -102
- package/cli/diagnostics.js +5 -1
- package/cli/firewall.js +141 -141
- package/cli/fp.js +638 -638
- package/cli/monitor.js +398 -398
- package/cli/run.js +132 -132
- package/cli/security.js +1866 -1856
- package/cli/ui.js +374 -374
- package/cli.js +923 -922
- package/firewall-cloud.js +202 -202
- package/firewall-iptables.js +139 -139
- package/firewall-only.js +46 -46
- package/firewall-tcp.js +74 -74
- package/firewall.js +1470 -1470
- package/mcp/catalog.js +2358 -2346
- package/nextjs-auto-capture.d.ts +29 -29
- package/nextjs-auto-capture.js +273 -273
- package/nextjs-middleware.d.ts +57 -57
- package/nextjs-middleware.js +267 -267
- package/nextjs-webpack-config.js +79 -79
- package/nextjs-wrapper.d.ts +95 -95
- package/nextjs-wrapper.js +233 -233
- package/nextjs.js +0 -9
- package/nuxt-server-plugin.mjs +0 -11
- package/nuxt.mjs +74 -74
- package/package.json +1 -2
- package/register.d.ts +42 -42
- package/register.js +44 -44
- package/resolve-ip.js +13 -13
- package/telemetry-schema.json +3 -1
- package/tracing.js +847 -853
- package/web-vite.mjs +0 -76
- package/free-trial-banner.js +0 -175
package/nuxt.mjs
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
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):
|
|
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
14
|
* Configuration is read from .securenow/credentials.json.
|
|
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
|
-
});
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "securenow",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.12.0",
|
|
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",
|
|
@@ -153,7 +153,6 @@
|
|
|
153
153
|
"cli.js",
|
|
154
154
|
"cli/",
|
|
155
155
|
"mcp/",
|
|
156
|
-
"free-trial-banner.js",
|
|
157
156
|
"resolve-ip.js",
|
|
158
157
|
"cidr.js",
|
|
159
158
|
"firewall.js",
|
package/register.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SecureNow Register Module TypeScript Declarations
|
|
3
|
-
*
|
|
4
|
-
* Main entry point for Node.js/Express/Fastify/NestJS applications.
|
|
5
|
-
* This module is automatically loaded when using NODE_OPTIONS="-r securenow/register"
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* SecureNow Register Module TypeScript Declarations
|
|
3
|
+
*
|
|
4
|
+
* Main entry point for Node.js/Express/Fastify/NestJS applications.
|
|
5
|
+
* This module is automatically loaded when using NODE_OPTIONS="-r securenow/register"
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
9
|
* Configuration:
|
|
10
10
|
*
|
|
11
11
|
* Local development reads .securenow/credentials.json. Run
|
|
@@ -17,28 +17,28 @@
|
|
|
17
17
|
* generated JSON to .securenow/credentials.json in the running app.
|
|
18
18
|
*
|
|
19
19
|
* Legacy env vars are fallback-only for existing installs.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
// This module has side effects (initializes OpenTelemetry)
|
|
23
|
-
// It's typically used via NODE_OPTIONS, not imported directly
|
|
24
|
-
export {};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @example
|
|
28
|
-
* ```bash
|
|
29
|
-
* # Using with Node.js preload
|
|
30
|
-
* NODE_OPTIONS="-r securenow/register" node app.js
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```bash
|
|
35
|
-
* # Using with PM2
|
|
36
|
-
* pm2 start app.js --node-args="-r securenow/register"
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```javascript
|
|
41
|
-
* // ecosystem.config.js
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
// This module has side effects (initializes OpenTelemetry)
|
|
23
|
+
// It's typically used via NODE_OPTIONS, not imported directly
|
|
24
|
+
export {};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @example
|
|
28
|
+
* ```bash
|
|
29
|
+
* # Using with Node.js preload
|
|
30
|
+
* NODE_OPTIONS="-r securenow/register" node app.js
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```bash
|
|
35
|
+
* # Using with PM2
|
|
36
|
+
* pm2 start app.js --node-args="-r securenow/register"
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```javascript
|
|
41
|
+
* // ecosystem.config.js
|
|
42
42
|
* module.exports = {
|
|
43
43
|
* apps: [{
|
|
44
44
|
* name: 'my-app',
|
|
@@ -47,15 +47,15 @@ export {};
|
|
|
47
47
|
* // Local and production use .securenow/credentials.json.
|
|
48
48
|
* }]
|
|
49
49
|
* };
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```typescript
|
|
54
|
-
* // Explicit import (optional, mainly for side effects)
|
|
55
|
-
* import 'securenow/register';
|
|
56
|
-
*
|
|
57
|
-
* import express from 'express';
|
|
58
|
-
* const app = express();
|
|
59
|
-
* // Your app code...
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* // Explicit import (optional, mainly for side effects)
|
|
55
|
+
* import 'securenow/register';
|
|
56
|
+
*
|
|
57
|
+
* import express from 'express';
|
|
58
|
+
* const app = express();
|
|
59
|
+
* // Your app code...
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
package/register.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
// securenow/register.js — the only preload customers need:
|
|
2
|
-
// node --require securenow/register app.js
|
|
3
|
-
//
|
|
4
|
-
// For ESM apps ("type": "module"), this file auto-registers the
|
|
5
|
-
// OpenTelemetry ESM loader hook via module.register() (Node >=20.6).
|
|
6
|
-
// On older Node versions it falls back to a warning.
|
|
7
|
-
'use strict';
|
|
8
|
-
|
|
9
|
-
// Do nothing inside Node's internal ESM-hooks thread (see internal-thread.js).
|
|
10
|
-
if (require('./internal-thread').inInternalThread()) return;
|
|
11
|
-
|
|
12
|
-
// 1. Auto-register the ESM loader hook so customers never need --import
|
|
13
|
-
(() => {
|
|
14
|
-
try {
|
|
15
|
-
const fs = require('fs');
|
|
16
|
-
const path = require('path');
|
|
17
|
-
const pkgPath = path.resolve(process.cwd(), 'package.json');
|
|
18
|
-
if (!fs.existsSync(pkgPath)) return;
|
|
19
|
-
|
|
20
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8').replace(/^\uFEFF/, ''));
|
|
21
|
-
if (pkg.type !== 'module') return;
|
|
22
|
-
|
|
23
|
-
// Already registered via --import?
|
|
24
|
-
const execArgv = process.execArgv.join(' ');
|
|
25
|
-
if (execArgv.includes('hook.mjs') || execArgv.includes('import-in-the-middle')) return;
|
|
26
|
-
|
|
27
|
-
// Node >=20.6 exposes module.register() for programmatic ESM hooks
|
|
28
|
-
const mod = require('node:module');
|
|
29
|
-
if (typeof mod.register !== 'function') {
|
|
30
|
-
console.warn('[securenow] ESM app detected but Node %s lacks module.register().', process.version);
|
|
31
|
-
console.warn('[securenow] Upgrade to Node >=20.6 or add: --import @opentelemetry/instrumentation/hook.mjs');
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const { pathToFileURL } = require('node:url');
|
|
36
|
-
mod.register('@opentelemetry/instrumentation/hook.mjs', pathToFileURL(__filename));
|
|
37
|
-
console.log('[securenow] ESM loader hook auto-registered (module.register)');
|
|
38
|
-
} catch (_) {
|
|
39
|
-
// Non-fatal — tracing.js will show its own ESM warning if the hook is missing
|
|
40
|
-
}
|
|
41
|
-
})();
|
|
42
|
-
|
|
43
|
-
// 2. Run the OTel SDK setup
|
|
44
|
-
require('./tracing');
|
|
1
|
+
// securenow/register.js — the only preload customers need:
|
|
2
|
+
// node --require securenow/register app.js
|
|
3
|
+
//
|
|
4
|
+
// For ESM apps ("type": "module"), this file auto-registers the
|
|
5
|
+
// OpenTelemetry ESM loader hook via module.register() (Node >=20.6).
|
|
6
|
+
// On older Node versions it falls back to a warning.
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
// Do nothing inside Node's internal ESM-hooks thread (see internal-thread.js).
|
|
10
|
+
if (require('./internal-thread').inInternalThread()) return;
|
|
11
|
+
|
|
12
|
+
// 1. Auto-register the ESM loader hook so customers never need --import
|
|
13
|
+
(() => {
|
|
14
|
+
try {
|
|
15
|
+
const fs = require('fs');
|
|
16
|
+
const path = require('path');
|
|
17
|
+
const pkgPath = path.resolve(process.cwd(), 'package.json');
|
|
18
|
+
if (!fs.existsSync(pkgPath)) return;
|
|
19
|
+
|
|
20
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8').replace(/^\uFEFF/, ''));
|
|
21
|
+
if (pkg.type !== 'module') return;
|
|
22
|
+
|
|
23
|
+
// Already registered via --import?
|
|
24
|
+
const execArgv = process.execArgv.join(' ');
|
|
25
|
+
if (execArgv.includes('hook.mjs') || execArgv.includes('import-in-the-middle')) return;
|
|
26
|
+
|
|
27
|
+
// Node >=20.6 exposes module.register() for programmatic ESM hooks
|
|
28
|
+
const mod = require('node:module');
|
|
29
|
+
if (typeof mod.register !== 'function') {
|
|
30
|
+
console.warn('[securenow] ESM app detected but Node %s lacks module.register().', process.version);
|
|
31
|
+
console.warn('[securenow] Upgrade to Node >=20.6 or add: --import @opentelemetry/instrumentation/hook.mjs');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const { pathToFileURL } = require('node:url');
|
|
36
|
+
mod.register('@opentelemetry/instrumentation/hook.mjs', pathToFileURL(__filename));
|
|
37
|
+
console.log('[securenow] ESM loader hook auto-registered (module.register)');
|
|
38
|
+
} catch (_) {
|
|
39
|
+
// Non-fatal — tracing.js will show its own ESM warning if the hook is missing
|
|
40
|
+
}
|
|
41
|
+
})();
|
|
42
|
+
|
|
43
|
+
// 2. Run the OTel SDK setup
|
|
44
|
+
require('./tracing');
|
package/resolve-ip.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
3
|
const os = require('os');
|
|
4
4
|
const appConfig = require('./app-config');
|
|
5
5
|
|
|
@@ -121,20 +121,20 @@ function resolveClientIpWithDetails(request) {
|
|
|
121
121
|
|
|
122
122
|
return details;
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Resolve the real client IP from an HTTP request, respecting trusted proxies.
|
|
127
|
-
* Reads X-Forwarded-For / X-Real-IP only when the direct connection comes
|
|
128
|
-
* from a private/trusted proxy IP. Prevents client-side IP spoofing.
|
|
129
|
-
*/
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Resolve the real client IP from an HTTP request, respecting trusted proxies.
|
|
127
|
+
* Reads X-Forwarded-For / X-Real-IP only when the direct connection comes
|
|
128
|
+
* from a private/trusted proxy IP. Prevents client-side IP spoofing.
|
|
129
|
+
*/
|
|
130
130
|
function resolveClientIp(request) {
|
|
131
131
|
return resolveClientIpWithDetails(request).ip || '';
|
|
132
132
|
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Resolve IP from a raw TCP socket (no HTTP headers available).
|
|
136
|
-
* Normalizes IPv6-mapped IPv4 addresses.
|
|
137
|
-
*/
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Resolve IP from a raw TCP socket (no HTTP headers available).
|
|
136
|
+
* Normalizes IPv6-mapped IPv4 addresses.
|
|
137
|
+
*/
|
|
138
138
|
function resolveSocketIp(socket) {
|
|
139
139
|
const raw = socket?.remoteAddress || '';
|
|
140
140
|
return normalizeIp(raw);
|
package/telemetry-schema.json
CHANGED
|
@@ -111,12 +111,14 @@
|
|
|
111
111
|
"userId": "attributes_string['enduser.id']",
|
|
112
112
|
"sessionId": "attributes_string['session.id']",
|
|
113
113
|
"ip": "attributes_string['http.client_ip']",
|
|
114
|
-
"userAgent": "attributes_string['
|
|
114
|
+
"userAgent": "attributes_string['user_agent.original']",
|
|
115
115
|
"severity": "severity_text",
|
|
116
116
|
"attributes.string": "attributes_string['<custom-key>']",
|
|
117
117
|
"attributes.number": "attributes_number['<custom-key>']",
|
|
118
118
|
"attributes.boolean": "attributes_bool['<custom-key>']"
|
|
119
119
|
},
|
|
120
|
+
"reservedAttributePrefixes": ["event.", "enduser.", "session.", "http.", "service.", "securenow.", "client."],
|
|
121
|
+
"reservedAttributeNote": "Custom attribute keys with a reserved prefix are stored as attr.<key>. Events keep the sender-supplied timestamp and carry no event ID. client.asn / client.as_org are added from ip only when the instance has ASN enrichment.",
|
|
120
122
|
"recommendedAuthenticationEvents": [
|
|
121
123
|
"auth.login.failure",
|
|
122
124
|
"auth.login.success",
|