securenow 7.5.0 → 7.6.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/CONSUMING-APPS-GUIDE.md +2 -0
- package/NPM_README.md +201 -237
- package/README.md +73 -26
- package/SKILL-API.md +209 -205
- package/SKILL-CLI.md +71 -64
- package/app-config.js +479 -83
- package/cli/apiKey.js +1 -1
- package/cli/apps.js +1 -1
- package/cli/config.js +31 -12
- package/cli/credentials.js +88 -0
- package/cli/diagnostics.js +81 -98
- package/cli/firewall.js +29 -14
- package/cli/init.js +246 -201
- package/cli/monitor.js +107 -43
- package/cli/security.js +24 -12
- package/cli/ui.js +22 -12
- package/cli/utils.js +2 -1
- package/cli.js +71 -39
- package/console-instrumentation.js +1 -1
- package/docs/ENVIRONMENT-VARIABLES.md +137 -863
- package/docs/ENVIRONMENTS.md +60 -0
- package/docs/EXPRESS-SETUP-GUIDE.md +3 -0
- package/docs/FIREWALL-GUIDE.md +3 -0
- package/docs/INDEX.md +6 -8
- package/docs/LOGGING-GUIDE.md +3 -0
- package/docs/MCP-GUIDE.md +8 -0
- package/docs/NEXTJS-GUIDE.md +3 -0
- package/docs/NEXTJS-QUICKSTART.md +24 -16
- package/docs/NUXT-GUIDE.md +3 -0
- package/docs/QUICKSTART-BODY-CAPTURE.md +3 -0
- package/docs/REQUEST-BODY-CAPTURE.md +3 -0
- package/firewall-cloud.js +10 -10
- package/firewall-only.js +25 -23
- package/firewall.js +47 -29
- package/free-trial-banner.js +1 -1
- package/mcp/catalog.js +104 -17
- package/nextjs-auto-capture.d.ts +7 -4
- package/nextjs-auto-capture.js +7 -7
- package/nextjs-middleware.js +4 -3
- package/nextjs-wrapper.js +6 -6
- package/nextjs.d.ts +36 -25
- package/nextjs.js +47 -55
- package/nuxt-server-plugin.mjs +35 -51
- package/nuxt.d.ts +29 -23
- package/package.json +1 -1
- package/postinstall.js +27 -61
- package/register.d.ts +19 -33
- package/register.js +8 -8
- package/resolve-ip.js +4 -5
- package/tracing.d.ts +21 -19
- package/tracing.js +34 -42
package/SKILL-CLI.md
CHANGED
|
@@ -9,22 +9,22 @@ Use the `securenow` CLI to perform security DevOps from the terminal: manage app
|
|
|
9
9
|
npm install -g securenow
|
|
10
10
|
|
|
11
11
|
# Or install per-project and use via npx
|
|
12
|
-
npm install securenow
|
|
12
|
+
npm install securenow@latest
|
|
13
13
|
npx securenow <command>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
**Full parity with the SDK:** every capability the `securenow` Node SDK exposes has a CLI counterpart — redaction, CIDR matching, log/span emission, firewall preload, config inspection. If you can do it in code, you can do it from the terminal.
|
|
17
|
-
|
|
18
|
-
**MCP parity (v7.5+):** the same package also ships a local stdio MCP server for Codex, Claude, and other MCP clients:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npx securenow login
|
|
22
|
-
codex mcp add securenow -- npx securenow mcp
|
|
23
|
-
# or
|
|
24
|
-
npx -p securenow securenow-mcp
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
The MCP server reuses `.securenow/credentials.json` and exposes apps, traces, logs, firewall, IP intelligence, forensics, notifications, remediation tools, bundled docs resources, and setup prompts. Write tools require `confirm:true` plus a reason.
|
|
16
|
+
**Full parity with the SDK:** every capability the `securenow` Node SDK exposes has a CLI counterpart — redaction, CIDR matching, log/span emission, firewall preload, config inspection. If you can do it in code, you can do it from the terminal.
|
|
17
|
+
|
|
18
|
+
**MCP parity (v7.5+):** the same package also ships a local stdio MCP server for Codex, Claude, and other MCP clients:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx securenow login
|
|
22
|
+
codex mcp add securenow -- npx securenow mcp
|
|
23
|
+
# or
|
|
24
|
+
npx -p securenow securenow-mcp
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The MCP server reuses `.securenow/credentials.json` and exposes apps, traces, logs, firewall, IP intelligence, forensics, notifications, remediation tools, bundled docs resources, and setup prompts. Write tools require `confirm:true` plus a reason.
|
|
28
28
|
|
|
29
29
|
### Authenticate
|
|
30
30
|
|
|
@@ -35,15 +35,17 @@ securenow login --token <JWT> # headless / CI login (get token from dashboard
|
|
|
35
35
|
securenow whoami # verify session (shows email, app, auth source)
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
**Zero-config flow (v7+):** the browser step lets the user pick (or create) an app. The CLI stores the app's **key (UUID)**, **name**, and **instance URL** in `.securenow/credentials.json`. The SDK reads this file at boot and sends traces/logs to the right app bucket — **no env vars required for local dev**.
|
|
39
|
-
|
|
40
|
-
**Default-on security (v7.4+):** after picking or creating the app, `securenow login` turns on that app's firewall toggle, mints an API key with `firewall:read + blocklist:read + allowlist:read` scopes, and writes it into `.securenow/credentials.json`. Traces, logs, POST body capture, multipart metadata capture, and the firewall are enabled by default. No `SECURENOW_API_KEY` env var is needed. To add or rotate a key later without re-running login, use `securenow api-key set snk_live_...` (see [API Key Management](#api-key-management) below).
|
|
38
|
+
**Zero-config flow (v7+):** the browser step lets the user pick (or create) an app. The CLI stores the app's **key (UUID)**, **name**, and **instance URL** in `.securenow/credentials.json`. The SDK reads this file at boot and sends traces/logs to the right app bucket — **no env vars required for local dev or production**.
|
|
41
39
|
|
|
42
|
-
|
|
40
|
+
**Default-on security (v7.5.1+):** after picking or creating the app, `securenow login` turns on that app's firewall toggle, mints an API key with `firewall:read + blocklist:read + allowlist:read` scopes, and writes it into `.securenow/credentials.json`. Traces, logs, POST body capture, multipart metadata capture, and the firewall are enabled by default. No `SECURENOW_API_KEY` env var is needed. To add or rotate a key later without re-running login, use `securenow api-key set snk_live_...` (see [API Key Management](#api-key-management) below).
|
|
43
41
|
|
|
44
|
-
|
|
42
|
+
Credentials resolve in order: project `.securenow/credentials.json` -> global `~/.securenow/credentials.json`. Legacy env vars are fallback-only for existing deployments.
|
|
45
43
|
|
|
46
|
-
|
|
44
|
+
The **firewall API key** should live in the same credentials file as `apiKey`. Legacy `SECURENOW_API_KEY` overrides are honored only when they start with `snk_live_`.
|
|
45
|
+
|
|
46
|
+
For CI / Docker / production, use `securenow credentials runtime --env production` to generate a tokenless runtime file, then mount/copy it as `.securenow/credentials.json`.
|
|
47
|
+
|
|
48
|
+
**Environment model:** use one SecureNow app key for local, preview, staging, and production. The credentials field `config.runtime.deploymentEnvironment` separates traces/logs/firewall/forensics by environment. CLI security commands default to `production`; pass `--env local`, `--env staging`, or `--env all` only when that scope is intentional.
|
|
47
49
|
|
|
48
50
|
### Integrate With Your App
|
|
49
51
|
|
|
@@ -60,10 +62,11 @@ node -r securenow/register src/index.js
|
|
|
60
62
|
For Next.js, run the interactive scaffolding:
|
|
61
63
|
|
|
62
64
|
```bash
|
|
63
|
-
securenow
|
|
65
|
+
securenow login
|
|
66
|
+
securenow init
|
|
64
67
|
```
|
|
65
68
|
|
|
66
|
-
This auto-detects your framework
|
|
69
|
+
This auto-detects your framework, creates the necessary `instrumentation.ts` and `next.config.js` changes, and reuses the app, instance, and firewall key written by login to `.securenow/credentials.json`.
|
|
67
70
|
|
|
68
71
|
### Install This Skill in Cursor
|
|
69
72
|
|
|
@@ -76,12 +79,12 @@ Config lives in `~/.securenow/` (global) and optionally `.securenow/` (per-proje
|
|
|
76
79
|
| File | Content |
|
|
77
80
|
|------|---------|
|
|
78
81
|
| `~/.securenow/config.json` | `apiUrl`, `appUrl`, `defaultApp`, `output` |
|
|
79
|
-
| `~/.securenow/credentials.json` | `token`, `email`, `expiresAt` (global) |
|
|
80
|
-
| `.securenow/credentials.json` | `token`, `email`, `expiresAt` (project-local
|
|
82
|
+
| `~/.securenow/credentials.json` | `token`, `email`, `expiresAt`, `apiKey`, `app`, `config` (global, use `login --global`) |
|
|
83
|
+
| `.securenow/credentials.json` | `token`, `email`, `expiresAt`, `apiKey`, `app`, `config`, `_securenow.explanations` (project-local default) |
|
|
81
84
|
|
|
82
|
-
**Credential resolution order:**
|
|
85
|
+
**Credential resolution order:** `.securenow/credentials.json` (project) -> `~/.securenow/credentials.json` (global). Legacy env vars are fallback-only for existing deployments.
|
|
83
86
|
|
|
84
|
-
**Firewall API key resolution (v7.1+):**
|
|
87
|
+
**Firewall API key resolution (v7.5.1+):** project `.securenow/credentials.json` -> global `~/.securenow/credentials.json`. Use `securenow login` for default setup or `securenow api-key set` to rotate a key without touching env vars.
|
|
85
88
|
|
|
86
89
|
```bash
|
|
87
90
|
securenow config set apiUrl https://api.securenow.ai
|
|
@@ -91,7 +94,7 @@ securenow config get defaultApp # show one
|
|
|
91
94
|
securenow config path # print file paths + active auth source
|
|
92
95
|
```
|
|
93
96
|
|
|
94
|
-
|
|
97
|
+
Legacy CLI overrides still exist for existing automation (`SECURENOW_TOKEN`, `SECURENOW_API_URL`, `SECURENOW_APP_URL`, `SECURENOW_APP`), but file credentials are the default path.
|
|
95
98
|
|
|
96
99
|
## Global Flags
|
|
97
100
|
|
|
@@ -124,13 +127,13 @@ Spawns `node --require securenow/register [--import otel/hook.mjs] <script>`. ES
|
|
|
124
127
|
### Authentication
|
|
125
128
|
|
|
126
129
|
```bash
|
|
127
|
-
securenow login # browser-based OAuth (stores in
|
|
128
|
-
securenow login --token <JWT> # headless / CI login
|
|
129
|
-
securenow login --
|
|
130
|
-
securenow logout # clear active credentials (local if present, else global)
|
|
131
|
-
securenow logout --
|
|
132
|
-
securenow whoami # show email, user ID, API URL, auth source, expiry, default app
|
|
133
|
-
```
|
|
130
|
+
securenow login # browser-based OAuth (stores in project ./.securenow/)
|
|
131
|
+
securenow login --token <JWT> # headless / CI login
|
|
132
|
+
securenow login --global # save credentials to ~/.securenow/ instead
|
|
133
|
+
securenow logout # clear active credentials (local if present, else global)
|
|
134
|
+
securenow logout --global # clear global credentials only
|
|
135
|
+
securenow whoami # show email, user ID, API URL, auth source, expiry, default app
|
|
136
|
+
```
|
|
134
137
|
|
|
135
138
|
### Applications
|
|
136
139
|
|
|
@@ -147,14 +150,15 @@ securenow apps scan [--yes] # scan all app domains for new subd
|
|
|
147
150
|
|
|
148
151
|
### API Key Management
|
|
149
152
|
|
|
150
|
-
Manage the firewall API key stored in the credentials file. Since v7.1
|
|
153
|
+
Manage the firewall API key stored in the credentials file. Since v7.5.1 the login flow writes `snk_live_...` keys to `.securenow/credentials.json` by default, so no env var is required for local dev.
|
|
151
154
|
|
|
152
155
|
```bash
|
|
153
156
|
securenow api-key set snk_live_xxxxxxxxxx # save to project ./.securenow/ (default)
|
|
154
157
|
securenow api-key set snk_live_xxx --global # save to ~/.securenow/ instead
|
|
155
|
-
securenow api-key show # print the masked current key + its source
|
|
156
|
-
securenow api-key clear # remove just the API key (keeps session/app)
|
|
157
|
-
securenow api-key clear --global # same, but from the global file
|
|
158
|
+
securenow api-key show # print the masked current key + its source
|
|
159
|
+
securenow api-key clear # remove just the API key (keeps session/app)
|
|
160
|
+
securenow api-key clear --global # same, but from the global file
|
|
161
|
+
securenow credentials runtime --env production # write .securenow/credentials.production.json for production secret-file deploys
|
|
158
162
|
```
|
|
159
163
|
|
|
160
164
|
The key must start with `snk_live_`. `securenow login` with firewall enabled writes the key automatically; use `api-key set` when you already have a key from the dashboard, or to rotate it later.
|
|
@@ -162,19 +166,21 @@ The key must start with `snk_live_`. `securenow login` with firewall enabled wri
|
|
|
162
166
|
### Init — Project Setup
|
|
163
167
|
|
|
164
168
|
```bash
|
|
165
|
-
securenow init [--key <API_KEY>]
|
|
169
|
+
securenow init [--env local] [--key <API_KEY>]
|
|
166
170
|
```
|
|
167
171
|
|
|
168
|
-
Auto-detects framework (Next.js, Nuxt, Express, Fastify, Koa, Hapi, Node) from `package.json`. Then:
|
|
169
|
-
- **
|
|
170
|
-
- **
|
|
171
|
-
- **
|
|
172
|
-
-
|
|
172
|
+
Auto-detects framework (Next.js, Nuxt, Express, Fastify, Koa, Hapi, Node) from `package.json`. Then:
|
|
173
|
+
- **Credentials**: ensures `.securenow/credentials.json` exists, has secure defaults/explanations, and `.securenow/` is gitignored
|
|
174
|
+
- **Next.js**: creates `instrumentation.ts/js` with `securenow/nextjs` + `securenow/nextjs-auto-capture`, and adds `serverExternalPackages: ['securenow']` when the config can be patched safely
|
|
175
|
+
- **Existing Next.js files**: prints a Codex/Claude-ready merge prompt when instrumentation or config already exists or is too custom to safely patch
|
|
176
|
+
- **Nuxt**: tells you to add `securenow/nuxt` to modules
|
|
177
|
+
- **Node/Express/etc.**: suggests adding `-r securenow/register` to start script
|
|
178
|
+
- Reuses `.securenow/credentials.json` written by login; production should mount/copy the tokenless runtime file generated by `securenow credentials runtime --env production`
|
|
173
179
|
|
|
174
180
|
### Dashboard & Status
|
|
175
181
|
|
|
176
182
|
```bash
|
|
177
|
-
securenow status [--app <key>]
|
|
183
|
+
securenow status [--app <key>] [--env local|production|all] # dashboard overview
|
|
178
184
|
securenow analytics [--app <key>] # response analytics
|
|
179
185
|
```
|
|
180
186
|
|
|
@@ -183,18 +189,18 @@ securenow analytics [--app <key>] # response analytics
|
|
|
183
189
|
### Traces
|
|
184
190
|
|
|
185
191
|
```bash
|
|
186
|
-
securenow traces [--app <key>] [--limit N] [--start ISO] [--end ISO]
|
|
187
|
-
securenow traces list --app my-app --limit 50
|
|
188
|
-
securenow traces show <traceId>
|
|
189
|
-
securenow traces analyze <traceId>
|
|
192
|
+
securenow traces [--app <key>] [--env production] [--limit N] [--start ISO] [--end ISO]
|
|
193
|
+
securenow traces list --app my-app --env production --limit 50
|
|
194
|
+
securenow traces show <traceId> --env production # full trace detail with spans
|
|
195
|
+
securenow traces analyze <traceId> --env production # AI-powered trace analysis
|
|
190
196
|
```
|
|
191
197
|
|
|
192
198
|
### Logs
|
|
193
199
|
|
|
194
200
|
```bash
|
|
195
|
-
securenow logs [--app <key>] [--limit N] [--minutes M] [--level error|warn|info]
|
|
196
|
-
securenow logs list --app my-app --minutes 30 --level error
|
|
197
|
-
securenow logs trace <traceId>
|
|
201
|
+
securenow logs [--app <key>] [--env production] [--limit N] [--minutes M] [--level error|warn|info]
|
|
202
|
+
securenow logs list --app my-app --env production --minutes 30 --level error
|
|
203
|
+
securenow logs trace <traceId> --env production # logs correlated to a specific trace
|
|
198
204
|
```
|
|
199
205
|
|
|
200
206
|
### Notifications
|
|
@@ -226,15 +232,15 @@ securenow alerts history [--limit N] # past triggered alerts
|
|
|
226
232
|
```bash
|
|
227
233
|
securenow ip <ip-address> # lookup (geo, ASN, threat score, reputation)
|
|
228
234
|
securenow ip lookup <ip-address> # same as above
|
|
229
|
-
securenow ip traces <ip-address>
|
|
235
|
+
securenow ip traces <ip-address> --env production # traces originating from this IP
|
|
230
236
|
```
|
|
231
237
|
|
|
232
238
|
### Forensics — Natural Language Security Queries
|
|
233
239
|
|
|
234
240
|
```bash
|
|
235
|
-
securenow forensics "show me all SQL injection attempts in the last 24h"
|
|
236
|
-
securenow forensics query "top 10 IPs by blocked requests" --app my-app
|
|
237
|
-
securenow forensics chat --app my-app
|
|
241
|
+
securenow forensics "show me all SQL injection attempts in the last 24h" --env production
|
|
242
|
+
securenow forensics query "top 10 IPs by blocked requests" --app my-app --env production
|
|
243
|
+
securenow forensics chat --app my-app --env production # interactive forensics chat session
|
|
238
244
|
securenow forensics library # view saved/template queries
|
|
239
245
|
```
|
|
240
246
|
|
|
@@ -252,11 +258,11 @@ securenow api-map stats # endpoint statistics
|
|
|
252
258
|
|
|
253
259
|
```bash
|
|
254
260
|
securenow firewall # show status (default)
|
|
255
|
-
securenow firewall status
|
|
261
|
+
securenow firewall status --env production # layers, sync time, blocked count, API key info
|
|
256
262
|
securenow firewall test-ip <ip> # check if IP would be blocked
|
|
257
263
|
```
|
|
258
264
|
|
|
259
|
-
**Zero-config setup (v7.
|
|
265
|
+
**Zero-config setup (v7.5.1+):** running `securenow login` enables the selected app's firewall toggle, auto-mints an API key (scoped `firewall:read + blocklist:read + allowlist:read`), and writes it to the credentials file after the app is selected. No `SECURENOW_API_KEY` env var needed. If the user already has a key, `securenow api-key set snk_live_...` achieves the same thing. See [the landing firewall page](https://securenow.ai/firewall) for an overview.
|
|
260
266
|
|
|
261
267
|
### Blocklist — Block Malicious IPs
|
|
262
268
|
|
|
@@ -375,7 +381,7 @@ securenow test-span
|
|
|
375
381
|
securenow test-span "ci.smoke-test" # custom span name
|
|
376
382
|
```
|
|
377
383
|
|
|
378
|
-
Both commands use the resolved
|
|
384
|
+
Both commands use the resolved collector settings from `.securenow/credentials.json` (`app.instance`, `config.otel.*`) and return non-zero on HTTP errors so CI/cron can detect failures.
|
|
379
385
|
|
|
380
386
|
### Utilities — Redaction, CIDR, Diagnostics
|
|
381
387
|
|
|
@@ -390,7 +396,7 @@ securenow redact @request.json --fields internal_id,sessionHash
|
|
|
390
396
|
securenow cidr match 10.0.0.5 10.0.0.0/24,192.168.0.0/16
|
|
391
397
|
securenow cidr parse 10.0.0.0/24 # network, broadcast, mask, size
|
|
392
398
|
|
|
393
|
-
# Show resolved config (service name, endpoints,
|
|
399
|
+
# Show resolved config (service name, endpoints, credentials, firewall layers)
|
|
394
400
|
securenow env # human-readable
|
|
395
401
|
securenow env --json # pipe to jq
|
|
396
402
|
|
|
@@ -448,7 +454,8 @@ securenow fp mark <notification-id> <ip> --rule-scope this_rule --reason "Known
|
|
|
448
454
|
```bash
|
|
449
455
|
securenow apps create my-new-app --hosts api.example.com,app.example.com
|
|
450
456
|
securenow apps default my-new-app
|
|
451
|
-
securenow
|
|
457
|
+
securenow login
|
|
458
|
+
securenow init
|
|
452
459
|
securenow run src/index.js
|
|
453
460
|
securenow status --json
|
|
454
461
|
```
|
|
@@ -482,10 +489,10 @@ All commands support `--json` for structured output. When piping to other tools
|
|
|
482
489
|
|
|
483
490
|
| Exit code / Error | Meaning | Recovery |
|
|
484
491
|
|------------------|---------|----------|
|
|
485
|
-
| `Session expired` | JWT expired | `securenow login` (or `login --
|
|
486
|
-
| `Not logged in` | No token found | `securenow login` or
|
|
487
|
-
| `Access denied (403)` | Insufficient plan or permissions | Upgrade plan or check user role |
|
|
488
|
-
| `Cannot connect` | API unreachable | Check `
|
|
492
|
+
| `Session expired` | JWT expired | `securenow login` (or `login --global` for shared credentials) |
|
|
493
|
+
| `Not logged in` | No token found | `securenow login` or mount/copy the right `.securenow/credentials.json` |
|
|
494
|
+
| `Access denied (403)` | Insufficient plan or permissions | Upgrade plan or check user role |
|
|
495
|
+
| `Cannot connect` | API unreachable | Check `securenow config get apiUrl` or network |
|
|
489
496
|
| `Unknown command` | Typo or unrecognized command | `securenow help` |
|
|
490
497
|
|
|
491
498
|
Set `SECURENOW_DEBUG=1` for full stack traces on any error.
|