kryptheon 0.1.52 → 0.1.54
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/bin/kryptheon.js +43 -3
- package/kryptheon-authz.js +874 -0
- package/kryptheon-dashboard-page.js +13 -7
- package/kryptheon-dashboard.js +20 -6
- package/kryptheon-fixture.js +18 -2
- package/kryptheon-heal.js +18 -0
- package/kryptheon-payments-run.js +80 -14
- package/kryptheon-payments.js +89 -10
- package/kryptheon-probe-fixture.js +23 -1
- package/kryptheon-probe.js +2 -3
- package/kryptheon-reliability.js +88 -24
- package/kryptheon-replay.js +122 -0
- package/kryptheon-roles.js +1332 -0
- package/package.json +10 -4
package/bin/kryptheon.js
CHANGED
|
@@ -107,8 +107,10 @@ function usage() {
|
|
|
107
107
|
console.log(' npx kryptheon code read your frontend code for text inserted as HTML');
|
|
108
108
|
console.log(' npx kryptheon edge try unusual values in your recorded forms (adds test data; asks first)');
|
|
109
109
|
console.log(' npx kryptheon reliability replay each flow 3 times, double-click what saves (adds test data; asks first)');
|
|
110
|
+
console.log(' npx kryptheon roles every recorded action tried as each account, and across organizations (needs permissions-policy.json; asks first)');
|
|
110
111
|
console.log(' npx kryptheon payments one test payment, its webhook sent again: given twice? (asks first)');
|
|
111
112
|
console.log(' ... --app <url> --port <n> --schema <name> --test-mode (database: KRYPTHEON_DATABASE_URL)');
|
|
113
|
+
console.log(' ... --signature-header <name> your app signs its own webhooks in this header (not Razorpay or Stripe)');
|
|
112
114
|
console.log(' npx kryptheon dashboard the page above (also: npx kryptheon, in a terminal)');
|
|
113
115
|
console.log('');
|
|
114
116
|
console.log(' add --quiet to check for one line when everything passes');
|
|
@@ -2156,6 +2158,13 @@ const PROBE_CHECKS = {
|
|
|
2156
2158
|
// It types nothing of its own, so nothing it saves carries the marker.
|
|
2157
2159
|
words: { marker: false },
|
|
2158
2160
|
},
|
|
2161
|
+
roles: {
|
|
2162
|
+
module: 'kryptheon-roles.js',
|
|
2163
|
+
// Read from the module when asked, so a command that never needs this check never loads it.
|
|
2164
|
+
get what() { return require(path.join(PACKAGE_DIR, 'kryptheon-roles.js')).WHAT; },
|
|
2165
|
+
get none() { return require(path.join(PACKAGE_DIR, 'kryptheon-roles.js')).NONE; },
|
|
2166
|
+
get words() { return require(path.join(PACKAGE_DIR, 'kryptheon-roles.js')).WORDS; },
|
|
2167
|
+
},
|
|
2159
2168
|
};
|
|
2160
2169
|
|
|
2161
2170
|
function probeModule(check) {
|
|
@@ -2172,6 +2181,17 @@ async function probeCommand(check, args) {
|
|
|
2172
2181
|
const runner = probeModule(check);
|
|
2173
2182
|
const probe = require(path.join(PACKAGE_DIR, 'kryptheon-probe.js'));
|
|
2174
2183
|
const { flows } = probeFlows();
|
|
2184
|
+
// Some checks need something from the person first (the roles check: the
|
|
2185
|
+
// permissions file). Said before anything is asked or run.
|
|
2186
|
+
if (typeof runner.preflight === 'function') {
|
|
2187
|
+
const pre = runner.preflight(USER_DIR);
|
|
2188
|
+
if (!pre.ok) {
|
|
2189
|
+
console.log('');
|
|
2190
|
+
for (const line of pre.lines) console.log(' ' + line);
|
|
2191
|
+
console.log('');
|
|
2192
|
+
return 2;
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2175
2195
|
if (!flows.length) {
|
|
2176
2196
|
console.log('');
|
|
2177
2197
|
console.log(' ' + PROBE_CHECKS[check].none);
|
|
@@ -2180,6 +2200,15 @@ async function probeCommand(check, args) {
|
|
|
2180
2200
|
return 2;
|
|
2181
2201
|
}
|
|
2182
2202
|
const addresses = probe.knownAddresses(USER_DIR, flows.map((f) => f.source));
|
|
2203
|
+
// A check that sends what must be refused runs only against this computer.
|
|
2204
|
+
if (runner.LOCAL_ONLY && probe.liveLooking(addresses).length) {
|
|
2205
|
+
console.log('');
|
|
2206
|
+
console.log(' Your recordings open ' + probe.liveLooking(addresses).join(', ') + ', which is not this computer.');
|
|
2207
|
+
console.log(' This check sends requests that must be refused, so it runs only against your app on this computer (localhost or 127.0.0.1).');
|
|
2208
|
+
console.log(' Start a copy of your app here, record against that, and run it again.');
|
|
2209
|
+
console.log('');
|
|
2210
|
+
return 2;
|
|
2211
|
+
}
|
|
2183
2212
|
const confirmed = await probeConsent(PROBE_CHECKS[check].what, addresses, args.includes('--yes'), PROBE_CHECKS[check].words);
|
|
2184
2213
|
if (!confirmed) return 2;
|
|
2185
2214
|
if (!ensureBrowser()) return 2;
|
|
@@ -2229,6 +2258,7 @@ async function paymentsCommand(args) {
|
|
|
2229
2258
|
database: process.env.KRYPTHEON_DATABASE_URL || null,
|
|
2230
2259
|
yes: args.includes('--yes'),
|
|
2231
2260
|
testMode: args.includes('--test-mode'),
|
|
2261
|
+
signatureHeader: flagValue(args, '--signature-header'),
|
|
2232
2262
|
ask: (question) => (process.stdin.isTTY ? askLine(' ' + question) : Promise.resolve('')),
|
|
2233
2263
|
say: (line) => console.log(line ? ' ' + line : ''),
|
|
2234
2264
|
stopped: () => stopped,
|
|
@@ -2684,7 +2714,8 @@ async function probeRecheckCommand(target, options) {
|
|
|
2684
2714
|
const addresses = probe.knownAddresses(USER_DIR, flow ? [flow.source] : []);
|
|
2685
2715
|
const name = '"' + (flow ? flow.title : file) + '"';
|
|
2686
2716
|
const what = 'Re-check ' + target.id + ': ' + (
|
|
2687
|
-
target.check === '
|
|
2717
|
+
target.check === 'roles' ? 'tries ' + target.where + ' again as every account, from the requests the last press learned. It changes data in your app (a refused account that gets through) and puts back what it can.'
|
|
2718
|
+
: target.check === 'edge' ? 'replays ' + name + ' as recorded, then once more with the value that found this. Two runs.'
|
|
2688
2719
|
: target.kind === 'flaky' ? 'replays ' + name + ' five times. It is fixed only if all five work.'
|
|
2689
2720
|
: target.kind === 'phone' ? 'replays ' + name + ' once, then once more at phone size, clicking every button with saving blocked. Two runs.'
|
|
2690
2721
|
: target.kind === 'race' ? 'replays ' + name + ' once, then once more with this save sent twice at the same moment. Two runs.'
|
|
@@ -2959,6 +2990,13 @@ async function probeFromDashboard(id, say, control, confirmed) {
|
|
|
2959
2990
|
if (!PROBE_CHECKS[id]) return { ok: false, why: '"' + id + '" cannot be run from the dashboard' };
|
|
2960
2991
|
const runner = probeModule(id);
|
|
2961
2992
|
const { flows } = probeFlows();
|
|
2993
|
+
if (typeof runner.preflight === 'function') {
|
|
2994
|
+
const pre = runner.preflight(USER_DIR);
|
|
2995
|
+
if (!pre.ok) {
|
|
2996
|
+
for (const line of pre.lines) say(line);
|
|
2997
|
+
return { ok: false, why: pre.lines[0] };
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
2962
3000
|
if (!flows.length) return { ok: false, why: 'there is no recording that can be replayed - record one of your flows' };
|
|
2963
3001
|
if (!ensureBrowser()) return { ok: false, why: 'the browser could not be downloaded' };
|
|
2964
3002
|
const report = await runner.run(USER_DIR, flows, {
|
|
@@ -2986,7 +3024,7 @@ async function probeRecheck(id, say, control, confirmed) {
|
|
|
2986
3024
|
if (!target) return null;
|
|
2987
3025
|
const runner = probeModule(target.check);
|
|
2988
3026
|
const { flows } = probeFlows();
|
|
2989
|
-
if (!ensureBrowser()) return { target: target, verdict: 'could not confirm', why: 'the browser could not be downloaded', newProblems: [] };
|
|
3027
|
+
if (target.check !== 'roles' && !ensureBrowser()) return { target: target, verdict: 'could not confirm', why: 'the browser could not be downloaded', newProblems: [] };
|
|
2990
3028
|
const r = await runner.recheck(USER_DIR, flows, target, {
|
|
2991
3029
|
say: say,
|
|
2992
3030
|
onControl: (c) => control && control.onStop(() => c.stop()),
|
|
@@ -3706,7 +3744,9 @@ async function main() {
|
|
|
3706
3744
|
return finishWith(await recheckCommand(rest.find((a) => !/^--/.test(a)), { yes: rest.includes('--yes') }));
|
|
3707
3745
|
case 'edge':
|
|
3708
3746
|
case 'reliability':
|
|
3709
|
-
|
|
3747
|
+
case 'roles':
|
|
3748
|
+
case 'authz':
|
|
3749
|
+
return finishWith(await probeCommand(command === 'authz' ? 'roles' : command, rest));
|
|
3710
3750
|
case 'payments':
|
|
3711
3751
|
return finishWith(await paymentsCommand(rest));
|
|
3712
3752
|
case '-v':
|