Skip to content

🏗️🔧:stop the workflows from keeping the token - #1889

Merged
openinf-commit-queue[bot] merged 1 commit into
livefrom
infra/workflow-token-hardening
Sep 7, 2026
Merged

openinf-commit-queue[bot] merged 1 commit into
livefrom
infra/workflow-token-hardening

Conversation

@DerekNonGeneric

@DerekNonGeneric DerekNonGeneric commented Sep 7, 2026 •

Copy link
Copy Markdown
Member

Ported from OpenINF/.github, where this is part of bccd6d2.

lint-and-test.yml named no permissions at all, so it inherited whatever the repository hands a workflow by default — for a repository that has not been narrowed, a write token, held for the length of an install and a lint run. Naming any permission drops the rest to none, so contents: read plus the pull-requests: read that paths-filter needs is the whole of what this workflow does.

Separately, actions/checkout leaves its token in .git/config unless told not to. Nothing downstream of any of these checkouts pushes, and no dependency is git-hosted, so the token is only sitting where pnpm install and everything after it could reach it.

The filter stays

OpenINF/.github retired its paths filter in the same series of changes. That reasoning does not transfer: its suite reads files, while this one builds a site and starts a JVM, so what filtering buys there and here is not the same number. Only the permissions and the checkout credential move across.

Wider than the change it is ported from

Deliberately, and worth a look. The upstream repository has two of these workflows; this one has four.

  • deploy.yml uploads an artifact and lets deploy-pages authenticate with its own id-token.
  • vendored-sync.yml talks to the API through GH_TOKEN rather than through git.

Neither needs the git credential either, and neither runs a git command that would want it. Hardening two of four and leaving the other two would be harder to explain than doing all of them — but if you would rather this stayed a literal port, the last two files are easy to drop.

How it was checked

verify.yaml and verify.spelling pass; no new failures across verify.all.

Summary by CodeRabbit

  • Chores
    • Improved automation security by limiting workflow permissions to required repository and pull request read access.
    • Prevented workflows from persisting GitHub credentials during repository checkout.
    • Deployment continues using its dedicated identity token.

Ported from OpenINF/.github, where this is part of bccd6d2.

lint-and-test.yml named no permissions at all, so it inherited whatever
the repository hands a workflow by default -- which for a repository
that has not been narrowed is a write token, held for the length of an
install and a lint run. Naming any permission drops the rest to none,
so `contents: read` plus the `pull-requests: read` that paths-filter
needs is the whole of what this workflow does.

The filter stays. The reasoning that retired it in OpenINF/.github does
not hold here: that suite reads files, while this one builds a site and
starts a JVM, so what filtering buys there and here is not the same
number.

Separately, actions/checkout leaves its token in .git/config unless
told not to. Nothing downstream of any of these four checkouts pushes,
and no dependency is git-hosted, so the token is only sitting where
`pnpm install` and everything after it could reach it.

Wider than the change it is ported from, and deliberately so: the
upstream repository has two of these workflows and this one has four.
deploy.yml uploads an artifact and lets deploy-pages authenticate with
its own id-token, and vendored-sync.yml talks to the API through
GH_TOKEN rather than through git, so neither needs the credential
either. Hardening two of four and leaving the other two would be
harder to explain than doing all of them.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Claude-Code:claude-opus-5
@netlify

netlify Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for gh-pages-openinf ready!

Name Link
🔨 Latest commit 8575413
🔍 Latest deploy log https://app.netlify.com/projects/gh-pages-openinf/deploys/6a9e292c0d2ff60008e0746d
😎 Deploy Preview https://deploy-preview-1889--gh-pages-openinf.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: f17d286b-4d46-416f-a4dd-4cd96915665a

📥 Commits

Reviewing files that changed from the base of the PR and between fa956d0 and 8575413.

📒 Files selected for processing (4)
  • .github/workflows/deploy.yml
  • .github/workflows/lint-and-test.yml
  • .github/workflows/pull-request-policy.yml
  • .github/workflows/vendored-sync.yml

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The workflows now restrict permissions and disable persisted Git credentials during checkout. Deployment continues to use the Pages action identity token.

Changes

Workflow security hardening

Layer / File(s) Summary
Restrict workflow permissions
.github/workflows/lint-and-test.yml
The lint and test workflow grants read-only access to repository contents and pull requests.
Disable persisted checkout credentials
.github/workflows/deploy.yml, .github/workflows/lint-and-test.yml, .github/workflows/pull-request-policy.yml, .github/workflows/vendored-sync.yml
Checkout steps no longer persist Git credentials in .git/config. Deployment comments identify the Pages action identity token as the credential source for artifact upload and deployment.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 85754

Workflow credentials are reduced and no longer retained in Git configuration; deployment and vendored-sync authentication paths remain supported. No merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: preventing workflows from persisting GitHub tokens. It is concise and related to the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch infra/workflow-token-hardening

Comment @coderabbitai help to get the list of available commands.

@DerekNonGeneric DerekNonGeneric added the 🚀 Status: Commit Queue Land this pull request when its checks pass label Sep 7, 2026
@openinf-commit-queue
openinf-commit-queue Bot merged commit 7e2a5b9 into live Sep 7, 2026
17 checks passed
@openinf-commit-queue openinf-commit-queue Bot removed the 🚀 Status: Commit Queue Land this pull request when its checks pass label Sep 7, 2026
@openinf-commit-queue
openinf-commit-queue Bot deleted the infra/workflow-token-hardening branch September 7, 2026 04:01
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