securenow 7.7.15 → 7.8.1
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 +35 -22
- package/README.md +50 -32
- package/SKILL-API.md +49 -25
- package/SKILL-CLI.md +61 -40
- package/app-config.js +127 -18
- package/cli/apiKey.js +7 -7
- package/cli/apps.js +3 -3
- package/cli/auth.js +113 -31
- package/cli/client.js +14 -13
- package/cli/config.js +219 -45
- package/cli/credentials.js +3 -3
- package/cli/diagnostics.js +35 -10
- package/cli/firewall.js +19 -7
- package/cli/init.js +5 -5
- package/cli/security.js +31 -11
- package/cli.js +57 -22
- package/firewall-only.js +4 -4
- package/firewall.js +172 -45
- package/mcp/catalog.js +43 -30
- package/mcp/server.js +73 -12
- package/nextjs.js +49 -11
- package/nuxt-server-plugin.mjs +8 -4
- package/otel-defaults.js +11 -0
- package/package.json +2 -1
- package/tracing.js +49 -12
- package/web-vite.mjs +3 -0
package/NPM_README.md
CHANGED
|
@@ -11,12 +11,16 @@ OpenTelemetry instrumentation library for Node.js, Next.js, and Nuxt application
|
|
|
11
11
|
- Multi-layer firewall -- auto-blocks IPs from your SecureNow blocklist
|
|
12
12
|
- `securenow init` scaffolds Next.js instrumentation, safe `serverExternalPackages`, and standalone output tracing includes
|
|
13
13
|
- `securenow/firewall-only` entry point for firewall without tracing overhead
|
|
14
|
-
-
|
|
14
|
+
- Split local credentials: `.securenow/admin.json` for CLI/MCP admin auth and `.securenow/runtime.json` for SDK runtime
|
|
15
15
|
- Single `-r securenow/register` flag -- works for both CJS and ESM apps
|
|
16
16
|
- Native Nuxt 3 module (`securenow/nuxt`)
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
+
> **v7.8 credential model:** admin/control-plane CLI and MCP auth lives in `.securenow/admin.json`; SDK runtime app config and the firewall key live in `.securenow/runtime.json`. `npx securenow login` can run both lanes for onboarding, `npx securenow admin login` refreshes only admin auth, and `npx securenow app connect` refreshes only runtime app config. Legacy combined `.securenow/credentials.json` files are still read, and production runtime exports can still be mounted as `.securenow/credentials.json`.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
20
24
|
## Table of Contents
|
|
21
25
|
|
|
22
26
|
- [Installation](#installation)
|
|
@@ -65,7 +69,9 @@ Run login - it is a browser flow that picks or creates an app and connects the f
|
|
|
65
69
|
npx securenow login
|
|
66
70
|
```
|
|
67
71
|
|
|
68
|
-
During the browser step, the dashboard enables the selected app's firewall toggle, mints an API key (scoped `firewall:read + blocklist:read + allowlist:read`), and the CLI writes
|
|
72
|
+
During the browser step, the dashboard enables the selected app's firewall toggle, mints an API key (scoped `firewall:read + blocklist:read + allowlist:read`), and the CLI writes runtime config into `.securenow/runtime.json`. Admin auth, when part of the flow, is saved separately to `.securenow/admin.json`. Traces, logs, POST body capture, multipart metadata capture, and firewall protection are enabled by default. No env vars, no copy-pasting keys.
|
|
73
|
+
|
|
74
|
+
Metrics export is intentionally off by default. SecureNow sets `OTEL_METRICS_EXPORTER=none` when the app has not explicitly configured metrics, preventing the OpenTelemetry SDK from creating a default metrics reader that retries `localhost:4318`.
|
|
69
75
|
|
|
70
76
|
For framework scaffolding (Next.js `instrumentation.ts`, `next.config.*`, etc.) use:
|
|
71
77
|
|
|
@@ -76,17 +82,17 @@ npx securenow init --key snk_live_abc123...
|
|
|
76
82
|
```
|
|
77
83
|
|
|
78
84
|
This detects your framework and:
|
|
79
|
-
- **Credentials**: Ensures `.securenow/
|
|
85
|
+
- **Credentials**: Ensures `.securenow/runtime.json` has secure defaults and explanations
|
|
80
86
|
- **Next.js**: Creates `instrumentation.ts`, adds `serverExternalPackages: ['securenow']` plus `outputFileTracingIncludes` when safe, or prints a Codex/Claude-ready merge prompt for existing files
|
|
81
87
|
- **Nuxt 3**: Suggests adding `securenow/nuxt` to modules
|
|
82
88
|
- **Express / Node.js**: Shows how to add `-r securenow/register` to your start script
|
|
83
|
-
- **All**: Stores `--key` in `.securenow/
|
|
89
|
+
- **All**: Stores `--key` in `.securenow/runtime.json`; no local `.env` file is needed
|
|
84
90
|
|
|
85
91
|
### 2. Manual Setup
|
|
86
92
|
|
|
87
93
|
#### Configure Locally
|
|
88
94
|
|
|
89
|
-
Run `npx securenow
|
|
95
|
+
Run `npx securenow app connect` to write `.securenow/runtime.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
96
|
|
|
91
97
|
#### Run Your Application
|
|
92
98
|
|
|
@@ -143,13 +149,15 @@ The `securenow` CLI gives you full access to the SecureNow platform from the ter
|
|
|
143
149
|
### Getting Started
|
|
144
150
|
|
|
145
151
|
```bash
|
|
146
|
-
#
|
|
147
|
-
# The browser flow mints and stores the firewall API key automatically in
|
|
148
|
-
# .securenow/credentials.json (no env var needed).
|
|
152
|
+
# Friendly onboarding: admin auth + app runtime connection.
|
|
149
153
|
npx securenow login
|
|
150
154
|
|
|
151
|
-
#
|
|
152
|
-
npx securenow login
|
|
155
|
+
# Admin/control-plane CLI and MCP auth only.
|
|
156
|
+
npx securenow admin login
|
|
157
|
+
npx securenow admin login --token <YOUR_JWT>
|
|
158
|
+
|
|
159
|
+
# App/runtime SDK config only.
|
|
160
|
+
npx securenow app connect
|
|
153
161
|
|
|
154
162
|
# Save to ~/.securenow/ instead of this project
|
|
155
163
|
npx securenow login --global
|
|
@@ -170,7 +178,7 @@ npx securenow api-key clear # remove just the key
|
|
|
170
178
|
# Auto-detect framework and scaffold instrumentation files
|
|
171
179
|
npx securenow init
|
|
172
180
|
|
|
173
|
-
# Pass your API key to store it in .securenow/
|
|
181
|
+
# Pass your API key to store it in .securenow/runtime.json
|
|
174
182
|
npx securenow init --key snk_live_abc123...
|
|
175
183
|
```
|
|
176
184
|
|
|
@@ -178,7 +186,7 @@ For Next.js projects, `init` creates `instrumentation.ts` (or `.js` if no TypeSc
|
|
|
178
186
|
|
|
179
187
|
### MCP for Codex and Claude
|
|
180
188
|
|
|
181
|
-
SecureNow includes a local stdio MCP server that
|
|
189
|
+
SecureNow includes a local stdio MCP server that resolves credentials by operation type:
|
|
182
190
|
|
|
183
191
|
```bash
|
|
184
192
|
npx securenow login
|
|
@@ -187,7 +195,7 @@ codex mcp add securenow -- npx securenow mcp
|
|
|
187
195
|
npx -p securenow securenow-mcp
|
|
188
196
|
```
|
|
189
197
|
|
|
190
|
-
The MCP surface exposes tools for applications, traces, logs, firewall, IP intelligence, forensics, notifications, blocklist, allowlist, trusted IPs, rate-limit remediation, and docs-backed prompts/resources. Write actions require `confirm:true` and a reason. Use `securenow_blocklist_unblock` to stop firewall enforcement while keeping the block report/history; `securenow_blocklist_remove` is a compatibility alias.
|
|
198
|
+
Admin/global tools use `.securenow/admin.json`. App-scoped runtime reads can use `.securenow/runtime.json` or an explicit app key. The MCP surface exposes tools for applications, traces, logs, firewall, IP intelligence, forensics, notifications, blocklist, allowlist, trusted IPs, rate-limit remediation, and docs-backed prompts/resources. Write actions require `confirm:true` and a reason. Use `securenow_blocklist_unblock` to stop firewall enforcement while keeping the block report/history; `securenow_blocklist_remove` is a compatibility alias.
|
|
191
199
|
|
|
192
200
|
For hosted clients, SecureNow can expose the same surface at `https://api.securenow.ai/mcp`. The hosted endpoint uses the same API authentication and scope checks as the rest of SecureNow.
|
|
193
201
|
|
|
@@ -418,11 +426,14 @@ Config files are stored in `~/.securenow/` (global) or `.securenow/` in the proj
|
|
|
418
426
|
| File | Description |
|
|
419
427
|
|------|-------------|
|
|
420
428
|
| `~/.securenow/config.json` | API URL, default app, output format |
|
|
421
|
-
| `~/.securenow/
|
|
422
|
-
|
|
|
429
|
+
| `~/.securenow/admin.json` | Global admin/control-plane CLI and MCP auth |
|
|
430
|
+
| `~/.securenow/runtime.json` | Global SDK runtime app config and firewall key |
|
|
431
|
+
| `.securenow/admin.json` | Project-local admin/control-plane CLI and MCP auth |
|
|
432
|
+
| `.securenow/runtime.json` | Project-local SDK runtime app config and firewall key |
|
|
433
|
+
| `.securenow/credentials.json` | Legacy combined credentials; still read for backward compatibility |
|
|
423
434
|
| `.securenow/credentials.<environment>.json` | Tokenless runtime credentials generated by `credentials runtime --env <environment>`; read in a fixed order, not selected from env vars |
|
|
424
435
|
|
|
425
|
-
**Resolution order:** project `.securenow/credentials.json` -> project named runtime credentials in the fixed staging/production/preview/local/test/development/dev/prod order -> global
|
|
436
|
+
**Resolution order:** runtime config resolves from project `.securenow/runtime.json` -> legacy project `.securenow/credentials.json` -> project named runtime credentials in the fixed staging/production/preview/local/test/development/dev/prod order -> global `.securenow/runtime.json` -> legacy global credentials -> global named runtime credentials. Admin auth resolves from `admin.json` first, then legacy `credentials.json`. Legacy CLI token overrides still work for existing automation.
|
|
426
437
|
|
|
427
438
|
### Global Flags
|
|
428
439
|
|
|
@@ -436,7 +447,7 @@ Every command supports these flags:
|
|
|
436
447
|
|
|
437
448
|
### Legacy CLI Overrides
|
|
438
449
|
|
|
439
|
-
Normal
|
|
450
|
+
Normal SDK runtime setup uses `.securenow/runtime.json`; admin CLI/MCP auth uses `.securenow/admin.json`.
|
|
440
451
|
Old per-terminal CLI overrides still exist for operator troubleshooting, but
|
|
441
452
|
they are not part of the SDK runtime configuration path.
|
|
442
453
|
|
|
@@ -488,16 +499,18 @@ npx securenow logs --json --level error | jq '.logs'
|
|
|
488
499
|
| Category | Command | Description |
|
|
489
500
|
|----------|---------|-------------|
|
|
490
501
|
| **Setup** | `init` | Auto-scaffold instrumentation for your framework |
|
|
491
|
-
| **Auth** | `login` |
|
|
492
|
-
| | `
|
|
493
|
-
| | `
|
|
502
|
+
| **Auth** | `login` | Friendly onboarding: admin auth + app runtime connection |
|
|
503
|
+
| | `admin login` | Authenticate admin/control-plane CLI and MCP tools |
|
|
504
|
+
| | `app connect` | Select/create app and write SDK runtime config |
|
|
505
|
+
| | `logout` | Clear admin auth; runtime app config remains |
|
|
506
|
+
| | `whoami` | Show admin auth and runtime app status separately |
|
|
494
507
|
| **Apps** | `apps` | List applications |
|
|
495
508
|
| | `apps create <name>` | Create application |
|
|
496
509
|
| | `apps info <id>` | Application details |
|
|
497
510
|
| | `apps delete <id>` | Delete application |
|
|
498
511
|
| | `apps default <key>` | Set default app |
|
|
499
512
|
| **API Key** | `api-key create [--name "CLI firewall"] [--global]` | Mint and save a firewall key with your logged-in session |
|
|
500
|
-
| | `api-key set <snk_live_...> [--global]` | Save firewall key to `.securenow/
|
|
513
|
+
| | `api-key set <snk_live_...> [--global]` | Save firewall key to `.securenow/runtime.json` |
|
|
501
514
|
| | `api-key show` | Show masked key + source |
|
|
502
515
|
| | `api-key clear [--global]` | Remove stored key (leaves session/app) |
|
|
503
516
|
| **Observe** | `traces` | List traces |
|
|
@@ -1203,7 +1216,7 @@ Use `.securenow/credentials.json` as the source of truth. Run `npx securenow env
|
|
|
1203
1216
|
| `config.logging.enabled` | Automatic console log export. | `true` |
|
|
1204
1217
|
| `config.capture.body` | Request body capture with redaction. | `true` |
|
|
1205
1218
|
| `config.capture.multipart` | Multipart metadata capture, never file content. | `true` |
|
|
1206
|
-
| `config.firewall.enabled` |
|
|
1219
|
+
| `config.firewall.enabled` | Deprecated local hint. Runtime enable/disable uses the dashboard/API environment toggle. | ignored |
|
|
1207
1220
|
| `config.otel.*` | Optional custom endpoints, headers, and log level. | empty |
|
|
1208
1221
|
|
|
1209
1222
|
The credentials file is versioned with `_securenow.schemaVersion`. The SDK reads
|
package/README.md
CHANGED
|
@@ -12,9 +12,8 @@ Zero-config OpenTelemetry for Node.js, Next.js, and Nuxt: traces, logs, body cap
|
|
|
12
12
|
# 1. Install
|
|
13
13
|
npm install securenow
|
|
14
14
|
|
|
15
|
-
# 2. Pick (or create) your app in the browser - writes .securenow/
|
|
16
|
-
#
|
|
17
|
-
# a scoped firewall API key in the same file - no env vars.
|
|
15
|
+
# 2. Pick (or create) your app in the browser - writes .securenow/runtime.json.
|
|
16
|
+
# The friendly login flow can also refresh admin CLI/MCP auth in .securenow/admin.json.
|
|
18
17
|
npx securenow login
|
|
19
18
|
|
|
20
19
|
# 3. Start your app - one flag is all it takes
|
|
@@ -35,12 +34,17 @@ That's it. No `.env` edits, no API keys to paste, no peer-dep warnings. Your tra
|
|
|
35
34
|
|
|
36
35
|
## How it works
|
|
37
36
|
|
|
38
|
-
`npx securenow login` opens a browser
|
|
37
|
+
`npx securenow login` opens a browser and runs both lanes for onboarding:
|
|
38
|
+
|
|
39
|
+
- admin/control-plane CLI and MCP auth goes to `.securenow/admin.json`
|
|
40
|
+
- app/runtime SDK config and the firewall API key go to `.securenow/runtime.json`
|
|
41
|
+
|
|
42
|
+
Use `npx securenow admin login` to refresh only admin auth, or `npx securenow app connect` to refresh only runtime app config. Legacy combined `.securenow/credentials.json` files are still read for old installs.
|
|
43
|
+
|
|
44
|
+
Runtime credentials look like:
|
|
39
45
|
|
|
40
46
|
```json
|
|
41
47
|
{
|
|
42
|
-
"token": "...",
|
|
43
|
-
"email": "you@example.com",
|
|
44
48
|
"apiKey": "snk_live_...",
|
|
45
49
|
"app": {
|
|
46
50
|
"key": "<uuid>",
|
|
@@ -56,7 +60,7 @@ That's it. No `.env` edits, no API keys to paste, no peer-dep warnings. Your tra
|
|
|
56
60
|
}
|
|
57
61
|
```
|
|
58
62
|
|
|
59
|
-
The SDK reads
|
|
63
|
+
The SDK reads the runtime file at boot and sends traces/logs directly to the right app bucket. `npx securenow init` also fills the config block with secure defaults plus an `_securenow.explanations` section so users can see what every setting does. Local credential files are auto-added to `.gitignore` so they never land in git.
|
|
60
64
|
|
|
61
65
|
---
|
|
62
66
|
|
|
@@ -71,7 +75,7 @@ npx securenow login
|
|
|
71
75
|
Then ask your coding agent to wire each app with this prompt:
|
|
72
76
|
|
|
73
77
|
```text
|
|
74
|
-
I already ran npx securenow login from the repo root. For every Node.js or Next.js app under this repo: install securenow@latest, run or merge npx securenow init, create or reuse a SecureNow app, write local .securenow/
|
|
78
|
+
I already ran npx securenow login from the repo root. For every Node.js or Next.js app under this repo: install securenow@latest, run or merge npx securenow init, create or reuse a SecureNow app, write local .securenow/runtime.json plus tokenless .securenow/credentials.production.json, gitignore only SecureNow credential files, enable traces, logs, body capture, multipart metadata, and firewall, then verify with npx securenow env --json, npx securenow test-span, npx securenow log send, and a local HTTP smoke test where possible. Do not print secrets.
|
|
75
79
|
```
|
|
76
80
|
|
|
77
81
|
For production, deploy the tokenless runtime credentials as a secret file mounted at `<app-root>/.securenow/credentials.json`.
|
|
@@ -151,7 +155,9 @@ Run `npx securenow init` after installing so the credentials file and secure def
|
|
|
151
155
|
- Multipart upload metadata (field names, file names, sizes, content-types; never file content)
|
|
152
156
|
- Firewall protection from the selected app's SecureNow blocklist and IPDB sync - activates as soon as you've logged in
|
|
153
157
|
|
|
154
|
-
All of these are **on by default**. Tune them in `.securenow/
|
|
158
|
+
All of these are **on by default**. Tune them in `.securenow/runtime.json` under the `config` block.
|
|
159
|
+
|
|
160
|
+
SecureNow does not export metrics by default. The preload sets `OTEL_METRICS_EXPORTER=none` when the app has not explicitly configured a metrics exporter, which prevents OpenTelemetry's default metrics reader from falling back to `localhost:4318`.
|
|
155
161
|
|
|
156
162
|
---
|
|
157
163
|
|
|
@@ -175,11 +181,13 @@ Starting in v7.7.2, the SDK also accepts generated runtime filenames directly wi
|
|
|
175
181
|
|
|
176
182
|
Resolution order:
|
|
177
183
|
|
|
178
|
-
1. Project-local `.securenow/
|
|
179
|
-
2.
|
|
180
|
-
3.
|
|
181
|
-
4. Global
|
|
182
|
-
5.
|
|
184
|
+
1. Project-local `.securenow/runtime.json`
|
|
185
|
+
2. Legacy project-local `.securenow/credentials.json`
|
|
186
|
+
3. Project-local named runtime credentials: `.securenow/credentials.staging.json`, then `.securenow/credentials.production.json`, then preview/local/test/development/dev/prod variants
|
|
187
|
+
4. Global `~/.securenow/runtime.json`
|
|
188
|
+
5. Legacy global `~/.securenow/credentials.json`
|
|
189
|
+
6. Global named runtime credentials in the same fixed order
|
|
190
|
+
7. `package.json#name` (label only)
|
|
183
191
|
|
|
184
192
|
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
193
|
|
|
@@ -189,13 +197,14 @@ SDK runtime config is credentials-json based. Legacy environment fallbacks are d
|
|
|
189
197
|
|
|
190
198
|
```bash
|
|
191
199
|
# Setup
|
|
192
|
-
npx securenow login #
|
|
193
|
-
npx securenow login
|
|
194
|
-
npx securenow
|
|
200
|
+
npx securenow login # friendly flow: admin auth + app runtime connection
|
|
201
|
+
npx securenow admin login # admin/control-plane CLI + MCP auth only
|
|
202
|
+
npx securenow app connect # app/runtime SDK connection only
|
|
203
|
+
npx securenow admin login --token <TOKEN> # headless admin auth (CI)
|
|
195
204
|
npx securenow init --env local # scaffold framework files + local env scope
|
|
196
205
|
npx securenow credentials runtime --env production # write tokenless production credentials file
|
|
197
206
|
npx securenow api-key create --name "CLI firewall" # mint + store firewall key
|
|
198
|
-
npx securenow api-key set snk_live_... # store firewall key in .securenow/
|
|
207
|
+
npx securenow api-key set snk_live_... # store firewall key in .securenow/runtime.json
|
|
199
208
|
|
|
200
209
|
# Apps
|
|
201
210
|
npx securenow apps # list all apps
|
|
@@ -211,6 +220,7 @@ npx securenow doctor # diagnose config + connectivity
|
|
|
211
220
|
# Security
|
|
212
221
|
npx securenow firewall status --env production
|
|
213
222
|
npx securenow blocklist add 1.2.3.4 --reason "scanner"
|
|
223
|
+
npx securenow blocklist add 1.2.3.4 --route /admin* --mode prefix --method ALL --reason "admin probing"
|
|
214
224
|
npx securenow blocklist unblock <id> --reason "reviewed safe"
|
|
215
225
|
npx securenow fp ai-fill --description "Stripe webhook POST /api/stripe/webhook"
|
|
216
226
|
|
|
@@ -229,18 +239,20 @@ SecureNow ships a local stdio MCP server for agent clients:
|
|
|
229
239
|
|
|
230
240
|
```bash
|
|
231
241
|
npx securenow login
|
|
242
|
+
npx securenow admin login # admin/control-plane only
|
|
243
|
+
npx securenow app connect # runtime app/firewall key only
|
|
232
244
|
codex mcp add securenow -- npx securenow mcp
|
|
233
245
|
# or run directly:
|
|
234
246
|
npx -p securenow securenow-mcp
|
|
235
247
|
```
|
|
236
248
|
|
|
237
|
-
The MCP server
|
|
249
|
+
The MCP server resolves credentials by operation type: admin/global tools use `.securenow/admin.json`, while app-scoped runtime reads can use `.securenow/runtime.json` or an explicit app key. Legacy combined `.securenow/credentials.json` remains a fallback. It exposes tools for apps, traces, logs, firewall, IP intelligence, forensics, blocklist/allowlist/trusted IPs, rate-limit remediation, plus resources for the bundled SecureNow docs and setup prompts.
|
|
238
250
|
|
|
239
251
|
---
|
|
240
252
|
|
|
241
253
|
## Credentials Config
|
|
242
254
|
|
|
243
|
-
Use `.securenow/
|
|
255
|
+
Use `.securenow/runtime.json` fields for new local SDK/runtime setups. Production exports still use tokenless `.securenow/credentials.<environment>.json` files that can be mounted as `.securenow/credentials.json`.
|
|
244
256
|
|
|
245
257
|
| Field | Default | Purpose |
|
|
246
258
|
|---|---|---|
|
|
@@ -253,7 +265,7 @@ Use `.securenow/credentials.json` fields for new local, CI, Docker, and producti
|
|
|
253
265
|
| `config.capture.multipart` | `true` | Capture multipart metadata, never file content |
|
|
254
266
|
| `config.capture.maxBodySize` | `10240` | Max bytes captured per body |
|
|
255
267
|
| `config.capture.sensitiveFields` | `[]` | Extra field-name fragments to redact |
|
|
256
|
-
| `config.firewall.enabled` |
|
|
268
|
+
| `config.firewall.enabled` | Deprecated | Ignored as a local kill switch; dashboard/API firewall toggle is scoped per environment |
|
|
257
269
|
| `config.otel.*` | empty | Optional custom OTLP endpoints, headers, and log level |
|
|
258
270
|
|
|
259
271
|
The credentials file is versioned with `_securenow.schemaVersion`, so future SDK
|
|
@@ -284,7 +296,7 @@ PostgreSQL, MySQL / MySQL2, MongoDB, Redis
|
|
|
284
296
|
### Other
|
|
285
297
|
HTTP/HTTPS, GraphQL, gRPC, and many more via [@opentelemetry/auto-instrumentations-node](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node).
|
|
286
298
|
|
|
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/
|
|
299
|
+
> MongoDB instrumentation is included in the current SDK. To disable it for a service, add `@opentelemetry/instrumentation-mongodb` to `config.otel.disableInstrumentations` in `.securenow/runtime.json`.
|
|
288
300
|
|
|
289
301
|
---
|
|
290
302
|
|
|
@@ -310,14 +322,16 @@ After install, the `securenow` CLI is available via `npx securenow` or globally
|
|
|
310
322
|
|
|
311
323
|
| Command | Description |
|
|
312
324
|
|---|---|
|
|
313
|
-
| `securenow login` |
|
|
325
|
+
| `securenow login` | Friendly onboarding: admin auth + runtime app connection |
|
|
326
|
+
| `securenow admin login` | Admin/control-plane CLI and MCP auth only |
|
|
327
|
+
| `securenow app connect` | App/runtime SDK connection only |
|
|
314
328
|
| `securenow login --global` | Save to ~/.securenow/ instead |
|
|
315
|
-
| `securenow login --token <TOKEN>` | Headless (CI/servers) |
|
|
316
|
-
| `securenow logout` | Clear
|
|
329
|
+
| `securenow admin login --token <TOKEN>` | Headless admin auth (CI/servers) |
|
|
330
|
+
| `securenow logout` | Clear admin auth only; runtime app config stays intact |
|
|
317
331
|
| `securenow logout --global` | Clear ~/.securenow/ instead |
|
|
318
|
-
| `securenow whoami` | Show
|
|
332
|
+
| `securenow whoami` | Show admin auth and runtime app status separately |
|
|
319
333
|
| `securenow api-key create [--name "CLI firewall"]` | Mint and store a firewall key using your session token |
|
|
320
|
-
| `securenow api-key set <snk_live_...>` | Store firewall key in `.securenow/
|
|
334
|
+
| `securenow api-key set <snk_live_...>` | Store firewall key in `.securenow/runtime.json` (`--global` for `~/.securenow/`) |
|
|
321
335
|
| `securenow api-key show` | Print masked key + source file |
|
|
322
336
|
| `securenow api-key clear` | Remove stored key (`--global` for `~/.securenow/`) |
|
|
323
337
|
|
|
@@ -368,14 +382,14 @@ After install, the `securenow` CLI is available via `npx securenow` or globally
|
|
|
368
382
|
| Command | Description |
|
|
369
383
|
|---|---|
|
|
370
384
|
| `securenow firewall status` | Firewall layers + key info |
|
|
371
|
-
| `securenow firewall test-ip <ip
|
|
385
|
+
| `securenow firewall test-ip <ip> [--path /admin/users]` | Would this IP be blocked? |
|
|
372
386
|
|
|
373
387
|
### Remediation
|
|
374
388
|
|
|
375
389
|
| Command | Description |
|
|
376
390
|
|---|---|
|
|
377
391
|
| `securenow blocklist` | List blocked IPs |
|
|
378
|
-
| `securenow blocklist add <ip> [--reason ...]` | Block an IP |
|
|
392
|
+
| `securenow blocklist add <ip> [--route /admin*] [--mode prefix] [--method GET] [--reason ...]` | Block an IP globally or only for matching routes |
|
|
379
393
|
| `securenow blocklist unblock <id> [--reason ...]` | Stop enforcement and keep block history |
|
|
380
394
|
| `securenow ratelimit parse "<request>"` | Fill a rate-limit rule draft from natural language |
|
|
381
395
|
| `securenow ratelimit from-text "<request>" --yes` | Create a soft rate-limit rule from natural language |
|
|
@@ -420,13 +434,17 @@ After install, the `securenow` CLI is available via `npx securenow` or globally
|
|
|
420
434
|
|
|
421
435
|
| File | Purpose |
|
|
422
436
|
|---|---|
|
|
423
|
-
| `./.securenow/
|
|
437
|
+
| `./.securenow/admin.json` | Project-local admin/control-plane CLI and MCP auth |
|
|
438
|
+
| `./.securenow/runtime.json` | Project-local SDK runtime app config and firewall key |
|
|
439
|
+
| `./.securenow/credentials.json` | Legacy combined credentials; still read for backward compatibility |
|
|
424
440
|
| `./.securenow/credentials.<environment>.json` | Tokenless runtime file generated by `securenow credentials runtime --env <environment>`; read in a fixed order, not selected from env vars |
|
|
425
|
-
| `~/.securenow/
|
|
441
|
+
| `~/.securenow/admin.json` | Global admin/control-plane auth |
|
|
442
|
+
| `~/.securenow/runtime.json` | Global SDK runtime app config |
|
|
443
|
+
| `~/.securenow/credentials.json` | Legacy global combined credentials |
|
|
426
444
|
| `~/.securenow/credentials.<environment>.json` | Global environment-specific runtime credentials |
|
|
427
445
|
| `~/.securenow/config.json` | API URL, default app, preferences |
|
|
428
446
|
|
|
429
|
-
|
|
447
|
+
Runtime resolution order: project `.securenow/runtime.json` -> legacy project `.securenow/credentials.json` -> project named runtime credentials in fixed staging/production/preview/local/test/development/dev/prod order -> global `~/.securenow/runtime.json` -> legacy global credentials -> global named runtime credentials -> package name fallback. Admin auth resolves from `admin.json` first, then legacy `credentials.json`. Legacy env fallbacks are disabled unless `SECURENOW_ENABLE_LEGACY_ENV=1` is set, and they never choose the credentials filename.
|
|
430
448
|
|
|
431
449
|
Override the dashboard API with `securenow config set apiUrl <url>`.
|
|
432
450
|
|
package/SKILL-API.md
CHANGED
|
@@ -4,7 +4,7 @@ Instrument any Node.js application with OpenTelemetry tracing, structured loggin
|
|
|
4
4
|
|
|
5
5
|
**CLI parity:** every capability exposed below (redaction, CIDR matching, log/span emission, firewall preload, config inspection) has an equivalent `securenow` CLI command. See [SKILL-CLI.md](./SKILL-CLI.md) for the terminal surface.
|
|
6
6
|
|
|
7
|
-
**MCP parity (v7.
|
|
7
|
+
**MCP parity (v7.8+):** `npx securenow mcp` starts a local stdio MCP server for Codex, Claude, and other MCP clients. It reads admin/control-plane auth from `.securenow/admin.json` and SDK runtime app credentials from `.securenow/runtime.json`, with legacy `.securenow/credentials.json` still supported. Alert-rule operators can inspect notifications, read exact `metadata.matchedSubdetectors`, dry-run candidate SQL with `securenow_alert_rule_candidate_test`, and apply global system-rule query fixes with `securenow_alert_rule_query_update` only when the admin user/plan permits it.
|
|
8
8
|
|
|
9
9
|
**Noisy alert-rule reviews:** prefer fixing a generic system-rule detector over creating customer-specific false positives. Dry-run candidate SQL first, preserve tenant scoping with `__USER_APP_KEYS__`, keep exploit-specific indicators, then save the shared query mapping only with an audit reason and explicit confirmation.
|
|
10
10
|
|
|
@@ -27,10 +27,12 @@ npm install securenow@latest
|
|
|
27
27
|
node -p "require('./node_modules/securenow/package.json').version"
|
|
28
28
|
npx securenow version
|
|
29
29
|
npx securenow login
|
|
30
|
+
npx securenow admin login # admin/control-plane CLI + MCP auth only
|
|
31
|
+
npx securenow app connect # SDK runtime app + firewall key only
|
|
30
32
|
npx securenow init
|
|
31
33
|
```
|
|
32
34
|
|
|
33
|
-
Use `securenow@7.
|
|
35
|
+
Use `securenow@7.8.0` or newer for split admin/runtime credentials. Start authentication with `npx securenow login`; do not manually open auth URLs, because the CLI generates the callback/state values. The friendly login flow can connect both lanes, while `npx securenow admin login` only writes `.securenow/admin.json` and `npx securenow app connect` only writes `.securenow/runtime.json`. `init` scaffolds the framework integration.
|
|
34
36
|
|
|
35
37
|
### 2. Run With Instrumentation
|
|
36
38
|
|
|
@@ -54,19 +56,21 @@ npx securenow init
|
|
|
54
56
|
|
|
55
57
|
That's it. Traces, logs, request body capture, multipart metadata capture, and firewall enforcement are on by default. No code changes for Express, Fastify, NestJS, Koa, Hapi, and raw Node.
|
|
56
58
|
|
|
59
|
+
Metrics export is off by default. SecureNow sets `OTEL_METRICS_EXPORTER=none` only when the app has not explicitly configured a metrics exporter, so `@opentelemetry/sdk-node` will not start a default metrics reader that retries `localhost:4318`.
|
|
60
|
+
|
|
57
61
|
### 3. Firewall Is Enabled by Default
|
|
58
62
|
|
|
59
|
-
Since v7.
|
|
60
|
-
the user picks or creates an app. The firewall key lives in
|
|
61
|
-
|
|
63
|
+
Since v7.8, the app runtime flow connects the firewall automatically after
|
|
64
|
+
the user picks or creates an app. The firewall key lives in `.securenow/runtime.json`
|
|
65
|
+
so admin CLI/MCP login cannot overwrite it:
|
|
62
66
|
|
|
63
67
|
```bash
|
|
64
|
-
npx securenow
|
|
68
|
+
npx securenow app connect # pick/create app; firewall key is minted automatically
|
|
65
69
|
# or, if you already have one:
|
|
66
70
|
npx securenow api-key set snk_live_abc123...
|
|
67
71
|
```
|
|
68
72
|
|
|
69
|
-
Both paths write the key to `.securenow/
|
|
73
|
+
Both paths write the key to `.securenow/runtime.json` (gitignored via credential-file patterns, not a whole-directory `.securenow/` ignore) and the firewall activates on next start. For production, run `npx securenow credentials runtime --env production` and mount/copy the tokenless file as `.securenow/credentials.json` or `.securenow/credentials.<env>.json`.
|
|
70
74
|
|
|
71
75
|
The firewall syncs your blocklist and enforces it on every request — zero code changes.
|
|
72
76
|
|
|
@@ -77,7 +81,7 @@ reblock context.
|
|
|
77
81
|
|
|
78
82
|
For near-realtime propagation after a block/unblock, set
|
|
79
83
|
`config.firewall.versionCheckInterval` to `1` or `2` in the protected app's
|
|
80
|
-
`.securenow/
|
|
84
|
+
`.securenow/runtime.json` or production runtime credentials. The SDK polls `/firewall/sync` with ETag/304, so
|
|
81
85
|
unchanged checks are lightweight; keep `config.firewall.syncInterval` high as a
|
|
82
86
|
safety-net full refresh.
|
|
83
87
|
|
|
@@ -138,7 +142,7 @@ module.exports = {
|
|
|
138
142
|
script: './app.js',
|
|
139
143
|
instances: 4,
|
|
140
144
|
node_args: '-r securenow/register',
|
|
141
|
-
// Reads .securenow/
|
|
145
|
+
// Reads .securenow/runtime.json from the project root.
|
|
142
146
|
}],
|
|
143
147
|
};
|
|
144
148
|
```
|
|
@@ -146,7 +150,7 @@ module.exports = {
|
|
|
146
150
|
**Docker:**
|
|
147
151
|
|
|
148
152
|
```dockerfile
|
|
149
|
-
COPY .securenow/credentials.json ./.securenow/credentials.json
|
|
153
|
+
COPY .securenow/credentials.production.json ./.securenow/credentials.production.json
|
|
150
154
|
CMD ["node", "-r", "securenow/register", "app.js"]
|
|
151
155
|
```
|
|
152
156
|
|
|
@@ -214,7 +218,7 @@ On Vercel it uses `@vercel/otel`; self-hosted uses vanilla `@opentelemetry/sdk-n
|
|
|
214
218
|
}
|
|
215
219
|
```
|
|
216
220
|
|
|
217
|
-
Local development and production do not need `.env.local`; `npx securenow
|
|
221
|
+
Local development and production do not need `.env.local`; `npx securenow app connect` and `npx securenow init` keep `.securenow/runtime.json` filled and gitignored. For production, run `npx securenow credentials runtime --env production` and mount/copy the generated JSON as `.securenow/credentials.json` or `.securenow/credentials.production.json`.
|
|
218
222
|
|
|
219
223
|
#### Next.js Body Capture
|
|
220
224
|
|
|
@@ -254,11 +258,11 @@ export const POST = withSecureNow(async (req) => {
|
|
|
254
258
|
#### Next.js with `securenow init`
|
|
255
259
|
|
|
256
260
|
```bash
|
|
257
|
-
npx securenow
|
|
261
|
+
npx securenow app connect
|
|
258
262
|
npx securenow init
|
|
259
263
|
```
|
|
260
264
|
|
|
261
|
-
Auto-detects Next.js, creates `instrumentation.ts`, adds `serverExternalPackages: ['securenow']` plus `outputFileTracingIncludes` when safe, and reuses the app, instance, firewall key, and secure defaults in `.securenow/
|
|
265
|
+
Auto-detects Next.js, creates `instrumentation.ts`, adds `serverExternalPackages: ['securenow']` plus `outputFileTracingIncludes` when safe, and reuses the app, instance, firewall key, and secure defaults in `.securenow/runtime.json`. If files already exist, it prints an agent-ready prompt with the exact edits to propose.
|
|
262
266
|
|
|
263
267
|
---
|
|
264
268
|
|
|
@@ -270,12 +274,12 @@ Auto-detects Next.js, creates `instrumentation.ts`, adds `serverExternalPackages
|
|
|
270
274
|
export default defineNuxtConfig({
|
|
271
275
|
modules: ['securenow/nuxt'],
|
|
272
276
|
securenow: {
|
|
273
|
-
// optional overrides (defaults come from .securenow/
|
|
277
|
+
// optional overrides (defaults come from .securenow/runtime.json)
|
|
274
278
|
},
|
|
275
279
|
});
|
|
276
280
|
```
|
|
277
281
|
|
|
278
|
-
The Nuxt module auto-configures Nitro externals, runtime config, and a server plugin that sets up OTel tracing + logging + firewall. Local
|
|
282
|
+
The Nuxt module auto-configures Nitro externals, runtime config, and a server plugin that sets up OTel tracing + logging + firewall. Local app identity, firewall key, and secure defaults come from `.securenow/runtime.json`; production can use tokenless `.securenow/credentials.<env>.json`.
|
|
279
283
|
|
|
280
284
|
---
|
|
281
285
|
|
|
@@ -296,7 +300,7 @@ Instruments document load, fetch, XMLHttpRequest, and user interactions with bro
|
|
|
296
300
|
|
|
297
301
|
## Firewall — Multi-Layer IP Blocking
|
|
298
302
|
|
|
299
|
-
The firewall auto-activates once an API key is resolvable and the app firewall toggle is on. Since **v7.
|
|
303
|
+
The firewall auto-activates once an API key is resolvable and the app firewall toggle is on. Since **v7.8**, `npx securenow app connect` enables the selected app firewall by default and writes the scoped key to `.securenow/runtime.json`; `securenow api-key set` can still write/rotate the key later. Production should use the tokenless file generated by `securenow credentials runtime --env production`. Runtime resolution order is project `./.securenow/runtime.json` -> legacy project credentials -> project named runtime credentials -> global runtime/legacy/named runtime credentials. Admin auth lives separately in `admin.json`.
|
|
300
304
|
|
|
301
305
|
```
|
|
302
306
|
Layer 4: Cloud/Edge WAF → blocked at CDN (Cloudflare, AWS WAF, GCP Cloud Armor)
|
|
@@ -308,8 +312,8 @@ Layer 1: HTTP Handler → 403 JSON response (always active)
|
|
|
308
312
|
### Activate
|
|
309
313
|
|
|
310
314
|
```bash
|
|
311
|
-
# Zero-config (recommended)
|
|
312
|
-
npx securenow
|
|
315
|
+
# Zero-config runtime (recommended) - writes the key to .securenow/runtime.json
|
|
316
|
+
npx securenow app connect # pick/create app; firewall connects automatically
|
|
313
317
|
# or, if you already have a key:
|
|
314
318
|
npx securenow api-key set snk_live_abc123...
|
|
315
319
|
|
|
@@ -317,6 +321,26 @@ npx securenow api-key set snk_live_abc123...
|
|
|
317
321
|
npx securenow credentials runtime --env production
|
|
318
322
|
```
|
|
319
323
|
|
|
324
|
+
### Scoped Blocklist Entries
|
|
325
|
+
|
|
326
|
+
Manual blocklist entries can target all routes or only matching request scopes.
|
|
327
|
+
Use the dashboard Advanced section, the API, CLI, or MCP with the same fields:
|
|
328
|
+
|
|
329
|
+
```json
|
|
330
|
+
{
|
|
331
|
+
"ip": "203.0.113.42",
|
|
332
|
+
"pathPattern": "/admin*",
|
|
333
|
+
"pathMatchMode": "prefix",
|
|
334
|
+
"method": "ALL",
|
|
335
|
+
"appKey": "optional-app-key",
|
|
336
|
+
"environment": "production",
|
|
337
|
+
"reason": "Admin probing"
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
`pathMatchMode` accepts `prefix`, `exact`, or `regex`. Omit `pathPattern` and
|
|
342
|
+
use `method: "ALL"` for a global IP/CIDR block.
|
|
343
|
+
|
|
320
344
|
### Firewall-Only Mode (No Tracing Overhead)
|
|
321
345
|
|
|
322
346
|
```bash
|
|
@@ -336,7 +360,7 @@ const appConfig = require('securenow/app-config');
|
|
|
336
360
|
|
|
337
361
|
await firewall.init({
|
|
338
362
|
...appConfig.resolveFirewallOptions(),
|
|
339
|
-
apiUrl: 'https://
|
|
363
|
+
apiUrl: 'https://ingest.securenow.ai',
|
|
340
364
|
syncInterval: 3600, // safety-net full sync every hour
|
|
341
365
|
versionCheckInterval: 10, // lightweight ETag check every 10s
|
|
342
366
|
failMode: 'open', // 'open' or 'closed'
|
|
@@ -500,7 +524,7 @@ const safe = redactSensitiveData({ username: 'alice', password: 's3cret', token:
|
|
|
500
524
|
|
|
501
525
|
**Auto-redacted fields:** `password`, `passwd`, `pwd`, `secret`, `token`, `api_key`, `apikey`, `access_token`, `auth`, `credentials`, `mysql_pwd`, `stripeToken`, `card`, `cardnumber`, `ccv`, `cvc`, `cvv`, `ssn`, `pin`.
|
|
502
526
|
|
|
503
|
-
Add custom fields via `config.capture.sensitiveFields` in `.securenow/
|
|
527
|
+
Add custom fields via `config.capture.sensitiveFields` in `.securenow/runtime.json`.
|
|
504
528
|
|
|
505
529
|
**CLI equivalent** (for piping, scripts, debugging what a payload looks like post-redaction):
|
|
506
530
|
|
|
@@ -513,7 +537,7 @@ securenow redact @request.json --fields internal_id,sessionHash
|
|
|
513
537
|
|
|
514
538
|
## Credentials Configuration
|
|
515
539
|
|
|
516
|
-
Local development
|
|
540
|
+
Local development uses `.securenow/runtime.json`; legacy `.securenow/credentials.json` is still read. Every setting below lives under `app` or `config`; `npx securenow credentials runtime --env production` creates a tokenless production file with the same structure. Since v7.7.2, the SDK also accepts named runtime files such as `.securenow/credentials.production.json` when the canonical `credentials.json` file is absent. Filename lookup is deterministic and does not read environment variables. Legacy env fallback is disabled unless `SECURENOW_ENABLE_LEGACY_ENV=1` is explicitly set.
|
|
517
541
|
|
|
518
542
|
| Credentials path | Purpose |
|
|
519
543
|
|---|---|
|
|
@@ -565,7 +589,7 @@ npm install securenow@latest
|
|
|
565
589
|
npx securenow login
|
|
566
590
|
```
|
|
567
591
|
|
|
568
|
-
No `.env` is needed. `npx securenow
|
|
592
|
+
No `.env` is needed. `npx securenow app connect` writes app identity, firewall key, and secure defaults to `.securenow/runtime.json`; the SDK uses the default SecureNow ingestion gateway and the gateway routes by `app.key`. `npx securenow init` makes sure the file has explanations and is gitignored without ignoring the whole `.securenow/` directory.
|
|
569
593
|
|
|
570
594
|
Update `package.json`:
|
|
571
595
|
```json
|
|
@@ -578,10 +602,10 @@ No code changes to the application needed.
|
|
|
578
602
|
|
|
579
603
|
```bash
|
|
580
604
|
npm install securenow@latest
|
|
581
|
-
npx securenow
|
|
605
|
+
npx securenow app connect # pick/create app; firewall key is minted automatically
|
|
582
606
|
```
|
|
583
607
|
|
|
584
|
-
`securenow
|
|
608
|
+
`securenow app connect` enables the selected app's firewall toggle and writes app/runtime config plus the firewall key to `.securenow/runtime.json` (gitignored via credential-file patterns, not a whole-directory `.securenow/` ignore). Traces, logs, request body capture, multipart metadata capture, and firewall enforcement are enabled by default. Then run `npx securenow init`; it creates `instrumentation.ts`, patches `next.config.*` when safe, or prints exact Codex/Claude merge instructions for existing files.
|
|
585
609
|
|
|
586
610
|
### Enable Firewall With Zero Tracing Overhead
|
|
587
611
|
|
|
@@ -591,7 +615,7 @@ For apps that only need IP blocking:
|
|
|
591
615
|
node -r securenow/firewall-only app.js
|
|
592
616
|
```
|
|
593
617
|
|
|
594
|
-
Make sure an API key is resolvable by running `npx securenow
|
|
618
|
+
Make sure an API key is resolvable by running `npx securenow app connect` first. If you already have a key, `securenow api-key set snk_live_...` writes the runtime credentials file. For production, run `npx securenow credentials runtime --env production` and mount/copy it as `.securenow/credentials.json` or `.securenow/credentials.production.json`.
|
|
595
619
|
|
|
596
620
|
### Production Hardened Configuration
|
|
597
621
|
|