fix(tests): R4.9 security gate findings: serve.mjs refuses an empty or unspecified --host (an unset FAUNOSTEO_DEV_HOST bound every interface); report-compare reads at most the 50 MiB cap + 1 byte after its size check; recettes source dev-env.sh first

This commit is contained in:
bchanot committed 2026-10-20 21:16:48 +02:00
1 parent 24e05cecd5
commit 80cc261c24
4 files changed
+18 -4

No files matched your search

+6
View File
@@ -27,6 +27,7 @@ import { parseArgs } from 'node:util'
import { DIST_DIR, HARNESS_DIR, REPO_ROOT } from './lib/paths.mjs'
const HOST = '127.0.0.1'
const UNSPECIFIED_HOSTS = new Set(['', '0.0.0.0', '::', '::0', '[::]'])
const WASM_KEYWORD = "'wasm-unsafe-eval'"
const REPORT_PATH = '/__csp-report'
const MAX_REPORT_BYTES = 64 * 1024
@@ -220,6 +221,11 @@ async function main() {
if (!['with', 'without'].includes(values.csp)) {
throw new Error('--csp is "with" or "without"')
}
// An empty or unspecified address would bind every interface (an unset
// FAUNOSTEO_DEV_HOST expands to ''): refused, the server never starts.
if (UNSPECIFIED_HOSTS.has(values.host.trim())) {
throw new Error(`--host must name one address, not "${values.host}"`)
}
const server = await startServer({
port: Number(values.port),
csp: values.csp,