diff --git a/checks/permissions_test.go b/checks/permissions_test.go index 40affa16220..978c1e4291a 100644 --- a/checks/permissions_test.go +++ b/checks/permissions_test.go @@ -240,9 +240,9 @@ func TestGithubTokenPermissions(t *testing.T) { filenames: []string{"./testdata/script.sh"}, expected: scut.TestReturn{ Error: nil, - Score: checker.MaxResultScore, + Score: checker.InconclusiveResultScore, NumberOfWarn: 0, - NumberOfInfo: 2, + NumberOfInfo: 0, NumberOfDebug: 0, }, }, @@ -375,7 +375,7 @@ func TestGithubTokenPermissions(t *testing.T) { ctrl := gomock.NewController(t) mockRepo := mockrepo.NewMockRepoClient(ctrl) - mockRepo.EXPECT().GetDefaultBranchName().Return("main", nil) + mockRepo.EXPECT().GetDefaultBranchName().Return("main", nil).AnyTimes() main := "main" mockRepo.EXPECT().URI().Return("github.com/ossf/scorecard").AnyTimes() diff --git a/clients/gitlabrepo/branches.go b/clients/gitlabrepo/branches.go index b4ca8dc1c28..50949f14474 100644 --- a/clients/gitlabrepo/branches.go +++ b/clients/gitlabrepo/branches.go @@ -71,8 +71,10 @@ func (handler *branchesHandler) setup() error { projectStatusChecks, resp, err := handler.glClient.ExternalStatusChecks.ListProjectStatusChecks( handler.repourl.project, &gitlab.ListOptions{}) - if err != nil && resp.StatusCode != 404 { + if (err != nil || resp.StatusCode != 404) && + resp.StatusCode != 401 { // 401: permissions. pass token authorization issues silently handler.errSetup = fmt.Errorf("request for external status checks failed with error %w", err) + return } projectApprovalRule, resp, err := handler.glClient.Projects.GetApprovalConfiguration(handler.repourl.project)