securenow 7.7.1 → 7.7.2

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
@@ -415,9 +415,9 @@ Config files are stored in `~/.securenow/` (global) or `.securenow/` in the proj
415
415
  | `~/.securenow/config.json` | API URL, default app, output format |
416
416
  | `~/.securenow/credentials.json` | Auth token, app, API key, config - global (use `login --global`) |
417
417
  | `.securenow/credentials.json` | Auth token, app, API key, config, explanations - project-local default |
418
- | `.securenow/credentials.<environment>.json` | Tokenless runtime credentials generated by `credentials runtime --env <environment>` |
418
+ | `.securenow/credentials.<environment>.json` | Tokenless runtime credentials generated by `credentials runtime --env <environment>`; read in a fixed order, not selected from env vars |
419
419
 
420
- **Resolution order:** project `.securenow/credentials.json` -> project `.securenow/credentials.<environment>.json` -> global `~/.securenow/credentials.json` -> global `~/.securenow/credentials.<environment>.json`. Legacy CLI token overrides still work for existing automation.
420
+ **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.
421
421
 
422
422
  ### Global Flags
423
423
 
@@ -465,8 +465,10 @@ npx securenow credentials runtime --env production
465
465
 
466
466
  # Store .securenow/credentials.production.json as a deployment secret file,
467
467
  # then materialize it as .securenow/credentials.json in the running app.
468
- # Since v7.7.1, mounting it as .securenow/credentials.production.json
468
+ # Since v7.7.2, mounting it as .securenow/credentials.production.json
469
469
  # also works when the canonical credentials.json file is absent.
470
+ # The SDK checks named files in a fixed order and does not use env vars
471
+ # to pick the credentials filename.
470
472
 
471
473
  # Use --json for machine-readable output
472
474
  npx securenow logs --json --level error | jq '.logs'
@@ -1076,7 +1078,7 @@ npx securenow api-key set snk_live_abc123...
1076
1078
  npx securenow credentials runtime --env production
1077
1079
  ```
1078
1080
 
1079
- The SDK resolves the firewall key from project `./.securenow/credentials.json`, then project `./.securenow/credentials.<environment>.json`, then global `~/.securenow/credentials.json`, then global `~/.securenow/credentials.<environment>.json`. Legacy `SECURENOW_API_KEY` overrides still work for existing deployments.
1081
+ 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. Legacy `SECURENOW_API_KEY` overrides still work for existing deployments.
1080
1082
 
1081
1083
  On startup, you'll see:
1082
1084
 
package/README.md CHANGED
@@ -152,14 +152,14 @@ npx securenow credentials runtime --env production
152
152
 
153
153
  It writes `.securenow/credentials.production.json`, with the same `app`, `apiKey`, `config`, and `_securenow.explanations` shape, but without the CLI OAuth `token`, `email`, or `expiresAt`. Store that JSON in your deployment secret manager and materialize it as `.securenow/credentials.json` at runtime.
154
154
 
155
- Starting in v7.7.1, the SDK also accepts the generated filename directly. If `.securenow/credentials.json` is missing, it checks `.securenow/credentials.<environment>.json`, so a production app with `NODE_ENV=production` can mount `.securenow/credentials.production.json` directly.
155
+ Starting in v7.7.2, the SDK also accepts generated runtime filenames directly without reading environment variables to choose the file. If `.securenow/credentials.json` is missing, it checks named files in a deterministic order: staging, production, preview, local, test, development, dev, then prod.
156
156
 
157
157
  Resolution order:
158
158
 
159
159
  1. Project-local `.securenow/credentials.json`
160
- 2. Project-local `.securenow/credentials.<environment>.json`
160
+ 2. Project-local named runtime credentials: `.securenow/credentials.staging.json`, then `.securenow/credentials.production.json`, then preview/local/test/development/dev/prod variants
161
161
  3. Global `~/.securenow/credentials.json`
162
- 4. Global `~/.securenow/credentials.<environment>.json`
162
+ 4. Global named runtime credentials in the same fixed order
163
163
  5. `package.json#name` (label only)
164
164
 
165
165
  Legacy environment variables are fallback-only for existing installs. New local, CI, Docker, and production setups should use the credentials file.
@@ -399,12 +399,12 @@ After install, the `securenow` CLI is available via `npx securenow` or globally
399
399
  | File | Purpose |
400
400
  |---|---|
401
401
  | `./.securenow/credentials.json` | Project-local or production runtime credentials |
402
- | `./.securenow/credentials.<environment>.json` | Tokenless runtime file generated by `securenow credentials runtime --env <environment>` |
402
+ | `./.securenow/credentials.<environment>.json` | Tokenless runtime file generated by `securenow credentials runtime --env <environment>`; read in a fixed order, not selected from env vars |
403
403
  | `~/.securenow/credentials.json` | Global (with `login --global`) |
404
404
  | `~/.securenow/credentials.<environment>.json` | Global environment-specific runtime credentials |
405
405
  | `~/.securenow/config.json` | API URL, default app, preferences |
406
406
 
407
- Resolution order: project `.securenow/credentials.json` -> project `.securenow/credentials.<environment>.json` -> global `~/.securenow/credentials.json` -> global `~/.securenow/credentials.<environment>.json` -> package name fallback. Legacy env vars are fallback-only for older installs.
407
+ 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 vars are fallback-only for older installs and do not choose the credentials filename.
408
408
 
409
409
  Override the dashboard API with `securenow config set apiUrl <url>`.
410
410
 
package/SKILL-API.md CHANGED
@@ -273,7 +273,7 @@ Instruments document load, fetch, XMLHttpRequest, and user interactions with bro
273
273
 
274
274
  ## Firewall — Multi-Layer IP Blocking
275
275
 
276
- The firewall auto-activates once an API key is resolvable and the app firewall toggle is on. Since **v7.5.1**, `npx securenow login` enables the selected app firewall by default and writes the scoped key to `.securenow/credentials.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`. Resolution order: project `./.securenow/credentials.json` -> project `./.securenow/credentials.<environment>.json` -> global `~/.securenow/credentials.json` -> global `~/.securenow/credentials.<environment>.json`; legacy env vars are fallback-only for existing deployments.
276
+ The firewall auto-activates once an API key is resolvable and the app firewall toggle is on. Since **v7.5.1**, `npx securenow login` enables the selected app firewall by default and writes the scoped key to `.securenow/credentials.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`. 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 env vars are fallback-only for existing deployments and do not choose the credentials filename.
277
277
 
278
278
  ```
279
279
  Layer 4: Cloud/Edge WAF → blocked at CDN (Cloudflare, AWS WAF, GCP Cloud Armor)
@@ -457,7 +457,7 @@ securenow redact @request.json --fields internal_id,sessionHash
457
457
 
458
458
  ## Credentials Configuration
459
459
 
460
- Local development and production use `.securenow/credentials.json`. 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.1, the SDK also accepts `.securenow/credentials.<environment>.json` when the canonical `credentials.json` file is absent, so `.securenow/credentials.production.json` can be mounted directly. Environment variables are legacy fallbacks only.
460
+ Local development and production use `.securenow/credentials.json`. 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. Environment variables are legacy fallbacks only.
461
461
 
462
462
  ### App Identity
463
463
 
package/SKILL-CLI.md CHANGED
@@ -39,11 +39,11 @@ securenow whoami # verify session (shows email, app, auth source)
39
39
 
40
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).
41
41
 
42
- Credentials resolve in order: project `.securenow/credentials.json` -> project `.securenow/credentials.<environment>.json` -> global `~/.securenow/credentials.json` -> global `~/.securenow/credentials.<environment>.json`. Legacy env vars are fallback-only for existing deployments.
42
+ Credentials resolve in 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 env vars are fallback-only for existing deployments and do not choose the credentials filename.
43
43
 
44
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
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`. Since v7.7.1, mounting the generated `.securenow/credentials.production.json` filename directly also works when `credentials.json` is absent.
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`. Since v7.7.2, mounting the generated `.securenow/credentials.production.json` filename directly also works when `credentials.json` is absent.
47
47
 
48
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.
49
49
 
@@ -81,11 +81,11 @@ Config lives in `~/.securenow/` (global) and optionally `.securenow/` (per-proje
81
81
  | `~/.securenow/config.json` | `apiUrl`, `appUrl`, `defaultApp`, `output` |
82
82
  | `~/.securenow/credentials.json` | `token`, `email`, `expiresAt`, `apiKey`, `app`, `config` (global, use `login --global`) |
83
83
  | `.securenow/credentials.json` | `token`, `email`, `expiresAt`, `apiKey`, `app`, `config`, `_securenow.explanations` (project-local default) |
84
- | `.securenow/credentials.<environment>.json` | Tokenless runtime credentials generated by `securenow credentials runtime --env <environment>` |
84
+ | `.securenow/credentials.<environment>.json` | Tokenless runtime credentials generated by `securenow credentials runtime --env <environment>`; read in a fixed order, not selected from env vars |
85
85
 
86
- **Credential resolution order:** `.securenow/credentials.json` (project) -> `.securenow/credentials.<environment>.json` (project) -> `~/.securenow/credentials.json` (global) -> `~/.securenow/credentials.<environment>.json` (global). Legacy env vars are fallback-only for existing deployments.
86
+ **Credential resolution order:** `.securenow/credentials.json` (project) -> project named runtime credentials in the fixed staging/production/preview/local/test/development/dev/prod order -> `~/.securenow/credentials.json` (global) -> global named runtime credentials in the same fixed order. Legacy env vars are fallback-only for existing deployments.
87
87
 
88
- **Firewall API key resolution (v7.5.1+):** project `.securenow/credentials.json` -> project `.securenow/credentials.<environment>.json` -> global `~/.securenow/credentials.json` -> global `~/.securenow/credentials.<environment>.json`. Use `securenow login` for default setup or `securenow api-key set` to rotate a key without touching env vars.
88
+ **Firewall API key resolution (v7.5.1+):** 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. Use `securenow login` for default setup or `securenow api-key set` to rotate a key without touching env vars.
89
89
 
90
90
  ```bash
91
91
  securenow config set apiUrl https://api.securenow.ai
package/app-config.js CHANGED
@@ -4,9 +4,10 @@
4
4
  * Shared SecureNow configuration resolver.
5
5
  *
6
6
  * Local development and production are driven by ./.securenow/credentials.json.
7
- * Environment-specific runtime files such as
7
+ * Named runtime files such as ./.securenow/credentials.staging.json and
8
8
  * ./.securenow/credentials.production.json are also accepted when the
9
- * canonical file is not present.
9
+ * canonical file is not present. Filename selection is deterministic and does
10
+ * not read environment variables.
10
11
  * Legacy environment variables are only fallback inputs for existing installs;
11
12
  * every SDK setting has a file-backed equivalent so customers do not need .env
12
13
  * files.
@@ -19,6 +20,16 @@ const os = require('os');
19
20
  const FREE_TRIAL_INSTANCE = 'https://freetrial.securenow.ai:4318';
20
21
  const DEFAULT_API_URL = 'https://api.securenow.ai';
21
22
  const CONFIG_SCHEMA_VERSION = 2;
23
+ const CREDENTIAL_FILE_ENVIRONMENTS = Object.freeze([
24
+ 'staging',
25
+ 'production',
26
+ 'preview',
27
+ 'local',
28
+ 'test',
29
+ 'development',
30
+ 'dev',
31
+ 'prod',
32
+ ]);
22
33
 
23
34
  const DEFAULT_CONFIG = Object.freeze({
24
35
  logging: {
@@ -231,30 +242,10 @@ function uniq(values) {
231
242
  return out;
232
243
  }
233
244
 
234
- function credentialEnvironmentNames() {
235
- const names = [];
236
- const rawValues = [
237
- rawEnv('SECURENOW_ENVIRONMENT'),
238
- rawEnv('SECURENOW_DEPLOYMENT_ENVIRONMENT'),
239
- rawEnv('NODE_ENV'),
240
- ];
241
-
242
- for (const rawValue of rawValues) {
243
- const value = pick(rawValue);
244
- if (value == null) continue;
245
- const text = String(value).trim().toLowerCase();
246
- if (/^[a-z0-9_.-]{1,64}$/.test(text)) names.push(text);
247
- names.push(normalizeDeploymentEnvironment(text));
248
- }
249
-
250
- names.push('production');
251
- return uniq(names);
252
- }
253
-
254
245
  function credentialRelativePaths() {
255
246
  return uniq([
256
247
  path.join('.securenow', 'credentials.json'),
257
- ...credentialEnvironmentNames().map((envName) =>
248
+ ...CREDENTIAL_FILE_ENVIRONMENTS.map((envName) =>
258
249
  path.join('.securenow', `credentials.${envName}.json`)
259
250
  ),
260
251
  ]);
@@ -717,6 +708,7 @@ module.exports = {
717
708
  FREE_TRIAL_INSTANCE,
718
709
  DEFAULT_API_URL,
719
710
  CONFIG_SCHEMA_VERSION,
711
+ CREDENTIAL_FILE_ENVIRONMENTS,
720
712
  DEFAULT_CONFIG,
721
713
  CONFIG_EXPLANATIONS,
722
714
  ENV_TO_CONFIG_PATH,
@@ -83,7 +83,8 @@ async function runtime(_args, flags) {
83
83
 
84
84
  ui.success(`Wrote runtime credentials to ${output}`);
85
85
  ui.info('Deploy this JSON as .securenow/credentials.json on the server/container.');
86
- ui.info('SDK v7.7.1+ can also read this generated filename directly when credentials.json is absent.');
86
+ ui.info('SDK v7.7.2+ can also read this generated filename directly when credentials.json is absent.');
87
+ ui.info('Credential filename lookup is fixed-order and does not depend on NODE_ENV.');
87
88
  ui.info(`Environment: ${envName}`);
88
89
  ui.info(`App: ${creds.app?.name || '(unnamed)'} ${creds.app?.key ? `(${creds.app.key})` : ''}`);
89
90
  ui.info(`Firewall key: ${creds.apiKey ? maskSecret(creds.apiKey) : '(missing)'}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securenow",
3
- "version": "7.7.1",
3
+ "version": "7.7.2",
4
4
  "description": "OpenTelemetry instrumentation for Node.js, Next.js, and Nuxt - Send traces and logs to any OTLP-compatible backend",
5
5
  "type": "commonjs",
6
6
  "main": "register.js",