-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Refine handling of permissions between reusable caller/called workflows #540
Comments
Thanks for the report @notdodo. To make sure I understand: you're reporting that zizmor gives you a finding on the reusable workflow definition itself, despite the call to that reusable workflow having its permissions constrained? If that summary is correct, then the current behavior is intentional: zizmor doesn't know how many times a reusable workflow is called or whether it's called outside of the repository being analyzed, so we conservatively assume that the workflow definition itself also needs to constrain the permissions. Let me know if I got the above right, and if the subsequent expiration makes sense! I'm a little bit murky on how reusable workflow permissions intersect between caller/callee, so it's also possible the definition's own permissions don't matter when the only trigger is a reusable workflow call. |
Thank you @woodruffw for the quick response. The issue is reported on the caller workflow, in this case repo-branch-cleanup.yml, that calls the reusable clean-branch-cache.yml where the permissions are defined.
I think that the two sentences above cleared me up as I don't know if a caller can override/extend callee permissions and, if needed for this issue, I can return to you with an answer. |
No problem! Yeah, if you could test how GHA behaves here, I would greatly appreciate it! But of course no problem if not; I'll get around to it eventually. (I think you're right that the caller can't expand the scope defined in the workflow itself, but the workflow should also define a minimal set so that the caller can't pass overscoped credentials in by accident. But that's speculation since I don't know how it actually behaves.) |
Hey @woodruffw; it seems that the caller can't override the reusable workflow permissions. And if I remove the And obviously if I remove the |
Thanks for trying those @notdodo! Based on that, it sounds like the following holds:
Given that, I think the current behavior is intentional: Long term we could probably make this better by doing more "interprocedural"-type analysis within |
Pre-submission checks
Expected behavior
zizmor shouldn't notify "overly broad permissions" if the permissions are set on the reusable workflow steps.
Actual behavior
When a reusable workflow, with permissions set, is used in an actual workflow zizmor reports:
Reproduction steps
Reusable workflow: https://github.com/notdodo/github-actions/blob/main/.github/workflows/clean-branch-cache.yml
The
permissions
are set at job levelRunning workflow: https://github.com/notdodo/github-actions/blob/main/.github/workflows/repo-branch-cleanup.yml
The workflow just uses the reusable workflow.
Logs
Additional context
Zizmor workflow: https://github.com/notdodo/github-actions/blob/main/.github/workflows/infra-security-scan.yml#L71
The text was updated successfully, but these errors were encountered: