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.
- package/NPM_README.md +13 -13
- package/README.md +21 -37
- package/app-config.js +5 -3
- package/cli/config.js +4 -3
- package/cli/diagnostics.js +54 -15
- package/cli/run.js +40 -11
- package/firewall-only.js +1 -1
- package/firewall.js +88 -57
- package/mcp/catalog.js +1 -1
- package/nextjs-webpack-config.js +3 -15
- package/nextjs.js +21 -23
- package/nuxt-server-plugin.mjs +20 -10
- package/package.json +33 -34
- package/register.js +1 -1
- package/tracing.js +17 -7
- package/web-vite.mjs +23 -13
- package/CONSUMING-APPS-GUIDE.md +0 -463
- package/docs/ALL-FRAMEWORKS-QUICKSTART.md +0 -1388
- package/docs/API-KEYS-GUIDE.md +0 -278
- package/docs/ARCHITECTURE.md +0 -408
- package/docs/AUTO-BODY-CAPTURE.md +0 -412
- package/docs/AUTO-SETUP-SUMMARY.md +0 -331
- package/docs/AUTO-SETUP.md +0 -419
- package/docs/AUTOMATIC-IP-CAPTURE.md +0 -359
- package/docs/BODY-CAPTURE-FIX.md +0 -261
- package/docs/BODY-CAPTURE-QUICKSTART.md +0 -147
- package/docs/CHANGELOG-NEXTJS.md +0 -235
- package/docs/COMPLETION-REPORT.md +0 -408
- package/docs/CUSTOMER-GUIDE.md +0 -364
- package/docs/EASIEST-SETUP.md +0 -342
- package/docs/ENVIRONMENT-VARIABLES.md +0 -166
- package/docs/ENVIRONMENTS.md +0 -60
- package/docs/EXPRESS-BODY-CAPTURE.md +0 -1028
- package/docs/EXPRESS-SETUP-GUIDE.md +0 -722
- package/docs/FINAL-SOLUTION.md +0 -335
- package/docs/FIREWALL-GUIDE.md +0 -440
- package/docs/IMPLEMENTATION-SUMMARY.md +0 -410
- package/docs/INDEX.md +0 -222
- package/docs/LOGGING-GUIDE.md +0 -704
- package/docs/LOGGING-QUICKSTART.md +0 -221
- package/docs/MCP-GUIDE.md +0 -58
- package/docs/NEXTJS-BODY-CAPTURE-COMPARISON.md +0 -323
- package/docs/NEXTJS-BODY-CAPTURE.md +0 -368
- package/docs/NEXTJS-GUIDE.md +0 -392
- package/docs/NEXTJS-QUICKSTART.md +0 -83
- package/docs/NEXTJS-SETUP-COMPLETE.md +0 -795
- package/docs/NEXTJS-WEBPACK-WARNINGS.md +0 -267
- package/docs/NEXTJS-WRAPPER-APPROACH.md +0 -414
- package/docs/NUXT-GUIDE.md +0 -173
- package/docs/QUICKSTART-BODY-CAPTURE.md +0 -293
- package/docs/REDACTION-EXAMPLES.md +0 -484
- package/docs/REQUEST-BODY-CAPTURE.md +0 -587
- package/docs/SOLUTION-SUMMARY.md +0 -312
- package/docs/VERCEL-OTEL-MIGRATION.md +0 -255
- package/examples/README.md +0 -265
- package/examples/express-with-logging.js +0 -137
- package/examples/instrumentation-with-auto-capture.ts +0 -41
- package/examples/next.config.js +0 -37
- package/examples/nextjs-api-route-with-body-capture.ts +0 -54
- package/examples/nextjs-env-example.txt +0 -32
- package/examples/nextjs-instrumentation.js +0 -36
- package/examples/nextjs-instrumentation.ts +0 -36
- package/examples/nextjs-middleware.js +0 -37
- package/examples/nextjs-middleware.ts +0 -37
- package/examples/nextjs-with-logging-example.md +0 -301
- package/examples/nextjs-with-options.ts +0 -36
- package/examples/test-nextjs-setup.js +0 -70
- package/postinstall.js +0 -296
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
# 📝 Request Body Capture - Quick Start
|
|
2
|
-
|
|
3
|
-
## Enable in 30 Seconds
|
|
4
|
-
|
|
5
|
-
### Step 1: Enable
|
|
6
|
-
Add to `.env.local`:
|
|
7
|
-
```bash
|
|
8
|
-
SECURENOW_CAPTURE_BODY=1
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
### Step 2: Deploy
|
|
12
|
-
```bash
|
|
13
|
-
npm run dev # or deploy to production
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Step 3: Done! ✅
|
|
17
|
-
|
|
18
|
-
All POST/PUT/PATCH request bodies are now captured with sensitive data automatically redacted!
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## What Gets Captured (ALL with Auto-Redaction!)
|
|
23
|
-
|
|
24
|
-
✅ **JSON** - API payloads (objects redacted)
|
|
25
|
-
✅ **GraphQL** - Queries and mutations (arguments/variables redacted)
|
|
26
|
-
✅ **Form Data** - Form submissions (parsed and redacted)
|
|
27
|
-
❌ **File Uploads** - NOT captured at all (by design)
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## Security Built-In
|
|
32
|
-
|
|
33
|
-
These fields are **automatically redacted**:
|
|
34
|
-
- `password`, `token`, `api_key`, `secret`
|
|
35
|
-
- `access_token`, `auth`, `credentials`
|
|
36
|
-
- `card`, `cardnumber`, `cvv`, `ssn`
|
|
37
|
-
- And 15+ more sensitive fields
|
|
38
|
-
|
|
39
|
-
**Example:**
|
|
40
|
-
```json
|
|
41
|
-
// Original
|
|
42
|
-
{"username": "john", "password": "secret123"}
|
|
43
|
-
|
|
44
|
-
// Captured
|
|
45
|
-
{"username": "john", "password": "[REDACTED]"}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## Configuration Options
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
# Enable capture (required)
|
|
54
|
-
SECURENOW_CAPTURE_BODY=1
|
|
55
|
-
|
|
56
|
-
# Max body size in bytes (default: 10KB)
|
|
57
|
-
SECURENOW_MAX_BODY_SIZE=20480
|
|
58
|
-
|
|
59
|
-
# Add custom sensitive fields to redact
|
|
60
|
-
SECURENOW_SENSITIVE_FIELDS=email,phone,address
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## View in SecureNow
|
|
66
|
-
|
|
67
|
-
Query for captured bodies:
|
|
68
|
-
```
|
|
69
|
-
http.request.body IS NOT NULL
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
See specific endpoint:
|
|
73
|
-
```
|
|
74
|
-
http.target = "/api/checkout"
|
|
75
|
-
AND http.request.body CONTAINS "product"
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
## Examples
|
|
81
|
-
|
|
82
|
-
### Next.js API Route
|
|
83
|
-
```typescript
|
|
84
|
-
// app/api/login/route.ts
|
|
85
|
-
export async function POST(request: Request) {
|
|
86
|
-
const body = await request.json();
|
|
87
|
-
// Body automatically captured in traces!
|
|
88
|
-
return Response.json({ success: true });
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Express.js
|
|
93
|
-
```javascript
|
|
94
|
-
app.post('/api/login', (req, res) => {
|
|
95
|
-
// req.body automatically captured!
|
|
96
|
-
res.json({ success: true });
|
|
97
|
-
});
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## Safety Features
|
|
103
|
-
|
|
104
|
-
✅ **Size limits** - Bodies over limit show `[TOO LARGE]`
|
|
105
|
-
✅ **Auto-redaction** - 20+ sensitive fields protected
|
|
106
|
-
✅ **Type detection** - JSON, GraphQL, Form parsed correctly
|
|
107
|
-
✅ **No file capture** - Multipart uploads excluded
|
|
108
|
-
✅ **Fast** - < 1ms overhead per request
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## Common Use Cases
|
|
113
|
-
|
|
114
|
-
1. **Debug API errors** - See exact input that caused error
|
|
115
|
-
2. **Monitor GraphQL** - Track slow queries
|
|
116
|
-
3. **Validate inputs** - Understand user input patterns
|
|
117
|
-
4. **Track features** - See which API features are used
|
|
118
|
-
5. **Security analysis** - Detect malicious payloads
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## Privacy Notes
|
|
123
|
-
|
|
124
|
-
⚠️ Request bodies may contain personal data
|
|
125
|
-
|
|
126
|
-
**Best practices:**
|
|
127
|
-
- Add relevant fields to `SECURENOW_SENSITIVE_FIELDS`
|
|
128
|
-
- Set appropriate retention in SecureNow
|
|
129
|
-
- Document in privacy policy
|
|
130
|
-
- Consider GDPR/CCPA requirements
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## Full Documentation
|
|
135
|
-
|
|
136
|
-
See [REQUEST-BODY-CAPTURE.md](./REQUEST-BODY-CAPTURE.md) for:
|
|
137
|
-
- Complete security guide
|
|
138
|
-
- GDPR compliance tips
|
|
139
|
-
- Advanced configuration
|
|
140
|
-
- Performance optimization
|
|
141
|
-
- Troubleshooting
|
|
142
|
-
- FAQ
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
**That's it!** Enable with one environment variable, get full request visibility with automatic security. 🔒
|
|
147
|
-
|
package/docs/CHANGELOG-NEXTJS.md
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
# Changelog - Next.js Support
|
|
2
|
-
|
|
3
|
-
## Version 3.1.0 (Next.js Support Added)
|
|
4
|
-
|
|
5
|
-
### 🎉 New Features
|
|
6
|
-
|
|
7
|
-
#### Next.js Integration (`nextjs.js`)
|
|
8
|
-
- ✅ **Seamless Next.js support** via `securenow/nextjs` export
|
|
9
|
-
- ✅ **One-line setup** using Next.js instrumentation hook
|
|
10
|
-
- ✅ **Auto-instrumentation** for all Node.js frameworks and libraries
|
|
11
|
-
- ✅ **Environment-based configuration** with sensible defaults
|
|
12
|
-
- ✅ **Programmatic configuration** option for advanced users
|
|
13
|
-
- ✅ **Edge runtime detection** (automatically skips unsupported runtimes)
|
|
14
|
-
- ✅ **Vercel deployment** attributes (region, environment, version)
|
|
15
|
-
- ✅ **PM2/Cluster support** with unique service instance IDs
|
|
16
|
-
|
|
17
|
-
#### Enhanced Core (`tracing.js`)
|
|
18
|
-
- ✅ **Added `getNodeAutoInstrumentations()`** for comprehensive auto-instrumentation
|
|
19
|
-
- ✅ **Supports 30+ Node.js libraries** out of the box:
|
|
20
|
-
- Web frameworks: Express, Fastify, NestJS, Koa, Hapi
|
|
21
|
-
- Databases: PostgreSQL, MySQL, MongoDB, Redis
|
|
22
|
-
- HTTP clients: fetch, axios, http/https
|
|
23
|
-
- GraphQL, gRPC, and more
|
|
24
|
-
- ✅ **Advanced configuration** via environment variables
|
|
25
|
-
- ✅ **Diagnostic logging** with configurable log levels
|
|
26
|
-
- ✅ **Test span creation** for setup verification
|
|
27
|
-
- ✅ **Graceful shutdown** handling for both SIGTERM and SIGINT
|
|
28
|
-
|
|
29
|
-
### 📦 Package Updates
|
|
30
|
-
|
|
31
|
-
#### New Exports
|
|
32
|
-
```json
|
|
33
|
-
{
|
|
34
|
-
"./nextjs": "./nextjs.js"
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
#### New Files
|
|
39
|
-
- `nextjs.js` - Next.js integration entry point
|
|
40
|
-
- `examples/nextjs-instrumentation.ts` - TypeScript example
|
|
41
|
-
- `examples/nextjs-instrumentation.js` - JavaScript example
|
|
42
|
-
- `examples/nextjs-with-options.ts` - Advanced configuration example
|
|
43
|
-
- `examples/nextjs-env-example.txt` - Environment variables reference
|
|
44
|
-
- `examples/test-nextjs-setup.js` - Test script
|
|
45
|
-
- `NEXTJS-GUIDE.md` - Complete Next.js integration guide
|
|
46
|
-
- `NEXTJS-QUICKSTART.md` - Quick start guide
|
|
47
|
-
- `ARCHITECTURE.md` - Technical architecture documentation
|
|
48
|
-
|
|
49
|
-
#### Updated Files
|
|
50
|
-
- `README.md` - Added Next.js quick start
|
|
51
|
-
- `package.json` - Added exports, keywords, description
|
|
52
|
-
|
|
53
|
-
### 🔧 Configuration Options
|
|
54
|
-
|
|
55
|
-
#### New Environment Variables
|
|
56
|
-
- `SECURENOW_APPID` - Preferred way to set service name
|
|
57
|
-
- `SECURENOW_INSTANCE` - Preferred way to set collector endpoint
|
|
58
|
-
- `SECURENOW_NO_UUID` - Disable UUID suffix
|
|
59
|
-
- `SECURENOW_STRICT` - Fail fast if no service name in cluster
|
|
60
|
-
- `SECURENOW_DISABLE_INSTRUMENTATIONS` - Disable specific instrumentations
|
|
61
|
-
- `OTEL_LOG_LEVEL` - Control diagnostic logging
|
|
62
|
-
- `SECURENOW_TEST_SPAN` - Create test span on startup
|
|
63
|
-
|
|
64
|
-
#### Backward Compatibility
|
|
65
|
-
- ✅ Legacy `securenow` and `securenow_instance` still work
|
|
66
|
-
- ✅ Standard OpenTelemetry env vars supported
|
|
67
|
-
- ✅ Existing Node.js apps work without changes
|
|
68
|
-
|
|
69
|
-
### 📊 Auto-Instrumented Libraries
|
|
70
|
-
|
|
71
|
-
#### New Instrumentations Added
|
|
72
|
-
- Express.js
|
|
73
|
-
- Fastify
|
|
74
|
-
- NestJS
|
|
75
|
-
- Koa
|
|
76
|
-
- Hapi
|
|
77
|
-
- PostgreSQL
|
|
78
|
-
- MySQL / MySQL2
|
|
79
|
-
- MongoDB
|
|
80
|
-
- Redis
|
|
81
|
-
- GraphQL
|
|
82
|
-
- HTTP/HTTPS
|
|
83
|
-
- Fetch API
|
|
84
|
-
- DNS
|
|
85
|
-
- Net
|
|
86
|
-
- File System
|
|
87
|
-
- And 20+ more via auto-instrumentations
|
|
88
|
-
|
|
89
|
-
### 🎯 Usage Examples
|
|
90
|
-
|
|
91
|
-
#### Next.js (New)
|
|
92
|
-
```typescript
|
|
93
|
-
// instrumentation.ts
|
|
94
|
-
import { registerSecureNow } from 'securenow/nextjs';
|
|
95
|
-
export function register() { registerSecureNow(); }
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
#### Node.js (Existing)
|
|
99
|
-
```bash
|
|
100
|
-
NODE_OPTIONS="-r securenow/register" node app.js
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### 📚 Documentation
|
|
104
|
-
|
|
105
|
-
#### New Guides
|
|
106
|
-
- **NEXTJS-QUICKSTART.md** - 30-second setup guide
|
|
107
|
-
- **NEXTJS-GUIDE.md** - Complete integration guide with:
|
|
108
|
-
- Installation instructions
|
|
109
|
-
- Configuration options
|
|
110
|
-
- Deployment guides (Vercel, Docker, VPS)
|
|
111
|
-
- Troubleshooting
|
|
112
|
-
- Best practices
|
|
113
|
-
- Comparison with alternatives
|
|
114
|
-
- **ARCHITECTURE.md** - Technical architecture and data flow
|
|
115
|
-
|
|
116
|
-
#### Updated Documentation
|
|
117
|
-
- **README.md** - Now includes Next.js quick start
|
|
118
|
-
- **Examples** - 5 new example files
|
|
119
|
-
|
|
120
|
-
### 🐛 Bug Fixes
|
|
121
|
-
- Fixed graceful shutdown handling
|
|
122
|
-
- Improved error messages for missing configuration
|
|
123
|
-
- Better handling of PM2/cluster deployments
|
|
124
|
-
|
|
125
|
-
### ⚡ Performance
|
|
126
|
-
- No additional overhead (uses existing OpenTelemetry SDK)
|
|
127
|
-
- Efficient batching of spans
|
|
128
|
-
- Configurable sampling (100% by default)
|
|
129
|
-
|
|
130
|
-
### 🔒 Security
|
|
131
|
-
- API keys passed via headers (never logged)
|
|
132
|
-
- Supports HTTPS endpoints
|
|
133
|
-
- No sensitive data exposed in spans by default
|
|
134
|
-
|
|
135
|
-
### 📈 Metrics
|
|
136
|
-
- Lines of code added: ~500
|
|
137
|
-
- New files: 11
|
|
138
|
-
- Dependencies added: 0 (uses existing dependencies)
|
|
139
|
-
- Breaking changes: 0 (fully backward compatible)
|
|
140
|
-
|
|
141
|
-
### 🚀 What's Next?
|
|
142
|
-
|
|
143
|
-
#### Planned Features
|
|
144
|
-
- Edge Runtime support for Next.js
|
|
145
|
-
- Browser instrumentation improvements
|
|
146
|
-
- Metrics support (in addition to traces)
|
|
147
|
-
- Log correlation
|
|
148
|
-
- Custom span decorators
|
|
149
|
-
- Configuration presets
|
|
150
|
-
|
|
151
|
-
### 🙏 Credits
|
|
152
|
-
- Built on OpenTelemetry
|
|
153
|
-
- Inspired by Vercel's `@vercel/otel`
|
|
154
|
-
- Compatible with SecureNow and all OTLP collectors
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
## Migration Guide
|
|
159
|
-
|
|
160
|
-
### From Previous Versions
|
|
161
|
-
|
|
162
|
-
No changes required! All existing code works as-is.
|
|
163
|
-
|
|
164
|
-
### Adding Next.js Support
|
|
165
|
-
|
|
166
|
-
If you want to add Next.js support:
|
|
167
|
-
|
|
168
|
-
1. Update to latest version:
|
|
169
|
-
```bash
|
|
170
|
-
npm install securenow@latest
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
2. Create `instrumentation.ts`:
|
|
174
|
-
```typescript
|
|
175
|
-
import { registerSecureNow } from 'securenow/nextjs';
|
|
176
|
-
export function register() { registerSecureNow(); }
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
3. Add environment variables:
|
|
180
|
-
```bash
|
|
181
|
-
SECURENOW_APPID=my-nextjs-app
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
That's it!
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## Breaking Changes
|
|
189
|
-
|
|
190
|
-
**None** - This release is 100% backward compatible.
|
|
191
|
-
|
|
192
|
-
---
|
|
193
|
-
|
|
194
|
-
## Deprecations
|
|
195
|
-
|
|
196
|
-
**None** - All existing APIs remain supported.
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
## Known Issues
|
|
201
|
-
|
|
202
|
-
### Edge Runtime
|
|
203
|
-
- Not yet supported (automatically skipped)
|
|
204
|
-
- Workaround: Use Node.js runtime for instrumented routes
|
|
205
|
-
|
|
206
|
-
### Vercel Deployment
|
|
207
|
-
- Some instrumentations may be too verbose
|
|
208
|
-
- Workaround: Use `SECURENOW_DISABLE_INSTRUMENTATIONS=fs`
|
|
209
|
-
|
|
210
|
-
---
|
|
211
|
-
|
|
212
|
-
## Testing
|
|
213
|
-
|
|
214
|
-
Tested with:
|
|
215
|
-
- ✅ Next.js 13.x (Pages Router)
|
|
216
|
-
- ✅ Next.js 14.x (App Router)
|
|
217
|
-
- ✅ Next.js 15.x (App Router)
|
|
218
|
-
- ✅ Vercel deployment
|
|
219
|
-
- ✅ Docker deployment
|
|
220
|
-
- ✅ PM2 cluster mode
|
|
221
|
-
- ✅ Express.js
|
|
222
|
-
- ✅ Fastify
|
|
223
|
-
- ✅ NestJS
|
|
224
|
-
|
|
225
|
-
---
|
|
226
|
-
|
|
227
|
-
**Release Date:** December 2024
|
|
228
|
-
**Version:** 3.1.0 (proposed)
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|