securenow 7.7.16 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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
- - Local and production configuration via `.securenow/credentials.json`
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
+ > **v8.0 credential model:** admin/control-plane CLI and MCP auth lives in `.securenow/admin.json`; SDK runtime app config and the runtime API 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 it into `.securenow/credentials.json`. Traces, logs, POST body capture, multipart metadata capture, and firewall protection are enabled by default. No env vars, no copy-pasting keys.
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/credentials.json` has secure defaults and explanations
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/credentials.json`; no local `.env` file is needed
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 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`.
95
+ Run `npx securenow app connect` to write `.securenow/runtime.json`. The SDK reads app identity, runtime API key, logging/body-capture defaults, and firewall defaults from that file at boot. Telemetry uses the default SecureNow ingestion gateway, routes by `app.key`, and authenticates with the runtime API 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
- # Log in (opens browser for OAuth + app picker)
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
- # Or use a token for CI/headless environments
152
- npx securenow login --token <YOUR_JWT>
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
@@ -157,8 +165,8 @@ npx securenow login --global
157
165
  # Check who you're logged in as (shows auth source)
158
166
  npx securenow whoami
159
167
 
160
- # Need or already have a firewall key? Create or store it without re-running login:
161
- npx securenow api-key create --name "CLI firewall"
168
+ # Need or already have a runtime API key? Create or store it without re-running login:
169
+ npx securenow api-key create --name "CLI runtime"
162
170
  npx securenow api-key set snk_live_abc123... # --global for ~/.securenow/
163
171
  npx securenow api-key show # masked key + source
164
172
  npx securenow api-key clear # remove just the key
@@ -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/credentials.json
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 uses the same credentials and API client as the CLI:
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/credentials.json` | Auth token, app, API key, config - global (use `login --global`) |
422
- | `.securenow/credentials.json` | Auth token, app, API key, config, explanations - project-local default |
429
+ | `~/.securenow/admin.json` | Global admin/control-plane CLI and MCP auth |
430
+ | `~/.securenow/runtime.json` | Global SDK runtime app config and runtime API 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 runtime API 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 `~/.securenow/credentials.json` -> global named runtime credentials in the same fixed order. Legacy CLI token overrides still work for existing automation.
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
 
@@ -434,17 +445,13 @@ Every command supports these flags:
434
445
  | `--help` | | Show help for the command |
435
446
  | `--app <key>` | | Override the default application key |
436
447
 
437
- ### Legacy CLI Overrides
448
+ ### CLI Configuration
438
449
 
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.
450
+ Normal SDK runtime setup uses `.securenow/runtime.json`; admin CLI/MCP auth uses `.securenow/admin.json`.
451
+ SecureNow-specific environment overrides are no longer supported by the SDK or CLI.
442
452
 
443
453
  | Override | Description |
444
454
  |----------|-------------|
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
455
  | `NO_COLOR` | Disable colored CLI output |
449
456
 
450
457
  ### Multi-Project Sessions
@@ -488,16 +495,18 @@ npx securenow logs --json --level error | jq '.logs'
488
495
  | Category | Command | Description |
489
496
  |----------|---------|-------------|
490
497
  | **Setup** | `init` | Auto-scaffold instrumentation for your framework |
491
- | **Auth** | `login` | Authenticate via browser, `--token`, or `--local` |
492
- | | `logout` | Clear credentials (`--local` for project only) |
493
- | | `whoami` | Show session info and auth source |
498
+ | **Auth** | `login` | Friendly onboarding: admin auth + app runtime connection |
499
+ | | `admin login` | Authenticate admin/control-plane CLI and MCP tools |
500
+ | | `app connect` | Select/create app and write SDK runtime config |
501
+ | | `logout` | Clear admin auth; runtime app config remains |
502
+ | | `whoami` | Show admin auth and runtime app status separately |
494
503
  | **Apps** | `apps` | List applications |
495
504
  | | `apps create <name>` | Create application |
496
505
  | | `apps info <id>` | Application details |
497
506
  | | `apps delete <id>` | Delete application |
498
507
  | | `apps default <key>` | Set default app |
499
- | **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/credentials.json` |
508
+ | **API Key** | `api-key create [--name "CLI runtime"] [--global]` | Mint and save a runtime API key with your logged-in session |
509
+ | | `api-key set <snk_live_...> [--global]` | Save runtime API key to `.securenow/runtime.json` |
501
510
  | | `api-key show` | Show masked key + source |
502
511
  | | `api-key clear [--global]` | Remove stored key (leaves session/app) |
503
512
  | **Observe** | `traces` | List traces |
@@ -1099,7 +1108,7 @@ npx securenow api-key set snk_live_abc123...
1099
1108
  npx securenow credentials runtime --env production
1100
1109
  ```
1101
1110
 
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.
1111
+ The SDK resolves the runtime API 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.
1103
1112
 
1104
1113
  On startup, you'll see:
1105
1114
 
@@ -1198,19 +1207,18 @@ Use `.securenow/credentials.json` as the source of truth. Run `npx securenow env
1198
1207
  |----------|-------------|---------|
1199
1208
  | `app.key` | App routing UUID. The SecureNow ingestion gateway routes telemetry by this key. | selected during login |
1200
1209
  | `app.name` | Human-readable app label. | selected during login |
1201
- | `apiKey` | Scoped firewall key (`snk_live_...`). | minted during login |
1210
+ | `apiKey` | Scoped runtime API key (`snk_live_...`) for telemetry ingestion and firewall sync. | minted during login |
1202
1211
  | `config.runtime.deploymentEnvironment` | `deployment.environment` trace/log scope. | `local` from init, `production` from runtime credentials |
1203
1212
  | `config.logging.enabled` | Automatic console log export. | `true` |
1204
1213
  | `config.capture.body` | Request body capture with redaction. | `true` |
1205
1214
  | `config.capture.multipart` | Multipart metadata capture, never file content. | `true` |
1206
- | `config.firewall.enabled` | Local SDK firewall switch; dashboard toggle is per environment. | `true` |
1215
+ | `config.firewall.enabled` | Deprecated local hint. Runtime enable/disable uses the dashboard/API environment toggle. | ignored |
1207
1216
  | `config.otel.*` | Optional custom endpoints, headers, and log level. | empty |
1208
1217
 
1209
1218
  The credentials file is versioned with `_securenow.schemaVersion`. The SDK reads
1210
1219
  all runtime settings from this JSON plus built-in defaults. Production should
1211
1220
  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`.
1221
+ Environment-variable fallback is not supported.
1214
1222
 
1215
1223
  **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`
1216
1224
 
@@ -1405,7 +1413,7 @@ All request bodies are automatically scanned and sensitive fields are redacted:
1405
1413
  "config": {
1406
1414
  "runtime": { "noUuid": true, "strict": true, "deploymentEnvironment": "production" },
1407
1415
  "otel": {
1408
- "headers": { "x-api-key": "your-api-key" },
1416
+ "headers": { "x-securenow-app-key": "my-production-app" },
1409
1417
  "logLevel": "info",
1410
1418
  "disableInstrumentations": ["fs", "dns"]
1411
1419
  },
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/ locally.
16
- # Since v7.4.0, the browser step enables the app firewall and stores
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, lets you pick (or create) an application, and writes a **project-local** credentials file to `.securenow/credentials.json`:
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 this 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. The file is auto-added to `.gitignore` so it never lands in git.
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/credentials.json plus tokenless .securenow/credentials.production.json, gitignore .securenow, 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.
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/credentials.json` under the `config` block.
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,13 +181,15 @@ 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/credentials.json`
179
- 2. Project-local named runtime credentials: `.securenow/credentials.staging.json`, then `.securenow/credentials.production.json`, then preview/local/test/development/dev/prod variants
180
- 3. Global `~/.securenow/credentials.json`
181
- 4. Global named runtime credentials in the same fixed order
182
- 5. `package.json#name` (label only)
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
- 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.
192
+ SDK runtime config is credentials-json based. Environment-variable fallbacks are no longer supported.
185
193
 
186
194
  ---
187
195
 
@@ -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 # browser auth + app picker + firewall enabled by default
193
- npx securenow login --global # save to ~/.securenow/ instead
194
- npx securenow login --token <TOKEN> # headless (CI)
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
- 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/credentials.json
206
+ npx securenow api-key create --name "CLI runtime" # mint + store runtime API key
207
+ npx securenow api-key set snk_live_... # store runtime API 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,31 +239,33 @@ 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/API 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 reuses the same project-local `.securenow/credentials.json` as the CLI and SDK. 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.
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/credentials.json` fields for new local, CI, Docker, and production setups. The credentials file is the product path.
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
  |---|---|---|
247
259
  | `app.key` | selected during login | App routing UUID; the gateway routes telemetry by this key |
248
260
  | `app.name` | selected during login | Human-readable label for CLI and dashboard output |
249
- | `apiKey` | minted during login | Scoped firewall key (`snk_live_...`) |
261
+ | `apiKey` | minted during login | Scoped runtime API key (`snk_live_...`) for telemetry ingestion and firewall sync |
250
262
  | `config.runtime.deploymentEnvironment` | `local` from `init`, `production` from runtime credentials | Sent as OTel `deployment.environment` |
251
263
  | `config.logging.enabled` | `true` | Forward `console.*` as OTLP logs |
252
264
  | `config.capture.body` | `true` | Capture JSON / form request bodies with redaction |
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` | `true` | Local SDK firewall switch; dashboard firewall toggle is scoped per environment |
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
@@ -268,8 +280,8 @@ Mount or copy that JSON as `.securenow/credentials.json` in the deployed app.
268
280
  New runtime credentials do not include a per-instance collector URL; the SDK
269
281
  uses `https://ingest.securenow.ai` by default and the gateway routes by
270
282
  `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.
283
+ Environment-variable fallback is not supported; use runtime credentials files
284
+ for local, staging, preview, and production.
273
285
 
274
286
  ---
275
287
 
@@ -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/credentials.json`.
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` | Browser auth + pick app; firewall key is minted automatically (writes ./.securenow/ by default) |
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 project-local credentials |
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 current session (email, app, expiry) |
319
- | `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/credentials.json` (`--global` for `~/.securenow/`) |
332
+ | `securenow whoami` | Show admin auth and runtime app status separately |
333
+ | `securenow api-key create [--name "CLI runtime"]` | Mint and store a runtime API key using your session token |
334
+ | `securenow api-key set <snk_live_...>` | Store runtime API 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>` | Would this IP be blocked? |
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/credentials.json` | Project-local or production runtime credentials |
437
+ | `./.securenow/admin.json` | Project-local admin/control-plane CLI and MCP auth |
438
+ | `./.securenow/runtime.json` | Project-local SDK runtime app config and runtime API 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/credentials.json` | Global (with `login --global`) |
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
- 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.
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`. Runtime config is never read from environment variables.
430
448
 
431
449
  Override the dashboard API with `securenow config set apiUrl <url>`.
432
450