Skip to content

ci: grant issues: write to the reusable build workflow - #4

Merged
tehw0lf merged 2 commits into
mainfrom
ci/3-grant-issues-write
Nov 17, 2026
Merged

tehw0lf merged 2 commits into
mainfrom
ci/3-grant-issues-write

Conversation

@tehw0lf

@tehw0lf tehw0lf commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Closes #3

Plan: #3 (comment)

Why

build_and_publish in .github/workflows/build.yml calls the reusable build-test-publish.yml, which calls security-scan-source.yml. That workflow has a failure_issue job declaring issues: write. GitHub checks a called workflow's requested permissions against the caller's grant at startup, before any if, and the caller's permissions: block had no issues entry. No failing run was observed; the cause follows from the upstream code and GitHub's permission model.

What

  • .github/workflows/build.yml: add issues: write to the job's permissions: block, with a comment.
  • pyproject.toml / uv.lock: patch bump 0.2.0 -> 0.2.1 (separate commit). No root version scripts apply (uv project).
  • publish.yml is unchanged: it calls no reusable workflow.

Verification

uv sync, uv run ruff check, uv run ruff format --check, uv run mypy, uv run ./scripts/fetch-conformance.sh, pytest on Python 3.11 and 3.14 (201 passed each), uv build: all exit 0. The commands are those of the Build caller in build.yml.

Not verified

That a run without the change fails at startup (not reproduced). The PR's own Build run is the check that it starts and passes.

@tehw0lf

tehw0lf commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

Independent local review

[pr-review] verdict, written by the pr-reviewer agent

Reviewed head: 44391f1

Verdict: mergeable

Blocking: 0 · Fix in PR: 0 · Follow-up: 0

Blocking: none

Fix in PR: none

Follow-up: none

What was checked
  • Base and head. The review was made against base main; the base was the same at the start and right before writing the verdict. The local checkout is on the reviewed head, its tree is clean, and the PR branch sits directly on the current tip of main.
  • Diff and commits. Two commits: 64e0470 adds issues: write (with a comment) to the job-level permissions: block of build_and_publish in .github/workflows/build.yml; 44391f1 bumps pyproject.toml from 0.2.0 to 0.2.1 and updates uv.lock. Nothing else is touched, which matches the description. In uv.lock, besides the yaft entry moving to 0.2.1, the lockfile revision moves from 3 to 5. That comes from running uv lock with a current uv: applying the same version bump to the base tree in a scratch copy and running uv lock gives a uv.lock byte-identical to the head's. The reusable test-and-build.yml installs uv through astral-sh/setup-uv with no version pin, and the repository sets no required-version, so CI uses a current uv.
  • Root cause. I read the upstream code of tehw0lf/workflows on main, which build.yml references. build-test-publish.yml calls security-scan-source.yml from its security_scan_source job. That workflow has a failure_issue job that declares permissions: issues: write, and its own open_failure_issue input description says callers must grant issues: write whatever the input's value. The caller's block on the base had no issues entry, so it granted the nested job less than it asks for. The change adds exactly that grant. It fixes the cause and does not work around a symptom.
  • Scope of the new grant. I listed every job in the reusable workflows this caller can reach: build-test-publish.yml, lint.yml, security-scan-source.yml, test-and-build.yml, security-scan-artifacts.yml, set-git-tag.yml, release-github.yml, summarize-workflow.yml, publish-python-libraries.yml and npm-audit-autofix.yml. Every leaf job declares its own permissions:, and the only one that asks for issues is failure_issue. The new grant therefore widens no other job's token. With the change, every permission scope declared anywhere in the upstream workflows is covered by the caller's block.
  • Description claims. publish.yml calls no reusable workflow (job-level uses: is absent; it only uses actions) and is unchanged: confirmed. The failure_issue job only runs on schedule/workflow_dispatch, and build.yml triggers only on push/pull_request, so the job will not run from here, and the grant is needed only so the run can start: confirmed from the code. 0.2.1 is not yet a published release of yaft on PyPI, so publish.yml will not collide after the merge.
  • Validation in a scratch copy of the head, with its own environment created from the head's uv.lock: uv sync, uv run ruff check, uv run ruff format --check, uv run mypy, ./scripts/fetch-conformance.sh, uv run --python 3.11 pytest and uv run --python 3.14 pytest (201 passed each, matching the description), and uv build (builds yaft-0.2.1 sdist and wheel). All exit 0. actionlint on .github/workflows/build.yml exits 0, and the parsed permissions: mapping contains issues: write.
  • Tests. The PR adds no tests, and none can cover a caller's workflow permission grant. The plan says so too.
  • PR comments and reviews: none. I read the CI state of the head but do not restate it here.
Not covered
  • That a Build run without the change fails at startup. Showing it would need a run on GitHub without the grant. The description lists this as not verified too.
  • That a uv older than the one that wrote lockfile revision = 5 still reads the updated uv.lock. I did not try an older uv. CI installs an unpinned current uv.
  • build.yml references tehw0lf/workflows at @main, so the upstream code reviewed here is whatever main held during the review.

@tehw0lf

tehw0lf commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

[work-issue] stop marker, written by the issue-worker agent

The review of this head is clean, but the required check GitGuardian does not appear as a required check on the head, so the merge waits for the next run.

@tehw0lf
tehw0lf merged commit b323986 into main Nov 17, 2026
24 checks passed
@tehw0lf
tehw0lf deleted the ci/3-grant-issues-write branch November 17, 2026 20:36
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.

Grant issues: write to callers of the reusable security scan

1 participant