You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recently found an internal PR where someone had effectively merged a branch with itself. When processing approvals for the PR, the sortCommits function
orders commits by their parents, only using the first parent of each commit. Any commits not in that first parent chain are discarded from the result. This works if the second parent is always another branch, but if both parents are present on the PR branch, only exploring the first path can discard commits.
The result was that a user who should have been a contributor was able to approve the PR, because their commits were only reachable through the second parent of a merge commit.
I think we need to update sortCommits to make sure the result always contains every commit in the input. However, I'm not sure yet how to order commits in this situation (e.g. should we evaluate parents depth-first or breadth-first?). This sorting function was introduced as part of #602, so we'll need to make sure than any ordering is valid for the invalidate_on_push option.
The text was updated successfully, but these errors were encountered:
We recently found an internal PR where someone had effectively merged a branch with itself. When processing approvals for the PR, the
sortCommits
functionpolicy-bot/policy/approval/approve.go
Lines 449 to 468 in 55d042d
orders commits by their parents, only using the first parent of each commit. Any commits not in that first parent chain are discarded from the result. This works if the second parent is always another branch, but if both parents are present on the PR branch, only exploring the first path can discard commits.
The result was that a user who should have been a contributor was able to approve the PR, because their commits were only reachable through the second parent of a merge commit.
I think we need to update
sortCommits
to make sure the result always contains every commit in the input. However, I'm not sure yet how to order commits in this situation (e.g. should we evaluate parents depth-first or breadth-first?). This sorting function was introduced as part of #602, so we'll need to make sure than any ordering is valid for theinvalidate_on_push
option.The text was updated successfully, but these errors were encountered: