Skip to content
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

Add note about bot authorization #1406

Merged
merged 1 commit into from
Aug 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/actions/bot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ async function bot(core, github, context, uuid) {
}
console.log("Comment found in payload");

// user's org membership must be public for the author_association to be MEMBER
// go to the org's member page, find yourself, and set the visibility to public
const author = payload.comment.user.login;
const authorized = ["OWNER", "MEMBER"].includes(payload.comment.author_association);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious would we ever want "COLLABORATOR"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wouldn't, because we can't expose the CI creds to any third parties. Github has a pretty good blog post covering this type of issue, it's messy: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 the examples in that blog are nice too

besides permissions on chore jobs like comments it lgtm

if (!authorized) {
Expand Down Expand Up @@ -152,4 +154,4 @@ module.exports = async (core, github, context, uuid) => {
bot(core, github, context, uuid).catch((error) => {
core.setFailed(error);
});
}
}