-
-
Notifications
You must be signed in to change notification settings - Fork 92
Add Fix for bot-conditions audit rule #921
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
Conversation
2eebc62
to
1bb7633
Compare
Thanks @mostafa! I'll do another review tomorrow most likely. (I'm going to look into improving the expression APIs more generally -- they should be returning spanned AST nodes so that we don't ever have to do any offset guesswork.) |
Hey @mostafa, sorry for the delay here! I've been working on some expression spanning APIs that will hopefully make future interactions with the expression APIs + getting the "raw" expression from a parsed AST a bit easier. |
37606ca
to
44dcb65
Compare
@woodruffw Thanks for the reviews! 🙏 I rebased from main and addressed your comments. |
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
...for now. We might want to re-add this, but the more I think about it the more I think that we probably always want to flag these kinds of spoofable checks. Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Thanks a ton @mostafa! I deduped the patch generation a bit, but otherwise this is good to go 🙂 |
This PR adds Fixes to bot-conditions audit rule, as suggested by the documentation. The bot-conditions audit rule provides three fixes that work together to secure the workflow:
RewriteFragmet
for actor context: fine-grained rewrites ofgithub.actor
togithub.event.pull_request.user.login
in conditions to ensure we check the PR author rather than the last actor.Replace
for trigger: Changespull_request_target
topull_request
to prevent running with elevated permissions.Remove
for conditions: Optionally removes bot conditions entirely if they're not needed.These operations are applied in sequence to transform the workflow from using spoofable bot checks to a more secure configuration.
xref #876