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/CONSUMING-APPS-GUIDE.md +17 -11
- package/README.md +204 -282
- package/SKILL-CLI.md +8 -4
- package/app-config.js +21 -1
- package/cli/apiKey.js +55 -0
- package/cli/apps.js +8 -19
- package/cli/auth.js +13 -2
- package/cli/config.js +24 -0
- package/cli/diagnostics.js +3 -1
- package/cli.js +24 -0
- package/docs/ALL-FRAMEWORKS-QUICKSTART.md +8 -0
- package/docs/ENVIRONMENT-VARIABLES.md +24 -15
- package/docs/LOGGING-QUICKSTART.md +25 -38
- package/docs/NEXTJS-QUICKSTART.md +46 -36
- package/docs/NUXT-GUIDE.md +17 -13
- package/examples/nextjs-env-example.txt +32 -34
- package/firewall-only.js +3 -2
- package/nextjs.js +4 -2
- package/package.json +1 -1
- package/postinstall.js +3 -11
package/docs/NUXT-GUIDE.md
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## Quick Start (1 minute)
|
|
4
4
|
|
|
5
|
-
### 1. Install
|
|
5
|
+
### 1. Install + login
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install securenow
|
|
9
|
+
npx securenow login # pick/create your app in the browser
|
|
9
10
|
```
|
|
10
11
|
|
|
12
|
+
`login` writes `.securenow/credentials.json` locally. No `.env` needed for local dev.
|
|
13
|
+
|
|
11
14
|
### 2. Add the module to `nuxt.config.ts`
|
|
12
15
|
|
|
13
16
|
```ts
|
|
@@ -16,16 +19,7 @@ export default defineNuxtConfig({
|
|
|
16
19
|
});
|
|
17
20
|
```
|
|
18
21
|
|
|
19
|
-
### 3.
|
|
20
|
-
|
|
21
|
-
Create a `.env` file in your project root:
|
|
22
|
-
|
|
23
|
-
```env
|
|
24
|
-
SECURENOW_APPID=my-nuxt-app
|
|
25
|
-
SECURENOW_INSTANCE=https://freetrial.securenow.ai:4318
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### 4. Start your app
|
|
22
|
+
### 3. Start your app
|
|
29
23
|
|
|
30
24
|
```bash
|
|
31
25
|
nuxt dev
|
|
@@ -36,10 +30,20 @@ You should see in the console:
|
|
|
36
30
|
```
|
|
37
31
|
[securenow] Nuxt module loaded ā server plugin registered
|
|
38
32
|
[securenow] š Nuxt OTel SDK started ā https://freetrial.securenow.ai:4318/v1/traces
|
|
39
|
-
[securenow] service.name=my-nuxt-app instance.id=my-nuxt-app-...
|
|
40
33
|
```
|
|
41
34
|
|
|
42
|
-
That's it ā all server-side requests are now traced.
|
|
35
|
+
That's it ā all server-side requests are now traced, logs forwarded, and bodies captured. The app you picked during `login` is where they land.
|
|
36
|
+
|
|
37
|
+
### 4. (Optional) Override for CI / Docker / prod
|
|
38
|
+
|
|
39
|
+
`.securenow/credentials.json` is for local dev. For environments where you can't run `npx securenow login`, set env vars:
|
|
40
|
+
|
|
41
|
+
```env
|
|
42
|
+
SECURENOW_APPID=<app-key-uuid>
|
|
43
|
+
SECURENOW_INSTANCE=https://freetrial.securenow.ai:4318
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Env vars always take precedence.
|
|
43
47
|
|
|
44
48
|
---
|
|
45
49
|
|
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
# SecureNow Configuration for Next.js
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
#
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
# Optional
|
|
21
|
-
#
|
|
22
|
-
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
# SecureNow Configuration for Next.js
|
|
2
|
+
#
|
|
3
|
+
# ============================================================
|
|
4
|
+
# For local dev you do NOT need this file.
|
|
5
|
+
# Instead run:
|
|
6
|
+
# npx securenow login
|
|
7
|
+
# That writes .securenow/credentials.json and the SDK reads it.
|
|
8
|
+
# ============================================================
|
|
9
|
+
#
|
|
10
|
+
# This template is for CI / Docker / Vercel ā places where you
|
|
11
|
+
# can't run the interactive login. Env vars always take
|
|
12
|
+
# precedence over .securenow/credentials.json.
|
|
13
|
+
|
|
14
|
+
# App routing key (UUID). From: npx securenow apps
|
|
15
|
+
SECURENOW_APPID=your-app-key-uuid
|
|
16
|
+
|
|
17
|
+
# OTLP collector endpoint. Default is the Free Trial.
|
|
18
|
+
SECURENOW_INSTANCE=https://freetrial.securenow.ai:4318
|
|
19
|
+
|
|
20
|
+
# Optional ā defaults are already sensible. Flip to 0 to disable.
|
|
21
|
+
# SECURENOW_LOGGING_ENABLED=0 # forward console.* as OTLP logs
|
|
22
|
+
# SECURENOW_CAPTURE_BODY=0 # capture POST/PUT/PATCH JSON + form bodies
|
|
23
|
+
# SECURENOW_CAPTURE_MULTIPART=0 # capture multipart field / file metadata
|
|
24
|
+
# SECURENOW_MAX_BODY_SIZE=10240 # bytes (default 10KB)
|
|
25
|
+
|
|
26
|
+
# Optional ā OTel tuning
|
|
27
|
+
# OTEL_LOG_LEVEL=info
|
|
28
|
+
# SECURENOW_DISABLE_INSTRUMENTATIONS=fs,dns
|
|
29
|
+
# SECURENOW_NO_UUID=1 # use bare APPID as service.name (no UUID suffix)
|
|
30
|
+
|
|
31
|
+
# Authentication (auto-set when SECURENOW_APPID is present)
|
|
32
|
+
# OTEL_EXPORTER_OTLP_HEADERS="x-api-key=your-api-key-here"
|
package/firewall-only.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* NODE_OPTIONS='-r securenow/firewall-only' next start
|
|
9
9
|
*
|
|
10
10
|
* Reads .env via dotenv (if installed), then initialises the HTTP-level
|
|
11
|
-
* firewall when
|
|
11
|
+
* firewall when an API key is resolvable (env var or .securenow/credentials.json).
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
try { require('dotenv').config(); } catch (_) {}
|
|
@@ -16,7 +16,8 @@ try { require('dotenv').config(); } catch (_) {}
|
|
|
16
16
|
const env = (k) =>
|
|
17
17
|
process.env[k] ?? process.env[k.toUpperCase()] ?? process.env[k.toLowerCase()];
|
|
18
18
|
|
|
19
|
-
const
|
|
19
|
+
const { resolveApiKey } = require('./app-config');
|
|
20
|
+
const firewallApiKey = resolveApiKey();
|
|
20
21
|
|
|
21
22
|
if (firewallApiKey && env('SECURENOW_FIREWALL_ENABLED') !== '0') {
|
|
22
23
|
require('./firewall').init({
|
package/nextjs.js
CHANGED
|
@@ -610,8 +610,10 @@ function registerSecureNow(options = {}) {
|
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
612
|
|
|
613
|
-
// Firewall ā runs independently from OTel so it works even if tracing fails
|
|
614
|
-
|
|
613
|
+
// Firewall ā runs independently from OTel so it works even if tracing fails.
|
|
614
|
+
// Key comes from env OR .securenow/credentials.json (set via
|
|
615
|
+
// `npx securenow api-key set snk_live_...`), so you don't need a .env entry.
|
|
616
|
+
const firewallApiKey = require('./app-config').resolveApiKey();
|
|
615
617
|
if (firewallApiKey && env('SECURENOW_FIREWALL_ENABLED') !== '0') {
|
|
616
618
|
try {
|
|
617
619
|
require('./firewall').init({
|
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -289,19 +289,11 @@ async function setup() {
|
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
// Create .env.local if it doesn't exist
|
|
293
|
-
const envPath = path.join(process.cwd(), '.env.local');
|
|
294
|
-
if (!fs.existsSync(envPath)) {
|
|
295
|
-
createEnvTemplate(envPath);
|
|
296
|
-
console.log('ā
Created .env.local template');
|
|
297
|
-
}
|
|
298
|
-
|
|
299
292
|
console.log('\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
300
293
|
console.log('ā š Next Steps: ā');
|
|
301
294
|
console.log('ā ā');
|
|
302
|
-
console.log('ā 1.
|
|
303
|
-
console.log('ā
|
|
304
|
-
console.log('ā SECURENOW_INSTANCE=http://your-otlp-backend:4318 ā');
|
|
295
|
+
console.log('ā 1. Pick your app in the browser: ā');
|
|
296
|
+
console.log('ā npx securenow login ā');
|
|
305
297
|
console.log('ā ā');
|
|
306
298
|
console.log('ā 2. Run your app: npm run dev ā');
|
|
307
299
|
console.log('ā ā');
|
|
@@ -312,7 +304,7 @@ async function setup() {
|
|
|
312
304
|
}
|
|
313
305
|
console.log('ā š Full guide: npm docs securenow ā');
|
|
314
306
|
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n');
|
|
315
|
-
|
|
307
|
+
|
|
316
308
|
rl.close();
|
|
317
309
|
});
|
|
318
310
|
|