Repository navigation
Description
Found by variant analysis during /cso --diff on #2533. Out of scope there (different workflow, pre-existing), filed rather than dropped.
What
.github/workflows/backend-unit-nightly.yml:527-534 builds the regression sticky comment by splicing a downloaded diff artifact straight into the body:
const md = fs.existsSync(l.diffPath) ? fs.readFileSync(l.diffPath, 'utf8') : '_diff artifact missing_';
return `**Seed \`${l.seed}\`**\n\n${md}`;
// ...
body = `${marker}\n⚠️ ...\n\n<details>\n<summary>...</summary>\n\n${sections}\n\n</details>\n\n...`;md is produced by the test job running pytest over the merged PR tree, so its content — test file names, test ids, assertion text — is chosen by the PR author. It is placed inside <details> but inside no code fence at all, so it renders as live markdown in a comment authored by github-actions[bot].
Why it matters
This is a public repo and fork PRs are evaluated. The impact is not RCE on the runner — it is that the bot's comment can be made to say something its author did not write (forged approval text, a link presented as the workflow's own output). The bot's voice is the only reason anyone trusts that comment.
Precedent / the fix that already exists
#2533 hit the identical class in scripts/ci/alembic-head-verdict.js and closed it two ways, both cheap and both reusable here:
fenced(text)— open the quoted block with one backtick more than the longest run inside it. CommonMark closes a fenced block on the first line whose backtick run is at least as long as the opening one, so a hard-coded```is escapable by any input containing one.isSafeRevisionId(id)— never interpolate an untrusted token into a command a human is invited to paste; degrade to a<placeholder>. The adjacent case here is--randomly-seed=${regressed[0].seed}in the "Reproduce locally" line — that one parses to a number today, so it is worth confirming rather than assuming.
integration-nightly.yml:432 splices ${diffMd} the same way and should be checked in the same pass.
Acceptance
- Author-controlled diff text is rendered inside a fence that its own content cannot close, in both nightlies.
- A test asserts the CommonMark property directly (no line inside the block carries a backtick run >= the opening fence) plus a control proving ordinary output still renders normally.
- Any token reaching a suggested shell command is allowlist-validated or proven non-textual.
Reference: docs/memory/requirements/infrastructure.md HEADW-011, and the 2026-09-07 entry in docs/memory/learnings.md.
Activity
test(2585): unwind the sys.modules registration through monkeypatch
fix(ci): a PR-authored test id cannot speak in the nightly bot's voice (