Repository navigation
Description
Problem Statement
.github/workflows/update-prs.yml runs devops pr update <PR> for any pull request comment whose body starts with /update or /sync (job if: at update-prs.yml:37-42). The job holds contents: write, pull-requests: write and issues: write (update-prs.yml:45-48) and never checks who commented; author_association appears nowhere under .github/, src/ or tests/. The repository is public, so anyone with a GitHub account can make the workflow update any open pull request's branch and spend Actions minutes. The file has not changed since v0.2.20 (git log --oneline -- .github/workflows/update-prs.yml shows only c5b8989), so nothing of this item is delivered.
The comment path interpolates only numeric or repository-controlled values into run: (github.event.comment.id at line 74, github.repository at lines 75 and 83, github.event_name at line 82, github.event.issue.number at line 86, github.ref_name at line 108), so there is no script injection today. The workflow_dispatch inputs, however, are interpolated straight into the run: script with ${{ }} (dry_run at line 91, pr_number at line 94, base_branch at line 95). Only people with write access can reach workflow_dispatch, so this is a hardening gap rather than an exploitable one, but uv run actionlint (ci.yml:65-66, the actionlint row of devops ci at src/devops_cli/commands/ci.py:436-440) does not flag it, and the workflow contract test planned by #697 (docs/agent/tasks/task-697-*.md:16, which names update-prs.yml:74-86 as the violation) and the zizmor template-injection rule #861 plans to enforce (docs/ROADMAP.md:1206, "report-only until the five sites move their GitHub Actions expressions into env:") both fail on any expression inside run:.
Nothing in src/ posts /update or /sync comments (grep -rnE "[\"' ]/(update|sync)\b" src/devops_cli matches nothing; the bare substrings match only Argo /sync API URLs and the pulls/{n}/update-branch endpoint), so restricting the comment trigger breaks no in-repo caller.
This is step 1 of the required-checks sequence (owner decision D3). It lands before update-prs.yml is given any privilege beyond what it holds today: #984 (D3 step 2) then adds actions: write to this job and makes it dispatch ci.yml, and #842 (D3 steps 3-5) confirms that live and turns the required checks on.
Proposed Solution
One pull request that changes only .github/workflows/update-prs.yml, one new test module, the task file and a changelog fragment:
- Collaborator guard. Extend the job-level
if:(update-prs.yml:37-42) so theissue_commentbranch also requirescontains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association). The guard lives in the jobif:, so an unauthorized comment produces a skipped job and no runner time; there is no reply or reaction to it. Thepushandworkflow_dispatchbranches of the condition are untouched. - No expressions inside
run:. Move every${{ }}that is currently inside arun:block ofupdate-prs.ymlto the step'senv:and read it as a shell variable, following the pattern already used bycleanup-devcontainer.yml:44-52(INPUT_PR_NUMBER: ${{ github.event.inputs.pr_number }}inenv:at line 46, then"$INPUT_PR_NUMBER"inrun:at line 52). That covers the three dispatch inputs (lines 91, 94, 95) and the six repository-controlled values (lines 74, 75, 82, 83, 86, 108).GH_TOKEN(lines 72, 80) and theconcurrency.groupexpression (line 30) are already outsiderun:and stay as they are. The shell logic ([ "$DRY_RUN" = "true" ],-ntests, argument arrays) does not change, so push and dispatch behaviour is identical. The fouruv run devops pr updateinvocations stay one-line calls, which is the shape feat(ci):devops pr update --dispatch-cistarts ci.yml on each branch it updates, and only update-prs.yml may holdactions: write#984 relies on when it appends--dispatch-cito each. - Contract test. Add
tests/test_workflow_contracts.py(the module name feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697 and fix(github): supply-chain claims made true — live Dependabot, zizmor and workflow invocation contracts #861 already cite, and the one feat(ci):devops pr update --dispatch-cistarts ci.yml on each branch it updates, and only update-prs.yml may holdactions: write#984 extends with itspermissionsand--dispatch-ciassertions; it starts with these assertions and imports nothing beyond PyYAML andpathlib, like the workflow tests attests/test_ci.py:538-628):- the
update-pull-requestsjobif:referencesgithub.event.comment.author_associationand each ofOWNER,MEMBER,COLLABORATOR, and still containsgithub.event_name == 'push'andgithub.event_name == 'workflow_dispatch'; - no
run:value in any step ofupdate-prs.ymlcontains the substring${{; - a mutation case for each: the first assertion fails on the workflow with the
author_associationclause removed, the second fails when${{ github.event.inputs.pr_number }}is put back into arun:string.
- the
- Changelog fragment
changelog.d/754.mdunder### Security(house style perchangelog.d/README.md), and the task filedocs/agent/tasks/task-754-collaborators-only-trigger-pr-updates.mdwritten as Done in the delivering commit.
Scope
- Files changed:
.github/workflows/update-prs.yml,tests/test_workflow_contracts.py(new),docs/agent/tasks/task-754-*.md(new),changelog.d/754.md(new). - Allowed associations:
OWNER,MEMBER,COLLABORATOR(from the original body). The repository is user-owned, soMEMBERnever matches today; it is harmless and keeps the guard correct if the repository moves to an organization. Any account without write access, including bots, is excluded. - The
permissions:block is not widened here;actions: writeis feat(ci):devops pr update --dispatch-cistarts ci.yml on each branch it updates, and only update-prs.yml may holdactions: write#984's change. - Effort: low. Value: high.
Key Questions
All answered; none open.
- Which associations may trigger the comment path? Answered in the body:
OWNER,MEMBER,COLLABORATOR.CONTRIBUTOR,FIRST_TIMER,FIRST_TIME_CONTRIBUTORandNONEare excluded. - Where does the guard live, and does an unauthorized comment get feedback? Settled by the deliverable wording ("the comment trigger also requires") and the problem statement (the item exists so untrusted comments spend no Actions minutes): the job-level
if:, so the job is skipped and nothing runs, posts or reacts. A feedback job would need a run and a token, which is what the item removes. - Do all
${{ }}insiderun:move toenv:, or only the three dispatch inputs? Settled: all nine. The placement comment's own rationale (feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697's contract test fails on any expression insiderun:), the task-697 file (:16, namingupdate-prs.yml:74-86as the violation) and fix(github): supply-chain claims made true — live Dependabot, zizmor and workflow invocation contracts #861's zizmor plan (docs/ROADMAP.md:1206) all treat these lines as to be cleared; it is the same file, the same mechanism and a few more lines, with no behaviour change, and it means feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697/fix(github): supply-chain claims made true — live Dependabot, zizmor and workflow invocation contracts #861 never touch this workflow again. - Where does the contract test live? Settled: a new
tests/test_workflow_contracts.py. Both feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697 and fix(github): supply-chain claims made true — live Dependabot, zizmor and workflow invocation contracts #861 name that module and feat(ci):devops pr update --dispatch-cistarts ci.yml on each branch it updates, and only update-prs.yml may holdactions: write#984 adds its assertions to it, so creating it here avoids a later move, and it keeps this PR out oftests/test_ci.py, which refactor(ci): github ci runs the gate throughdevops cifrom one check table #843 (v0.2.26) is adding itsci.ymlparity test to. - Does
pushorworkflow_dispatchbehaviour change? Answered in the body: no. Restated in the acceptance criteria. - Does this item wait for a privileged token or dispatch route? Answered by owner decision D3 and the Q2 split of chore(github): required CI checks bind merges into release and main, and ADR 0004 records the verification policy #842: no, this lands first; feat(ci):
devops pr update --dispatch-cistarts ci.yml on each branch it updates, and only update-prs.yml may holdactions: write#984 (D3 step 2,actions: writeanddevops pr update --dispatch-ci) editsupdate-prs.ymlafterwards, and chore(github): required CI checks bind merges into release and main, and ADR 0004 records the verification policy #842 (steps 3-5) follows feat(ci):devops pr update --dispatch-cistarts ci.yml on each branch it updates, and only update-prs.yml may holdactions: write#984.
Acceptance Criteria
-
uv run pytest tests/test_workflow_contracts.py -qpasses. The module parses.github/workflows/update-prs.ymlwith PyYAML and asserts theupdate-pull-requestsjobif:referencesgithub.event.comment.author_association,OWNER,MEMBERandCOLLABORATOR, and still containsgithub.event_name == 'push'andgithub.event_name == 'workflow_dispatch'. - The same module asserts that no
run:value in any step ofupdate-prs.ymlcontains${{. After the change,grep -n '\${{' .github/workflows/update-prs.ymlmatches onlyconcurrency.group(line 30) andenv:value lines (the jobif:and theAcknowledge comment triggerstepif:, line 70 at HEAD, contain no${{). - The module's two mutation cases pass: removing the
author_associationclause from the parsed condition makes the guard assertion fail, and putting${{ github.event.inputs.pr_number }}back into arun:string makes the no-expression assertion fail. -
uv run actionlintexits 0 on the changed workflow. -
uv run devops cipasses offline; the new tests spawn no process and open no socket (thetests/conftest.py:99network guard stays silent), anduv run pytest --durations=5 tests/test_workflow_contracts.pyshows each test under 1 s. -
git diff --stat main...HEADlists only.github/workflows/update-prs.yml,tests/test_workflow_contracts.py,docs/agent/tasks/task-754-*.mdandchangelog.d/754.md;CHANGELOG.mdanddocs/ROADMAP.mdare untouched (devops pr check-readinessblocks either on arelease/*base,src/devops_cli/commands/pr.py:1648-1668). -
git diffofupdate-prs.ymlchanges no character of thepushorworkflow_dispatchbranches of the jobif:; theon:block, thepermissions:block (contents,pull-requests,issues; noactions:key) and the step order are unchanged, andgrep -c 'uv run devops pr update' .github/workflows/update-prs.ymlstill prints 4. - Pending a person: after merge, comment
/updateon an open PR from the owner account, then rungh run list --workflow update-prs.yml --limit 3and see a completed run and the rocket reaction on the comment. When an account without write access next comments/updateor/syncon a PR, the Actions tab lists that run as skipped. GitHub computesauthor_associationserver-side, so no offline test exercises the live guard.
Out of Scope
- Adding
actions: writetoupdate-prs.ymlor dispatchingci.ymlfrom it (feat(ci):devops pr update --dispatch-cistarts ci.yml on each branch it updates, and only update-prs.yml may holdactions: write#984, D3 step 2), and the live confirmation, required checks, branch-protection cleanup and ADR 0004 (chore(github): required CI checks bind merges into release and main, and ADR 0004 records the verification policy #842, D3 steps 3-5). - A general workflow contract test across all workflows, zizmor, and
release.yml:62(VERSION="${{ github.event.inputs.version }}"), which has the same${{ }}-in-run:shape (feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697 prerequisite, fix(github): supply-chain claims made true — live Dependabot, zizmor and workflow invocation contracts #861 in v0.2.28). - Restricting
workflow_dispatchfurther; write access already gates it. - Changing which comment bodies trigger the workflow or adding new slash commands.
- Any change to
devops pr update(src/devops_cli/commands/pr.py:2035); the--dispatch-cioption is feat(ci):devops pr update --dispatch-cistarts ci.yml on each branch it updates, and only update-prs.yml may holdactions: write#984's.
Dependencies
- Depends on nothing; this item lands first in the D3 sequence.
- feat(ci):
devops pr update --dispatch-cistarts ci.yml on each branch it updates, and only update-prs.yml may holdactions: write#984 (v0.2.27) depends on this item: D3 step 2 addsactions: writeto the same job and--dispatch-cito the same fourrun:lines, and extendstests/test_workflow_contracts.py, so fix(ci): only collaborators can trigger pr updates with/updateor/synccomments #754 must merge first; feat(ci):devops pr update --dispatch-cistarts ci.yml on each branch it updates, and only update-prs.yml may holdactions: write#984 also depends on refactor(ci): github ci runs the gate throughdevops cifrom one check table #843 (v0.2.26). - chore(github): required CI checks bind merges into release and main, and ADR 0004 records the verification policy #842 (v0.2.27) depends on this item and on feat(ci):
devops pr update --dispatch-cistarts ci.yml on each branch it updates, and only update-prs.yml may holdactions: write#984: steps 3-5 verify feat(ci):devops pr update --dispatch-cistarts ci.yml on each branch it updates, and only update-prs.yml may holdactions: write#984's dispatch live and turn the required checks on, so the order is fixed: fix(ci): only collaborators can trigger pr updates with/updateor/synccomments #754, then feat(ci):devops pr update --dispatch-cistarts ci.yml on each branch it updates, and only update-prs.yml may holdactions: write#984, then chore(github): required CI checks bind merges into release and main, and ADR 0004 records the verification policy #842. - No other v0.2.26 or v0.2.27 item edits
update-prs.yml. - refactor(ci): github ci runs the gate through
devops cifrom one check table #843 (v0.2.26) is related, not a dependency: it adds its parity test totests/test_ci.py, which this item does not touch. - feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697 (task file
Status: Backlog, roadmap leftover atdocs/ROADMAP.md:637) and fix(github): supply-chain claims made true — live Dependabot, zizmor and workflow invocation contracts #861 (v0.2.28,docs/ROADMAP.md:1206) are related, not dependencies: both plan to extendtests/test_workflow_contracts.py, which this item creates.
Readiness check (2026-10-04)
Checked at the release/v0.2.26 tip (b61e5a0). update-prs.yml is unchanged (its history is still only c5b8989), so every update-prs.yml line, the job if: (:37-42) and the nine ${{ }} sites inside run: hold. tests/test_workflow_contracts.py does not exist yet. Corrections:
- refactor(ci): github ci runs the gate through
devops cifrom one check table #843 merged (v0.2.26).ci.ymlno longer has its ownuv run actionlintstep (it was:65-66). actionlint now runs as a row ofdevops ci(src/devops_cli/commands/ci.py:438-443), insideci.yml:43(uv run devops ci --check --no-cache --skip test,outdated). feat(ci):devops pr update --dispatch-cistarts ci.yml on each branch it updates, and only update-prs.yml may holdactions: write#984's dependency on refactor(ci): github ci runs the gate throughdevops cifrom one check table #843 is now satisfied. docs/ROADMAP.mdwas regenerated. The quoted "report-only until the five sites ..." line (:1206) is gone. fix(github): supply-chain claims made true — live Dependabot, zizmor and workflow invocation contracts #861 (open, v0.2.28) is now atdocs/ROADMAP.md:119, and its body still names the template-injection sites atupdate-prs.yml:91-108. feat(github): defect prs carry their hardening readiness blocker and post-merge audit #697 (open, no milestone) is at:129.docs/agent/tasks/task-697-*.md:16still namesupdate-prs.yml:74-86.- Moved lines:
- The PyYAML workflow tests in
tests/test_ci.pynow start at:575. - The release-file readiness guard is
_leaves_release_files_to_the_cutatsrc/devops_cli/commands/pr.py:1660-1680, replacing:1648-1668. devops pr updateisupdate_pratpr.py:2105-2106, replacing:2035.
- The PyYAML workflow tests in
The acceptance criteria are unchanged. The item agrees with the rules in force: offline tests, a changelog.d fragment, and one PR that closes #754 only.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
chore(docs): record roadmap service decisions and the machine-account…
dan-petty commentedon Oct 1, 2026
Placement (2026-10-01): v0.2.27. Value High, Effort Low. Not Ready yet.
Checked against
release/v0.2.24at d38251e. What stops it being Ready:${{ }}dispatch inputs in run:.feat(release): v0.2.24 (#905)
fix(ci): only collaborators can trigger pr updates with /update or /s…
dan-petty-bot commentedon Oct 5, 2026
What changed
#1191, merged into
release/v0.2.27as 6329396.4 file(s) changed.
How it was verified
Check runs at e907e90:
Acceptance Criteria of
docs/agent/tasks/task-754-collaborators-only-trigger-pr-updates.md:uv run pytest tests/test_workflow_contracts.py -qpasses, verifying that theupdate-pull-requestsjob condition requiresgithub.event.comment.author_associationmatchingOWNER,MEMBER, orCOLLABORATOR, while preservingpushandworkflow_dispatchevents.update-prs.ymlinterpolates expressions insiderun:blocks, with occurrences restricted toconcurrency.groupand stepenv:variables.run:blocks causes immediate test failure.uv run actionlintexits 0 on.github/workflows/update-prs.yml.uv run devops cipasses offline with 100% green status across all quality gates.git diffagainst base branch lists only.github/workflows/update-prs.yml,tests/test_workflow_contracts.py,docs/agent/tasks/task-754-collaborators-only-trigger-pr-updates.md, andchangelog.d/754.md.update-prs.ymlpreserves the 4uv run devops pr updateinvocations, step order, and minimal permissions./updateon an open PR from the owner account, then rungh run list --workflow update-prs.yml --limit 3and see a completed run and the rocket reaction on the comment. When an account without write access next comments/updateor/syncon a PR, the Actions tab lists that run as skipped.feat(release): v0.2.27 (#1257)