Skip to content

fix(csharp-ci): restore with github.token instead of the bot PAT - #45

Merged
monsieurleberre merged 3 commits into
devfrom
fix/csharp-ci-github-token-restore
Oct 9, 2026
Merged

monsieurleberre merged 3 commits into
devfrom
fix/csharp-ci-github-token-restore

Conversation

@monsieurleberre

@monsieurleberre monsieurleberre commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Why

csharp-ci.yaml ran dotnet restore / dotnet pack with the org-admin peaceful-bot PAT (BOT_GITHUB_TOKEN) in the step env. Those steps execute pull-request-controlled MSBuild files (Directory.Build.props, nuget.config, targets), so any same-repo PR could exfiltrate the PAT. The private GitHub Packages feed is retired and every package is on nuget.org, so restore needs no credential at all.

What changed

  • csharp-ci.yaml: the Restore steps (build-and-test and pack) carry no GITHUB_TOKEN/GITHUB_USERNAME env. The actions/checkout steps use persist-credentials: false. BOT_GITHUB_TOKEN is no longer referenced by any step.
  • CHANGELOG [Unreleased] entry and README note updated: restore is credential-free and resolves from nuget.org; no package grants are needed. Contract-compatible (no input/output/secret change), so a v2.6.x/v2.7.0 cut that moves v2; the tag is the owner's to push.
  • Callers using secrets: inherit need no edit. BOT_GITHUB_TOKEN stays declared as optional and deprecated, so a caller naming it in an explicit secrets: block does not fail with "Invalid secret".
  • actionlint is clean on the changed workflows.

Ordering

Merge after https://github.com/peacefulstudio/dotnet-extensions-internal/pull/208 (dotnet-extensions-internal drops its peaceful NuGet source; it calls this workflow and would otherwise lose its restore credential).

https://claude.ai/code/session_01C8uJmZ2aaTMnWXHQKWJezu

Restore and pack authenticate to GitHub Packages with the job's github.token. BOT_GITHUB_TOKEN stays declared as optional and deprecated.

Claude-Session: https://claude.ai/code/session_01C8uJmZ2aaTMnWXHQKWJezu
Restore sets GITHUB_TOKEN only when the run is not a fork pull request, and the build-and-test and pack checkouts use persist-credentials: false, so fork-controlled MSBuild never sees a packages: read token. README and CHANGELOG say to grant package Actions access only to private consumers; public repos resolve from nuget.org.

Claude-Session: https://claude.ai/code/session_01C8uJmZ2aaTMnWXHQKWJezu
@monsieurleberre
monsieurleberre marked this pull request as ready for review October 9, 2026 10:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T11:11:45.986909Z e96a002 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

The private GitHub Packages feed is retired and every package resolves from
nuget.org, so the Restore steps carry no token and the jobs no longer need
packages: read.

Claude-Session: https://claude.ai/code/session_01C8uJmZ2aaTMnWXHQKWJezu

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5a7bf4f8f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/csharp-ci.yaml Outdated
Comment thread .github/workflows/csharp-ci.yaml Outdated
@monsieurleberre
monsieurleberre merged commit d629710 into dev Oct 9, 2026
2 checks passed
@monsieurleberre
monsieurleberre deleted the fix/csharp-ci-github-token-restore branch October 9, 2026 11:29
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