ci: stop putting a fork's tree on the runner at all - #49
Conversation
PR #26 was the first real exercise of this workflow and it failed at checkout: Refusing to check out fork pull request code from a 'pull_request_target' workflow ... set 'allow-unsafe-pr-checkout: true' Not our logic -- authorise passed, timeline lookup and permission check both worked. actions/checkout added that input (default false) and now refuses the pattern this workflow was built on, which is the pattern behind most pwn-request reports because the next person adds a build step. Opting back in was available and defensible: tools here are restricted to reading and commenting, so there is no execution path today. Declined. 'No execution path' is an invariant someone has to keep re-establishing on every future edit of allowedTools, and not depending on that is what the guardrail is for. Today alone produced three guards that were silent no-ops. Removing the need is cheap here. A fork PR's unchanged files ARE the base repo's, which is already checked out at the root and readable, and gh pr diff carries the changed ones -- for a newly added file the diff is the whole file. On #26, 13 of 20 files are new, including the JS reimplementation of the security gate, so the diff contains essentially everything worth reviewing. Also pinned both actions to commits. This job holds a write-scoped token and an API credential; it was the only workflow left on floating tags.
Quorum review
Beyond the diff, the models made 12 read-only lookup(s) into the checkout at No new issues found in this diff. Usage
Reviewed |
ReviewWhat it does: Removes the fork-HEAD Assessment: sound, and a real improvement, not just a workaround.
Not verified: I don't have network access in this sandbox, so I could not confirm that the two pinned SHAs ( No other issues found. |
#26 was the first real exercise of this workflow, and it failed at checkout:
Not our logic —
authorisepassed, so the timeline lookup and the write-access checkboth worked.
actions/checkoutaddedallow-unsafe-pr-checkout(defaultfalse) and nowrefuses the pattern this workflow was built on. Reasonably: it's the shape behind most
"pwn request" reports, because the next person adds a build step.
Why not just opt in
It was available and defensible —
--allowedToolshere is reading and commenting only, sothere's no execution path today.
Declined, because "no execution path" is an invariant somebody has to keep re-establishing
on every future edit of that tools list, and not depending on that is precisely what the
guardrail is for. This repo produced three guards that were silent no-ops in the last two
days; I'd rather not add a fourth that depends on future me.
Removing the need turned out to be cheap
A fork PR's unchanged files are the base repo's — already checked out at the workspace
root, trusted, readable.
gh pr diffcarries the changed ones, and for a newly added filethe diff is the entire file.
On #26 that's not a theoretical trade: 13 of 20 files are new — the
.cmdwrappers, the.jshooks, including
hooks/validate-delegate-bash.js, a JavaScript reimplementation of thesecurity gate. The single highest-scrutiny file in the change is new, so it arrives in full.
What's actually lost: full content of modified files, where the reviewer now sees hunks
against a base it can read. Modest, and worth it.
Also
Both actions pinned to commits. This job holds a write-scoped token and an API credential and
was the only workflow left on floating tags — which is also how the behaviour changed under us
without a diff.
README updated: "checked out read-only into a subdirectory" → "never reaches the runner at
all". That sentence is a promise to contributors and it needed to stay true.
191 tests, validate passes. No plugin code touched.
@yuting0624 — separately, on #26 being likely
wontfix: worth deciding that before re-labelling. Thisruns a paid review on a 20-file change, and if the answer is already no, the useful reply is a
short one from you about scope, not a code review.