Skip to content

ci: restrict workflow token to read-only contents - #149

Merged
senrecep merged 1 commit into
mainfrom
ci/least-privilege-permissions
Oct 10, 2026
Merged

senrecep merged 1 commit into
mainfrom
ci/least-privilege-permissions

Conversation

@senrecep

Copy link
Copy Markdown
Owner

What / why

CodeQL actions/missing-workflow-permissions alerts #9 (publish.yml:16), #11 (build.yml:11), #12 (build.yml:64). Adds top-level permissions: contents: read to build.yml and publish.yml. Item C of #146 (no release).

Permission requirement per step

Step Needs
actions/checkout (build, aot, publish) contents: read
setup-dotnet, restore/build/test/pack/run/publish, apt-get none (no GITHUB_TOKEN)
codecov-action uses CODECOV_TOKEN secret, no GITHUB_TOKEN grant needed
build-and-publish-nugets.sh --parallel $NUGET_API_KEY NuGet API key secret only; script has no gh/git/GITHUB_TOKEN usage (grep verified)

So no job needs more than contents: read; no job-level grants added. No id-token/packages/releases usage exists.

Caller/callee

release-please.yml publish job already grants contents: read to the reusable publish.yml, which now requests exactly contents: read (callee cannot exceed caller): compatible. Tag-push trigger uses the top-level grant. release-please.yml and codeql.yml already declare permissions (unchanged). Secrets untouched.

Evidence

actionlint v1.7.12 (go run): clean, exit 0. publish.yml cannot be exercised without a release; reasoned from the steps above. This PR's build.yml run is the live check.

Behaviour change: workflow token read-only; nothing else.

Refs #146

🤖 Generated with Claude Code

Add top-level permissions: contents: read to build.yml and publish.yml,
resolving CodeQL actions/missing-workflow-permissions alerts.
No behaviour change for consumers; the workflow token is now read-only.

Refs #146

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@senrecep
senrecep merged commit 6ad33ad into main Oct 10, 2026
10 checks passed
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.

1 participant