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 GitHub Actions to auto-review BCR PRs #1549

Closed
wants to merge 2 commits into from

Conversation

meteorcloudy
Copy link
Member

@meteorcloudy meteorcloudy commented Feb 28, 2024

The GitHub Action was implemented in bazelbuild/continuous-integration#1887

The goal of this GitHub Action is to automate and speed up the review process of trivial PRs that add a new version for existing modules without significant changes.

This GitHub Action will do

  • Review all open PRs every 10 mins.
  • Approve a PR if the latest reviewable commit is approved by at least one module maintainer for each modified module.
  • (Not yet) Merge the PR if presubmit passes. (I'm not turning on this for now in case there is still something we are missing, instead it will ping the bcr maintainers to take a final look.)

Fixes #130

@meteorcloudy meteorcloudy requested a review from a team February 28, 2024 14:33
.github/workflows/bcr_pr_review_approver.yml Outdated Show resolved Hide resolved
egress-policy: audit

- name: Run BCR PR Review Approver
uses: bazelbuild/continuous-integration/actions/bcr-pr-review-approver@b9b7f0dad8ab00a48cc262d1d38339a1dd11c7c5 # master
Copy link
Contributor

Choose a reason for hiding this comment

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

I had a cursory look at https://github.com/bazelbuild/continuous-integration/blob/b9b7f0dad8ab00a48cc262d1d38339a1dd11c7c5/actions/bcr-pr-review-approver/index.js.

In L88, we are getting the author date from the latest commit and then proceed to consider the PR approved if any approval happened after this time. But the commit author date can be freely modified by the PR owner. I haven't tried this, but couldn't the owner just get an innocuous PR approved and then amend malicious changes into it, keeping the date constant?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, nice catch! That's indeed a concern. Let me check if we can get the push time of a commit.

Copy link
Contributor

@fmeum fmeum Feb 28, 2024

Choose a reason for hiding this comment

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

My worry is that we'll miss other things. Is there someone on the OSS team (GOSST?) at Google who could give this a proper security review?

Copy link
Member Author

Choose a reason for hiding this comment

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

@mihaimaruseac Any advice? 😃

Copy link
Contributor

Choose a reason for hiding this comment

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

We could do a go/gosst-review for this to look deeper if needed.

Just to check my understanding: this workflow is supposed to ensure that if a PR updates packages A and B, then it has been reviewed by an owner of A and an owner of B?

And the risk here is that owners of A approves for A and before an owner for B gets to review the PR author modifies package A?

For PRs with a single owner to review, having Require approval of the most recent reviewable push in branch protection should ensure that any change is reviewed by someone, but if we want 2 separate owners, maybe we need something to discard package A's review if a new commit lands to package A?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I haven't thought about the patches. We could probably ask a BCR repo maintainer to review those PRs too (and rely only on package maintainers for other package reviews).

I think only nixpkgs matches the scenarios BCR has. But I'll need to see what processes for review they had.

Other package managers put all the responsibility on the package owners and have a team to react to mishaps after they occur (by yanking malicious packages), afaik.

Copy link
Contributor

Choose a reason for hiding this comment

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

Of note: nearly every module has patches because of how the submit-to-bcr app works, mainly to change the version. #1566 might help get away from patches for that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll have to think more about this, I'll be back next week

Copy link
Member Author

Choose a reason for hiding this comment

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

I think only nixpkgs matches the scenarios BCR has. But I'll need to see what processes for review they had.

@aherrmann Do you know what's the review process for nixpkgs?

Copy link
Contributor

Choose a reason for hiding this comment

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

The nixpkgs contribution and review process is documented here, see also maintainer's README.

meteorcloudy added a commit to bazelbuild/continuous-integration that referenced this pull request Mar 13, 2024
- Merged the module maintainer notifier and the PR approval into one
  action, which can be distinguished by the "action-type" input.
- Implement a new functionality to dismiss stale approvals from all
reviewers.
The default `Dismiss stale pull request approvals when new commits are
pushed` option from GitHub doesn't dismiss approvals from users who is
not a repo maintainer. This helps address the concern that a local
commit was made before the approval but pushed after it. See
bazelbuild/bazel-central-registry#1549 (comment)
@meteorcloudy
Copy link
Member Author

Sending #1621 to replace this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add CODEOWNER for each module
5 participants