Skip to content

ci: declare contents:read on sync-openapi workflow#1663

Open
arpitjain099 wants to merge 1 commit into
NVIDIA:mainfrom
arpitjain099:chore/sync-openapi-permissions
Open

ci: declare contents:read on sync-openapi workflow#1663
arpitjain099 wants to merge 1 commit into
NVIDIA:mainfrom
arpitjain099:chore/sync-openapi-permissions

Conversation

@arpitjain099
Copy link
Copy Markdown

The sync-openapi workflow runs fern-api/sync-openapi@8e936a4... with FERN_OPENAPI_SYNC_TOKEN, a PAT scoped for the Fern sync. The actions/checkout step also uses that same PAT, and the git push origin --delete fern/update-api reuses the credentials persisted by checkout. The implicit workflow GITHUB_TOKEN is therefore unused for any write path.

Pinning the job to permissions: contents: read:

  • documents the contract (workflow token is checkout-only)
  • removes the dependency on the repo-default token grant
  • narrows the blast radius if fern-api/sync-openapi is ever compromised (cf. tj-actions/changed-files CVE-2025-30066). The action runs against the workflow context, so an explicit read-only scope keeps it boxed.

The block sits inside jobs.update-from-source to match the per-job pattern used by ci.yaml, docs.yml, fern-docs-ci.yml, fern-docs-preview-build.yml, fern-docs-preview-comment.yml, publish-fern-docs.yml, and stale-check.yml.

promotion.yaml and release.yaml are deliberately out of scope: each is a multi-stage workflow with release approval, environment gating, and image promotion against ghcr.io. Their per-job permission story is non-trivial and deserves a separate review rather than a drive-by.

The sync-openapi job uses FERN_OPENAPI_SYNC_TOKEN (a custom PAT) for
both the checkout and the fern-api/sync-openapi action's pull-request
creation. The implicit GITHUB_TOKEN doesn't drive any write here, so
the job-level scope can be pinned to contents:read.

Matches the per-job permissions style used in ci.yaml, docs.yml,
and the fern-docs workflows.

promotion.yaml and release.yaml are deliberately left out: each is a
multi-stage workflow with release-approval, environment gating, and
image promotion that warrants a more careful per-job scope analysis.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
@arpitjain099 arpitjain099 requested a review from a team as a code owner May 14, 2026 01:11
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 14, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

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.

2 participants