Skip to content

Commit

Permalink
ci: define permissions for enforce-labels workflow
Browse files Browse the repository at this point in the history
Explicitely stating required permissions is considered best practice.
This case was detected by Poutine, see
/~https://github.com/boostsecurityio/poutine/blob/main/docs/content/en/rules/default_permissions_on_risky_events.md.

Signed-off-by: Florian Greinacher <florian@greinacher.de>
  • Loading branch information
fgreinacher committed May 6, 2024
1 parent db2bfc9 commit 16e8612
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/enforce-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ name: "Enforce PR labels"
on: # yamllint disable-line rule:truthy
pull_request_target:
types: [labeled, unlabeled, opened, edited, synchronize]

permissions:
contents: read # to read configuration file
pull-requests: write # to label PRs

jobs:
enforce-label:
if: github.repository == 'dev-sec/ansible-collection-hardening'
Expand Down

0 comments on commit 16e8612

Please sign in to comment.