Skip to content

Commit 861ecbb

Browse files
fix: Add pagination to collaborators collector (#275)
* fix: Fix typo in deletion protection policy * fix: Add pagination to collaborators collector --------- Co-authored-by: noamd-legit <74864790+noamd-legit@users.noreply.github.com>
1 parent 0d52c90 commit 861ecbb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

internal/collectors/github/repository_collector.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -360,15 +360,15 @@ func (rc *repositoryCollector) withVulnerabilityAlerts(repo ghcollected.Reposito
360360
}
361361

362362
func (rc *repositoryCollector) withRepoCollaborators(repo ghcollected.Repository, org string) ghcollected.Repository {
363-
users, _, err := rc.Client.Client().Repositories.ListCollaborators(rc.Context, org, repo.Repository.Name, &github.ListCollaboratorsOptions{})
363+
users, err := pagination.New[*github.User](rc.Client.Client().Repositories.ListCollaborators, &github.ListCollaboratorsOptions{}).Sync(rc.Context, org, repo.Repository.Name)
364364
if err != nil {
365365
perm := collectors.NewMissingPermission(permissions.RepoAdmin, collectors.FullRepoName(org, repo.Repository.Name),
366366
"Cannot read repository collaborators", namespace.Repository)
367367
rc.IssueMissingPermissions(perm)
368368
return repo
369369
}
370370

371-
repo.Collaborators = users
371+
repo.Collaborators = users.Collected
372372
return repo
373373
}
374374

policies/github/repository.rego

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ missing_default_branch_protection_deletion := false {
151151
missing_default_branch_protection_deletion := false {
152152
some index
153153
rule := input.rules_set[index]
154-
rule.type == "deletions"
154+
rule.type == "deletion"
155155
}
156156

157157
# METADATA

0 commit comments

Comments
 (0)