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:
parent
e7729d0a1e
commit
dd6e4f4f8a
89 changed files with 316 additions and 213 deletions
|
|
@ -1,8 +1,9 @@
|
|||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { load } = require('./harness');
|
||||
const { lit } = require('../scripts/lib/js-literal');
|
||||
|
||||
const g = n => `RG.findIndex(r=>r.n===${JSON.stringify(n)})`;
|
||||
const g = n => `RG.findIndex(r=>r.n===${lit(n)})`;
|
||||
const setup = (ev, router) => ev(`ACT.start({});S.cash=1e8;S.nextFail=1e9;S.nextEvent=1e9;S.pops.fra.rgen=${g(router)};S.caches=[];compute()`);
|
||||
const boxes = (n, site = 'a') => `for(let i=0;i<${n};i++)S.caches.push({id:'c${site}'+i,city:'fra',net:'cfl',site:'${site}'});`;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue