fix(forge): accept invitations only to configured repositories
The GitHub forge extension accepted every pending repository invitation, so any GitHub user could add archie's account to a repository by sending an invitation. AcceptInvitations now carries the connection's configured repositories and the extension leaves an invitation to anything else pending.
This commit is contained in:
1 parent
b60ec06839
commit
ebec2f3081
6 files changed
+106
-67
No files matched your search
@@ -310,9 +310,13 @@ func (f *Forge) CreateReviewComments(ctx context.Context, owner, repo string, nu
|
||||
return err
|
||||
}
|
||||
|
||||
func (f *Forge) AcceptInvitations(ctx context.Context) error {
|
||||
func (f *Forge) AcceptInvitations(ctx context.Context, repos []forge.RepoRef) error {
|
||||
in := make([]*forgev1.RepoRef, 0, len(repos))
|
||||
for _, r := range repos {
|
||||
in = append(in, ref(r.Owner, r.Repo))
|
||||
}
|
||||
_, err := call(ctx, f, "accept invitations", func(c forgev1.ForgeServiceClient) (*forgev1.AcceptInvitationsResponse, error) {
|
||||
return c.AcceptInvitations(ctx, &forgev1.AcceptInvitationsRequest{})
|
||||
return c.AcceptInvitations(ctx, &forgev1.AcceptInvitationsRequest{Repositories: in})
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user