Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/enforce-draft-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
name: Enforce Draft PR
runs-on: ubuntu-24.04
if: github.event.pull_request.draft == false
permissions:
pull-requests: write
contents: write

Check warning on line 14 in .github/workflows/enforce-draft-pr.yml

View check run for this annotation

@sentry/warden / warden: find-bugs

Potentially excessive contents:write permission for draft PR conversion

The workflow adds `contents: write` permission alongside `pull-requests: write` for the `pull_request_target` trigger. The stated purpose is to convert a PR to draft using `gh pr ready --undo`, which typically only requires `pull-requests: write`. Granting `contents: write` on a `pull_request_target` workflow could allow unintended write access to repository contents, though this specific workflow doesn't appear to use it. If not required, this permission should be removed to follow the principle of least privilege.
steps:
- name: Generate GitHub App token
id: app-token
Expand All @@ -19,7 +22,7 @@

- name: Convert PR to draft
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
GH_TOKEN: ${{github.token}}
PR_URL: ${{ github.event.pull_request.html_url }}
run: |
gh pr ready "$PR_URL" --undo
Expand Down
Loading