-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
Security concern with using pull_request_target
#182
Comments
As far as I understand the situation this shouldn't be a concern for |
Response to maintainer
Okay, so the code should be safe when people use it as intended, if I'm understanding you correctly. What about dangerous patterns?From the GitHub Docs:
I think this means that you should never use
And I think you shouldn't use Possible warnings for the docsIf I'm correct about the above, maybe it's a good idea to warn the users, like this:
|
I think the checkout action checks out the base branch in this case, so we're not executing potentially malicious code from an opened pull request. If you feel like validating this it'd be great to hear your feedback! |
Hmm, I don't know enough code to validate the behavior of |
FYI I decided to lock down the permissions to just reading PRs for this reason, and everything seems to be working well: |
@amannn Do you want me to create a PR to put @JamesHenry's config into an example in the |
I'm struggling to understand why that would be necessary. By passing the Am I missing something? |
Correct.
I think its a good idea in general, regardless of trust, to limit the scope of each action. This helps prevent some bad stuff in case the repository goes rogue for whatever reason. It turns out that this action works with just
You're right, people should check the action code before running it. 😉
Limiting the scope to People should still:
In summary: I'm trying to explain that even small changes add up when combined with other best practices. You as author have the final say over what goes in your |
You're definitely raising some good points and I agree that there are some actions a consumer should take before using 3rd party code. For me putting these things in the README conflicts a bit with the ease-of-use of the action – I wouldn't want to tell a consumer to carefully review the code of the action either. Btw. it could be that the action-semantic-pull-request/src/index.js Lines 145 to 161 in 348e2e6
So I think for the time being I wouldn't change the README in regards to this. |
I see this action uses
pull_request_target
to work on public forks. Have you seen this warning in the GitHub Docs, Events that trigger workflowspull_request_target
?It might be good to mention this warning in the
README.md
as well?The text was updated successfully, but these errors were encountered: