kryptheon 0.1.47 → 0.1.49
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 +3654 -3462
- package/kryptheon-code.js +50 -0
- package/kryptheon-dashboard-page.js +3 -0
- package/kryptheon-dashboard.js +1166 -1132
- package/kryptheon-edge.js +1112 -792
- package/kryptheon-fixture.js +117 -0
- package/kryptheon-heal.js +254 -215
- package/kryptheon-look.js +306 -259
- package/kryptheon-probe-fixture.js +721 -303
- package/kryptheon-reliability.js +984 -599
- package/kryptheon-reporter.js +1108 -1080
- package/kryptheon-signature.js +69 -8
- package/package.json +104 -104
package/kryptheon-code.js
CHANGED
|
@@ -264,6 +264,19 @@ function classify(node, scope, code, depth, aliases) {
|
|
|
264
264
|
return 'safe';
|
|
265
265
|
}
|
|
266
266
|
if (node.callee.type === 'MemberExpression' && node.callee.object && node.callee.object.name === 'Math') return 'safe';
|
|
267
|
+
// crypto.randomUUID(): hex digits and dashes, made on this page - never a
|
|
268
|
+
// tag. Found on blind round 17: a row id made this way and written into
|
|
269
|
+
// the page was reported as a risk.
|
|
270
|
+
if (name === 'randomUUID' && node.callee.type === 'MemberExpression' &&
|
|
271
|
+
/^(crypto|self\.crypto|window\.crypto|globalThis\.crypto)$/.test(memberPath(node.callee.object))) {
|
|
272
|
+
return 'safe';
|
|
273
|
+
}
|
|
274
|
+
// list.reduce((t, s) => t + s.count, 0) - as dangerous as where it starts
|
|
275
|
+
// and what each step returns. A sum of counts from zero is a number;
|
|
276
|
+
// names joined from '' are as dangerous as the names. Found on blind
|
|
277
|
+
// round 17: a total written into the page was reported as a risk.
|
|
278
|
+
const reduced = reduceCallback(node, scope, code, depth, aliases);
|
|
279
|
+
if (reduced) return reduced;
|
|
267
280
|
// items.map(i => `<li>${i.name}</li>`).join('') - judge what map builds.
|
|
268
281
|
const mapped = mapCallback(node, scope, code, depth, aliases);
|
|
269
282
|
if (mapped) {
|
|
@@ -427,6 +440,43 @@ function mapCallback(node, scope, code, depth, aliases) {
|
|
|
427
440
|
return { returns: returns, inner: inner };
|
|
428
441
|
}
|
|
429
442
|
|
|
443
|
+
/** a.b.c as text, '' when the node is not a plain chain of names. */
|
|
444
|
+
function memberPath(node) {
|
|
445
|
+
if (!node) return '';
|
|
446
|
+
if (node.type === 'Identifier') return node.name;
|
|
447
|
+
if (node.type === 'MemberExpression' && !node.computed && node.property && node.property.type === 'Identifier') {
|
|
448
|
+
const left = memberPath(node.object);
|
|
449
|
+
return left ? left + '.' + node.property.name : '';
|
|
450
|
+
}
|
|
451
|
+
return '';
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* list.reduce(cb, start): the worst of the start and every value the callback
|
|
456
|
+
* returns, judged with the running total standing for the start, the item for
|
|
457
|
+
* whatever the list holds and the index for a number. Null when node is not
|
|
458
|
+
* that shape. With no start, the first item is the start.
|
|
459
|
+
*/
|
|
460
|
+
function reduceCallback(node, scope, code, depth, aliases) {
|
|
461
|
+
const name = calleeName(node.callee);
|
|
462
|
+
if (!/^(reduce|reduceRight)$/.test(name) || !/MemberExpression$/.test(node.callee.type)) return null;
|
|
463
|
+
const fn = node.arguments[0];
|
|
464
|
+
if (!fn || !/Function/.test(fn.type)) return null;
|
|
465
|
+
const listOrigin = classify(node.callee.object, scope, code, depth + 1, aliases);
|
|
466
|
+
const start = node.arguments.length > 1 ? classify(node.arguments[1], scope, code, depth + 1, aliases) : listOrigin;
|
|
467
|
+
const inner = Object.assign({}, aliases || {});
|
|
468
|
+
const params = fn.params || [];
|
|
469
|
+
if (params[0] && params[0].type === 'Identifier') inner[params[0].name] = start;
|
|
470
|
+
if (params[1] && params[1].type === 'Identifier') inner[params[1].name] = listOrigin;
|
|
471
|
+
if (params[2] && params[2].type === 'Identifier') inner[params[2].name] = 'safe';
|
|
472
|
+
const fnPath = FN_PATHS.get(fn);
|
|
473
|
+
const returns = fnPath
|
|
474
|
+
? returnsOf(fnPath)
|
|
475
|
+
: (returnedBy(fn) ? [{ node: returnedBy(fn), scope: scope }] : []);
|
|
476
|
+
if (!returns.length) return 'unknown';
|
|
477
|
+
return worst([start].concat(returns.map((r) => classify(r.node, r.scope, code, depth + 1, inner))));
|
|
478
|
+
}
|
|
479
|
+
|
|
430
480
|
/**
|
|
431
481
|
* Whether a call escapes HTML - by name for the well-known ones, and for a
|
|
432
482
|
* helper of this file's own, by what it does: every return is a replace()
|
|
@@ -955,6 +955,9 @@
|
|
|
955
955
|
edge: 'Re-check: replays this flow as recorded, then once more with the value that found this. Two runs.',
|
|
956
956
|
flaky: 'Re-check: replays this flow five times. It is fixed only if all five work.',
|
|
957
957
|
double: 'Re-check: replays this flow once, then once more with this step double-clicked. Two runs.',
|
|
958
|
+
phone: 'Re-check: replays this flow once, then once more at phone size, clicking every button with saving blocked. Two runs.',
|
|
959
|
+
race: 'Re-check: replays this flow once, then once more with this save sent twice at the same moment. Two runs.',
|
|
960
|
+
shown: 'Re-check: replays this flow three times, looking for what this step saved on the page right after it. It is fixed only if it shows right away.',
|
|
958
961
|
};
|
|
959
962
|
|
|
960
963
|
// Which probe check is asking for a yes right now, and for which finding
|