securenow 8.11.1 → 8.11.3
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/NPM_README.md +3 -1
- package/README.md +2 -0
- package/SKILL-API.md +3 -1
- package/SKILL-CLI.md +625 -632
- package/TELEMETRY-SQL.md +6 -1
- package/cidr.js +83 -83
- package/cli/client.js +102 -102
- package/cli/diagnostics.js +4 -0
- 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/legacy-semconv.js +4 -3
- package/mcp/catalog.js +2358 -2346
- package/nextjs-auto-capture.d.ts +29 -29
- package/nextjs-auto-capture.js +280 -274
- package/nextjs-middleware.d.ts +57 -57
- package/nextjs-middleware.js +274 -268
- package/nextjs-webpack-config.js +79 -79
- package/nextjs-wrapper.d.ts +95 -95
- package/nextjs-wrapper.js +240 -234
- package/nextjs.js +19 -12
- package/nuxt-server-plugin.mjs +11 -5
- package/nuxt.mjs +74 -74
- package/otp-redaction.js +99 -0
- package/package.json +3 -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 +860 -855
package/nextjs-webpack-config.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
4
|
* Next.js configuration helpers for SecureNow
|
|
5
|
-
*
|
|
6
|
-
* Usage (recommended — zero-list approach):
|
|
7
|
-
*
|
|
5
|
+
*
|
|
6
|
+
* Usage (recommended — zero-list approach):
|
|
7
|
+
*
|
|
8
8
|
* const { withSecureNow } = require('securenow/nextjs-webpack-config');
|
|
9
9
|
* module.exports = withSecureNow({
|
|
10
10
|
* // your existing next.config options
|
|
@@ -12,68 +12,68 @@
|
|
|
12
12
|
*
|
|
13
13
|
* This externalizes SecureNow for server bundles and includes the package in
|
|
14
14
|
* standalone output so runtime modules such as the firewall are available.
|
|
15
|
-
*
|
|
16
|
-
* Legacy webpack-only helper (still exported for backwards compat):
|
|
17
|
-
*
|
|
18
|
-
* const { getSecureNowWebpackConfig } = require('securenow/nextjs-webpack-config');
|
|
19
|
-
* module.exports = { webpack: (config, opts) => getSecureNowWebpackConfig(config, opts) };
|
|
20
|
-
*/
|
|
21
|
-
|
|
15
|
+
*
|
|
16
|
+
* Legacy webpack-only helper (still exported for backwards compat):
|
|
17
|
+
*
|
|
18
|
+
* const { getSecureNowWebpackConfig } = require('securenow/nextjs-webpack-config');
|
|
19
|
+
* module.exports = { webpack: (config, opts) => getSecureNowWebpackConfig(config, opts) };
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
22
|
const EXTERNAL_PACKAGES = [
|
|
23
23
|
'securenow',
|
|
24
24
|
];
|
|
25
25
|
const OUTPUT_TRACE_INCLUDE_KEY = '/*';
|
|
26
26
|
const SECURENOW_OUTPUT_TRACE_INCLUDE = './node_modules/securenow/**/*';
|
|
27
|
-
|
|
28
|
-
function detectNextMajor() {
|
|
29
|
-
try {
|
|
30
|
-
const pkg = require('next/package.json');
|
|
31
|
-
return parseInt(pkg.version, 10) || 14;
|
|
32
|
-
} catch {
|
|
33
|
-
return 14;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
27
|
+
|
|
28
|
+
function detectNextMajor() {
|
|
29
|
+
try {
|
|
30
|
+
const pkg = require('next/package.json');
|
|
31
|
+
return parseInt(pkg.version, 10) || 14;
|
|
32
|
+
} catch {
|
|
33
|
+
return 14;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
38
|
* Wrap a Next.js config object to auto-externalize SecureNow,
|
|
39
39
|
* include runtime files in standalone output, and enable the
|
|
40
40
|
* instrumentation hook.
|
|
41
|
-
*
|
|
42
|
-
* module.exports = withSecureNow({ reactStrictMode: true });
|
|
43
|
-
*/
|
|
44
|
-
function withSecureNow(userConfig) {
|
|
45
|
-
if (typeof userConfig === 'function') {
|
|
46
|
-
return (...args) => withSecureNow(userConfig(...args));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const cfg = { ...userConfig };
|
|
50
|
-
const major = detectNextMajor();
|
|
51
|
-
|
|
52
|
-
if (major >= 15) {
|
|
53
|
-
cfg.serverExternalPackages = dedup([
|
|
54
|
-
...(cfg.serverExternalPackages || []),
|
|
55
|
-
...EXTERNAL_PACKAGES,
|
|
56
|
-
]);
|
|
41
|
+
*
|
|
42
|
+
* module.exports = withSecureNow({ reactStrictMode: true });
|
|
43
|
+
*/
|
|
44
|
+
function withSecureNow(userConfig) {
|
|
45
|
+
if (typeof userConfig === 'function') {
|
|
46
|
+
return (...args) => withSecureNow(userConfig(...args));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const cfg = { ...userConfig };
|
|
50
|
+
const major = detectNextMajor();
|
|
51
|
+
|
|
52
|
+
if (major >= 15) {
|
|
53
|
+
cfg.serverExternalPackages = dedup([
|
|
54
|
+
...(cfg.serverExternalPackages || []),
|
|
55
|
+
...EXTERNAL_PACKAGES,
|
|
56
|
+
]);
|
|
57
57
|
} else {
|
|
58
58
|
cfg.experimental = { ...(cfg.experimental || {}) };
|
|
59
59
|
cfg.experimental.instrumentationHook = true;
|
|
60
|
-
cfg.experimental.serverComponentsExternalPackages = dedup([
|
|
61
|
-
...(cfg.experimental.serverComponentsExternalPackages || []),
|
|
62
|
-
...EXTERNAL_PACKAGES,
|
|
60
|
+
cfg.experimental.serverComponentsExternalPackages = dedup([
|
|
61
|
+
...(cfg.experimental.serverComponentsExternalPackages || []),
|
|
62
|
+
...EXTERNAL_PACKAGES,
|
|
63
63
|
]);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
cfg.outputFileTracingIncludes = mergeOutputFileTracingIncludes(cfg.outputFileTracingIncludes);
|
|
67
67
|
|
|
68
68
|
const origWebpack = cfg.webpack;
|
|
69
|
-
cfg.webpack = (config, options) => {
|
|
70
|
-
const c = origWebpack ? origWebpack(config, options) : config;
|
|
71
|
-
return getSecureNowWebpackConfig(c, options);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
return cfg;
|
|
75
|
-
}
|
|
76
|
-
|
|
69
|
+
cfg.webpack = (config, options) => {
|
|
70
|
+
const c = origWebpack ? origWebpack(config, options) : config;
|
|
71
|
+
return getSecureNowWebpackConfig(c, options);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return cfg;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
77
|
function dedup(arr) {
|
|
78
78
|
return [...new Set(arr)];
|
|
79
79
|
}
|
|
@@ -92,32 +92,32 @@ function mergeOutputFileTracingIncludes(existing) {
|
|
|
92
92
|
|
|
93
93
|
return includes;
|
|
94
94
|
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Legacy: suppress OTel webpack warnings and add externals.
|
|
98
|
-
*/
|
|
99
|
-
function getSecureNowWebpackConfig(config, options) {
|
|
100
|
-
const { isServer } = options;
|
|
101
|
-
|
|
102
|
-
if (isServer) {
|
|
103
|
-
config.ignoreWarnings = config.ignoreWarnings || [];
|
|
104
|
-
config.ignoreWarnings.push(
|
|
105
|
-
{
|
|
106
|
-
module: /@opentelemetry\/instrumentation/,
|
|
107
|
-
message: /Critical dependency: the request of a dependency is an expression/,
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
module: /@opentelemetry/,
|
|
111
|
-
message: /Module not found.*@opentelemetry\/winston-transport/,
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
module: /@opentelemetry/,
|
|
115
|
-
message: /Module not found.*@opentelemetry\/exporter-jaeger/,
|
|
116
|
-
},
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return config;
|
|
121
|
-
}
|
|
122
|
-
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Legacy: suppress OTel webpack warnings and add externals.
|
|
98
|
+
*/
|
|
99
|
+
function getSecureNowWebpackConfig(config, options) {
|
|
100
|
+
const { isServer } = options;
|
|
101
|
+
|
|
102
|
+
if (isServer) {
|
|
103
|
+
config.ignoreWarnings = config.ignoreWarnings || [];
|
|
104
|
+
config.ignoreWarnings.push(
|
|
105
|
+
{
|
|
106
|
+
module: /@opentelemetry\/instrumentation/,
|
|
107
|
+
message: /Critical dependency: the request of a dependency is an expression/,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
module: /@opentelemetry/,
|
|
111
|
+
message: /Module not found.*@opentelemetry\/winston-transport/,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
module: /@opentelemetry/,
|
|
115
|
+
message: /Module not found.*@opentelemetry\/exporter-jaeger/,
|
|
116
|
+
},
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return config;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
123
|
module.exports = { withSecureNow, getSecureNowWebpackConfig, EXTERNAL_PACKAGES };
|
package/nextjs-wrapper.d.ts
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SecureNow Next.js API Route Wrapper TypeScript Declarations
|
|
3
|
-
*
|
|
4
|
-
* Provides a higher-order function to wrap Next.js API routes for body capture.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { NextRequest } from 'next/server';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Next.js API route handler type
|
|
11
|
-
*/
|
|
12
|
-
export type NextApiHandler = (
|
|
13
|
-
request: NextRequest,
|
|
14
|
-
context?: any
|
|
15
|
-
) => Promise<Response> | Response;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Wrap a Next.js API route handler to enable body capture
|
|
19
|
-
*
|
|
20
|
-
* @param handler - Your API route handler function
|
|
21
|
-
* @returns Wrapped handler with body capture enabled
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```typescript
|
|
25
|
-
* // app/api/users/route.ts
|
|
26
|
-
* import { NextRequest } from 'next/server';
|
|
27
|
-
* import { withSecureNow } from 'securenow/nextjs-wrapper';
|
|
28
|
-
*
|
|
29
|
-
* async function handler(request: NextRequest) {
|
|
30
|
-
* const body = await request.json();
|
|
31
|
-
* // Your logic here
|
|
32
|
-
* return Response.json({ success: true });
|
|
33
|
-
* }
|
|
34
|
-
*
|
|
35
|
-
* export const POST = withSecureNow(handler);
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```typescript
|
|
40
|
-
* // With TypeScript types
|
|
41
|
-
* import { NextRequest } from 'next/server';
|
|
42
|
-
* import { withSecureNow } from 'securenow/nextjs-wrapper';
|
|
43
|
-
*
|
|
44
|
-
* interface CreateUserBody {
|
|
45
|
-
* email: string;
|
|
46
|
-
* name: string;
|
|
47
|
-
* }
|
|
48
|
-
*
|
|
49
|
-
* async function createUser(request: NextRequest) {
|
|
50
|
-
* const body: CreateUserBody = await request.json();
|
|
51
|
-
* // Body is automatically captured and redacted in traces
|
|
52
|
-
* return Response.json({ id: 123 });
|
|
53
|
-
* }
|
|
54
|
-
*
|
|
55
|
-
* export const POST = withSecureNow(createUser);
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export function withSecureNow<T extends NextApiHandler>(
|
|
59
|
-
handler: T
|
|
60
|
-
): T;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Configuration options for the wrapper
|
|
64
|
-
*/
|
|
65
|
-
export interface WrapperOptions {
|
|
66
|
-
/**
|
|
67
|
-
* Maximum body size to capture in bytes
|
|
68
|
-
* @default 10240 (10KB)
|
|
69
|
-
*/
|
|
70
|
-
maxBodySize?: number;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Additional sensitive field names to redact
|
|
74
|
-
* @default []
|
|
75
|
-
*/
|
|
76
|
-
sensitiveFields?: string[];
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Enable body capture
|
|
80
|
-
* @default true
|
|
81
|
-
*/
|
|
82
|
-
enabled?: boolean;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Wrap a Next.js API route handler with custom options
|
|
87
|
-
*
|
|
88
|
-
* @param handler - Your API route handler function
|
|
89
|
-
* @param options - Configuration options
|
|
90
|
-
* @returns Wrapped handler with body capture enabled
|
|
91
|
-
*/
|
|
92
|
-
export function withSecureNowOptions<T extends NextApiHandler>(
|
|
93
|
-
handler: T,
|
|
94
|
-
options: WrapperOptions
|
|
95
|
-
): T;
|
|
1
|
+
/**
|
|
2
|
+
* SecureNow Next.js API Route Wrapper TypeScript Declarations
|
|
3
|
+
*
|
|
4
|
+
* Provides a higher-order function to wrap Next.js API routes for body capture.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { NextRequest } from 'next/server';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Next.js API route handler type
|
|
11
|
+
*/
|
|
12
|
+
export type NextApiHandler = (
|
|
13
|
+
request: NextRequest,
|
|
14
|
+
context?: any
|
|
15
|
+
) => Promise<Response> | Response;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Wrap a Next.js API route handler to enable body capture
|
|
19
|
+
*
|
|
20
|
+
* @param handler - Your API route handler function
|
|
21
|
+
* @returns Wrapped handler with body capture enabled
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // app/api/users/route.ts
|
|
26
|
+
* import { NextRequest } from 'next/server';
|
|
27
|
+
* import { withSecureNow } from 'securenow/nextjs-wrapper';
|
|
28
|
+
*
|
|
29
|
+
* async function handler(request: NextRequest) {
|
|
30
|
+
* const body = await request.json();
|
|
31
|
+
* // Your logic here
|
|
32
|
+
* return Response.json({ success: true });
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* export const POST = withSecureNow(handler);
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* // With TypeScript types
|
|
41
|
+
* import { NextRequest } from 'next/server';
|
|
42
|
+
* import { withSecureNow } from 'securenow/nextjs-wrapper';
|
|
43
|
+
*
|
|
44
|
+
* interface CreateUserBody {
|
|
45
|
+
* email: string;
|
|
46
|
+
* name: string;
|
|
47
|
+
* }
|
|
48
|
+
*
|
|
49
|
+
* async function createUser(request: NextRequest) {
|
|
50
|
+
* const body: CreateUserBody = await request.json();
|
|
51
|
+
* // Body is automatically captured and redacted in traces
|
|
52
|
+
* return Response.json({ id: 123 });
|
|
53
|
+
* }
|
|
54
|
+
*
|
|
55
|
+
* export const POST = withSecureNow(createUser);
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export function withSecureNow<T extends NextApiHandler>(
|
|
59
|
+
handler: T
|
|
60
|
+
): T;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Configuration options for the wrapper
|
|
64
|
+
*/
|
|
65
|
+
export interface WrapperOptions {
|
|
66
|
+
/**
|
|
67
|
+
* Maximum body size to capture in bytes
|
|
68
|
+
* @default 10240 (10KB)
|
|
69
|
+
*/
|
|
70
|
+
maxBodySize?: number;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Additional sensitive field names to redact
|
|
74
|
+
* @default []
|
|
75
|
+
*/
|
|
76
|
+
sensitiveFields?: string[];
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Enable body capture
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
enabled?: boolean;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Wrap a Next.js API route handler with custom options
|
|
87
|
+
*
|
|
88
|
+
* @param handler - Your API route handler function
|
|
89
|
+
* @param options - Configuration options
|
|
90
|
+
* @returns Wrapped handler with body capture enabled
|
|
91
|
+
*/
|
|
92
|
+
export function withSecureNowOptions<T extends NextApiHandler>(
|
|
93
|
+
handler: T,
|
|
94
|
+
options: WrapperOptions
|
|
95
|
+
): T;
|