securenow 7.0.0-anas.2 → 7.1.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/README.md CHANGED
@@ -1,28 +1,25 @@
1
1
  # SecureNow
2
2
 
3
- OpenTelemetry instrumentation for Node.js, Next.js, and Nuxt applications - send **traces and logs** to any OTLP-compatible backend (including SecureNow).
3
+ Zero-config OpenTelemetry for Node.js, Next.js, and Nuxt traces, logs, body capture, and IP firewall in one install. **No env vars. No copy-pasting keys.**
4
4
 
5
5
  **Official npm package:** [securenow](http://securenow.ai/)
6
6
 
7
7
  ---
8
8
 
9
- ## 🚀 Quick Start
10
-
11
- ### For Any Node.js App (Express, Fastify, NestJS, Koa, Hapi, etc.)
9
+ ## 🚀 30-second setup
12
10
 
13
11
  ```bash
14
12
  # 1. Install
15
13
  npm install securenow
16
14
 
17
- # 2. Set env vars
18
- export SECURENOW_APPID=my-app
19
- export SECURENOW_INSTANCE=https://freetrial.securenow.ai:4318
15
+ # 2. Pick (or create) your app in the browser — writes .securenow/ locally
16
+ npx securenow login
20
17
 
21
- # 3. Add -r securenow/register to your start command
22
- node -r securenow/register src/app.js
18
+ # 3. Start your app one flag is all it takes
19
+ node -r securenow/register src/index.js
23
20
  ```
24
21
 
25
- That's it. One `-r` flag is all you need ESM and CJS apps are handled automatically (Node >=20.6 auto-registers the ESM loader hook).
22
+ That's it. No `.env` edits, no API keys to paste, no peer-dep warnings. Your traces arrive in the app you picked during login.
26
23
 
27
24
  > **package.json** example:
28
25
  > ```json
@@ -32,26 +29,51 @@ That's it. One `-r` flag is all you need — ESM and CJS apps are handled automa
32
29
  > }
33
30
  > ```
34
31
 
35
- You can also use `NODE_OPTIONS` so your existing scripts stay unchanged:
36
- ```bash
37
- NODE_OPTIONS="-r securenow/register" npm start
32
+ ---
33
+
34
+ ## How it works
35
+
36
+ `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
+
38
+ ```json
39
+ {
40
+ "token": "...",
41
+ "email": "you@example.com",
42
+ "app": {
43
+ "key": "<uuid>",
44
+ "name": "my-backend",
45
+ "instance": "https://freetrial.securenow.ai:4318"
46
+ }
47
+ }
38
48
  ```
39
49
 
40
- See the [All Frameworks Quick Start](./docs/ALL-FRAMEWORKS-QUICKSTART.md) for tested setup guides.
50
+ The SDK reads this file at boot and sends traces/logs directly to the right app bucket. The file is auto-added to `.gitignore` so it never lands in git.
41
51
 
42
52
  ---
43
53
 
44
- ### For Next.js Applications
54
+ ## Framework integration
55
+
56
+ ### Node.js / Express / Fastify / NestJS / Koa / Hapi
57
+
58
+ Just add `-r securenow/register` to your start command. No code changes. Every route, DB call, and `console.log` is captured automatically.
45
59
 
46
60
  ```bash
47
- # 1. Install
48
- npm install securenow
61
+ node -r securenow/register src/app.js
62
+ ```
63
+
64
+ Or with `NODE_OPTIONS` if you can't change the script:
65
+
66
+ ```bash
67
+ NODE_OPTIONS="-r securenow/register" npm start
68
+ ```
69
+
70
+ ### Next.js
49
71
 
50
- # 2. Auto-scaffold instrumentation files
51
- npx securenow init --key snk_live_abc123...
72
+ ```bash
73
+ npx securenow init
52
74
  ```
53
75
 
54
- This creates `instrumentation.ts` and tells you to wrap your `next.config.js`:
76
+ Creates `instrumentation.ts` and shows you how to wrap `next.config.js`:
55
77
 
56
78
  ```javascript
57
79
  // next.config.js
@@ -62,382 +84,282 @@ module.exports = withSecureNow({
62
84
  });
63
85
  ```
64
86
 
65
- `withSecureNow()` auto-detects Next.js 14 vs 15 and sets the correct externalization config. No manual `serverExternalPackages` list needed.
66
-
67
- Configure `.env.local`:
68
-
69
- ```bash
70
- SECURENOW_APPID=my-nextjs-app
71
- SECURENOW_INSTANCE=http://your-otlp-collector:4318
72
- SECURENOW_API_KEY=snk_live_abc123...
73
- ```
74
-
75
- **Done!** See [Next.js Complete Guide](./docs/NEXTJS-GUIDE.md) for details.
76
-
77
- ---
87
+ `withSecureNow()` auto-detects Next.js 14 vs 15 vs 16. See [Next.js Complete Guide](./docs/NEXTJS-GUIDE.md).
78
88
 
79
- ### For Nuxt 3 Applications
80
-
81
- ```bash
82
- # 1. Install
83
- npm install securenow
84
- ```
85
-
86
- Add the module to your `nuxt.config.ts`:
89
+ ### Nuxt 3
87
90
 
88
91
  ```ts
92
+ // nuxt.config.ts
89
93
  export default defineNuxtConfig({
90
94
  modules: ['securenow/nuxt'],
91
95
  });
92
96
  ```
93
97
 
94
- Set environment variables in `.env`:
95
-
96
- ```bash
97
- SECURENOW_APPID=my-nuxt-app
98
- SECURENOW_INSTANCE=https://freetrial.securenow.ai:4318
99
- ```
100
-
101
- **Done!** All server-side requests are now traced automatically. The firewall also activates automatically when `SECURENOW_API_KEY` is set. See the [Nuxt 3 Complete Guide](./docs/NUXT-GUIDE.md) for details.
98
+ See [Nuxt 3 Guide](./docs/NUXT-GUIDE.md).
102
99
 
103
100
  ---
104
101
 
105
- ### CLI -- Manage Everything from the Terminal
106
-
107
- ```bash
108
- # Set up your project (auto-detects framework, creates instrumentation files)
109
- npx securenow init --key snk_live_abc123...
110
-
111
- # Authenticate
112
- npx securenow login
113
-
114
- # Create an app and get the key
115
- npx securenow apps create my-app
116
-
117
- # Set it as default so you don't need --app every time
118
- npx securenow config set defaultApp <key>
102
+ ## What's captured automatically
119
103
 
120
- # View traces, logs
121
- npx securenow traces
122
- npx securenow logs
104
+ - HTTP spans (Express, Fastify, NestJS, Koa, Hapi, Next.js, Nuxt, raw `http`)
105
+ - Database spans (Postgres, MySQL, MongoDB, Redis)
106
+ - `console.log/info/warn/error/debug` forwarded as OTLP logs with trace correlation
107
+ - ✅ Request body capture (JSON, GraphQL, form-encoded) with auto-redaction of `password`, `token`, `api_key`, `authorization`, `cookie`, etc.
108
+ - ✅ Multipart upload metadata (field names, file names, sizes, content-types — never file content)
109
+ - ✅ Firewall (500k+ known-bad IPs, refreshed hourly) — activates as soon as you've logged in
123
110
 
124
- # IP intelligence, forensic queries, blocklist
125
- npx securenow ip 1.2.3.4
126
- npx securenow forensics "show top attacking IPs in the last hour"
127
- npx securenow blocklist add 1.2.3.4 --reason "scanner"
128
-
129
- # Firewall — automatic IP blocking
130
- npx securenow firewall status
131
- npx securenow firewall test-ip 1.2.3.4
132
-
133
- # False-positive triage from the terminal (full parity with the dashboard)
134
- npx securenow fp ai-fill --description "Stripe webhook POST to /api/stripe/webhook"
135
- npx securenow fp mark <notification-id> <ip> --reason "Known partner IP"
136
-
137
- # Telemetry from scripts/CI — no SDK boot required
138
- npx securenow log send "Deploy succeeded" --level info --attrs version=1.2.3
139
- npx securenow test-span # verify collector connectivity
140
-
141
- # Diagnostics & utilities
142
- npx securenow doctor # probe OTLP + API endpoints
143
- npx securenow env # show resolved config
144
- npx securenow redact '{"user":"a","password":"s"}' # preview redaction
145
- npx securenow cidr match 10.0.0.5 10.0.0.0/8 # exit 0 = hit, 2 = miss
146
-
147
- # Full dashboard overview
148
- npx securenow status
149
- ```
150
-
151
- Run `npx securenow help` for all commands. See the [CLI Reference](#cli-reference) below.
152
-
153
- > **Full CLI/SDK parity (v6.1.0+).** Every SDK export has a CLI counterpart: `redactSensitiveData` → `securenow redact`, `createMatcher` → `securenow cidr match`, `getLogger().emit()` → `securenow log send`, `SECURENOW_TEST_SPAN` → `securenow test-span`, `node -r securenow/firewall-only` → `securenow run --firewall-only`.
111
+ All of these are **on by default**. Each can be disabled individually with an env var if needed (e.g. `SECURENOW_CAPTURE_BODY=0`).
154
112
 
155
113
  ---
156
114
 
157
- ---
115
+ ## Overriding via environment variables (CI, Docker, prod)
158
116
 
159
- ## 📦 Installation
117
+ `.securenow/credentials.json` is the zero-config path for local dev. For CI, containers, or prod servers where you can't run `npx securenow login`, set env vars — they always take precedence:
160
118
 
161
119
  ```bash
162
- npm install securenow
163
- # or
164
- yarn add securenow
165
- # or
166
- pnpm add securenow
120
+ SECURENOW_APPID=<app-key-uuid> # routing key (from dashboard or `npx securenow apps`)
121
+ SECURENOW_INSTANCE=https://your-collector # defaults to freetrial
122
+ SECURENOW_API_KEY=<same uuid> # enables the firewall
167
123
  ```
168
124
 
169
- ---
125
+ Resolution order (first non-empty wins):
126
+
127
+ 1. Environment variable
128
+ 2. Project-local `.securenow/credentials.json`
129
+ 3. Global `~/.securenow/credentials.json`
130
+ 4. `package.json#name` (label only — won't route telemetry)
170
131
 
171
- ## ⚙️ Configuration
132
+ ---
172
133
 
173
- ### Environment Variables
134
+ ## CLI
174
135
 
175
136
  ```bash
176
- # Required: Your application identifier
177
- SECURENOW_APPID=my-app-name
137
+ # Setup
138
+ npx securenow login # browser auth + app picker (saves to ./.securenow/)
139
+ npx securenow login --global # save to ~/.securenow/ instead
140
+ npx securenow login --token <TOKEN> # headless (CI)
141
+ npx securenow init # scaffold Next.js instrumentation files
142
+
143
+ # Apps
144
+ npx securenow apps # list all apps
145
+ npx securenow apps create my-app # create and get the key
146
+ npx securenow apps default <key> # change which app this project uses
147
+
148
+ # Observability
149
+ npx securenow traces # list recent traces
150
+ npx securenow logs # tail logs
151
+ npx securenow status # dashboard summary
152
+ npx securenow doctor # diagnose config + connectivity
153
+
154
+ # Security
155
+ npx securenow firewall status
156
+ npx securenow blocklist add 1.2.3.4 --reason "scanner"
157
+ npx securenow fp ai-fill --description "Stripe webhook POST /api/stripe/webhook"
178
158
 
179
- # Optional: Your OTLP collector endpoint
180
- # Default: https://freetrial.securenow.ai:4318
181
- SECURENOW_INSTANCE=http://your-otlp-collector:4318
159
+ # Telemetry from shell (no SDK boot)
160
+ npx securenow log send "Deploy succeeded" --level info
161
+ npx securenow test-span # verify collector connectivity
162
+ ```
182
163
 
183
- # Optional: Enable Logging
184
- SECURENOW_LOGGING_ENABLED=1 # Enable automatic log collection
164
+ Full reference: run `npx securenow help` or see [CLI Reference](#cli-reference) below.
185
165
 
186
- # Optional: Additional configuration
187
- SECURENOW_NO_UUID=1 # Don't append UUID to service name
188
- OTEL_LOG_LEVEL=info # debug|info|warn|error
189
- SECURENOW_DISABLE_INSTRUMENTATIONS=fs,dns # Disable specific instrumentations
190
- OTEL_EXPORTER_OTLP_HEADERS="x-api-key=..." # Authentication headers
166
+ ---
191
167
 
192
- # Optional: Request body capture (for debugging)
193
- SECURENOW_CAPTURE_BODY=1 # Capture request bodies in traces
194
- SECURENOW_MAX_BODY_SIZE=10240 # Max body size in bytes
195
- SECURENOW_SENSITIVE_FIELDS="field1,field2" # Additional fields to redact
168
+ ## Environment variables (optional)
196
169
 
197
- # Optional: Multipart body capture (file upload metadata)
198
- SECURENOW_CAPTURE_MULTIPART=1 # Capture multipart field names, values & file metadata
199
- ```
170
+ Only set these if you want to override the zero-config defaults.
200
171
 
201
- ### Legacy Environment Variables (still supported)
172
+ | Variable | Default | Purpose |
173
+ |---|---|---|
174
+ | `SECURENOW_APPID` | from credentials file | App routing key (UUID) — sent as OTel `service.name` |
175
+ | `SECURENOW_INSTANCE` | `https://freetrial.securenow.ai:4318` | OTLP collector endpoint |
176
+ | `SECURENOW_API_KEY` | from credentials file | Enables firewall + collector routing |
177
+ | `SECURENOW_LOGGING_ENABLED` | `1` (on) | Forward `console.*` as OTLP logs. Set to `0` to disable. |
178
+ | `SECURENOW_CAPTURE_BODY` | `1` (on) | Capture JSON / form request bodies. Set to `0` for Fastify/Hapi/Hono. |
179
+ | `SECURENOW_CAPTURE_MULTIPART` | `1` (on) | Capture multipart metadata (not content). |
180
+ | `SECURENOW_MAX_BODY_SIZE` | `10240` | Max bytes captured per body. |
181
+ | `SECURENOW_SENSITIVE_FIELDS` | `password,token,authorization,...` | Extra fields to redact (comma-separated). |
182
+ | `SECURENOW_DISABLE_INSTRUMENTATIONS` | — | Comma-separated OTel instrumentations to disable. |
183
+ | `SECURENOW_NO_UUID` | `0` | Don't append a UUID to `service.instance.id`. |
184
+ | `SECURENOW_STRICT` | `0` | Exit with code 1 if `SECURENOW_APPID` is missing in a PM2 cluster. |
185
+ | `OTEL_EXPORTER_OTLP_HEADERS` | — | Raw OTLP headers (e.g. `x-api-key=...`). |
186
+ | `OTEL_LOG_LEVEL` | — | `debug`/`info`/`warn`/`error`. |
202
187
 
203
- ```bash
204
- export securenow=<API-KEY>
205
- export securenow_instance='http://<dedicated_instance>:4318'
206
- ```
188
+ Full list: [docs/ENVIRONMENT-VARIABLES.md](./docs/ENVIRONMENT-VARIABLES.md).
207
189
 
208
190
  ---
209
191
 
210
- ## 🎯 Supported Frameworks & Libraries
192
+ ## Supported frameworks
211
193
 
212
- SecureNow automatically instruments:
213
-
214
- ### Web Frameworks
215
- - ✅ Next.js (App Router & Pages Router)
216
- - ✅ Nuxt 3 (Nitro server)
217
- - ✅ Express.js
218
- - ✅ Fastify
219
- - ✅ NestJS
220
- - ✅ Koa
221
- - ✅ Hapi
194
+ ### Web
195
+ Next.js (App & Pages Router) · Nuxt 3 · Express · Fastify · NestJS · Koa · Hapi
222
196
 
223
197
  ### Databases
224
- - PostgreSQL
225
- - ✅ MySQL / MySQL2
226
- - ✅ MongoDB
227
- - ✅ Redis
228
-
229
- ### Logging
230
- - ✅ Automatic console logging (console.log, info, warn, error)
231
- - ✅ Structured logging with OpenTelemetry
232
- - ✅ Automatic trace-log correlation
233
- - ✅ Works with all frameworks
198
+ PostgreSQL · MySQL / MySQL2 · MongoDB · Redis
234
199
 
235
200
  ### Other
236
- - ✅ HTTP/HTTPS requests
237
- - ✅ GraphQL
238
- - gRPC
239
- - ✅ And many more via OpenTelemetry auto-instrumentation
201
+ HTTP/HTTPS · GraphQL · gRPC · and many more via [@opentelemetry/auto-instrumentations-node](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node).
202
+
203
+ > MongoDB instrumentation is opt-in (`SECURENOW_ENABLE_MONGODB_INSTRUMENTATION=1`) because older versions corrupted cursors on `mongodb@6.6+`. Safe again since SDK v6.0.2.
240
204
 
241
205
  ---
242
206
 
243
- ## 📚 Documentation
207
+ ## Documentation
244
208
 
245
209
  ### Quick Starts
246
- - **[Next.js Quick Start](./docs/NEXTJS-QUICKSTART.md)** - Get started in 30 seconds
247
- - **[Nuxt 3 Guide](./docs/NUXT-GUIDE.md)** - One-line Nuxt module setup
248
- - **[Logging Quick Start](./docs/LOGGING-QUICKSTART.md)** - Add logging in 2 minutes
210
+ - [Next.js Quick Start](./docs/NEXTJS-QUICKSTART.md)
211
+ - [Nuxt 3 Guide](./docs/NUXT-GUIDE.md)
212
+ - [All Frameworks](./docs/ALL-FRAMEWORKS-QUICKSTART.md)
213
+ - [Logging Quick Start](./docs/LOGGING-QUICKSTART.md)
249
214
 
250
215
  ### Complete Guides
251
- - **[Firewall Guide](./docs/FIREWALL-GUIDE.md)** - Automatic multi-layer IP blocking
252
- - **[API Keys Guide](./docs/API-KEYS-GUIDE.md)** - API key management and scopes
253
- - **[Next.js Complete Guide](./docs/NEXTJS-GUIDE.md)** - Full Next.js integration guide
254
- - **[Nuxt 3 Complete Guide](./docs/NUXT-GUIDE.md)** - Full Nuxt 3 integration guide
255
- - **[Logging Complete Guide](./docs/LOGGING-GUIDE.md)** - Full logging setup for all frameworks
256
- - **[📚 Complete Documentation](./docs/INDEX.md)** - All guides and references
216
+ - [Firewall](./docs/FIREWALL-GUIDE.md)
217
+ - [API Keys](./docs/API-KEYS-GUIDE.md)
218
+ - [Next.js Complete](./docs/NEXTJS-GUIDE.md)
219
+ - [Nuxt 3 Complete](./docs/NUXT-GUIDE.md)
220
+ - [Logging Complete](./docs/LOGGING-GUIDE.md)
221
+ - [📚 All Docs](./docs/INDEX.md)
257
222
 
258
223
  ### Examples
259
- - **[Code Examples](./examples/)** - Ready-to-use examples for different setups
224
+ - [Code Examples](./examples/)
260
225
 
261
226
  ---
262
227
 
263
228
  ## CLI Reference
264
229
 
265
- After installing the package, the `securenow` CLI is available via `npx securenow` or globally after `npm install -g securenow`.
230
+ After install, the `securenow` CLI is available via `npx securenow` or globally with `npm install -g securenow`.
266
231
 
267
232
  ### Run (convenience wrapper)
268
233
 
269
234
  | Command | Description |
270
- |---------|-------------|
271
- | `securenow run <script>` | Run a Node.js app with `-r securenow/register` injected |
235
+ |---|---|
236
+ | `securenow run <script>` | Run a Node app with `-r securenow/register` injected |
272
237
  | `securenow run --watch <script>` | Same, with Node.js watch mode |
273
-
274
- Most users won't need this — just add `-r securenow/register` to your existing start script.
238
+ | `securenow run --firewall-only <script>` | Preload the firewall only, skip OTel |
275
239
 
276
240
  ### Authentication
277
241
 
278
242
  | Command | Description |
279
- |---------|-------------|
280
- | `securenow login` | Log in via browser (opens OAuth flow) |
281
- | `securenow login --token <TOKEN>` | Log in with a token (for CI/headless) |
282
- | `securenow login --local` | Log in and save credentials to the current project only |
283
- | `securenow logout` | Clear stored credentials |
284
- | `securenow logout --local` | Clear project-local credentials only |
285
- | `securenow whoami` | Show current session info (including auth source) |
243
+ |---|---|
244
+ | `securenow login` | Browser auth + pick app (writes ./.securenow/ by default) |
245
+ | `securenow login --global` | Save to ~/.securenow/ instead |
246
+ | `securenow login --token <TOKEN>` | Headless (CI/servers) |
247
+ | `securenow logout` | Clear project-local credentials |
248
+ | `securenow logout --global` | Clear ~/.securenow/ instead |
249
+ | `securenow whoami` | Show current session (email, app, expiry) |
286
250
 
287
251
  ### Applications
288
252
 
289
253
  | Command | Description |
290
- |---------|-------------|
291
- | `securenow apps` | List all applications |
292
- | `securenow apps create <name>` | Create app and get the app key |
293
- | `securenow apps info <id>` | Show application details |
294
- | `securenow apps delete <id>` | Delete an application |
295
- | `securenow apps default <key>` | Set default app for all commands |
254
+ |---|---|
255
+ | `securenow apps` | List all apps for your account |
256
+ | `securenow apps create <name>` | Create an app |
257
+ | `securenow apps info <id>` | Show app details |
258
+ | `securenow apps delete <id>` | Delete an app |
259
+ | `securenow apps default <key>` | Switch which app this project uses (updates `.securenow/`) |
296
260
 
297
261
  ### Observability
298
262
 
299
263
  | Command | Description |
300
- |---------|-------------|
301
- | `securenow traces --app <key>` | List recent traces |
302
- | `securenow traces show <traceId>` | Show trace spans |
303
- | `securenow traces analyze <traceId>` | AI security analysis of a trace |
304
- | `securenow logs --app <key>` | View logs (with `--minutes`, `--level`) |
305
- | `securenow logs trace <traceId>` | View logs for a specific trace |
306
- | `securenow analytics` | Response code analytics overview |
307
- | `securenow status` | Full dashboard summary |
264
+ |---|---|
265
+ | `securenow traces` | Recent traces |
266
+ | `securenow traces show <traceId>` | Trace spans |
267
+ | `securenow traces analyze <traceId>` | AI security analysis |
268
+ | `securenow logs` | View logs (`--minutes`, `--level`) |
269
+ | `securenow logs trace <traceId>` | Logs for a trace |
270
+ | `securenow analytics` | Response code analytics |
271
+ | `securenow status` | Dashboard summary |
308
272
 
309
273
  ### Detect & Respond
310
274
 
311
275
  | Command | Description |
312
- |---------|-------------|
276
+ |---|---|
313
277
  | `securenow notifications` | List notifications |
314
- | `securenow notifications unread` | Show unread count |
315
- | `securenow notifications read <id>` | Mark notification as read |
316
- | `securenow notifications read-all` | Mark all as read |
317
- | `securenow alerts rules` | List alert rules (status, applications, schedule) |
318
- | `securenow alerts rules show <id>` | Show one rule (includes all-apps vs explicit apps) |
319
- | `securenow alerts rules update <id> --applications-all` | Set rule to all current & future apps |
320
- | `securenow alerts rules update <id> --apps k1,k2` | Scope rule to specific app keys |
321
- | `securenow alerts channels` | List alert channels |
322
- | `securenow alerts history` | View alert history |
278
+ | `securenow notifications unread` | Unread count |
279
+ | `securenow alerts rules` | List alert rules |
280
+ | `securenow alerts history` | Alert history |
323
281
 
324
282
  ### Investigate
325
283
 
326
284
  | Command | Description |
327
- |---------|-------------|
328
- | `securenow ip <address>` | IP intelligence lookup (geo, abuse score, verdict) |
329
- | `securenow ip traces <address>` | Show traces originating from an IP |
330
- | `securenow forensics "<query>"` | Natural language forensic query (NL to SQL) |
331
- | `securenow forensics library` | View saved query library |
332
- | `securenow api-map` | View discovered API endpoints |
333
- | `securenow api-map stats` | API map statistics |
285
+ |---|---|
286
+ | `securenow ip <address>` | IP intel (geo, abuse, verdict) |
287
+ | `securenow ip traces <address>` | Traces from an IP |
288
+ | `securenow forensics "<query>"` | Natural language forensic query |
289
+ | `securenow api-map` | Discovered API endpoints |
334
290
 
335
291
  ### Firewall
336
292
 
337
293
  | Command | Description |
338
- |---------|-------------|
339
- | `securenow firewall status` | Show firewall status, active layers, and API key info |
340
- | `securenow firewall test-ip <ip>` | Check if an IP would be blocked by the current blocklist |
341
- | `securenow run --firewall-only <script>` | Run a Node.js app with the firewall preloaded but **no** OTel tracing overhead |
294
+ |---|---|
295
+ | `securenow firewall status` | Firewall layers + key info |
296
+ | `securenow firewall test-ip <ip>` | Would this IP be blocked? |
342
297
 
343
298
  ### Remediation
344
299
 
345
300
  | Command | Description |
346
- |---------|-------------|
301
+ |---|---|
347
302
  | `securenow blocklist` | List blocked IPs |
348
- | `securenow blocklist add <ip>` | Block an IP (`--reason <reason>`) |
349
- | `securenow blocklist remove <id>` | Remove from blocklist |
350
- | `securenow blocklist stats` | Blocklist statistics |
351
- | `securenow allowlist` | List allowed IPs (restrict-mode) |
352
- | `securenow allowlist add <ip>` | Allow an IP (`--label`, `--reason`) |
353
- | `securenow allowlist remove <id>` | Remove from allowlist |
354
- | `securenow trusted` | List trusted IPs |
355
- | `securenow trusted add <ip>` | Add trusted IP (`--label <label>`) |
356
- | `securenow trusted remove <id>` | Remove trusted IP |
357
-
358
- ### False-Positive Management
303
+ | `securenow blocklist add <ip> [--reason ...]` | Block an IP |
304
+ | `securenow allowlist add <ip>` | Allow an IP (restrict-mode) |
305
+ | `securenow trusted add <ip>` | Mark an IP as trusted |
359
306
 
360
- Full false-positive triage without leaving the terminal — mirrors the web dashboard one-for-one.
307
+ ### False positives
361
308
 
362
309
  | Command | Description |
363
- |---------|-------------|
364
- | `securenow fp` / `securenow fp list` | List all exclusion rules |
365
- | `securenow fp show <id>` | Show rule details (conditions, scope, match mode) |
366
- | `securenow fp create --conditions '[...]'` | Create a raw exclusion rule |
367
- | `securenow fp create --path /api/events --method POST --path-safe standard --ua-safe standard --reason "..."` | Create with safe-value presets |
368
- | `securenow fp edit <id> [--active true\|false] [--conditions '[...]']` | Edit an existing rule |
369
- | `securenow fp delete <id> [--yes]` | Delete a rule |
370
- | `securenow fp test-body '<json>' --conditions '[...]'` | Test conditions against a request body |
371
- | `securenow fp dry-run --conditions '[...]'` | Dry-run against the last 3 days of live traces |
372
- | `securenow fp ai-fill --description "Stripe webhook POST to /api/stripe/webhook"` | AI-generate exclusion conditions |
373
- | `securenow fp mark <notification-id> <ip>` | Mark an IP as false positive on a specific notification |
374
-
375
- ### Telemetry
376
-
377
- Emit OTLP logs and spans from the shell — for cron jobs, CI pipelines, and scripts. No SDK boot required.
310
+ |---|---|
311
+ | `securenow fp` | List exclusion rules |
312
+ | `securenow fp ai-fill --description "..."` | AI-generate exclusion conditions |
313
+ | `securenow fp mark <notif-id> <ip>` | Mark an alert as a false positive |
314
+ | `securenow fp dry-run --conditions '[...]'` | Test against last 3 days of traces |
378
315
 
379
- | Command | Description |
380
- |---------|-------------|
381
- | `securenow log send "<message>" [--level info\|warn\|error] [--attrs k=v,k=v]` | Send a single log record via OTLP/HTTP |
382
- | `securenow test-span [<name>]` | Emit a test span to verify collector connectivity |
383
-
384
- ### Utilities
385
-
386
- SDK helpers surfaced as CLI commands — debug redaction, test CIDR matching, inspect config without writing Node.
316
+ ### Telemetry from the shell
387
317
 
388
318
  | Command | Description |
389
- |---------|-------------|
390
- | `securenow redact '<json>' [--fields f1,f2]` | Redact sensitive fields (also accepts `@file.json`) |
391
- | `securenow cidr match <ip> <cidr1,cidr2>` | Check if an IP matches a CIDR list (exit `0` hit / `2` miss) |
392
- | `securenow cidr parse <cidr>` | Parse a CIDR — print network, broadcast, mask, size |
393
- | `securenow env [--json]` | Show resolved config (service name, endpoints, env vars) |
394
- | `securenow doctor [--json]` | End-to-end diagnostic: probe OTLP + API, check config |
319
+ |---|---|
320
+ | `securenow log send "<msg>" [--level info\|warn\|error]` | Emit a log record via OTLP |
321
+ | `securenow test-span` | Send a test span |
395
322
 
396
- ### Settings
323
+ ### Diagnostics & utilities
397
324
 
398
325
  | Command | Description |
399
- |---------|-------------|
400
- | `securenow instances` | List ClickHouse instances |
401
- | `securenow instances test <id>` | Test instance connection |
402
- | `securenow config get` | Show all config values |
403
- | `securenow config set <key> <value>` | Set a config value |
404
- | `securenow config path` | Show config file locations |
405
- | `securenow init [--key <KEY>]` | Auto-scaffold instrumentation for your framework |
406
- | `securenow version` | Show CLI version |
407
-
408
- ### Global Flags
326
+ |---|---|
327
+ | `securenow doctor` | Probe OTLP + API, check config |
328
+ | `securenow env` | Show resolved config |
329
+ | `securenow redact '<json>'` | Preview redaction |
330
+ | `securenow cidr match <ip> <cidr>` | Test CIDR match (exit 0/2) |
409
331
 
410
- | Flag | Description |
411
- |------|-------------|
412
- | `--json` | Output as JSON (works on every command) |
413
- | `--help` | Show help for any command |
414
- | `--app <key>` | Specify app key (or set default with `config set defaultApp`) |
415
- | `--local` | Save/clear credentials per-project (login/logout only) |
332
+ ### Global flags
416
333
 
417
- ### Configuration
334
+ | Flag | Effect |
335
+ |---|---|
336
+ | `--json` | Machine-readable output |
337
+ | `--help` | Help for any command |
338
+ | `--app <key>` | Override which app |
339
+ | `--global` | Global credentials scope (login/logout) |
418
340
 
419
- Credentials and settings are stored in `~/.securenow/` (global) or `.securenow/` (per-project):
341
+ ### Where things live
420
342
 
421
343
  | File | Purpose |
422
- |------|---------|
344
+ |---|---|
345
+ | `./.securenow/credentials.json` | Project-local token + app (default) |
346
+ | `~/.securenow/credentials.json` | Global (with `login --global`) |
423
347
  | `~/.securenow/config.json` | API URL, default app, preferences |
424
- | `~/.securenow/credentials.json` | Auth token — global (restricted permissions) |
425
- | `.securenow/credentials.json` | Auth token — project-local (use `login --local`) |
426
348
 
427
- **Credential resolution order:** `SECURENOW_TOKEN` env var → project `.securenow/credentials.json` → global `~/.securenow/credentials.json`.
349
+ Resolution order: `SECURENOW_TOKEN` env → project `.securenow/` → global `~/.securenow/`.
428
350
 
429
- Override the API URL with `securenow config set apiUrl <url>` or the `SECURENOW_API_URL` environment variable.
351
+ Override the API with `securenow config set apiUrl <url>` or `SECURENOW_API_URL`.
430
352
 
431
353
  ---
432
354
 
433
355
  ## Support
434
356
 
435
357
  - **Website:** [securenow.ai](http://securenow.ai/)
436
- - **Issues:** Report bugs and request features
437
- - **Documentation:** Full documentation and guides
358
+ - **Docs:** see `docs/` folder
359
+ - **Issues:** report bugs and requests on GitHub
438
360
 
439
361
  ---
440
362
 
441
363
  ## License
442
364
 
443
- ISC
365
+ ISC