securenow 8.11.2 → 8.12.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 +7 -8
- package/SKILL-API.md +0 -1
- package/SKILL-CLI.md +624 -632
- package/TELEMETRY-SQL.md +6 -1
- package/app-config.js +10 -7
- package/cidr.js +83 -83
- package/cli/apps.js +36 -8
- package/cli/client.js +102 -102
- package/cli/diagnostics.js +5 -1
- package/cli/firewall.js +141 -141
- package/cli/fp.js +638 -638
- package/cli/monitor.js +398 -398
- package/cli/run.js +132 -132
- package/cli/security.js +1866 -1856
- package/cli/ui.js +374 -374
- package/cli.js +923 -922
- package/firewall-cloud.js +202 -202
- package/firewall-iptables.js +139 -139
- package/firewall-only.js +46 -46
- package/firewall-tcp.js +74 -74
- package/firewall.js +1470 -1470
- package/mcp/catalog.js +2358 -2346
- package/nextjs-auto-capture.d.ts +29 -29
- package/nextjs-auto-capture.js +273 -273
- package/nextjs-middleware.d.ts +57 -57
- package/nextjs-middleware.js +267 -267
- package/nextjs-webpack-config.js +79 -79
- package/nextjs-wrapper.d.ts +95 -95
- package/nextjs-wrapper.js +233 -233
- package/nextjs.js +0 -9
- package/nuxt-server-plugin.mjs +0 -11
- package/nuxt.mjs +74 -74
- package/package.json +1 -2
- package/register.d.ts +42 -42
- package/register.js +44 -44
- package/resolve-ip.js +13 -13
- package/telemetry-schema.json +3 -1
- package/tracing.js +847 -853
- package/web-vite.mjs +0 -76
- package/free-trial-banner.js +0 -175
package/web-vite.mjs
CHANGED
|
@@ -24,7 +24,6 @@ const DEFAULT_BROWSER_CONFIG = Object.freeze({
|
|
|
24
24
|
noUuid: null,
|
|
25
25
|
strict: false,
|
|
26
26
|
testSpan: false,
|
|
27
|
-
hideBanner: false,
|
|
28
27
|
},
|
|
29
28
|
},
|
|
30
29
|
});
|
|
@@ -258,84 +257,9 @@ export function startSecurenowWeb() {
|
|
|
258
257
|
console.log('[securenow] Web OTel started → %s', tracesUrl);
|
|
259
258
|
}
|
|
260
259
|
|
|
261
|
-
// ---- Free trial banner (browser DOM injection) ----
|
|
262
|
-
function injectFreeTrialBanner() {
|
|
263
|
-
const FREE_TRIAL_HOSTS = ['ingest.securenow.ai', 'freetrial.securenow.ai'];
|
|
264
|
-
const hideBanner = boolConfig('config.runtime.hideBanner', false);
|
|
265
|
-
if (hideBanner || !FREE_TRIAL_HOSTS.some(host => endpointBase.includes(host))) return;
|
|
266
|
-
if (typeof document === 'undefined') return;
|
|
267
|
-
|
|
268
|
-
function create() {
|
|
269
|
-
if (document.getElementById('sn-ft-banner')) return;
|
|
270
|
-
|
|
271
|
-
const d = document.createElement('div');
|
|
272
|
-
d.id = 'sn-ft-banner';
|
|
273
|
-
d.style.cssText =
|
|
274
|
-
'position:fixed;top:0;left:0;right:0;z-index:2147483647;' +
|
|
275
|
-
'background:#FEF3CD;color:#856404;padding:10px 16px;' +
|
|
276
|
-
'font-family:system-ui,-apple-system,sans-serif;font-size:13px;' +
|
|
277
|
-
'text-align:center;border-bottom:2px solid #FFE69C;' +
|
|
278
|
-
'display:flex;align-items:center;justify-content:center;gap:6px;' +
|
|
279
|
-
'box-shadow:0 2px 8px rgba(0,0,0,0.12)';
|
|
280
|
-
|
|
281
|
-
const icon = document.createElement('span');
|
|
282
|
-
icon.textContent = '\u26a0\ufe0f';
|
|
283
|
-
d.appendChild(icon);
|
|
284
|
-
|
|
285
|
-
const msg = document.createElement('span');
|
|
286
|
-
const strong = document.createElement('strong');
|
|
287
|
-
strong.textContent = 'Testing Environment:';
|
|
288
|
-
msg.appendChild(strong);
|
|
289
|
-
msg.appendChild(document.createTextNode(
|
|
290
|
-
' Only add test applications. For production usage, '
|
|
291
|
-
));
|
|
292
|
-
|
|
293
|
-
const link = document.createElement('a');
|
|
294
|
-
link.href = 'https://app.securenow.ai/dashboard/settings/instances';
|
|
295
|
-
link.target = '_blank';
|
|
296
|
-
link.rel = 'noopener';
|
|
297
|
-
link.style.cssText = 'color:#664D03;font-weight:600;text-decoration:underline';
|
|
298
|
-
link.textContent = 'create a new production instance';
|
|
299
|
-
msg.appendChild(link);
|
|
300
|
-
msg.appendChild(document.createTextNode('.'));
|
|
301
|
-
d.appendChild(msg);
|
|
302
|
-
|
|
303
|
-
const upgradeBtn = document.createElement('a');
|
|
304
|
-
upgradeBtn.href = 'https://app.securenow.ai/dashboard/settings/instances';
|
|
305
|
-
upgradeBtn.target = '_blank';
|
|
306
|
-
upgradeBtn.rel = 'noopener';
|
|
307
|
-
upgradeBtn.textContent = '\u26a1 Upgrade';
|
|
308
|
-
upgradeBtn.style.cssText =
|
|
309
|
-
'display:inline-flex;align-items:center;gap:4px;' +
|
|
310
|
-
'background:#D97706;color:#fff;padding:4px 12px;border-radius:4px;' +
|
|
311
|
-
'font-size:12px;font-weight:600;text-decoration:none;margin-left:10px;' +
|
|
312
|
-
'white-space:nowrap;transition:background 0.15s';
|
|
313
|
-
upgradeBtn.onmouseover = () => { upgradeBtn.style.background = '#B45309'; };
|
|
314
|
-
upgradeBtn.onmouseout = () => { upgradeBtn.style.background = '#D97706'; };
|
|
315
|
-
d.appendChild(upgradeBtn);
|
|
316
|
-
|
|
317
|
-
const close = document.createElement('button');
|
|
318
|
-
close.textContent = '\u00d7';
|
|
319
|
-
close.style.cssText =
|
|
320
|
-
'background:none;border:none;color:#856404;font-size:18px;' +
|
|
321
|
-
'cursor:pointer;margin-left:12px;padding:0 4px;line-height:1';
|
|
322
|
-
close.onclick = () => { d.style.display = 'none'; };
|
|
323
|
-
d.appendChild(close);
|
|
324
|
-
|
|
325
|
-
document.body.prepend(d);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
if (document.readyState === 'loading') {
|
|
329
|
-
document.addEventListener('DOMContentLoaded', create);
|
|
330
|
-
} else {
|
|
331
|
-
create();
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
260
|
// Auto-start
|
|
336
261
|
try {
|
|
337
262
|
startSecurenowWeb();
|
|
338
|
-
injectFreeTrialBanner();
|
|
339
263
|
} catch (e) {
|
|
340
264
|
console.error('[securenow/web-vite] failed to start:', e);
|
|
341
265
|
}
|
package/free-trial-banner.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Free Trial Banner — auto-injects a visible "Testing Environment" banner
|
|
5
|
-
* into HTML pages served by apps using the SecureNow free trial instance.
|
|
6
|
-
*
|
|
7
|
-
* Opt-out: set config.runtime.hideBanner=true in .securenow/credentials.json
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const FREE_TRIAL_HOSTS = ['ingest.securenow.ai', 'freetrial.securenow.ai'];
|
|
11
|
-
|
|
12
|
-
function isFreeTrial(endpointBase) {
|
|
13
|
-
return !!endpointBase && FREE_TRIAL_HOSTS.some((host) => endpointBase.includes(host));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/* istanbul ignore next — runs in browser, not Node */
|
|
17
|
-
function _bannerClientCode() {
|
|
18
|
-
if (window.__snBanner) return;
|
|
19
|
-
window.__snBanner = 1;
|
|
20
|
-
|
|
21
|
-
function create() {
|
|
22
|
-
if (document.getElementById('sn-ft-banner')) return;
|
|
23
|
-
|
|
24
|
-
var d = document.createElement('div');
|
|
25
|
-
d.id = 'sn-ft-banner';
|
|
26
|
-
d.style.cssText =
|
|
27
|
-
'position:fixed;top:0;left:0;right:0;z-index:2147483647;' +
|
|
28
|
-
'background:#FEF3CD;color:#856404;padding:10px 16px;' +
|
|
29
|
-
'font-family:system-ui,-apple-system,sans-serif;font-size:13px;' +
|
|
30
|
-
'text-align:center;border-bottom:2px solid #FFE69C;' +
|
|
31
|
-
'display:flex;align-items:center;justify-content:center;gap:6px;' +
|
|
32
|
-
'box-shadow:0 2px 8px rgba(0,0,0,0.12)';
|
|
33
|
-
|
|
34
|
-
var icon = document.createElement('span');
|
|
35
|
-
icon.textContent = '\u26a0\ufe0f';
|
|
36
|
-
d.appendChild(icon);
|
|
37
|
-
|
|
38
|
-
var msg = document.createElement('span');
|
|
39
|
-
var strong = document.createElement('strong');
|
|
40
|
-
strong.textContent = 'Testing Environment:';
|
|
41
|
-
msg.appendChild(strong);
|
|
42
|
-
msg.appendChild(document.createTextNode(
|
|
43
|
-
' Only add test applications. For production usage, '
|
|
44
|
-
));
|
|
45
|
-
|
|
46
|
-
var link = document.createElement('a');
|
|
47
|
-
link.href = 'https://app.securenow.ai/dashboard/settings/instances';
|
|
48
|
-
link.target = '_blank';
|
|
49
|
-
link.rel = 'noopener';
|
|
50
|
-
link.style.cssText = 'color:#664D03;font-weight:600;text-decoration:underline';
|
|
51
|
-
link.textContent = 'create a new production instance';
|
|
52
|
-
msg.appendChild(link);
|
|
53
|
-
msg.appendChild(document.createTextNode('.'));
|
|
54
|
-
d.appendChild(msg);
|
|
55
|
-
|
|
56
|
-
var upgradeBtn = document.createElement('a');
|
|
57
|
-
upgradeBtn.href = 'https://app.securenow.ai/dashboard/settings/instances';
|
|
58
|
-
upgradeBtn.target = '_blank';
|
|
59
|
-
upgradeBtn.rel = 'noopener';
|
|
60
|
-
upgradeBtn.textContent = '\u26a1 Upgrade';
|
|
61
|
-
upgradeBtn.style.cssText =
|
|
62
|
-
'display:inline-flex;align-items:center;gap:4px;' +
|
|
63
|
-
'background:#D97706;color:#fff;padding:4px 12px;border-radius:4px;' +
|
|
64
|
-
'font-size:12px;font-weight:600;text-decoration:none;margin-left:10px;' +
|
|
65
|
-
'white-space:nowrap;transition:background 0.15s';
|
|
66
|
-
upgradeBtn.onmouseover = function () { upgradeBtn.style.background = '#B45309'; };
|
|
67
|
-
upgradeBtn.onmouseout = function () { upgradeBtn.style.background = '#D97706'; };
|
|
68
|
-
d.appendChild(upgradeBtn);
|
|
69
|
-
|
|
70
|
-
var close = document.createElement('button');
|
|
71
|
-
close.textContent = '\u00d7';
|
|
72
|
-
close.style.cssText =
|
|
73
|
-
'background:none;border:none;color:#856404;font-size:18px;' +
|
|
74
|
-
'cursor:pointer;margin-left:12px;padding:0 4px;line-height:1';
|
|
75
|
-
close.onclick = function () { d.style.display = 'none'; };
|
|
76
|
-
d.appendChild(close);
|
|
77
|
-
|
|
78
|
-
document.body.prepend(d);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (document.readyState === 'loading') {
|
|
82
|
-
document.addEventListener('DOMContentLoaded', create);
|
|
83
|
-
} else {
|
|
84
|
-
create();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
var BANNER_SCRIPT =
|
|
89
|
-
'<script data-securenow-banner>(' +
|
|
90
|
-
_bannerClientCode.toString() +
|
|
91
|
-
')()</scr' + 'ipt>';
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Monkey-patch http.ServerResponse to inject the banner script into HTML
|
|
95
|
-
* responses. Searches for `<head...>` and inserts the script right after it.
|
|
96
|
-
* Skips compressed responses and non-HTML content types.
|
|
97
|
-
*/
|
|
98
|
-
function patchHttpForBanner() {
|
|
99
|
-
try {
|
|
100
|
-
var nodeRequire = typeof __non_webpack_require__ === 'function' ? __non_webpack_require__ : eval('require');
|
|
101
|
-
var http = nodeRequire('node:http');
|
|
102
|
-
var _origWrite = http.ServerResponse.prototype.write;
|
|
103
|
-
var _origEnd = http.ServerResponse.prototype.end;
|
|
104
|
-
|
|
105
|
-
function maybeInject(res, chunk) {
|
|
106
|
-
if (res._snBannerDone || !chunk) return chunk;
|
|
107
|
-
|
|
108
|
-
if (res._snIsHtml === undefined) {
|
|
109
|
-
var ct = res.getHeader('content-type');
|
|
110
|
-
var ce = res.getHeader('content-encoding');
|
|
111
|
-
var csp = res.getHeader('content-security-policy');
|
|
112
|
-
res._snIsHtml = !!(ct && String(ct).includes('text/html') && !ce && !csp);
|
|
113
|
-
}
|
|
114
|
-
if (!res._snIsHtml) {
|
|
115
|
-
res._snBannerDone = true;
|
|
116
|
-
return chunk;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
var isStr = typeof chunk === 'string';
|
|
120
|
-
var isBuf = Buffer.isBuffer(chunk);
|
|
121
|
-
if (!isStr && !isBuf) return chunk;
|
|
122
|
-
|
|
123
|
-
var str = isStr ? chunk : chunk.toString('utf8');
|
|
124
|
-
var headIdx = str.indexOf('<head');
|
|
125
|
-
if (headIdx === -1) return chunk;
|
|
126
|
-
|
|
127
|
-
var gt = str.indexOf('>', headIdx);
|
|
128
|
-
if (gt === -1) return chunk;
|
|
129
|
-
|
|
130
|
-
res._snBannerDone = true;
|
|
131
|
-
var result = str.slice(0, gt + 1) + BANNER_SCRIPT + str.slice(gt + 1);
|
|
132
|
-
return isStr ? result : Buffer.from(result, 'utf8');
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
http.ServerResponse.prototype.write = function (chunk, encoding, cb) {
|
|
136
|
-
try {
|
|
137
|
-
var modified = maybeInject(this, chunk);
|
|
138
|
-
if (modified !== chunk) {
|
|
139
|
-
var enc = typeof encoding === 'function' ? 'utf8' : encoding;
|
|
140
|
-
var callback = typeof encoding === 'function' ? encoding : cb;
|
|
141
|
-
try {
|
|
142
|
-
if (this.getHeader('content-length')) {
|
|
143
|
-
this.setHeader('content-length', Buffer.byteLength(modified));
|
|
144
|
-
}
|
|
145
|
-
} catch (_) { /* headers already sent */ }
|
|
146
|
-
return _origWrite.call(this, modified, enc, callback);
|
|
147
|
-
}
|
|
148
|
-
} catch (_) { /* never break the app */ }
|
|
149
|
-
return _origWrite.call(this, chunk, encoding, cb);
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
http.ServerResponse.prototype.end = function (chunk, encoding, cb) {
|
|
153
|
-
try {
|
|
154
|
-
var modified = maybeInject(this, chunk);
|
|
155
|
-
if (modified !== chunk) {
|
|
156
|
-
var enc = typeof encoding === 'function' ? 'utf8' : encoding;
|
|
157
|
-
var callback = typeof encoding === 'function' ? encoding : cb;
|
|
158
|
-
try {
|
|
159
|
-
if (this.getHeader('content-length')) {
|
|
160
|
-
this.setHeader('content-length', Buffer.byteLength(modified));
|
|
161
|
-
}
|
|
162
|
-
} catch (_) { /* headers already sent */ }
|
|
163
|
-
return _origEnd.call(this, modified, enc, callback);
|
|
164
|
-
}
|
|
165
|
-
} catch (_) { /* never break the app */ }
|
|
166
|
-
return _origEnd.call(this, chunk, encoding, cb);
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
console.log('[securenow] Free trial banner injection enabled');
|
|
170
|
-
} catch (err) {
|
|
171
|
-
console.warn('[securenow] Could not setup free trial banner:', err.message);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
module.exports = { isFreeTrial, patchHttpForBanner, BANNER_SCRIPT };
|