-
Notifications
You must be signed in to change notification settings - Fork 35
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
Not merging with "pull_request_target" #355
Comments
I don't remember the details but I have a feeling that It's worth having a closer look to figure out if we can simply allow this so that, if used with that trigger, it just works, or if we should change anything else. |
I think if anything it's a security implication cause pull_request_target have write permissions to the target repository when pull_request doesn't. In theory a forked repo can use pull_request_target to modify a parent repo but in the case of dependabot updates I don't believe it would be an issue. Edit: It should just work since pull_request_target is just pull_request with more permissions. I can create a test repo to double check and submit a pull request if this is correct |
So, when you run the unit test to ensure everything is ok, it is not. |
I am also against this feature. Pull_Request is an event which for security reasons does not run modified and potential malicious workflows. Pull_request_target has security implications. |
I don't think that pr_target is the same as pr with more permissions, it's a rather different behavior. As I commented previously, I am not saying that it will not work, but it will affect how this action should be used. Did you have any specific reason why you wanted to run this in pr_target? |
Seems I need to read up more on pull request target then, I knew everything ran on the base repository but I wasn't aware the source code from the pull request wasn't pulled also. Mostly for that I was using pull request target in the past with other dependabot auto merge bots, and didn't want to have to redo actions for it. I have already rewritten them to use pull_request a week ago so it's not really needed at this point personally short of making it 'just work' if for some reason I have to use pull_request_target again cause there was a reason I had to use it in the past I just can't remember why I discovered it in the first place. |
Shall we close this issue then? |
Doesn't seem to be supported on `pull-request-target`, ref fastify/github-action-merge-dependabot#355
FWIW I would have expected that From GH's blog: https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/
That said, because dependabot is on the repo rather than a forks means it can do privileged things anyway, so it doesn't make a big difference... |
Have you really read the whole conversation?
|
Right, — the build would still need to run on |
I can see the reason, but we need to provide extra check to ensure the user is not misconfiguration. |
@climba03003, - name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }} This pattern is extremely common on sensitive repos ... you ensure that the build flow itself is coming from your trusted At the end of the day, I don't see why this particular action should have an opinionated view of which types of triggers should be allowed to be used... let the repository owner dictate that based on their needs, and just be flexible would be my preference. |
@diranged what's the benefit of using pull_request_target then pull the code from the PR branch? I'm actually not even sure that the code you showed above works. If the workflow is triggered by pull_request_target, are you sure that github.event.pull_request is even populated? |
Here's the primary motivation: dependabot/dependabot-core#3253 |
I see your point but after having used this action extensively, I've never actually experienced that issue. Here are the reasons:
While I understand that these are not necessarily strong enough safety nets, I would like to understand and validate that the approach you propose actually works. As I asked in the previous message, are you sure that |
@simoneb, About the For this Github Action - I'd just like to see it be an option to change |
Okay understood, thanks for clarifying. We never built this with that intent but I can see its usefulness. Would you mind sending a PR? I don't think this would require many changes to the source code, it will be mostly documentation to show the new use case. |
I haven't yet had a chance to test this - but I believe #500 will work. |
🎉 This issue has been resolved in version 3.10.0 🎉 The release is available on: Your optic bot 📦🚀 |
Prerequisites
Fastify version
3
Plugin version
No response
Node.js version
16
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
ubuntu-latest
Description
Dependabot pr's don't merge when using pull_request_target.
This can be fixed by adding "pull_request_target" with "pull_request" as github events to run with in action.yml.
I have no problem submitting a pull request adding this little detail, just let me know if you want the fix or if this was a design decision.
Steps to Reproduce
use pull_request_target for merging pull requests action
Expected Behavior
Should merge pull requests instead of failing silently.
The text was updated successfully, but these errors were encountered: