securenow 5.18.0 → 6.0.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/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 +1 -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 +239 -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 +135 -190
- 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 +22 -287
- 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
|
@@ -1,147 +1,136 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Console instrumentation helper for securenow
|
|
5
|
-
*
|
|
6
|
-
* This module wraps the default console methods (log, info, warn, error, debug)
|
|
7
|
-
* to automatically send logs to OpenTelemetry
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
* 1. Enable logging: SECURENOW_LOGGING_ENABLED=1
|
|
11
|
-
* 2. Import this file AFTER securenow is initialized
|
|
12
|
-
* 3. Use console.log/info/warn/error as normal
|
|
13
|
-
*
|
|
14
|
-
* Example:
|
|
15
|
-
* // At the top of your app.js or index.js
|
|
16
|
-
* require('securenow/register'); // or use NODE_OPTIONS
|
|
17
|
-
* require('securenow/console-instrumentation');
|
|
18
|
-
*
|
|
19
|
-
* // Now all console calls are captured
|
|
20
|
-
* console.log('Application started');
|
|
21
|
-
* console.error('An error occurred');
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
const tracing = require('./tracing');
|
|
25
|
-
|
|
26
|
-
if (!tracing.isLoggingEnabled()) {
|
|
27
|
-
console.warn('[securenow] Console instrumentation loaded but logging is not enabled. Set SECURENOW_LOGGING_ENABLED=1 to enable.');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Get a logger instance
|
|
31
|
-
const logger = tracing.getLogger('console', '1.0.0');
|
|
32
|
-
|
|
33
|
-
if (!logger) {
|
|
34
|
-
console.warn('[securenow] Console instrumentation: No logger available. Logging will not work.');
|
|
35
|
-
module.exports = {};
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
console.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
console.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
console.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
console.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
console.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
module.exports = {
|
|
139
|
-
originalConsole,
|
|
140
|
-
restoreConsole: () => {
|
|
141
|
-
console.log = originalConsole.log;
|
|
142
|
-
console.info = originalConsole.info;
|
|
143
|
-
console.warn = originalConsole.warn;
|
|
144
|
-
console.error = originalConsole.error;
|
|
145
|
-
console.debug = originalConsole.debug;
|
|
146
|
-
},
|
|
147
|
-
};
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Console instrumentation helper for securenow
|
|
5
|
+
*
|
|
6
|
+
* This module wraps the default console methods (log, info, warn, error, debug)
|
|
7
|
+
* to automatically send logs to OpenTelemetry/SigNoz.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* 1. Enable logging: SECURENOW_LOGGING_ENABLED=1
|
|
11
|
+
* 2. Import this file AFTER securenow is initialized
|
|
12
|
+
* 3. Use console.log/info/warn/error as normal
|
|
13
|
+
*
|
|
14
|
+
* Example:
|
|
15
|
+
* // At the top of your app.js or index.js
|
|
16
|
+
* require('securenow/register'); // or use NODE_OPTIONS
|
|
17
|
+
* require('securenow/console-instrumentation');
|
|
18
|
+
*
|
|
19
|
+
* // Now all console calls are captured
|
|
20
|
+
* console.log('Application started');
|
|
21
|
+
* console.error('An error occurred');
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const tracing = require('./tracing');
|
|
25
|
+
|
|
26
|
+
if (!tracing.isLoggingEnabled()) {
|
|
27
|
+
console.warn('[securenow] Console instrumentation loaded but logging is not enabled. Set SECURENOW_LOGGING_ENABLED=1 to enable.');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Get a logger instance
|
|
31
|
+
const logger = tracing.getLogger('console', '1.0.0');
|
|
32
|
+
|
|
33
|
+
if (!logger) {
|
|
34
|
+
console.warn('[securenow] Console instrumentation: No logger available. Logging will not work.');
|
|
35
|
+
module.exports = {};
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Store original console methods
|
|
40
|
+
const originalConsole = {
|
|
41
|
+
log: console.log,
|
|
42
|
+
info: console.info,
|
|
43
|
+
warn: console.warn,
|
|
44
|
+
error: console.error,
|
|
45
|
+
debug: console.debug,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Map severity levels (OpenTelemetry standard)
|
|
49
|
+
const SeverityNumber = {
|
|
50
|
+
DEBUG: 5,
|
|
51
|
+
INFO: 9,
|
|
52
|
+
WARN: 13,
|
|
53
|
+
ERROR: 17,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Format arguments into a log message
|
|
58
|
+
*/
|
|
59
|
+
function formatMessage(args) {
|
|
60
|
+
return args
|
|
61
|
+
.map((arg) => {
|
|
62
|
+
if (typeof arg === 'object' && arg !== null) {
|
|
63
|
+
try {
|
|
64
|
+
return JSON.stringify(arg);
|
|
65
|
+
} catch (e) {
|
|
66
|
+
return String(arg);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return String(arg);
|
|
70
|
+
})
|
|
71
|
+
.join(' ');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Emit a log record
|
|
76
|
+
*/
|
|
77
|
+
function emitLog(severityNumber, severityText, args) {
|
|
78
|
+
const message = formatMessage(args);
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
logger.emit({
|
|
82
|
+
severityNumber,
|
|
83
|
+
severityText,
|
|
84
|
+
body: message,
|
|
85
|
+
attributes: {
|
|
86
|
+
'log.source': 'console',
|
|
87
|
+
'log.method': severityText.toLowerCase(),
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
} catch (e) {
|
|
91
|
+
// Silently fail to avoid breaking the application
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Override console.log
|
|
96
|
+
console.log = function (...args) {
|
|
97
|
+
emitLog(SeverityNumber.INFO, 'INFO', args);
|
|
98
|
+
originalConsole.log.apply(console, args);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Override console.info
|
|
102
|
+
console.info = function (...args) {
|
|
103
|
+
emitLog(SeverityNumber.INFO, 'INFO', args);
|
|
104
|
+
originalConsole.info.apply(console, args);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// Override console.warn
|
|
108
|
+
console.warn = function (...args) {
|
|
109
|
+
emitLog(SeverityNumber.WARN, 'WARN', args);
|
|
110
|
+
originalConsole.warn.apply(console, args);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// Override console.error
|
|
114
|
+
console.error = function (...args) {
|
|
115
|
+
emitLog(SeverityNumber.ERROR, 'ERROR', args);
|
|
116
|
+
originalConsole.error.apply(console, args);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Override console.debug
|
|
120
|
+
console.debug = function (...args) {
|
|
121
|
+
emitLog(SeverityNumber.DEBUG, 'DEBUG', args);
|
|
122
|
+
originalConsole.debug.apply(console, args);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
console.log('[securenow] Console instrumentation installed - all console logs will be sent to SigNoz');
|
|
126
|
+
|
|
127
|
+
module.exports = {
|
|
128
|
+
originalConsole,
|
|
129
|
+
restoreConsole: () => {
|
|
130
|
+
console.log = originalConsole.log;
|
|
131
|
+
console.info = originalConsole.info;
|
|
132
|
+
console.warn = originalConsole.warn;
|
|
133
|
+
console.error = originalConsole.error;
|
|
134
|
+
console.debug = originalConsole.debug;
|
|
135
|
+
},
|
|
136
|
+
};
|