ci: Update workflow to add labels in PR editing docstrings safe to run from forks #4145
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.
Proposed Changes:
This changes the event that triggers the
docstring-labeler.yml
workflow frompull_request
topull_request_target
.It also adds a new job to prevent running malicious code.
How did you test it?
Can't be tested.
Notes for the reviewer
This PR has some security implications that we might need to discuss.
This is only one of the possible approaches to label PRs from forks. Other approaches might be:
pull_request
event and a different token with elevated privilegepull_request_target
event and embed the Python code in the workflow filepull_request_target
event, checkout base, copy the Python script outside the repo and run that (This might be good 🤔 ), see ci: Update docstring-labeler.yml workflow to safely run in PRs from forks #4146I recommend reading this blog post to gain a clear view on the security issues.
Am open to different solutions.
Checklist
I have updated the related issue with new insights and changesI added tests that demonstrate the correct behavior of the changefix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.