Skip to content

ci: harden lane-line's error annotation against body-content injection - #637

Merged
brettheap merged 1 commit into
mainfrom
ci/lane-line-annotation-hardening
Sep 4, 2026
Merged

brettheap merged 1 commit into
mainfrom
ci/lane-line-annotation-hardening

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Lane: openxfactory-f2

What this is

Errata for the lane-line workflow (Amendment 1, Rule 8) already merged
here as PR #631 (b1d492a3). Copilot's automated review on the three
sibling adoption PRs — codexFactory
#190, xFactory
#231, openXwallet
#15 — flagged two
findings against the identical file those PRs vendored from this repo's
appendix. Both are TAKEN there and here.

Finding 1 — the ::error annotation interpolated untrusted body content

The original run: step built:

echo "::error title=lane-line::PR body must open with 'Lane: <name>' (lane-collision-protocol Rule 5). First non-empty line was: ${first:-<empty>}"

$first is the PR body's first non-empty line — untrusted input. GitHub
Actions workflow commands percent-decode their message payload (%0A,
%0D, %25), so a crafted body line could inject additional workflow
commands into the runner log via this annotation. Fix: the annotation
message is now fully static (no interpolation at all), and the offending
line is still surfaced — via a plain echo printed before the
annotation, not inside it:

echo "lane-line: first non-empty body line was: ${first:-<empty>}"
echo "::error title=lane-line::PR body must open with 'Lane: <name>' (lane-collision-protocol Rule 5)."

The plain echo is safe from the same class of issue because it is always
prefixed with "lane-line: first non-empty body line was: ", so the
printed line can never itself begin with :: regardless of $first's
content, and $first cannot contain an embedded newline (it is extracted
by sed -n '/[^[:space:]]/{p;q;}', which returns exactly one line).

The annotation still cites Rule 5 — that is deliberate, not a residual
bug: Rule 5 is the substantive convention this check enforces (the PR
body must open with Lane: <name>); Rule 8 is the enforcement mechanism
itself. The appendix text is unchanged on that point.

Finding 2 — the exemption comment misnamed the condition

The comment said "Bots are exempt by ACTOR", but the if: condition keys
on github.event.pull_request.user.type — the PR author, not the
workflow-run actor (which can differ, e.g. on synchronize pushed by a
human to a bot-opened PR, or vice versa). Reworded to say PR AUTHOR type
explicitly:

# Bots are exempt by PR AUTHOR type (`github.event.pull_request.user.type`),
# never by body. `gh pr list --json author` renders these as
# `app/dependabot`, `app/openxfactory`.

The if: condition itself is unchanged — only the comment now matches it.

Local verification

Re-ran the five local logic cases from PR #631's own verification, against
the patched run: script extracted verbatim (BODY set via environment,
exactly as the workflow invokes it):

Case BODY Expected Actual
(a) Lane: openxfactory-f2\n\n## x exit 0 exit 0 — lane-line OK: Lane: openxfactory-f2
(b) \nLane: repo-shape (second window) exit 0 exit 0 — lane-line OK: Lane: repo-shape (second window)
(c) ## What is proposed exit 1 exit 1 — plain-echo line, then static ::error
(d) (empty) exit 1 exit 1 — plain-echo line (<empty>), then static ::error
(e) Lane: Openxfactory_F2 exit 1 exit 1 — plain-echo line, then static ::error

All five match. python3 -c "import yaml; yaml.safe_load(open('.github/workflows/lane-line.yml'))"
also passed. lane-line PASSED on this PR's own head (this PR body opens
with Lane: openxfactory-f2), and PASSED on the re-pushed heads of all
three sibling PRs after the identical patch was applied there.

Byte identity note

This patch is applied identically to the copy already merged here (this
PR) and to the copies in the three sibling repos' open adoption PRs. The
appendix in ~/agents/protocols/lane-collision-protocol-amendment-1.md
is recorded by the orchestrating session as carrying this errata going
forward — this PR is the code-side landing of that correction in
openxFactory.

Adoption note

Unchanged from #631: this does not make lane-line required. That remains
Brett's console act.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KeBPLWRL4rhgRbmjP8Li41

Copilot review finding on the sibling adoption PRs (codexFactory #190,
xFactory #231, openXwallet #15): the ::error annotation interpolated the
untrusted PR-body first line ($first) directly into the workflow command
message, which GitHub Actions percent-decodes — a crafted body line could
inject additional workflow commands into the runner log. The annotation
is now fully static; the offending line is still surfaced, via a plain
echo before the annotation instead of inside it.

Also fixes the exemption comment: it said "bots are exempt by ACTOR" but
the condition keys on github.event.pull_request.user.type, the PR AUTHOR,
not the actor. Reworded to say PR AUTHOR type explicitly.

This is the appendix errata for lane-collision-protocol-amendment-1.md's
Rule 8 appendix, applied to the copy already merged here as #631
(b1d492a).

Lane: openxfactory-f2
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KeBPLWRL4rhgRbmjP8Li41
Copilot AI lite review requested due to automatic review settings September 4, 2026 02:17

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change correctly removes untrusted interpolation from workflow-command annotations while preserving safe diagnostics and does not introduce behavioral regressions.

Pull request overview

This PR hardens the lane-line GitHub Actions workflow against GitHub Actions workflow-command injection by ensuring that untrusted PR body content is never interpolated into an ::error annotation message.

Changes:

  • Removes interpolation of the first non-empty PR body line from the ::error workflow command message, making the annotation fully static.
  • Logs the offending first non-empty body line via a plain echo prior to emitting the ::error, preserving debuggability without command injection risk.
  • Updates the bot-exemption comment to accurately describe the condition as based on PR author type (github.event.pull_request.user.type).
File summaries
File Description
.github/workflows/lane-line.yml Makes the error annotation message static and adjusts logging/comment wording to avoid untrusted content interpolation.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-f2

Provenance for the admin merge. RULING for lane openxfactory-f2's PR #637 (head f071e223): Brett Heap, 2026-09-04 ~02:2xZ, in-session, verbatim: "roll out lane-line" — this PR carries the hardening Copilot required on the rollout PRs (static ::error annotation with the untrusted body line echoed separately; bot exemption described as PR-author type) back onto the copy already merged as #631, so all four repositories run the identical file (amendment errata reference = xFactory main after #231). Merge basis: all six checks SUCCESS on f071e223 — lane-line (on its own body), pytest-suite, wallet-validation, signed-execution-chain-gate, merge-master-approval, openreposhape-pin; zero review threads. --admin satisfies only the review-count rule. Squash merge at 2026-09-04T02:35Z. Session: https://claude.ai/code/session_013f11Yb8DF5FTL6NuV7xWYb

@brettheap
brettheap merged commit 21190cf into main Sep 4, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants