Skip to content

Trust only our own comments for the state marker#51

Open
Phlogistique wants to merge 1 commit into
claude/fail-loud-resume-reads-3njvdxfrom
claude/marker-author-trust-3njvdx
Open

Trust only our own comments for the state marker#51
Phlogistique wants to merge 1 commit into
claude/fail-loud-resume-reads-3njvdxfrom
claude/marker-author-trust-3njvdx

Conversation

@Phlogistique

Copy link
Copy Markdown
Collaborator

read_state_marker accepted a marker from any comment, so on a public repo anyone able to comment could plant one; if its base= matched, the resume would merge an attacker-chosen commit (fork-pushed objects are reachable by hash in the repo network) into the branch and push it with the action's token. Benign variant: a quote-reply of an old conflict comment resurrects a stale marker, since HTML comments survive quoting and the newest marker wins.

Fix: filter comments to viewerDidAuthor — those posted with the same token the action runs under — which needs no configured identity. The resume test's gh mock rejects comment queries without that filter. Caveat: if the repo switches tokens (e.g. GITHUB_TOKEN → App) while a PR sits in conflict, the old marker is no longer "ours" and the resume takes the safe abandon path.

Also rejects markers with missing fields instead of passing empty values to git (a marker missing squash= used to crash on update-ref and strand the PR under the label); new scenario E covers it.

Stacked on #50 (same function).

🤖 Generated with Claude Code

https://claude.ai/code/session_01JHvKryT4QUpHYdNq9YEQxX


Generated by Claude Code

read_state_marker accepted a marker from any comment, so anyone able to
comment on a public repo could plant one; if its base matched, the
resume would merge an attacker-chosen commit (fork-pushed objects are
reachable by hash) into the branch and push it with the action's token.
A quote-reply of an old conflict comment could likewise resurrect a
stale marker, since HTML comments survive quoting and the newest marker
wins. Filter the comments to viewerDidAuthor, i.e. those posted with
the same token the action runs under.

Also reject markers with missing fields instead of passing empty values
to git: a marker missing squash= used to crash the run on update-ref
and strand the PR under the label.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01JHvKryT4QUpHYdNq9YEQxX
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