From 5c44b7c742c085bb42023b428c18b8136d40924f Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Fri, 2 Oct 2026 19:32:38 +0200 Subject: [PATCH] A console gate that skipped its own escaping invariant used to report success MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The markup-seed assertions are guarded by the seed values, and the seed values default to empty. Measured on this head, same seeded stack, driver only: with the seeds: 69 ok, 0 failed, exit 0 with SEED_MARKUP_* unset: 65 ok, 0 failed, exit 0 and the line "console check: all assertions passed" Four assertions were not there and the summary line is identical either way. The seeding script sets both today, so nothing is broken right now — what is broken is that nothing required them to be present, in the driver or in the Linux rehearsal, which already refuses a missing SEED_ERROR or SEED_EXPIRED_CIDR and says nothing about these two. The driver now names an absent seed instead of stepping around it, and the rehearsal refuses one the same way it refuses the other two. Teeth of the new guard, measured: the same unset run now gives 65 ok, 1 failed, exit 1, and the failure line carries the two empty values by name. Teeth of the invariant itself, re-measured rather than carried forward: reducing esc() to identity in the shipped page gives 7 failures, not the 6 this item originally counted — the filter-echo case was added after that number was taken — and the page title becomes XSS. Reverted; the tree carries no mutation. --- scripts/ci-linux-rehearsal.sh | 7 +++++++ scripts/console-check.cjs | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/scripts/ci-linux-rehearsal.sh b/scripts/ci-linux-rehearsal.sh index b4dec1d..4209cf2 100755 --- a/scripts/ci-linux-rehearsal.sh +++ b/scripts/ci-linux-rehearsal.sh @@ -179,6 +179,13 @@ if [ "$STAGE" = all ] || [ "$STAGE" = console ]; then # Empty here would make the expired-exemption assertion look at '' and fail, # which is the right outcome but the wrong reason, so it is named instead. [ -n "$SEED_EXPIRED_CIDR" ] || { echo 'console stage: no SEED_EXPIRED_CIDR in console-seed.env' >&2; console_status=1; } + # The escaping invariant is guarded inside the driver by these two values. + # Measured: unset, the driver prints 65 ok lines instead of 69, zero + # failures and "all assertions passed" — the invariant is gone and the + # summary line cannot tell. The driver now names it; the harness names it + # too, because a stage that silently drops four assertions is not a pass. + [ -n "$SEED_MARKUP_PATH" ] || { echo 'console stage: no SEED_MARKUP_PATH in console-seed.env' >&2; console_status=1; } + [ -n "$SEED_MARKUP_BLOCK" ] || { echo 'console stage: no SEED_MARKUP_BLOCK in console-seed.env' >&2; console_status=1; } fi if [ "$console_status" -eq 0 ]; then diff --git a/scripts/console-check.cjs b/scripts/console-check.cjs index 32a308e..a94431d 100644 --- a/scripts/console-check.cjs +++ b/scripts/console-check.cjs @@ -173,6 +173,15 @@ const rgb = (s) => s.match(/\d+/g).slice(0, 3).map(Number); // whatever a visitor asked for and the reason on a block is a form field, so // the assertion is not "the page looks fine" — it is "nothing from the API // became an element, and the markup is still visible as text". + // A seed the driver was never given is not a pass — it is an assertion that did + // not run. Measured on this head: with SEED_MARKUP_PATH and SEED_MARKUP_BLOCK + // unset the driver prints 65 ok lines instead of 69, zero failures, and "all + // assertions passed". The escaping invariant this gate exists for is simply + // gone, and the summary line cannot tell that from a gate that ran. So the + // absence is named, and the count moves: 69 -> 70. + check('the markup seeds the escaping invariant needs were given to the driver', + SEED_MARKUP_PATH !== '' && SEED_MARKUP_BLOCK !== '', + `SEED_MARKUP_PATH=${JSON.stringify(SEED_MARKUP_PATH)} SEED_MARKUP_BLOCK=${JSON.stringify(SEED_MARKUP_BLOCK)}`); if (SEED_MARKUP_PATH) { const decoded = decodeURIComponent(SEED_MARKUP_PATH); const title = await page.title();