Skip to content

REMEMBER_BRANCH_CMD's stdout is substituted into the summarizer prompt unbounded -- a multi-line resolver writes at column 0 of the prompt #501

Closed

Description

@fdaviddpt

Found by the v0.25.0 release audit (round 1, dispatch token rel-fca064b6), class C, returned unranked. Ranked here by the maintainer before the round cap was applied: not blocking, no existing row fits, and no new row is earned -- see below.

Mechanism

REMEMBER_BRANCH_CMD's stdout becomes BRANCH in scripts/save-session.sh:448, and BRANCH is substituted into the summarizer prompt at pipeline/prompts.py:74:

.replace("{{BRANCH}}", branch)

No newline bound, no length bound, no sanitisation. Command substitution strips trailing newlines but preserves internal ones, so a resolver that emits more than one line writes arbitrary content at column 0 of the prompt the model then summarises into the memory header.

Why this is a footgun and not an injection

The auditor considered the forges row and rejected it, and the reasoning is what keeps this non-blocking: forges is about text somebody else wrote. Here the author is the operator who configured the resolver -- they are writing into their own prompt.

The one attacker-influenceable input to that resolver is $SESSION_ID, and the allowlist at scripts/session-end-hook.sh:128 confines it to [A-Za-z0-9._-]. The auditor exercised that allowlist: it cannot carry a newline. That is the fact separating this from a third-party injection, and it is the fact to re-check if either the allowlist or the resolver contract ever changes. See #500 for the related question of what shape that id can be.

Why no row

fails-to-preserve does not fit -- nothing is lost. misreports does not fit -- nothing misreports today; a multi-line branch produces a strange prompt, not a false claim. forges was rejected for the reason above. Unbounded operator-supplied text at a template seam is a shape the table does not cover, and one instance where the operator is the only author is not enough to earn a row. Filed unranked-as-ranked: not blocking, worth fixing, no new row.

What would settle it

Whether BRANCH should be bounded to a single line at the substitution seam. A first-line-only truncation, or a rejection with a logged WARNING, both fit this repo's existing convention -- #481's own resolver fall-through already logs a WARNING specifically so a fault does not silently read as the ordinary case, and this seam has no such guard.

Ranked

Unranked by the audit; ranked here as non-blocking with no row. Nothing about this held the v0.25.0 tag.

Platform

Not platform-specific -- string substitution. Read on macOS/arm64 (Darwin 24.3.0) against v0.24.0..HEAD at 53bd09b.

Activity

  1. fdaviddpt commented on Sep 1, 2026

    @fdaviddpt
    ContributorAuthor

    Correcting the rationale in this issue's body. The rank does not change -- non-blocking, no row -- but the stated reason was wrong and the next reader should not inherit it.

    I wrote that $SESSION_ID cannot carry a newline, and used that to argue the seam is an operator footgun rather than a third-party injection. The v0.25.0 release audit (round 2) pointed out that the value substituted at pipeline/prompts.py:74 is not $SESSION_ID at all -- it is CMD_BRANCH, the stdout of REMEMBER_BRANCH_CMD, and $(...) strips only trailing newlines. A two-line resolver therefore yields a BRANCH with an embedded newline. The sentence as written could be read as "the substituted value cannot contain a newline", which is false.

    The conclusion survives on the correct chain: the resolver is an executable the operator configured, so the author of any multi-line output is the operator. The only attacker-influenceable input reaching that resolver is $SESSION_ID, and that is where the [A-Za-z0-9._-] allowlist at scripts/session-end-hook.sh:128 does its work -- it bounds what a host can push into the resolver's argv, not what the resolver may emit. So forges still does not fit, and this stays non-blocking.

    Round 2 also traced BRANCH to its terminus and confirmed it does not reach column 0 of any receipt this loop parses -- it reaches the summarizer prompt; the model's output is what reaches a receipt, and that passes the FIRST_LINE entry-header validator.

    Two things to re-check together if either changes: this allowlist, and #500, which is about the shape a host can give that same id.

  2. added
    cohort-4
    priority:low
    on Sep 1, 2026
  3. self-assigned this
    on Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cohort-4priority:low

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions