Skip to content

session-end-hook.sh: unextended dash-guard lets --dry reach save-session.sh via SessionEnd session_id #600

Closed

Description

@fdaviddpt

Filed by the release gate 3 audit of v0.28.0..HEAD (round 1), ahead of tagging v0.29.0.

Ranked splices per the ranking table (files, does not block): a value reaches a subprocess argv where the callee's option parser decides what it means.

Commit a07f08e (#576) added a leading-dash rejection so nothing option-shaped can reach save-session.sh's argv, but only at one of the three call sites. Its own comment already says the sibling guard does not close this, and it does not:

scripts/session-end-hook.sh:131-133 uses the unextended guard:

case "$STDIN_SESSION_ID" in
    ''|.|..|*[!A-Za-z0-9._-]*) STDIN_SESSION_ID="" ;;
esac
...
bash "$SAVE_SCRIPT" "$STDIN_SESSION_ID" --force

scripts/save-session.sh:127-132 reads a literal --dry as a flag from any position.

Effect: a session_id of exactly --dry on the SessionEnd payload turns the session's last-chance flush into a dry-run preview -- no summary written, position not advanced, and the log line reads like an ordinary run.

Exercised (not reasoned): lifted both fragments into a scratch harness and ran them. --dry -> DRY_RUN=true; a real UUID -> SESSION_ID=<uuid>, DRY_RUN=false; ../etc and x;y -> emptied by the guard. --force also survives this guard but is inert at this call site since it already passes --force unconditionally.

Open question the audit could not close: whether any host can actually emit a session_id the operator does not control. scripts/post-tool-hook.sh:893 is closed by a separate existence check (STDIN_SESSION_ID_TRUSTED requires the id to name a real transcript) -- reasoned from reading post-tool-hook.sh:584-589, not observed to fire.

Fix: add -* to the case pattern at session-end-hook.sh:132, exactly as #576 did at its own call site.

[AI-generated]

Activity

  1. added
    bug
    priority:medium
    filed-by-loop
    cohort-7
    lane-capture
    on Sep 6, 2026
  2. self-assigned this
    on Sep 6, 2026
  3. removed their assignment
    on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcohort-7filed-by-looplane-capturepriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions