chore: declare minimum scope on pr-metadata-check workflow#2081
chore: declare minimum scope on pr-metadata-check workflow#2081arpitjain099 wants to merge 1 commit into
Conversation
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
| - ready_for_review | ||
|
|
||
| permissions: | ||
| contents: read |
There was a problem hiding this comment.
I asked Cursor GPT-5.4 Extra High Fast if read (in general) is sufficient. After fetching a bunch of GHA API documentation, it came back with a "yes", but it isn't sure if the contents: read is actually required.
@arpitjain099: since this workflow only reads PR metadata via gh pr view and does not check out code, do you know whether pull-requests: read alone is sufficient, or whether contents: read is also required?
There was a problem hiding this comment.
Good question. The workflow only calls gh pr view, which goes through the REST API and doesn't touch repo contents, so pull-requests: read alone is sufficient. I left contents: read in as future-proofing in case a checkout step ever gets added, but happy to drop it for the minimum scope if you prefer. Either works for the CVE-2025-30066 hardening intent.
pr-metadata-check.ymlruns onpull_request_targetand usesgh pr view --json assignees,labels,milestoneto enforce PR hygiene. It only reads PR metadata, no checkout. Addingcontents: read(for the implicit checkout if it gets re-added later) pluspull-requests: read(for thegh pr viewcall) caps the otherwise-inherited token scope onpull_request_target.