-
Notifications
You must be signed in to change notification settings - Fork 32
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
Discussion of permissions and security in README / sample workflows needs clarification? #461
Comments
Hey there, thanks for opening this. The part that makes it secure is not exactly linked to permissions but to the fact the part that interacts with the PR code is in: python-coverage-comment-action/README.md Lines 99 to 100 in d2ae3c8
While the part that can write to the repo is in: python-coverage-comment-action/README.md Lines 143 to 144 in d2ae3c8
And here:
So the permissions are here to define what exactly the action needs to be able to do on the repo, and the permissions will not be enough to give forked repos write access (unless you check the checkbox that is mentionned in the doc exceropt above, which could as well be named (note: it's neithertheless relevant to give the On the other hand, regarding
This means there's still a risk: a malicious PR could control what file gets used as the basis for posting the PR comment, so they could craft a PR that makes GHA post "All your base are belong to us" instead of the coverage report, and it would only work on their own PR. That's not very disruptive. If you're interested in what exactly we do with the file downloaded from the artifacts (and wonder if there could be a way an attacker would escape the normal code path), the corresponding code is here: So as long as httpx doesn't make anything special on the payload, I don't have an idea what an attacker might attempt to do. Note that the attacker doesn't control how the zipfile is made (GitHub does) so I don't think they can even do a zip bomb. But all in all, this has nothing to do with the Hope it answered your question and also, happy to have the opportunity to explain this action's stance on security in (excruciating) detail. Feel free if you have follow-up questions :) Also, these three articles are always relevant (they're a must-read if you do anything github-actions) |
@ewjoachim Thanks for such a detailed response!
Ah, OK! I think that's the main thing I was missing, that the (As a completely random aside, this line from that second article is hilarious:)
There are probably some things that can be done to secure the workflows even more (just kind of thinking out loud here, it's not Python Coverage Comment's job to deal with this stuff):
|
Well I think it's safe to assume people review PRs before merging them :D Whether they want to use CODEOWNERS or anything else, I feel it's their decision. This would be true for literally any workflow they have: if they merge it without reviewing, then they'll get hacked.
It's a bit of the same point. This is a step people may want to take to secure their workflows independently from this action. Also, if the workflow is public, it's public, whether that's in the same repo or in an org-specific repo, so I guess, there could be malicious PRs either way. |
Oh, I don't think it's safe to assume that AT ALL, unfortunately. And the more committers a project has, the less safe it is to assume that the RIGHT people review a PR before it's merged. (Hence, I guess, CODEOWNERS in general.)
Sure, but the repo an organization workflow lives in ( |
Anyway, closing this as answered. Thanks again! |
The documentation in
README.md
takes some pains to consider issues of security when integrating this Action that will have write access to your repo, which is great. But the details don't seem to match up with the text.The dual-workflow setup is introduced with,
...But since #122, the
ci.yml
("untrusted" workflow) has the exact same permissions as the supposedly "trusted"coverage.yml
workflow:ci.yml
:python-coverage-comment-action/README.md
Lines 107 to 116 in d2ae3c8
coverage.yml
:python-coverage-comment-action/README.md
Lines 151 to 164 in d2ae3c8
also:
python-coverage-comment-action/README.md
Lines 165 to 167 in d2ae3c8
So what makes the
coverage.yml
"trusted", and why is it not OK to runactions/checkout
there, but it's OK to run it inci.yml
with the same permissions?If granting permissions to
ci.yml
is no longer avoidable due to changes in the GitHub backend, then it is what it is, but that seems like it makes the whole "split workflow" thing sort of pointless and complicated for no reason, no? And it would probably be better to just drop the security advice that's no longer being followed from the docs. (Unless I've misunderstood?)The text was updated successfully, but these errors were encountered: