Files
stack/agents/darkwing/work/queue-74-review/r2/mutants.sh
T
jason.woltjeandClaude Opus 5.5 3a2b051736 review(74): Darkwing round 2 packet, approve (#1568 comment 27486)
Round 2 candidate 17b6d7f6 on 17ea0dbc. 22 of 23 mutants killed, joined-value
equivalent; probes cover repeated Host, proxy Host, HEAD and absolute-form.
r1/ holds the round 1 findings sent to Dewey in place of a verdict.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-11 18:30:48 -05:00

49 lines
3.9 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Darkwing's own row 74 mutants, aimed at sites Dewey's 22 don't cover. Each edits one source file
# in the review worktree, runs preview.test.mjs (or serve.test.mjs), then restores the file from
# the worktree index, which holds the candidate.
export TMPDIR=~/darkwing-scratch/rv74r2/tmp
cd ~/darkwing-scratch/rv74r2/wt
M=~/darkwing-scratch/rv59/mut.mjs
S=packages/webui/src/serve.mjs; C=packages/webui/src/cli.mjs
PT=packages/webui/tests/preview.test.mjs; ST=packages/webui/tests/serve.test.mjs
run() { # name file from to test
node $M "$2" "$3" "$4" || { echo "$1: MUTATION DID NOT APPLY"; return; }
env -u NODE_TEST_CONTEXT node --test --test-timeout=30000 "$5" > $TMPDIR/mut-$1.log 2>&1
echo "$1: rc=$? $(grep -E '^ℹ (pass|fail) ' $TMPDIR/mut-$1.log | tr '\n' ' ')"
grep -E '^✖ ' $TMPDIR/mut-$1.log | sed 's/ ([0-9.]*ms)$//; s/^/ /' | sort -u | head -4
git checkout -q -- "$2"
}
run head-unsigned $S ' if (named) {
// One value' ' if (named && req.method !== '"'HEAD'"') {
// One value' $PT
run unsigned-write-403 $S ' if (named) {
// One value' ' if (named && (req.method === '"'GET'"' || req.method === '"'HEAD'"')) {
// One value' $PT
run head-refused $S "req.method !== 'GET' && req.method !== 'HEAD') return json(res, 403" "req.method !== 'GET') return json(res, 403" $PT
run origin-skip-named $S "if (req.headers.origin && req.headers.origin !== (named ?" "if (req.headers.origin && !named && req.headers.origin !== (named ?" $PT
run single-label-host $S '(?:[a-z0-9-]{0,61}[a-z0-9])?)+$/;' '(?:[a-z0-9-]{0,61}[a-z0-9])?)*$/;' $PT
run user-space $S 'const USER = /^[\x21-\x2b' 'const USER = /^[\x20-\x2b' $PT
run user-no-limit $S '\x2d-\x7e]{1,256}$/;' '\x2d-\x7e]{1,}$/;' $PT
run origin-header-ok $S "['host', 'origin'].includes(header)" "['host'].includes(header)" $PT
run header-no-limit $S 'const HEADER = /^[a-z0-9][a-z0-9-]{0,63}$/;' 'const HEADER = /^[a-z0-9][a-z0-9-]*$/;' $PT
run empty-value-ok $S 'if (!values || values.length !== 1 || values[0] !== preview.user)' 'if (values && (values.length !== 1 || values[0] !== preview.user))' $PT
run joined-value $S 'const values = req.headersDistinct[preview.header];' 'const values = req.headers[preview.header] === undefined ? undefined : [req.headers[preview.header]];' $PT
run named-port-check $S ' if (!named) {
const authority' ' if (true) {
const authority' $PT
run noflags-readonly $S "if (preview !== null && req.method !== 'GET'" "if (req.method !== 'GET'" $ST
run cli-preview-before-check $C ' options.preview = previewOptions(preview);
' '' $PT
run cli-no-preview-line $C "\${busLine}\${previewLine}" "\${busLine}" $PT
run ip-host $S "if (!HOSTNAME.test(host) || isIP(host))" "if (!HOSTNAME.test(host))" $PT
run repeated-host-off $S "if ((req.headersDistinct.host?.length ?? 0) > 1) return" "if (false) return" $PT
run repeated-host-preview-only $S "if ((req.headersDistinct.host?.length ?? 0) > 1) return" "if (preview !== null && (req.headersDistinct.host?.length ?? 0) > 1) return" $PT
run repeated-host-after-named $S " if ((req.headersDistinct.host?.length ?? 0) > 1) return json(res, 400, { error: 'repeated Host refused' });
" "" $PT
run proxy-host-off $S "if (preview !== null && !named && req.headersDistinct[preview.header]) return" "if (false) return" $PT
run proxy-host-named-too $S "if (preview !== null && !named && req.headersDistinct[preview.header]) return" "if (preview !== null && req.headersDistinct[preview.header]) return" $PT
run proxy-host-loopback-only $S "if (preview !== null && !named && req.headersDistinct[preview.header]) return" "if (preview !== null && !named && /^(127\\.0\\.0\\.1)(:|$)/.test(req.headers.host ?? '') && req.headersDistinct[preview.header]) return" $PT
run proxy-host-empty-value $S "&& !named && req.headersDistinct[preview.header]) return" "&& !named && req.headers[preview.header]) return" $PT
git diff --quiet -- $S $C && echo "restored: sources match the candidate index" || echo "NOT RESTORED"