securenow 7.7.14 → 7.7.16
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 +65 -121
- package/README.md +19 -24
- package/SKILL-API.md +491 -490
- package/SKILL-CLI.md +8 -8
- package/app-config.js +146 -43
- package/cli/apps.js +589 -597
- package/cli/auth.js +1 -3
- package/cli/config.js +37 -9
- package/cli/credentials.js +1 -1
- package/cli/diagnostics.js +40 -10
- package/cli/init.js +1 -0
- package/firewall-only.js +1 -0
- package/firewall.js +62 -10
- package/free-trial-banner.js +2 -2
- package/mcp/catalog.js +2 -2
- package/nextjs.d.ts +67 -63
- package/nextjs.js +93 -52
- package/nuxt-server-plugin.mjs +7 -11
- package/nuxt.d.ts +42 -38
- package/nuxt.mjs +1 -1
- package/package.json +1 -1
- package/tracing.d.ts +2 -1
- package/tracing.js +75 -57
- package/web-vite.mjs +105 -15
package/NPM_README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# SecureNow - Complete OpenTelemetry Observability for Node.js
|
|
1
|
+
# SecureNow - Complete OpenTelemetry Observability for Node.js
|
|
2
2
|
|
|
3
3
|
OpenTelemetry instrumentation library for Node.js, Next.js, and Nuxt applications. Send distributed traces and logs to any OTLP-compatible observability backend.
|
|
4
4
|
|
|
@@ -86,7 +86,7 @@ This detects your framework and:
|
|
|
86
86
|
|
|
87
87
|
#### Configure Locally
|
|
88
88
|
|
|
89
|
-
Run `npx securenow login` to write `.securenow/credentials.json`. The SDK reads app identity,
|
|
89
|
+
Run `npx securenow login` to write `.securenow/credentials.json`. The SDK reads app identity, firewall key, logging/body-capture defaults, and firewall defaults from that file at boot. Telemetry uses the default SecureNow ingestion gateway and routes by `app.key`, so customer credentials do not expose per-instance collector URLs. Production uses the same file shape via `npx securenow credentials runtime --env production`.
|
|
90
90
|
|
|
91
91
|
#### Run Your Application
|
|
92
92
|
|
|
@@ -127,7 +127,7 @@ const app = express();
|
|
|
127
127
|
You'll see confirmation in the console:
|
|
128
128
|
|
|
129
129
|
```
|
|
130
|
-
[securenow] OTel SDK started ->
|
|
130
|
+
[securenow] OTel SDK started -> https://ingest.securenow.ai/v1/traces
|
|
131
131
|
[securenow] Firewall: ENABLED
|
|
132
132
|
[securenow] Firewall: synced 142 blocked IPs (138 exact + 4 CIDR ranges)
|
|
133
133
|
```
|
|
@@ -138,7 +138,7 @@ You'll see confirmation in the console:
|
|
|
138
138
|
|
|
139
139
|
The `securenow` CLI gives you full access to the SecureNow platform from the terminal -- no browser required for day-to-day workflows. Zero additional dependencies.
|
|
140
140
|
|
|
141
|
-
**Full CLI/SDK parity (v6.1.0+):** every SDK export has a matching CLI command. `redactSensitiveData` -> `securenow redact`, `createMatcher` -> `securenow cidr match`, `getLogger().emit()` -> `securenow log send`,
|
|
141
|
+
**Full CLI/SDK parity (v6.1.0+):** every SDK export has a matching CLI command. `redactSensitiveData` -> `securenow redact`, `createMatcher` -> `securenow cidr match`, `getLogger().emit()` -> `securenow log send`, startup smoke spans -> `securenow test-span`, `node -r securenow/firewall-only` -> `securenow run --firewall-only`. False-positive triage (`fp create`, `fp ai-fill`, `fp mark`) works from the terminal without the web dashboard.
|
|
142
142
|
|
|
143
143
|
### Getting Started
|
|
144
144
|
|
|
@@ -374,7 +374,7 @@ npx securenow test-span
|
|
|
374
374
|
npx securenow test-span "ci.smoke-test" # custom span name
|
|
375
375
|
```
|
|
376
376
|
|
|
377
|
-
Both commands use the resolved
|
|
377
|
+
Both commands use the resolved credentials JSON endpoints and headers. Non-zero exit on HTTP errors so CI/cron can detect failures.
|
|
378
378
|
|
|
379
379
|
### Utilities -- Redaction, CIDR, Diagnostics
|
|
380
380
|
|
|
@@ -434,14 +434,18 @@ Every command supports these flags:
|
|
|
434
434
|
| `--help` | | Show help for the command |
|
|
435
435
|
| `--app <key>` | | Override the default application key |
|
|
436
436
|
|
|
437
|
-
###
|
|
437
|
+
### Legacy CLI Overrides
|
|
438
438
|
|
|
439
|
-
|
|
439
|
+
Normal CLI, SDK, and production runtime setup uses `.securenow/credentials.json`.
|
|
440
|
+
Old per-terminal CLI overrides still exist for operator troubleshooting, but
|
|
441
|
+
they are not part of the SDK runtime configuration path.
|
|
442
|
+
|
|
443
|
+
| Override | Description |
|
|
440
444
|
|----------|-------------|
|
|
441
|
-
| `SECURENOW_TOKEN` |
|
|
442
|
-
| `SECURENOW_API_URL` |
|
|
443
|
-
| `SECURENOW_DEBUG` |
|
|
444
|
-
| `NO_COLOR` | Disable colored output |
|
|
445
|
+
| `SECURENOW_TOKEN` | Legacy CLI auth override for a single terminal session |
|
|
446
|
+
| `SECURENOW_API_URL` | Legacy CLI API base override for testing |
|
|
447
|
+
| `SECURENOW_DEBUG` | CLI stack traces while debugging |
|
|
448
|
+
| `NO_COLOR` | Disable colored CLI output |
|
|
445
449
|
|
|
446
450
|
### Multi-Project Sessions
|
|
447
451
|
|
|
@@ -460,7 +464,7 @@ npx securenow login
|
|
|
460
464
|
npx securenow whoami # Shows auth source: project (.securenow/)
|
|
461
465
|
```
|
|
462
466
|
|
|
463
|
-
For new automation,
|
|
467
|
+
For new automation, use project-local or runtime credentials files.
|
|
464
468
|
|
|
465
469
|
### CI/CD Integration
|
|
466
470
|
|
|
@@ -566,7 +570,7 @@ npx securenow logs --json --level error | jq '.logs'
|
|
|
566
570
|
|
|
567
571
|
## Framework-Specific Setup
|
|
568
572
|
|
|
569
|
-
> **v5.6.0+:** When `
|
|
573
|
+
> **v5.6.0+:** When `config.logging.enabled` is `true`, all `console.log`/`warn`/`error`/`info`/`debug` calls
|
|
570
574
|
> are **automatically** forwarded as OTLP log records. The separate `require('securenow/console-instrumentation')` is no longer needed (but still available for backward compat).
|
|
571
575
|
|
|
572
576
|
### Express.js
|
|
@@ -641,7 +645,7 @@ fastify.listen({ port: 3000 }, (err) => {
|
|
|
641
645
|
});
|
|
642
646
|
```
|
|
643
647
|
|
|
644
|
-
> **Default:** Traces, logs, POST body capture, multipart metadata capture, and firewall protection are on. If a specific Fastify version or plugin stack reports request-stream conflicts, set `
|
|
648
|
+
> **Default:** Traces, logs, POST body capture, multipart metadata capture, and firewall protection are on. If a specific Fastify version or plugin stack reports request-stream conflicts, set `config.capture.body=false` in credentials as a local override.
|
|
645
649
|
|
|
646
650
|
---
|
|
647
651
|
|
|
@@ -764,7 +768,7 @@ const init = async () => {
|
|
|
764
768
|
init().catch((err) => { console.error(err); process.exit(1); });
|
|
765
769
|
```
|
|
766
770
|
|
|
767
|
-
> **Default:** Traces, logs, POST body capture, multipart metadata capture, and firewall protection are on. If a specific Hapi version or payload plugin reports request-stream conflicts, set `
|
|
771
|
+
> **Default:** Traces, logs, POST body capture, multipart metadata capture, and firewall protection are on. If a specific Hapi version or payload plugin reports request-stream conflicts, set `config.capture.body=false` in credentials as a local override.
|
|
768
772
|
|
|
769
773
|
---
|
|
770
774
|
|
|
@@ -1061,10 +1065,10 @@ The Nuxt server plugin (v5.13.0+) initializes the firewall independently from Op
|
|
|
1061
1065
|
| Framework | Traces | Logs | Body Capture | Firewall | Notes |
|
|
1062
1066
|
|-----------|--------|------|--------------|----------|-------|
|
|
1063
1067
|
| Express | Yes | Yes | Yes | Yes | Fully compatible |
|
|
1064
|
-
| Fastify | Yes | Yes | Yes | Yes | Default on; use `
|
|
1068
|
+
| Fastify | Yes | Yes | Yes | Yes | Default on; use `config.capture.body=false` only for local stream conflicts |
|
|
1065
1069
|
| Koa | Yes | Yes | Yes | Yes | Needs `koa-bodyparser` |
|
|
1066
1070
|
| NestJS | Yes | Yes | Yes | Yes | Use `-r ts-node/register` |
|
|
1067
|
-
| Hapi | Yes | Yes | Yes | Yes | Default on; use `
|
|
1071
|
+
| Hapi | Yes | Yes | Yes | Yes | Default on; use `config.capture.body=false` only for local stream conflicts |
|
|
1068
1072
|
| h3 | Yes | Yes | Yes | Yes | Uses `toNodeListener()` |
|
|
1069
1073
|
| Polka | Yes | Yes | Yes | Yes | Needs manual body parser |
|
|
1070
1074
|
| Micro/HTTP | Yes | Yes | Yes | Yes | Full control |
|
|
@@ -1095,7 +1099,7 @@ npx securenow api-key set snk_live_abc123...
|
|
|
1095
1099
|
npx securenow credentials runtime --env production
|
|
1096
1100
|
```
|
|
1097
1101
|
|
|
1098
|
-
The SDK resolves the firewall key from project `./.securenow/credentials.json`, then project named runtime credentials in the fixed staging/production/preview/local/test/development/dev/prod order, then global `~/.securenow/credentials.json`, then global named runtime credentials in the same fixed order.
|
|
1102
|
+
The SDK resolves the firewall key from project `./.securenow/credentials.json`, then project named runtime credentials in the fixed staging/production/preview/local/test/development/dev/prod order, then global `~/.securenow/credentials.json`, then global named runtime credentials in the same fixed order.
|
|
1099
1103
|
|
|
1100
1104
|
On startup, you'll see:
|
|
1101
1105
|
|
|
@@ -1155,12 +1159,12 @@ node -r securenow/firewall-only app.js
|
|
|
1155
1159
|
|
|
1156
1160
|
The firewall supports four layers -- Layer 1 is always on, the rest are opt-in:
|
|
1157
1161
|
|
|
1158
|
-
| Layer |
|
|
1162
|
+
| Layer | Credentials key | Description |
|
|
1159
1163
|
|-------|---------|-------------|
|
|
1160
1164
|
| **Layer 1: HTTP** | *(always on)* | Returns 403 Forbidden with a security alert page. Works with proxy headers. |
|
|
1161
|
-
| **Layer 2: TCP** | `
|
|
1162
|
-
| **Layer 3: iptables** | `
|
|
1163
|
-
| **Layer 4: Cloud WAF** | `
|
|
1165
|
+
| **Layer 2: TCP** | `config.firewall.tcp=true` | `socket.destroy()` -- zero bytes sent back |
|
|
1166
|
+
| **Layer 3: iptables** | `config.firewall.iptables=true` | Kernel-level DROP (Linux, requires root) |
|
|
1167
|
+
| **Layer 4: Cloud WAF** | `config.firewall.cloud="cloudflare"` | Pushes to Cloudflare, AWS WAF, or GCP Cloud Armor |
|
|
1164
1168
|
|
|
1165
1169
|
### Blocked Page
|
|
1166
1170
|
|
|
@@ -1192,8 +1196,8 @@ Use `.securenow/credentials.json` as the source of truth. Run `npx securenow env
|
|
|
1192
1196
|
|
|
1193
1197
|
| Field | Description | Default |
|
|
1194
1198
|
|----------|-------------|---------|
|
|
1195
|
-
| `app.key` |
|
|
1196
|
-
| `app.
|
|
1199
|
+
| `app.key` | App routing UUID. The SecureNow ingestion gateway routes telemetry by this key. | selected during login |
|
|
1200
|
+
| `app.name` | Human-readable app label. | selected during login |
|
|
1197
1201
|
| `apiKey` | Scoped firewall key (`snk_live_...`). | minted during login |
|
|
1198
1202
|
| `config.runtime.deploymentEnvironment` | `deployment.environment` trace/log scope. | `local` from init, `production` from runtime credentials |
|
|
1199
1203
|
| `config.logging.enabled` | Automatic console log export. | `true` |
|
|
@@ -1202,90 +1206,18 @@ Use `.securenow/credentials.json` as the source of truth. Run `npx securenow env
|
|
|
1202
1206
|
| `config.firewall.enabled` | Local SDK firewall switch; dashboard toggle is per environment. | `true` |
|
|
1203
1207
|
| `config.otel.*` | Optional custom endpoints, headers, and log level. | empty |
|
|
1204
1208
|
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|----------|-------------|---------|
|
|
1211
|
-
| `SECURENOW_APPID` | Fallback for missing credentials `app.key`. Used as the app routing key/service name. | `<uuid>` |
|
|
1212
|
-
| `SECURENOW_INSTANCE` | Fallback for missing credentials `app.instance`. Base URL of your OTLP collector endpoint. | `https://freetrial.securenow.ai:4318` |
|
|
1213
|
-
|
|
1214
|
-
### Optional Configuration
|
|
1215
|
-
|
|
1216
|
-
#### Service Naming
|
|
1217
|
-
|
|
1218
|
-
| Variable | Description | Default |
|
|
1219
|
-
|----------|-------------|---------|
|
|
1220
|
-
| `OTEL_SERVICE_NAME` | Fallback for missing `app.name`. Standard OpenTelemetry variable. | - |
|
|
1221
|
-
| `SECURENOW_NO_UUID` | Legacy fallback for `config.runtime.noUuid`. | `0` |
|
|
1222
|
-
| `SECURENOW_STRICT` | Legacy fallback for `config.runtime.strict`. | `0` |
|
|
1223
|
-
|
|
1224
|
-
#### Connection Settings
|
|
1225
|
-
|
|
1226
|
-
| Variable | Description | Default |
|
|
1227
|
-
|----------|-------------|---------|
|
|
1228
|
-
| `OTEL_EXPORTER_OTLP_ENDPOINT` | Fallback for `config.otel.endpoint`. | - |
|
|
1229
|
-
| `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | Fallback for `config.otel.tracesEndpoint`. | `{instance}/v1/traces` |
|
|
1230
|
-
| `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` | Fallback for `config.otel.logsEndpoint`. | `{instance}/v1/logs` |
|
|
1231
|
-
| `OTEL_EXPORTER_OTLP_HEADERS` | Fallback for `config.otel.headers`. Format: `key1=value1,key2=value2` | - |
|
|
1232
|
-
|
|
1233
|
-
#### Logging
|
|
1234
|
-
|
|
1235
|
-
| Variable | Description | Default |
|
|
1236
|
-
|----------|-------------|---------|
|
|
1237
|
-
| `SECURENOW_LOGGING_ENABLED` | Enable automatic logging to OTLP backend. Set to `0` to disable. | `1` |
|
|
1238
|
-
|
|
1239
|
-
#### Request Body Capture
|
|
1240
|
-
|
|
1241
|
-
| Variable | Description | Default |
|
|
1242
|
-
|----------|-------------|---------|
|
|
1243
|
-
| `SECURENOW_CAPTURE_BODY` | Capture request bodies in traces. Set to `0` to disable. | `1` |
|
|
1244
|
-
| `SECURENOW_MAX_BODY_SIZE` | Maximum body size to capture in bytes. Bodies larger than this are truncated. | `10240` (10KB) |
|
|
1245
|
-
| `SECURENOW_SENSITIVE_FIELDS` | Comma-separated list of additional field names to redact. | - |
|
|
1246
|
-
| `SECURENOW_CAPTURE_MULTIPART` | Capture multipart/form-data metadata. Streams through the request to extract text field values and file metadata (name, filename, content-type, size) without buffering file content. Set to `0` to disable. | `1` |
|
|
1209
|
+
The credentials file is versioned with `_securenow.schemaVersion`. The SDK reads
|
|
1210
|
+
all runtime settings from this JSON plus built-in defaults. Production should
|
|
1211
|
+
mount a tokenless runtime credentials file at `.securenow/credentials.json`.
|
|
1212
|
+
Legacy env fallback is disabled by default and exists only for old deployments
|
|
1213
|
+
that explicitly opt in with `SECURENOW_ENABLE_LEGACY_ENV=1`.
|
|
1247
1214
|
|
|
1248
1215
|
**Default sensitive fields (auto-redacted):** `password`, `passwd`, `pwd`, `secret`, `token`, `api_key`, `apikey`, `access_token`, `auth`, `credentials`, `mysql_pwd`, `stripeToken`, `card`, `cardnumber`, `ccv`, `cvc`, `cvv`, `ssn`, `pin`
|
|
1249
1216
|
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
| `SECURENOW_DISABLE_INSTRUMENTATIONS` | Comma-separated list of instrumentation packages to disable. | - |
|
|
1255
|
-
|
|
1256
|
-
**Example:** `SECURENOW_DISABLE_INSTRUMENTATIONS=fs,dns` disables filesystem and DNS instrumentations.
|
|
1257
|
-
|
|
1258
|
-
#### Firewall
|
|
1259
|
-
|
|
1260
|
-
| Variable | Description | Default |
|
|
1261
|
-
|----------|-------------|---------|
|
|
1262
|
-
| `SECURENOW_API_KEY` | Legacy firewall key override. Prefer `apiKey` in `.securenow/credentials.json`. | from creds file |
|
|
1263
|
-
| `SECURENOW_API_URL` | SecureNow API base URL. Auto-detected for co-located deployments (falls back to `http://localhost:4000` on ECONNREFUSED). | `https://api.securenow.ai` |
|
|
1264
|
-
| `SECURENOW_FIREWALL_VERSION_INTERVAL` | Seconds between lightweight ETag checks. | `10` |
|
|
1265
|
-
| `SECURENOW_FIREWALL_SYNC_INTERVAL` | Safety-net full blocklist refresh interval in seconds. | `3600` |
|
|
1266
|
-
| `SECURENOW_FIREWALL_FAIL_MODE` | `open` (allow when unavailable) or `closed` (block all). | `open` |
|
|
1267
|
-
| `SECURENOW_FIREWALL_STATUS_CODE` | HTTP status code for blocked requests. | `403` |
|
|
1268
|
-
| `SECURENOW_FIREWALL_LOG` | Log blocked requests and sync events to console. Set to `0` to silence. | `1` |
|
|
1269
|
-
| `SECURENOW_FIREWALL_TCP` | Enable Layer 2 TCP blocking. | `0` |
|
|
1270
|
-
| `SECURENOW_FIREWALL_IPTABLES` | Enable Layer 3 iptables blocking. | `0` |
|
|
1271
|
-
| `SECURENOW_FIREWALL_CLOUD` | Cloud WAF provider: `cloudflare`, `aws`, or `gcp`. | - |
|
|
1272
|
-
| `SECURENOW_FIREWALL_CLOUD_DRY_RUN` | Log cloud pushes without applying changes. | `0` |
|
|
1273
|
-
| `SECURENOW_TRUSTED_PROXIES` | Comma-separated trusted proxy IPs. | - |
|
|
1274
|
-
|
|
1275
|
-
Use `npx securenow help firewall` for complete details on all layers.
|
|
1276
|
-
|
|
1277
|
-
#### Debugging
|
|
1278
|
-
|
|
1279
|
-
| Variable | Description | Default |
|
|
1280
|
-
|----------|-------------|---------|
|
|
1281
|
-
| `OTEL_LOG_LEVEL` | OpenTelemetry diagnostic override. Options: `debug`, `info`, `warn`, `error`, `none`. Overrides `config.otel.logLevel` for emergency debugging. | `error` |
|
|
1282
|
-
| `SECURENOW_TEST_SPAN` | Set to `1` to emit a test span on startup. | `0` |
|
|
1283
|
-
|
|
1284
|
-
#### Environment
|
|
1285
|
-
|
|
1286
|
-
| Variable | Description | Default |
|
|
1287
|
-
|----------|-------------|---------|
|
|
1288
|
-
| `SECURENOW_ENVIRONMENT` / `SECURENOW_DEPLOYMENT_ENVIRONMENT` / `NODE_ENV` | Fallback for `config.runtime.deploymentEnvironment`. | `production` |
|
|
1217
|
+
For instrumentation, firewall layers, debugging, trusted proxies, and deployment
|
|
1218
|
+
environment, edit the matching `config.*` keys in `.securenow/credentials.json`.
|
|
1219
|
+
Use `npx securenow env --json` to inspect the resolved values and
|
|
1220
|
+
`npx securenow help firewall` for the firewall command reference.
|
|
1289
1221
|
|
|
1290
1222
|
---
|
|
1291
1223
|
|
|
@@ -1310,13 +1242,15 @@ SecureNow provides multiple entry points depending on your needs:
|
|
|
1310
1242
|
|
|
1311
1243
|
### Automatic Console Logging
|
|
1312
1244
|
|
|
1313
|
-
|
|
1245
|
+
Console log forwarding is enabled by default through
|
|
1246
|
+
`config.logging.enabled: true`; all console calls are automatically forwarded as
|
|
1247
|
+
OTLP log records:
|
|
1314
1248
|
|
|
1315
1249
|
```javascript
|
|
1316
1250
|
// At the top of your main file
|
|
1317
1251
|
require('securenow/register');
|
|
1318
1252
|
|
|
1319
|
-
// With
|
|
1253
|
+
// With config.logging.enabled=true, all console logs are automatically sent
|
|
1320
1254
|
console.log('Application started');
|
|
1321
1255
|
console.info('User action', { userId: 123, action: 'login' });
|
|
1322
1256
|
console.warn('Deprecation warning');
|
|
@@ -1331,10 +1265,7 @@ console.debug('Debug info');
|
|
|
1331
1265
|
- `console.error()` -> ERROR
|
|
1332
1266
|
- `console.debug()` -> DEBUG
|
|
1333
1267
|
|
|
1334
|
-
|
|
1335
|
-
```bash
|
|
1336
|
-
SECURENOW_LOGGING_ENABLED=1
|
|
1337
|
-
```
|
|
1268
|
+
Logging is controlled by `config.logging.enabled` in `.securenow/credentials.json`.
|
|
1338
1269
|
|
|
1339
1270
|
### Direct Logger API
|
|
1340
1271
|
|
|
@@ -1377,13 +1308,20 @@ node -r securenow/register app.js
|
|
|
1377
1308
|
|
|
1378
1309
|
## Request Body Capture
|
|
1379
1310
|
|
|
1380
|
-
SecureNow captures HTTP request bodies in traces by default, with sensitive fields automatically redacted. Set `
|
|
1311
|
+
SecureNow captures HTTP request bodies in traces by default, with sensitive fields automatically redacted. Set `config.capture.body=false` in `.securenow/credentials.json` only when you need a local opt-out.
|
|
1381
1312
|
|
|
1382
1313
|
### Body Capture Defaults
|
|
1383
1314
|
|
|
1384
|
-
```
|
|
1385
|
-
|
|
1386
|
-
|
|
1315
|
+
```json
|
|
1316
|
+
{
|
|
1317
|
+
"config": {
|
|
1318
|
+
"capture": {
|
|
1319
|
+
"body": true,
|
|
1320
|
+
"maxBodySize": 10240,
|
|
1321
|
+
"multipart": true
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1387
1325
|
```
|
|
1388
1326
|
|
|
1389
1327
|
### Supported Content Types
|
|
@@ -1391,11 +1329,11 @@ export SECURENOW_MAX_BODY_SIZE=10240 # 10KB (optional)
|
|
|
1391
1329
|
- `application/json`
|
|
1392
1330
|
- `application/x-www-form-urlencoded`
|
|
1393
1331
|
- `application/graphql`
|
|
1394
|
-
- `multipart/form-data` (metadata capture is on unless `
|
|
1332
|
+
- `multipart/form-data` (metadata capture is on unless `config.capture.multipart=false`)
|
|
1395
1333
|
|
|
1396
1334
|
### Multipart Body Capture (v5.8.0+)
|
|
1397
1335
|
|
|
1398
|
-
Multipart/form-data metadata capture is enabled by default. Set `
|
|
1336
|
+
Multipart/form-data metadata capture is enabled by default. Set `config.capture.multipart=false` to disable it. Uses a streaming parser that never buffers file content -- memory stays at ~few KB regardless of upload size.
|
|
1399
1337
|
|
|
1400
1338
|
**What gets captured:**
|
|
1401
1339
|
- **Text fields** -- field name and value (up to 1000 chars), with sensitive fields auto-redacted
|
|
@@ -1422,8 +1360,14 @@ All request bodies are automatically scanned and sensitive fields are redacted:
|
|
|
1422
1360
|
|
|
1423
1361
|
**Add custom fields to redact:**
|
|
1424
1362
|
|
|
1425
|
-
```
|
|
1426
|
-
|
|
1363
|
+
```json
|
|
1364
|
+
{
|
|
1365
|
+
"config": {
|
|
1366
|
+
"capture": {
|
|
1367
|
+
"sensitiveFields": ["custom_secret", "internal_token"]
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1427
1371
|
```
|
|
1428
1372
|
|
|
1429
1373
|
### Example
|
|
@@ -1874,10 +1818,10 @@ Do not hardcode configuration in code or deployment dashboards. Use `.securenow/
|
|
|
1874
1818
|
|
|
1875
1819
|
```javascript
|
|
1876
1820
|
// Bad
|
|
1877
|
-
|
|
1821
|
+
const appKey = 'hardcoded-value';
|
|
1878
1822
|
|
|
1879
1823
|
// Good: use .securenow/credentials.json
|
|
1880
|
-
// { "app": { "key": "my-app", "instance": "https://
|
|
1824
|
+
// { "app": { "key": "my-app", "instance": "https://ingest.securenow.ai" } }
|
|
1881
1825
|
```
|
|
1882
1826
|
|
|
1883
1827
|
### 2. Use Structured Logging
|
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ That's it. No `.env` edits, no API keys to paste, no peer-dep warnings. Your tra
|
|
|
45
45
|
"app": {
|
|
46
46
|
"key": "<uuid>",
|
|
47
47
|
"name": "my-backend",
|
|
48
|
-
"instance": "https://
|
|
48
|
+
"instance": "https://ingest.securenow.ai"
|
|
49
49
|
},
|
|
50
50
|
"config": {
|
|
51
51
|
"runtime": { "deploymentEnvironment": "local" },
|
|
@@ -181,7 +181,7 @@ Resolution order:
|
|
|
181
181
|
4. Global named runtime credentials in the same fixed order
|
|
182
182
|
5. `package.json#name` (label only)
|
|
183
183
|
|
|
184
|
-
Legacy environment
|
|
184
|
+
SDK runtime config is credentials-json based. Legacy environment fallbacks are disabled by default and only work when `SECURENOW_ENABLE_LEGACY_ENV=1` is explicitly set for an old deployment.
|
|
185
185
|
|
|
186
186
|
---
|
|
187
187
|
|
|
@@ -244,8 +244,8 @@ Use `.securenow/credentials.json` fields for new local, CI, Docker, and producti
|
|
|
244
244
|
|
|
245
245
|
| Field | Default | Purpose |
|
|
246
246
|
|---|---|---|
|
|
247
|
-
| `app.key` | selected during login | App routing UUID
|
|
248
|
-
| `app.
|
|
247
|
+
| `app.key` | selected during login | App routing UUID; the gateway routes telemetry by this key |
|
|
248
|
+
| `app.name` | selected during login | Human-readable label for CLI and dashboard output |
|
|
249
249
|
| `apiKey` | minted during login | Scoped firewall key (`snk_live_...`) |
|
|
250
250
|
| `config.runtime.deploymentEnvironment` | `local` from `init`, `production` from runtime credentials | Sent as OTel `deployment.environment` |
|
|
251
251
|
| `config.logging.enabled` | `true` | Forward `console.*` as OTLP logs |
|
|
@@ -256,25 +256,20 @@ Use `.securenow/credentials.json` fields for new local, CI, Docker, and producti
|
|
|
256
256
|
| `config.firewall.enabled` | `true` | Local SDK firewall switch; dashboard firewall toggle is scoped per environment |
|
|
257
257
|
| `config.otel.*` | empty | Optional custom OTLP endpoints, headers, and log level |
|
|
258
258
|
|
|
259
|
-
|
|
259
|
+
The credentials file is versioned with `_securenow.schemaVersion`, so future SDK
|
|
260
|
+
versions can migrate defaults without asking customers to manage env vars. For
|
|
261
|
+
production, generate a tokenless runtime file:
|
|
260
262
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
| `SECURENOW_DISABLE_INSTRUMENTATIONS` | - | Comma-separated OTel instrumentations to disable. |
|
|
272
|
-
| `SECURENOW_NO_UUID` | `0` | Don't append a UUID to `service.instance.id`. |
|
|
273
|
-
| `SECURENOW_STRICT` | `0` | Exit with code 1 if `SECURENOW_APPID` is missing in a PM2 cluster. |
|
|
274
|
-
| `OTEL_EXPORTER_OTLP_HEADERS` | - | Raw OTLP headers (e.g. `x-api-key=...`). |
|
|
275
|
-
| `OTEL_LOG_LEVEL` | - | `debug`/`info`/`warn`/`error`. |
|
|
276
|
-
|
|
277
|
-
New installs should use `.securenow/credentials.json`; environment variables remain legacy fallbacks for existing deployments.
|
|
263
|
+
```bash
|
|
264
|
+
npx securenow credentials runtime --env production
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Mount or copy that JSON as `.securenow/credentials.json` in the deployed app.
|
|
268
|
+
New runtime credentials do not include a per-instance collector URL; the SDK
|
|
269
|
+
uses `https://ingest.securenow.ai` by default and the gateway routes by
|
|
270
|
+
`app.key`.
|
|
271
|
+
Legacy env fallback exists only for old deployments that explicitly opt in with
|
|
272
|
+
`SECURENOW_ENABLE_LEGACY_ENV=1`; new installs should not use it.
|
|
278
273
|
|
|
279
274
|
---
|
|
280
275
|
|
|
@@ -289,7 +284,7 @@ PostgreSQL, MySQL / MySQL2, MongoDB, Redis
|
|
|
289
284
|
### Other
|
|
290
285
|
HTTP/HTTPS, GraphQL, gRPC, and many more via [@opentelemetry/auto-instrumentations-node](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node).
|
|
291
286
|
|
|
292
|
-
> MongoDB instrumentation is
|
|
287
|
+
> MongoDB instrumentation is included in the current SDK. To disable it for a service, add `@opentelemetry/instrumentation-mongodb` to `config.otel.disableInstrumentations` in `.securenow/credentials.json`.
|
|
293
288
|
|
|
294
289
|
---
|
|
295
290
|
|
|
@@ -431,7 +426,7 @@ After install, the `securenow` CLI is available via `npx securenow` or globally
|
|
|
431
426
|
| `~/.securenow/credentials.<environment>.json` | Global environment-specific runtime credentials |
|
|
432
427
|
| `~/.securenow/config.json` | API URL, default app, preferences |
|
|
433
428
|
|
|
434
|
-
Resolution order: project `.securenow/credentials.json` -> project named runtime credentials in the fixed staging/production/preview/local/test/development/dev/prod order -> global `~/.securenow/credentials.json` -> global named runtime credentials in the same fixed order -> package name fallback. Legacy env
|
|
429
|
+
Resolution order: project `.securenow/credentials.json` -> project named runtime credentials in the fixed staging/production/preview/local/test/development/dev/prod order -> global `~/.securenow/credentials.json` -> global named runtime credentials in the same fixed order -> package name fallback. Legacy env fallbacks are disabled unless `SECURENOW_ENABLE_LEGACY_ENV=1` is set, and they never choose the credentials filename.
|
|
435
430
|
|
|
436
431
|
Override the dashboard API with `securenow config set apiUrl <url>`.
|
|
437
432
|
|