Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce permission for milestone GitHub Action #3193

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

marcotc
Copy link
Member

@marcotc marcotc commented Oct 6, 2023

This PR reduces the permission of the add-milestone-to-pull-requests GitHub Action to the minimum possible.

This is specially important on GitHub Actions that use the pull_request_target trigger, because it can run on pull requests by external contributors (which is what we want for this tagger action). More details about the dangers of pull_request_target here: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
Despite these concerns, pull_request_target is the trigger we want because we do want external pull requests to trigger this Action and have permission to edit the milestone of a pull request (a write permission).

Notes

The only other action using, the pull-request-labeler, already has minimum permissions declared, thanks to well-documented default permissions by the Action author:

permissions:
contents: read
pull-requests: write

@marcotc marcotc self-assigned this Oct 6, 2023
@marcotc marcotc requested a review from a team as a code owner October 6, 2023 21:13
@github-actions github-actions bot added the dev/github Github repository maintenance and automation label Oct 6, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #3193 (8f9dfa7) into master (790e6b4) will increase coverage by 0.00%.
Report is 9 commits behind head on master.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #3193   +/-   ##
=======================================
  Coverage   98.21%   98.21%           
=======================================
  Files        1252     1252           
  Lines       71907    71937   +30     
  Branches     3329     3331    +2     
=======================================
+ Hits        70622    70654   +32     
+ Misses       1285     1283    -2     
Files Coverage Δ
lib/datadog/appsec/processor.rb 94.18% <100.00%> (+0.28%) ⬆️
spec/datadog/appsec/processor_spec.rb 99.07% <100.00%> (+0.12%) ⬆️

... and 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@ivoanjo ivoanjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM. I took a look at the list of available permissions and it confirms (in a bit of a confusing way) that this is the right permission for the job.

@marcotc marcotc merged commit e56c150 into master Oct 10, 2023
176 checks passed
@marcotc marcotc deleted the reduce-gha-permission-milestone branch October 10, 2023 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev/github Github repository maintenance and automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants