securenow 7.6.6 → 7.6.8

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 (68) hide show
  1. package/NPM_README.md +13 -13
  2. package/README.md +21 -37
  3. package/app-config.js +5 -3
  4. package/cli/config.js +4 -3
  5. package/cli/diagnostics.js +54 -15
  6. package/cli/run.js +40 -11
  7. package/firewall-only.js +1 -1
  8. package/firewall.js +88 -57
  9. package/mcp/catalog.js +1 -1
  10. package/nextjs-webpack-config.js +3 -15
  11. package/nextjs.js +21 -23
  12. package/nuxt-server-plugin.mjs +20 -10
  13. package/package.json +33 -34
  14. package/register.js +1 -1
  15. package/tracing.js +17 -7
  16. package/web-vite.mjs +23 -13
  17. package/CONSUMING-APPS-GUIDE.md +0 -463
  18. package/docs/ALL-FRAMEWORKS-QUICKSTART.md +0 -1388
  19. package/docs/API-KEYS-GUIDE.md +0 -278
  20. package/docs/ARCHITECTURE.md +0 -408
  21. package/docs/AUTO-BODY-CAPTURE.md +0 -412
  22. package/docs/AUTO-SETUP-SUMMARY.md +0 -331
  23. package/docs/AUTO-SETUP.md +0 -419
  24. package/docs/AUTOMATIC-IP-CAPTURE.md +0 -359
  25. package/docs/BODY-CAPTURE-FIX.md +0 -261
  26. package/docs/BODY-CAPTURE-QUICKSTART.md +0 -147
  27. package/docs/CHANGELOG-NEXTJS.md +0 -235
  28. package/docs/COMPLETION-REPORT.md +0 -408
  29. package/docs/CUSTOMER-GUIDE.md +0 -364
  30. package/docs/EASIEST-SETUP.md +0 -342
  31. package/docs/ENVIRONMENT-VARIABLES.md +0 -166
  32. package/docs/ENVIRONMENTS.md +0 -60
  33. package/docs/EXPRESS-BODY-CAPTURE.md +0 -1028
  34. package/docs/EXPRESS-SETUP-GUIDE.md +0 -722
  35. package/docs/FINAL-SOLUTION.md +0 -335
  36. package/docs/FIREWALL-GUIDE.md +0 -440
  37. package/docs/IMPLEMENTATION-SUMMARY.md +0 -410
  38. package/docs/INDEX.md +0 -222
  39. package/docs/LOGGING-GUIDE.md +0 -704
  40. package/docs/LOGGING-QUICKSTART.md +0 -221
  41. package/docs/MCP-GUIDE.md +0 -58
  42. package/docs/NEXTJS-BODY-CAPTURE-COMPARISON.md +0 -323
  43. package/docs/NEXTJS-BODY-CAPTURE.md +0 -368
  44. package/docs/NEXTJS-GUIDE.md +0 -392
  45. package/docs/NEXTJS-QUICKSTART.md +0 -83
  46. package/docs/NEXTJS-SETUP-COMPLETE.md +0 -795
  47. package/docs/NEXTJS-WEBPACK-WARNINGS.md +0 -267
  48. package/docs/NEXTJS-WRAPPER-APPROACH.md +0 -414
  49. package/docs/NUXT-GUIDE.md +0 -173
  50. package/docs/QUICKSTART-BODY-CAPTURE.md +0 -293
  51. package/docs/REDACTION-EXAMPLES.md +0 -484
  52. package/docs/REQUEST-BODY-CAPTURE.md +0 -587
  53. package/docs/SOLUTION-SUMMARY.md +0 -312
  54. package/docs/VERCEL-OTEL-MIGRATION.md +0 -255
  55. package/examples/README.md +0 -265
  56. package/examples/express-with-logging.js +0 -137
  57. package/examples/instrumentation-with-auto-capture.ts +0 -41
  58. package/examples/next.config.js +0 -37
  59. package/examples/nextjs-api-route-with-body-capture.ts +0 -54
  60. package/examples/nextjs-env-example.txt +0 -32
  61. package/examples/nextjs-instrumentation.js +0 -36
  62. package/examples/nextjs-instrumentation.ts +0 -36
  63. package/examples/nextjs-middleware.js +0 -37
  64. package/examples/nextjs-middleware.ts +0 -37
  65. package/examples/nextjs-with-logging-example.md +0 -301
  66. package/examples/nextjs-with-options.ts +0 -36
  67. package/examples/test-nextjs-setup.js +0 -70
  68. package/postinstall.js +0 -296
@@ -1,265 +0,0 @@
1
- # SecureNow Next.js Examples
2
-
3
- This folder contains example files to help you integrate SecureNow with your Next.js application.
4
-
5
- ---
6
-
7
- ## 📁 Files
8
-
9
- ### 1. `nextjs-instrumentation.ts`
10
- **TypeScript setup (recommended for TS projects)**
11
-
12
- Basic Next.js instrumentation setup using TypeScript.
13
-
14
- **Usage:**
15
- 1. Copy this file to your project root as `instrumentation.ts`
16
- 2. Set environment variables in `.env.local`
17
- 3. Run your Next.js app
18
-
19
- ---
20
-
21
- ### 2. `nextjs-instrumentation.js`
22
- **JavaScript setup (for JS projects)**
23
-
24
- Basic Next.js instrumentation setup using JavaScript.
25
-
26
- **Usage:**
27
- 1. Copy this file to your project root as `instrumentation.js`
28
- 2. Set environment variables in `.env.local`
29
- 3. Run your Next.js app
30
-
31
- ---
32
-
33
- ### 3. `nextjs-with-options.ts`
34
- **Advanced configuration with programmatic options**
35
-
36
- Shows how to pass configuration options directly to `registerSecureNow()` instead of using only environment variables.
37
-
38
- **Usage:**
39
- 1. Copy to project root as `instrumentation.ts`
40
- 2. Customize the options object
41
- 3. Set sensitive values (API keys) via environment variables
42
-
43
- **Good for:**
44
- - Complex configurations
45
- - Multiple environments
46
- - Custom headers
47
- - Selective instrumentation
48
-
49
- ---
50
-
51
- ### 4. `nextjs-env-example.txt`
52
- **Complete environment variables reference**
53
-
54
- Lists all available environment variables with explanations.
55
-
56
- **Usage:**
57
- 1. Copy contents to your `.env.local` file
58
- 2. Uncomment and set the variables you need
59
- 3. Remove or comment out unused variables
60
-
61
- ---
62
-
63
- ### 5. `test-nextjs-setup.js`
64
- **Test script to verify your setup**
65
-
66
- A standalone script to test SecureNow configuration before integrating with Next.js.
67
-
68
- **Usage:**
69
- ```bash
70
- # Test with environment variables
71
- SECURENOW_APPID=test-app \
72
- SECURENOW_INSTANCE=http://localhost:4318 \
73
- node examples/test-nextjs-setup.js
74
-
75
- # Or set them in .env first
76
- node examples/test-nextjs-setup.js
77
- ```
78
-
79
- **What it tests:**
80
- - ✅ Package installation
81
- - ✅ SDK registration
82
- - ✅ Span creation
83
- - ✅ Configuration loading
84
- - ✅ Export functionality
85
-
86
- ---
87
-
88
- ## 🚀 Quick Start Guide
89
-
90
- ### Step 1: Choose Your Setup
91
-
92
- **TypeScript project?** → Use `nextjs-instrumentation.ts`
93
- **JavaScript project?** → Use `nextjs-instrumentation.js`
94
- **Need advanced config?** → Use `nextjs-with-options.ts`
95
-
96
- ### Step 2: Copy File
97
-
98
- ```bash
99
- # From your project root
100
- cp node_modules/securenow/examples/nextjs-instrumentation.ts instrumentation.ts
101
- # or
102
- cp node_modules/securenow/examples/nextjs-instrumentation.js instrumentation.js
103
- ```
104
-
105
- ### Step 3: Configure Environment
106
-
107
- ```bash
108
- # Copy environment variables template
109
- cp node_modules/securenow/examples/nextjs-env-example.txt .env.local
110
- # Edit .env.local with your values
111
- ```
112
-
113
- ### Step 4: Test (Optional)
114
-
115
- ```bash
116
- # Verify setup works
117
- node node_modules/securenow/examples/test-nextjs-setup.js
118
- ```
119
-
120
- ### Step 5: Run Your App
121
-
122
- ```bash
123
- npm run dev
124
- ```
125
-
126
- ---
127
-
128
- ## 📚 Documentation
129
-
130
- - **[Quick Start](../NEXTJS-QUICKSTART.md)** - 30-second setup
131
- - **[Complete Guide](../NEXTJS-GUIDE.md)** - Full documentation
132
- - **[Customer Guide](../CUSTOMER-GUIDE.md)** - User-friendly guide
133
- - **[Architecture](../ARCHITECTURE.md)** - Technical details
134
-
135
- ---
136
-
137
- ## 💡 Tips
138
-
139
- ### For Development
140
- ```bash
141
- # Use simpler service names
142
- SECURENOW_NO_UUID=1
143
- SECURENOW_APPID=my-app-dev
144
-
145
- # Enable debug logging
146
- OTEL_LOG_LEVEL=debug
147
- ```
148
-
149
- ### For Production
150
- ```bash
151
- # Use descriptive names with UUID
152
- SECURENOW_APPID=my-app-prod
153
- # UUID is auto-appended
154
-
155
- # Use info or warn level
156
- OTEL_LOG_LEVEL=info
157
- ```
158
-
159
- ### For Vercel
160
- ```bash
161
- # Set in Vercel dashboard:
162
- SECURENOW_APPID=my-app
163
- SECURENOW_INSTANCE=http://your-collector-host:4318
164
- OTEL_EXPORTER_OTLP_HEADERS="x-api-key=your-key"
165
- ```
166
-
167
- ---
168
-
169
- ## 🆘 Troubleshooting
170
-
171
- ### "Cannot find module 'securenow/nextjs'"
172
-
173
- Make sure you're on the latest version:
174
- ```bash
175
- npm install securenow@latest
176
- ```
177
-
178
- ### Traces not appearing
179
-
180
- 1. Check console for `[securenow] ✅ OpenTelemetry started`
181
- 2. Enable debug mode: `OTEL_LOG_LEVEL=debug`
182
- 3. Run test script: `node examples/test-nextjs-setup.js`
183
- 4. Verify OTLP collector accessibility: `curl http://your-collector-host:4318/v1/traces`
184
-
185
- ### Too many spans
186
-
187
- Disable noisy instrumentations:
188
- ```bash
189
- SECURENOW_DISABLE_INSTRUMENTATIONS=fs,dns
190
- ```
191
-
192
- ---
193
-
194
- ## 📝 Customization
195
-
196
- ### Disable Specific Instrumentations
197
-
198
- ```typescript
199
- registerSecureNow({
200
- disableInstrumentations: ['fs', 'dns', 'net'],
201
- });
202
- ```
203
-
204
- ### Add Custom Headers
205
-
206
- ```typescript
207
- registerSecureNow({
208
- headers: {
209
- 'x-api-key': process.env.SECURENOW_API_KEY,
210
- 'x-environment': process.env.NODE_ENV,
211
- },
212
- });
213
- ```
214
-
215
- ### Use Different Service Name
216
-
217
- ```typescript
218
- registerSecureNow({
219
- serviceName: 'my-custom-app-name',
220
- noUuid: false, // Still append UUID
221
- });
222
- ```
223
-
224
- ---
225
-
226
- ## 🎯 Next Steps
227
-
228
- After setting up:
229
-
230
- 1. **Run your app** and verify traces appear
231
- 2. **Test key user flows** to see end-to-end tracing
232
- 3. **Check SecureNow dashboard** for service map and traces
233
- 4. **Adjust configuration** based on your needs
234
- 5. **Deploy to production** with proper environment variables
235
-
236
- ---
237
-
238
- ## 🌟 Success Looks Like
239
-
240
- ```bash
241
- $ npm run dev
242
-
243
- [securenow] Next.js integration loading (pid=12345)
244
- [securenow] 🚀 Next.js App → service.name=my-app-abc123
245
- [securenow] ✅ OpenTelemetry started for Next.js → http://your-collector-host:4318/v1/traces
246
-
247
- ✓ Ready in 1.2s
248
- ```
249
-
250
- Then in SecureNow:
251
- - ✅ See your service in service map
252
- - ✅ View traces for requests
253
- - ✅ Analyze performance metrics
254
- - ✅ Debug issues with distributed tracing
255
-
256
- ---
257
-
258
- **Happy tracing! 🎉**
259
-
260
-
261
-
262
-
263
-
264
-
265
-
@@ -1,137 +0,0 @@
1
- /**
2
- * Express.js Example with SecureNow Tracing and Logging
3
- *
4
- * This example demonstrates:
5
- * - Automatic tracing of HTTP requests
6
- * - Automatic logging via console instrumentation
7
- * - Structured logging with context
8
- *
9
- * Setup:
10
- * 1. npm install securenow express
11
- * 2. export SECURENOW_LOGGING_ENABLED=1
12
- * 3. export SECURENOW_APPID=express-demo
13
- * 4. export SECURENOW_INSTANCE=http://localhost:4318
14
- * 5. node examples/express-with-logging.js
15
- */
16
-
17
- // Initialize SecureNow (must be first!)
18
- require('securenow/register');
19
- require('securenow/console-instrumentation');
20
-
21
- const express = require('express');
22
- const app = express();
23
-
24
- app.use(express.json());
25
-
26
- // Logging middleware
27
- app.use((req, res, next) => {
28
- console.info('Incoming request', {
29
- method: req.method,
30
- path: req.path,
31
- query: req.query,
32
- ip: req.ip,
33
- userAgent: req.get('user-agent'),
34
- });
35
- next();
36
- });
37
-
38
- // Routes
39
- app.get('/', (req, res) => {
40
- console.log('Home page accessed');
41
- res.json({
42
- message: 'Express with SecureNow Logging',
43
- timestamp: new Date().toISOString(),
44
- });
45
- });
46
-
47
- app.get('/users', (req, res) => {
48
- console.log('Fetching users list');
49
-
50
- // Simulate user data
51
- const users = [
52
- { id: 1, name: 'John Doe' },
53
- { id: 2, name: 'Jane Smith' },
54
- ];
55
-
56
- console.info('Users fetched successfully', {
57
- count: users.length,
58
- requestId: req.get('x-request-id'),
59
- });
60
-
61
- res.json(users);
62
- });
63
-
64
- app.post('/users', (req, res) => {
65
- console.info('Creating new user', {
66
- userData: req.body,
67
- });
68
-
69
- try {
70
- // Simulate validation
71
- if (!req.body.name || !req.body.email) {
72
- console.warn('User creation validation failed', {
73
- body: req.body,
74
- missing: !req.body.name ? 'name' : 'email',
75
- });
76
- return res.status(400).json({ error: 'Name and email required' });
77
- }
78
-
79
- // Simulate user creation
80
- const newUser = {
81
- id: Math.floor(Math.random() * 1000),
82
- ...req.body,
83
- createdAt: new Date().toISOString(),
84
- };
85
-
86
- console.log('User created successfully', {
87
- userId: newUser.id,
88
- email: newUser.email,
89
- });
90
-
91
- res.status(201).json(newUser);
92
- } catch (error) {
93
- console.error('Failed to create user', {
94
- error: error.message,
95
- stack: error.stack,
96
- body: req.body,
97
- });
98
- res.status(500).json({ error: 'Internal server error' });
99
- }
100
- });
101
-
102
- app.get('/error', (req, res) => {
103
- console.warn('Error endpoint accessed - will throw error');
104
- throw new Error('Intentional error for testing');
105
- });
106
-
107
- // Error handler
108
- app.use((err, req, res, next) => {
109
- console.error('Express error handler', {
110
- error: err.message,
111
- stack: err.stack,
112
- path: req.path,
113
- method: req.method,
114
- });
115
-
116
- res.status(500).json({
117
- error: 'Internal server error',
118
- message: err.message,
119
- });
120
- });
121
-
122
- // Start server
123
- const PORT = process.env.PORT || 3000;
124
- app.listen(PORT, () => {
125
- console.log('Express server started', {
126
- port: PORT,
127
- nodeVersion: process.version,
128
- env: process.env.NODE_ENV || 'development',
129
- });
130
-
131
- console.info('Available endpoints:', {
132
- home: `http://localhost:${PORT}/`,
133
- users: `http://localhost:${PORT}/users`,
134
- createUser: `POST http://localhost:${PORT}/users`,
135
- error: `http://localhost:${PORT}/error`,
136
- });
137
- });
@@ -1,41 +0,0 @@
1
- /**
2
- * Next.js Instrumentation with Automatic Body Capture
3
- *
4
- * This is the EASIEST way to enable body capture - just one import line!
5
- * No code changes needed in your handlers.
6
- */
7
-
8
- import { registerSecureNow } from 'securenow/nextjs';
9
- import 'securenow/nextjs-auto-capture'; // ← Add this line for auto body capture!
10
-
11
- export function register() {
12
- registerSecureNow();
13
- }
14
-
15
- /**
16
- * That's it! Now ALL your API routes automatically capture bodies:
17
- *
18
- * app/api/login/route.ts:
19
- * export async function POST(request: Request) {
20
- * const body = await request.json(); // ← Auto-captured!
21
- * return Response.json({ success: true });
22
- * }
23
- *
24
- * Benefits:
25
- * - ✅ Zero code changes in handlers
26
- * - ✅ No wrapping needed
27
- * - ✅ No middleware conflicts
28
- * - ✅ Automatic sensitive data redaction
29
- * - ✅ Works with NextAuth
30
- *
31
- * Configuration in .env.local:
32
- * SECURENOW_APPID=my-app
33
- * SECURENOW_INSTANCE=http://localhost:4318
34
- * SECURENOW_CAPTURE_BODY=1
35
- * SECURENOW_MAX_BODY_SIZE=10240
36
- * SECURENOW_SENSITIVE_FIELDS=custom_field
37
- */
38
-
39
-
40
-
41
-
@@ -1,37 +0,0 @@
1
- /**
2
- * Example Next.js configuration for SecureNow
3
- *
4
- * This configuration suppresses OpenTelemetry instrumentation warnings
5
- */
6
-
7
- const { getSecureNowWebpackConfig } = require('securenow/nextjs-webpack-config');
8
-
9
- /** @type {import('next').NextConfig} */
10
- const nextConfig = {
11
- // Next.js 15+ doesn't need this
12
- // For Next.js 14 and below, uncomment:
13
- // experimental: {
14
- // instrumentationHook: true,
15
- // },
16
-
17
- // Suppress OpenTelemetry bundling warnings
18
- webpack: (config, options) => {
19
- return getSecureNowWebpackConfig(config, options);
20
- },
21
-
22
- // Optional: Tell Next.js not to bundle OpenTelemetry packages
23
- serverExternalPackages: [
24
- '@opentelemetry/sdk-node',
25
- '@opentelemetry/auto-instrumentations-node',
26
- '@opentelemetry/instrumentation',
27
- ],
28
- };
29
-
30
- module.exports = nextConfig;
31
-
32
-
33
-
34
-
35
-
36
-
37
-
@@ -1,54 +0,0 @@
1
- /**
2
- * Example: Next.js API Route with Body Capture
3
- *
4
- * This approach is SAFE and NON-INVASIVE:
5
- * - No middleware conflicts
6
- * - No blocking
7
- * - Runs inside your handler
8
- * - Optional per route
9
- */
10
-
11
- import { withSecureNow } from 'securenow/nextjs-wrapper';
12
-
13
- // Option 1: Wrap the entire handler (recommended)
14
- export const POST = withSecureNow(async (request: Request) => {
15
- // Your normal handler code
16
- const body = await request.json();
17
-
18
- // Do your logic
19
- const result = await processLogin(body);
20
-
21
- return Response.json({ success: true, result });
22
- });
23
-
24
- // Option 2: Selective wrapping - only certain routes
25
- export const PUT = withSecureNow(async (request: Request) => {
26
- const body = await request.json();
27
- return Response.json({ updated: true });
28
- });
29
-
30
- // Option 3: Don't wrap - no body capture for this route
31
- export async function GET(request: Request) {
32
- // This route won't capture bodies (but still traced!)
33
- return Response.json({ data: 'hello' });
34
- }
35
-
36
- /**
37
- * Benefits of this approach:
38
- *
39
- * ✅ No middleware conflicts (doesn't run before routing)
40
- * ✅ No blocking (captures in background)
41
- * ✅ Per-route control (wrap only what you need)
42
- * ✅ Works with NextAuth, other middleware
43
- * ✅ Never interferes with request flow
44
- * ✅ Automatic sensitive data redaction
45
- *
46
- * Setup:
47
- * 1. Set SECURENOW_CAPTURE_BODY=1 in .env.local
48
- * 2. Wrap handlers with withSecureNow()
49
- * 3. Done! Bodies captured with redaction
50
- */
51
-
52
-
53
-
54
-
@@ -1,32 +0,0 @@
1
- # SecureNow Configuration for Next.js
2
- #
3
- # ============================================================
4
- # For local dev you do NOT need this file.
5
- # Instead run:
6
- # npx securenow login
7
- # That writes .securenow/credentials.json and the SDK reads it.
8
- # ============================================================
9
- #
10
- # This template is for CI / Docker / Vercel — places where you
11
- # can't run the interactive login. Env vars always take
12
- # precedence over .securenow/credentials.json.
13
-
14
- # App routing key (UUID). From: npx securenow apps
15
- SECURENOW_APPID=your-app-key-uuid
16
-
17
- # OTLP collector endpoint. Default is the Free Trial.
18
- SECURENOW_INSTANCE=https://freetrial.securenow.ai:4318
19
-
20
- # Optional — defaults are already sensible. Flip to 0 to disable.
21
- # SECURENOW_LOGGING_ENABLED=0 # forward console.* as OTLP logs
22
- # SECURENOW_CAPTURE_BODY=0 # capture POST/PUT/PATCH JSON + form bodies
23
- # SECURENOW_CAPTURE_MULTIPART=0 # capture multipart field / file metadata
24
- # SECURENOW_MAX_BODY_SIZE=10240 # bytes (default 10KB)
25
-
26
- # Optional — OTel tuning
27
- # OTEL_LOG_LEVEL=info
28
- # SECURENOW_DISABLE_INSTRUMENTATIONS=fs,dns
29
- # SECURENOW_NO_UUID=1 # use bare APPID as service.name (no UUID suffix)
30
-
31
- # Authentication (auto-set when SECURENOW_APPID is present)
32
- # OTEL_EXPORTER_OTLP_HEADERS="x-api-key=your-api-key-here"
@@ -1,36 +0,0 @@
1
- /**
2
- * Next.js Instrumentation with SecureNow (JavaScript version)
3
- *
4
- * Place this file at the root of your Next.js project as: instrumentation.js
5
- * (or in the src/ folder if you're using it)
6
- *
7
- * For Next.js 14 and below, also add to next.config.js:
8
- * experimental: { instrumentationHook: true }
9
- */
10
-
11
- const { registerSecureNow } = require('securenow/nextjs');
12
-
13
- export function register() {
14
- registerSecureNow();
15
- }
16
-
17
- /**
18
- * Configuration via Environment Variables (.env.local):
19
- *
20
- * Required:
21
- * SECURENOW_APPID=my-nextjs-app
22
- *
23
- * Optional:
24
- * SECURENOW_INSTANCE=http://your-otlp-collector:4318
25
- * SECURENOW_NO_UUID=1 # Don't append UUID to service name
26
- * OTEL_LOG_LEVEL=info # debug|info|warn|error
27
- * SECURENOW_DISABLE_INSTRUMENTATIONS=fs # Comma-separated list
28
- * SECURENOW_TEST_SPAN=1 # Create test span on startup
29
- */
30
-
31
-
32
-
33
-
34
-
35
-
36
-
@@ -1,36 +0,0 @@
1
- /**
2
- * Next.js Instrumentation with SecureNow
3
- *
4
- * Place this file at the root of your Next.js project as: instrumentation.ts
5
- * (or in the src/ folder if you're using it)
6
- *
7
- * For Next.js 14 and below, also add to next.config.js:
8
- * experimental: { instrumentationHook: true }
9
- */
10
-
11
- import { registerSecureNow } from 'securenow/nextjs';
12
-
13
- export function register() {
14
- registerSecureNow();
15
- }
16
-
17
- /**
18
- * Configuration via Environment Variables (.env.local):
19
- *
20
- * Required:
21
- * SECURENOW_APPID=my-nextjs-app
22
- *
23
- * Optional:
24
- * SECURENOW_INSTANCE=http://your-otlp-collector:4318
25
- * SECURENOW_NO_UUID=1 # Don't append UUID to service name
26
- * OTEL_LOG_LEVEL=info # debug|info|warn|error
27
- * SECURENOW_DISABLE_INSTRUMENTATIONS=fs # Comma-separated list
28
- * SECURENOW_TEST_SPAN=1 # Create test span on startup
29
- */
30
-
31
-
32
-
33
-
34
-
35
-
36
-
@@ -1,37 +0,0 @@
1
- /**
2
- * Next.js Middleware with SecureNow Body Capture (JavaScript version)
3
- *
4
- * Place this file as: middleware.js (in your project root or src/)
5
- *
6
- * This single line enables automatic body capture for all API routes!
7
- */
8
-
9
- // Just export the middleware from securenow - that's it!
10
- export { middleware } from 'securenow/nextjs-middleware';
11
-
12
- // Optional: Configure which routes to apply to
13
- export const config = {
14
- matcher: '/api/:path*', // Apply to all API routes
15
-
16
- // Or be more specific:
17
- // matcher: ['/api/login', '/api/register', '/api/graphql'],
18
-
19
- // Or apply to everything:
20
- // matcher: '/((?!_next/static|_next/image|favicon.ico).*)',
21
- };
22
-
23
- /**
24
- * That's it! Request bodies are now automatically captured with:
25
- * - Sensitive fields redacted (passwords, tokens, cards, etc.)
26
- * - Size limits enforced
27
- * - All content types supported (JSON, GraphQL, Form)
28
- * - Zero impact on request processing
29
- *
30
- * Configure via environment variables:
31
- * SECURENOW_MAX_BODY_SIZE=20480
32
- * SECURENOW_SENSITIVE_FIELDS=email,phone,address
33
- */
34
-
35
-
36
-
37
-