Commit bf02a40
Trust only our own comments for the state marker (#51)
`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.com/claude-code)
https://claude.ai/code/session_01JHvKryT4QUpHYdNq9YEQxX
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JHvKryT4QUpHYdNq9YEQxX)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: github-actions <github-actions@github.com>1 parent 9c0543e commit bf02a40
2 files changed
Lines changed: 28 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| |||
167 | 171 | | |
168 | 172 | | |
169 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
170 | 190 | | |
171 | 191 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
307 | 308 | | |
308 | 309 | | |
309 | 310 | | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
310 | 316 | | |
311 | 317 | | |
312 | 318 | | |
| |||
0 commit comments