Fix CodeQL code-scanning alerts

- Values pasted into eval'd or inline-script code go through lit() (scripts/lib/js-literal.js), which escapes <, >, /, U+2028 and U+2029 after JSON.stringify
- build test and i18n-check read script tags with a DOM parser or a plain search, not HTML regexes
- mcp.js parses the Authorization header without a backtracking regex
This commit is contained in:
Frederic Jung 2026-11-05 21:24:26 +01:00
parent e7729d0a1e
commit dd6e4f4f8a
No known key found for this signature in database
89 changed files with 316 additions and 213 deletions

View file

@ -1,6 +1,7 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const { load } = require('./harness');
const { lit } = require('../scripts/lib/js-literal');
// A triangle: Frankfurt-Amsterdam direct, or round through Paris.
function setup(ev) {
@ -9,7 +10,7 @@ function setup(ev) {
[['fra', 'par'], ['par', 'ams'], ['fra', 'ams']].forEach(([a, b], i) => ev(`UI.via=null;openLinkModal('${a}','${b}');ACT.buildLink({tier:1});closeModal();S.links[S.links.length-1].tag=${i}`));
ev("var D=S.links.find(l=>l.tag===2);compute()");
}
const hops = (ev, mode) => ev(`trPaths('fra',${JSON.stringify(mode)}).path('ams').length`);
const hops = (ev, mode) => ev(`trPaths('fra',${lit(mode)}).path('ams').length`);
test('a trace can follow the metrics, the lowest latency or the quietest links', () => {
const { ev, errors } = load();