ci: declare contents:read on sync-openapi workflow#1663
Open
arpitjain099 wants to merge 1 commit into
Open
Conversation
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>
lachen-nv
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
sync-openapiworkflow runsfern-api/sync-openapi@8e936a4...withFERN_OPENAPI_SYNC_TOKEN, a PAT scoped for the Fern sync. Theactions/checkoutstep also uses that same PAT, and thegit push origin --delete fern/update-apireuses the credentials persisted by checkout. The implicit workflowGITHUB_TOKENis therefore unused for any write path.Pinning the job to
permissions: contents: read:fern-api/sync-openapiis 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-sourceto match the per-job pattern used byci.yaml,docs.yml,fern-docs-ci.yml,fern-docs-preview-build.yml,fern-docs-preview-comment.yml,publish-fern-docs.yml, andstale-check.yml.promotion.yamlandrelease.yamlare deliberately out of scope: each is a multi-stage workflow with release approval, environment gating, and image promotion againstghcr.io. Their per-job permission story is non-trivial and deserves a separate review rather than a drive-by.