mirror of
https://github.com/ossf/scorecard.git
synced 2024-09-19 04:57:14 +03:00
Add validation for commit-based APIs (#1635)
Co-authored-by: Azeem Shaikh <azeems@google.com>
This commit is contained in:
parent
eb0730ae79
commit
f3332ce129
@ -22,6 +22,7 @@ import (
|
|||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/localdir"
|
"github.com/ossf/scorecard/v4/clients/localdir"
|
||||||
"github.com/ossf/scorecard/v4/log"
|
"github.com/ossf/scorecard/v4/log"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
@ -72,7 +73,7 @@ func TestBinaryArtifacts(t *testing.T) {
|
|||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
client := localdir.CreateLocalDirClient(ctx, logger)
|
client := localdir.CreateLocalDirClient(ctx, logger)
|
||||||
if err := client.InitRepo(repo, "HEAD"); err != nil {
|
if err := client.InitRepo(repo, clients.HeadSHA); err != nil {
|
||||||
t.Errorf("InitRepo: %v", err)
|
t.Errorf("InitRepo: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/localdir"
|
"github.com/ossf/scorecard/v4/clients/localdir"
|
||||||
"github.com/ossf/scorecard/v4/log"
|
"github.com/ossf/scorecard/v4/log"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
@ -154,7 +155,7 @@ func TestLicenseFileSubdirectory(t *testing.T) {
|
|||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
client := localdir.CreateLocalDirClient(ctx, logger)
|
client := localdir.CreateLocalDirClient(ctx, logger)
|
||||||
if err := client.InitRepo(repo, "HEAD"); err != nil {
|
if err := client.InitRepo(repo, clients.HeadSHA); err != nil {
|
||||||
t.Errorf("InitRepo: %v", err)
|
t.Errorf("InitRepo: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks/fileparser"
|
"github.com/ossf/scorecard/v4/checks/fileparser"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
sce "github.com/ossf/scorecard/v4/errors"
|
sce "github.com/ossf/scorecard/v4/errors"
|
||||||
"github.com/ossf/scorecard/v4/log"
|
"github.com/ossf/scorecard/v4/log"
|
||||||
@ -80,7 +81,7 @@ func SecurityPolicy(c *checker.CheckRequest) (checker.SecurityPolicyData, error)
|
|||||||
Repo: c.Repo.Org(),
|
Repo: c.Repo.Org(),
|
||||||
}
|
}
|
||||||
|
|
||||||
err = dotGitHub.RepoClient.InitRepo(dotGitHub.Repo, "HEAD")
|
err = dotGitHub.RepoClient.InitRepo(dotGitHub.Repo, clients.HeadSHA)
|
||||||
switch {
|
switch {
|
||||||
case err == nil:
|
case err == nil:
|
||||||
defer dotGitHub.RepoClient.Close()
|
defer dotGitHub.RepoClient.Close()
|
||||||
|
@ -31,7 +31,6 @@ var allowedConclusions = map[string]bool{"success": true, "neutral": true}
|
|||||||
|
|
||||||
//nolint:gochecknoinits
|
//nolint:gochecknoinits
|
||||||
func init() {
|
func init() {
|
||||||
// TODO(#575): Check if we can support commit-based requests here.
|
|
||||||
if err := registerCheck(CheckSAST, SAST, nil); err != nil {
|
if err := registerCheck(CheckSAST, SAST, nil); err != nil {
|
||||||
// This should never happen.
|
// This should never happen.
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -17,6 +17,7 @@ package githubrepo
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/google/go-github/v38/github"
|
"github.com/google/go-github/v38/github"
|
||||||
@ -113,31 +114,34 @@ type branchesHandler struct {
|
|||||||
once *sync.Once
|
once *sync.Once
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
errSetup error
|
errSetup error
|
||||||
owner string
|
repourl *repoURL
|
||||||
repo string
|
|
||||||
defaultBranchRef *clients.BranchRef
|
defaultBranchRef *clients.BranchRef
|
||||||
branches []*clients.BranchRef
|
branches []*clients.BranchRef
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *branchesHandler) init(ctx context.Context, owner, repo string) {
|
func (handler *branchesHandler) init(ctx context.Context, repourl *repoURL) {
|
||||||
handler.ctx = ctx
|
handler.ctx = ctx
|
||||||
handler.owner = owner
|
handler.repourl = repourl
|
||||||
handler.repo = repo
|
|
||||||
handler.errSetup = nil
|
handler.errSetup = nil
|
||||||
handler.once = new(sync.Once)
|
handler.once = new(sync.Once)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *branchesHandler) setup() error {
|
func (handler *branchesHandler) setup() error {
|
||||||
handler.once.Do(func() {
|
handler.once.Do(func() {
|
||||||
|
if !strings.EqualFold(handler.repourl.commitSHA, clients.HeadSHA) {
|
||||||
|
handler.errSetup = fmt.Errorf("%w: branches only supported for HEAD queries", clients.ErrUnsupportedFeature)
|
||||||
|
return
|
||||||
|
}
|
||||||
vars := map[string]interface{}{
|
vars := map[string]interface{}{
|
||||||
"owner": githubv4.String(handler.owner),
|
"owner": githubv4.String(handler.repourl.owner),
|
||||||
"name": githubv4.String(handler.repo),
|
"name": githubv4.String(handler.repourl.repo),
|
||||||
"refsToAnalyze": githubv4.Int(refsToAnalyze),
|
"refsToAnalyze": githubv4.Int(refsToAnalyze),
|
||||||
"refPrefix": githubv4.String(refPrefix),
|
"refPrefix": githubv4.String(refPrefix),
|
||||||
}
|
}
|
||||||
handler.data = new(branchesData)
|
handler.data = new(branchesData)
|
||||||
if err := handler.graphClient.Query(handler.ctx, handler.data, vars); err != nil {
|
if err := handler.graphClient.Query(handler.ctx, handler.data, vars); err != nil {
|
||||||
handler.errSetup = sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("githubv4.Query: %v", err))
|
handler.errSetup = sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("githubv4.Query: %v", err))
|
||||||
|
return
|
||||||
}
|
}
|
||||||
handler.defaultBranchRef = getBranchRefFrom(handler.data.Repository.DefaultBranchRef)
|
handler.defaultBranchRef = getBranchRefFrom(handler.data.Repository.DefaultBranchRef)
|
||||||
handler.branches = getBranchRefsFrom(handler.data.Repository.Refs.Nodes, handler.defaultBranchRef)
|
handler.branches = getBranchRefsFrom(handler.data.Repository.Refs.Nodes, handler.defaultBranchRef)
|
||||||
|
@ -17,6 +17,7 @@ package githubrepo
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/google/go-github/v38/github"
|
"github.com/google/go-github/v38/github"
|
||||||
|
|
||||||
@ -25,21 +26,22 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type checkrunsHandler struct {
|
type checkrunsHandler struct {
|
||||||
client *github.Client
|
client *github.Client
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
owner string
|
repourl *repoURL
|
||||||
repo string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *checkrunsHandler) init(ctx context.Context, owner, repo string) {
|
func (handler *checkrunsHandler) init(ctx context.Context, repourl *repoURL) {
|
||||||
handler.ctx = ctx
|
handler.ctx = ctx
|
||||||
handler.owner = owner
|
handler.repourl = repourl
|
||||||
handler.repo = repo
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *checkrunsHandler) listCheckRunsForRef(ref string) ([]clients.CheckRun, error) {
|
func (handler *checkrunsHandler) listCheckRunsForRef(ref string) ([]clients.CheckRun, error) {
|
||||||
checkRuns, _, err := handler.client.Checks.ListCheckRunsForRef(handler.ctx, handler.owner, handler.repo, ref,
|
if !strings.EqualFold(handler.repourl.commitSHA, clients.HeadSHA) {
|
||||||
&github.ListCheckRunsOptions{})
|
return nil, fmt.Errorf("%w: ListCheckRuns only supported for HEAD queries", clients.ErrUnsupportedFeature)
|
||||||
|
}
|
||||||
|
checkRuns, _, err := handler.client.Checks.ListCheckRunsForRef(
|
||||||
|
handler.ctx, handler.repourl.owner, handler.repourl.repo, ref, &github.ListCheckRunsOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("ListCheckRunsForRef: %v", err))
|
return nil, sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("ListCheckRunsForRef: %v", err))
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,7 @@ var errInputRepoType = errors.New("input repo should be of type repoURL")
|
|||||||
|
|
||||||
// Client is GitHub-specific implementation of RepoClient.
|
// Client is GitHub-specific implementation of RepoClient.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
owner string
|
repourl *repoURL
|
||||||
repoName string
|
|
||||||
repo *github.Repository
|
repo *github.Repository
|
||||||
repoClient *github.Client
|
repoClient *github.Client
|
||||||
graphClient *graphqlHandler
|
graphClient *graphqlHandler
|
||||||
@ -62,9 +61,14 @@ func (client *Client) InitRepo(inputRepo clients.Repo, commitSHA string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return sce.WithMessage(sce.ErrRepoUnreachable, err.Error())
|
return sce.WithMessage(sce.ErrRepoUnreachable, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
client.repo = repo
|
client.repo = repo
|
||||||
client.owner = repo.Owner.GetLogin()
|
client.repourl = &repoURL{
|
||||||
client.repoName = repo.GetName()
|
owner: repo.Owner.GetLogin(),
|
||||||
|
repo: repo.GetName(),
|
||||||
|
defaultBranch: repo.GetDefaultBranch(),
|
||||||
|
commitSHA: commitSHA,
|
||||||
|
}
|
||||||
|
|
||||||
// Init tarballHandler.
|
// Init tarballHandler.
|
||||||
if err := client.tarball.init(client.ctx, client.repo, commitSHA); err != nil {
|
if err := client.tarball.init(client.ctx, client.repo, commitSHA); err != nil {
|
||||||
@ -72,36 +76,35 @@ func (client *Client) InitRepo(inputRepo clients.Repo, commitSHA string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup GraphQL.
|
// Setup GraphQL.
|
||||||
client.graphClient.init(client.ctx, client.owner, client.repoName,
|
client.graphClient.init(client.ctx, client.repourl)
|
||||||
client.repo.GetDefaultBranch(), commitSHA)
|
|
||||||
|
|
||||||
// Setup contributorsHandler.
|
// Setup contributorsHandler.
|
||||||
client.contributors.init(client.ctx, client.owner, client.repoName)
|
client.contributors.init(client.ctx, client.repourl)
|
||||||
|
|
||||||
// Setup branchesHandler.
|
// Setup branchesHandler.
|
||||||
client.branches.init(client.ctx, client.owner, client.repoName)
|
client.branches.init(client.ctx, client.repourl)
|
||||||
|
|
||||||
// Setup releasesHandler.
|
// Setup releasesHandler.
|
||||||
client.releases.init(client.ctx, client.owner, client.repoName)
|
client.releases.init(client.ctx, client.repourl)
|
||||||
|
|
||||||
// Setup workflowsHandler.
|
// Setup workflowsHandler.
|
||||||
client.workflows.init(client.ctx, client.owner, client.repoName)
|
client.workflows.init(client.ctx, client.repourl)
|
||||||
|
|
||||||
// Setup checkrunsHandler.
|
// Setup checkrunsHandler.
|
||||||
client.checkruns.init(client.ctx, client.owner, client.repoName)
|
client.checkruns.init(client.ctx, client.repourl)
|
||||||
|
|
||||||
// Setup statusesHandler.
|
// Setup statusesHandler.
|
||||||
client.statuses.init(client.ctx, client.owner, client.repoName)
|
client.statuses.init(client.ctx, client.repourl)
|
||||||
|
|
||||||
// Setup searchHandler.
|
// Setup searchHandler.
|
||||||
client.search.init(client.ctx, client.owner, client.repoName)
|
client.search.init(client.ctx, client.repourl)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// URI implements RepoClient.URI.
|
// URI implements RepoClient.URI.
|
||||||
func (client *Client) URI() string {
|
func (client *Client) URI() string {
|
||||||
return fmt.Sprintf("github.com/%s/%s", client.owner, client.repoName)
|
return fmt.Sprintf("github.com/%s/%s", client.repourl.owner, client.repourl.repo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListFiles implements RepoClient.ListFiles.
|
// ListFiles implements RepoClient.ListFiles.
|
||||||
@ -224,7 +227,7 @@ func CreateOssFuzzRepoClient(ctx context.Context, logger *log.Logger) (clients.R
|
|||||||
}
|
}
|
||||||
|
|
||||||
ossFuzzRepoClient := CreateGithubRepoClient(ctx, logger)
|
ossFuzzRepoClient := CreateGithubRepoClient(ctx, logger)
|
||||||
if err := ossFuzzRepoClient.InitRepo(ossFuzzRepo, "HEAD"); err != nil {
|
if err := ossFuzzRepoClient.InitRepo(ossFuzzRepo, clients.HeadSHA); err != nil {
|
||||||
return nil, fmt.Errorf("error during InitRepo: %w", err)
|
return nil, fmt.Errorf("error during InitRepo: %w", err)
|
||||||
}
|
}
|
||||||
return ossFuzzRepoClient, nil
|
return ossFuzzRepoClient, nil
|
||||||
|
@ -17,6 +17,7 @@ package githubrepo
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/google/go-github/v38/github"
|
"github.com/google/go-github/v38/github"
|
||||||
@ -29,25 +30,28 @@ type contributorsHandler struct {
|
|||||||
once *sync.Once
|
once *sync.Once
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
errSetup error
|
errSetup error
|
||||||
owner string
|
repourl *repoURL
|
||||||
repo string
|
|
||||||
contributors []clients.Contributor
|
contributors []clients.Contributor
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *contributorsHandler) init(ctx context.Context, owner, repo string) {
|
func (handler *contributorsHandler) init(ctx context.Context, repourl *repoURL) {
|
||||||
handler.ctx = ctx
|
handler.ctx = ctx
|
||||||
handler.owner = owner
|
handler.repourl = repourl
|
||||||
handler.repo = repo
|
|
||||||
handler.errSetup = nil
|
handler.errSetup = nil
|
||||||
handler.once = new(sync.Once)
|
handler.once = new(sync.Once)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *contributorsHandler) setup() error {
|
func (handler *contributorsHandler) setup() error {
|
||||||
handler.once.Do(func() {
|
handler.once.Do(func() {
|
||||||
|
if !strings.EqualFold(handler.repourl.commitSHA, clients.HeadSHA) {
|
||||||
|
handler.errSetup = fmt.Errorf("%w: ListContributors only supported for HEAD queries", clients.ErrUnsupportedFeature)
|
||||||
|
return
|
||||||
|
}
|
||||||
contribs, _, err := handler.ghClient.Repositories.ListContributors(
|
contribs, _, err := handler.ghClient.Repositories.ListContributors(
|
||||||
handler.ctx, handler.owner, handler.repo, &github.ListContributorsOptions{})
|
handler.ctx, handler.repourl.owner, handler.repourl.repo, &github.ListContributorsOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
handler.errSetup = fmt.Errorf("error during ListContributors: %w", err)
|
handler.errSetup = fmt.Errorf("error during ListContributors: %w", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, contrib := range contribs {
|
for _, contrib := range contribs {
|
||||||
|
@ -114,26 +114,20 @@ type graphqlData struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type graphqlHandler struct {
|
type graphqlHandler struct {
|
||||||
client *githubv4.Client
|
client *githubv4.Client
|
||||||
data *graphqlData
|
data *graphqlData
|
||||||
once *sync.Once
|
once *sync.Once
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
errSetup error
|
errSetup error
|
||||||
owner string
|
repourl *repoURL
|
||||||
repo string
|
commits []clients.Commit
|
||||||
defaultBranch string
|
issues []clients.Issue
|
||||||
commitSHA string
|
archived bool
|
||||||
commits []clients.Commit
|
|
||||||
issues []clients.Issue
|
|
||||||
archived bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *graphqlHandler) init(ctx context.Context, owner, repo, defaultBranch, commitSHA string) {
|
func (handler *graphqlHandler) init(ctx context.Context, repourl *repoURL) {
|
||||||
handler.ctx = ctx
|
handler.ctx = ctx
|
||||||
handler.owner = owner
|
handler.repourl = repourl
|
||||||
handler.repo = repo
|
|
||||||
handler.defaultBranch = defaultBranch
|
|
||||||
handler.commitSHA = commitSHA
|
|
||||||
handler.data = new(graphqlData)
|
handler.data = new(graphqlData)
|
||||||
handler.errSetup = nil
|
handler.errSetup = nil
|
||||||
handler.once = new(sync.Once)
|
handler.once = new(sync.Once)
|
||||||
@ -141,15 +135,15 @@ func (handler *graphqlHandler) init(ctx context.Context, owner, repo, defaultBra
|
|||||||
|
|
||||||
func (handler *graphqlHandler) setup() error {
|
func (handler *graphqlHandler) setup() error {
|
||||||
handler.once.Do(func() {
|
handler.once.Do(func() {
|
||||||
commitExpression := handler.commitSHA
|
commitExpression := handler.repourl.commitSHA
|
||||||
if strings.EqualFold(handler.commitSHA, "HEAD") {
|
if strings.EqualFold(handler.repourl.commitSHA, clients.HeadSHA) {
|
||||||
// TODO(#575): Confirm that this works as expected.
|
// TODO(#575): Confirm that this works as expected.
|
||||||
commitExpression = fmt.Sprintf("heads/%s", handler.defaultBranch)
|
commitExpression = fmt.Sprintf("heads/%s", handler.repourl.defaultBranch)
|
||||||
}
|
}
|
||||||
|
|
||||||
vars := map[string]interface{}{
|
vars := map[string]interface{}{
|
||||||
"owner": githubv4.String(handler.owner),
|
"owner": githubv4.String(handler.repourl.owner),
|
||||||
"name": githubv4.String(handler.repo),
|
"name": githubv4.String(handler.repourl.repo),
|
||||||
"pullRequestsToAnalyze": githubv4.Int(pullRequestsToAnalyze),
|
"pullRequestsToAnalyze": githubv4.Int(pullRequestsToAnalyze),
|
||||||
"issuesToAnalyze": githubv4.Int(issuesToAnalyze),
|
"issuesToAnalyze": githubv4.Int(issuesToAnalyze),
|
||||||
"issueCommentsToAnalyze": githubv4.Int(issueCommentsToAnalyze),
|
"issueCommentsToAnalyze": githubv4.Int(issueCommentsToAnalyze),
|
||||||
@ -163,7 +157,7 @@ func (handler *graphqlHandler) setup() error {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
handler.archived = bool(handler.data.Repository.IsArchived)
|
handler.archived = bool(handler.data.Repository.IsArchived)
|
||||||
handler.commits, handler.errSetup = commitsFrom(handler.data, handler.owner, handler.repo)
|
handler.commits, handler.errSetup = commitsFrom(handler.data, handler.repourl.owner, handler.repourl.repo)
|
||||||
if handler.errSetup != nil {
|
if handler.errSetup != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -180,6 +174,9 @@ func (handler *graphqlHandler) getCommits() ([]clients.Commit, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (handler *graphqlHandler) getIssues() ([]clients.Issue, error) {
|
func (handler *graphqlHandler) getIssues() ([]clients.Issue, error) {
|
||||||
|
if !strings.EqualFold(handler.repourl.commitSHA, clients.HeadSHA) {
|
||||||
|
return nil, fmt.Errorf("%w: ListIssues only supported for HEAD queries", clients.ErrUnsupportedFeature)
|
||||||
|
}
|
||||||
if err := handler.setup(); err != nil {
|
if err := handler.setup(); err != nil {
|
||||||
return nil, fmt.Errorf("error during graphqlHandler.setup: %w", err)
|
return nil, fmt.Errorf("error during graphqlHandler.setup: %w", err)
|
||||||
}
|
}
|
||||||
@ -187,6 +184,9 @@ func (handler *graphqlHandler) getIssues() ([]clients.Issue, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (handler *graphqlHandler) isArchived() (bool, error) {
|
func (handler *graphqlHandler) isArchived() (bool, error) {
|
||||||
|
if !strings.EqualFold(handler.repourl.commitSHA, clients.HeadSHA) {
|
||||||
|
return false, fmt.Errorf("%w: IsArchived only supported for HEAD queries", clients.ErrUnsupportedFeature)
|
||||||
|
}
|
||||||
if err := handler.setup(); err != nil {
|
if err := handler.setup(); err != nil {
|
||||||
return false, fmt.Errorf("error during graphqlHandler.setup: %w", err)
|
return false, fmt.Errorf("error during graphqlHandler.setup: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ package githubrepo
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/google/go-github/v38/github"
|
"github.com/google/go-github/v38/github"
|
||||||
@ -30,23 +31,25 @@ type releasesHandler struct {
|
|||||||
once *sync.Once
|
once *sync.Once
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
errSetup error
|
errSetup error
|
||||||
owner string
|
repourl *repoURL
|
||||||
repo string
|
|
||||||
releases []clients.Release
|
releases []clients.Release
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *releasesHandler) init(ctx context.Context, owner, repo string) {
|
func (handler *releasesHandler) init(ctx context.Context, repourl *repoURL) {
|
||||||
handler.ctx = ctx
|
handler.ctx = ctx
|
||||||
handler.owner = owner
|
handler.repourl = repourl
|
||||||
handler.repo = repo
|
|
||||||
handler.errSetup = nil
|
handler.errSetup = nil
|
||||||
handler.once = new(sync.Once)
|
handler.once = new(sync.Once)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *releasesHandler) setup() error {
|
func (handler *releasesHandler) setup() error {
|
||||||
handler.once.Do(func() {
|
handler.once.Do(func() {
|
||||||
|
if !strings.EqualFold(handler.repourl.commitSHA, clients.HeadSHA) {
|
||||||
|
handler.errSetup = fmt.Errorf("%w: ListReleases only supported for HEAD queries", clients.ErrUnsupportedFeature)
|
||||||
|
return
|
||||||
|
}
|
||||||
releases, _, err := handler.client.Repositories.ListReleases(
|
releases, _, err := handler.client.Repositories.ListReleases(
|
||||||
handler.ctx, handler.owner, handler.repo, &github.ListOptions{})
|
handler.ctx, handler.repourl.owner, handler.repourl.repo, &github.ListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
handler.errSetup = sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("githubv4.Query: %v", err))
|
handler.errSetup = sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("githubv4.Query: %v", err))
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type repoURL struct {
|
type repoURL struct {
|
||||||
host, owner, repo string
|
host, owner, repo, defaultBranch, commitSHA string
|
||||||
metadata []string
|
metadata []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parses input string into repoURL struct.
|
// Parses input string into repoURL struct.
|
||||||
|
@ -30,17 +30,19 @@ var errEmptyQuery = errors.New("search query is empty")
|
|||||||
type searchHandler struct {
|
type searchHandler struct {
|
||||||
ghClient *github.Client
|
ghClient *github.Client
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
owner string
|
repourl *repoURL
|
||||||
repo string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *searchHandler) init(ctx context.Context, owner, repo string) {
|
func (handler *searchHandler) init(ctx context.Context, repourl *repoURL) {
|
||||||
handler.ctx = ctx
|
handler.ctx = ctx
|
||||||
handler.owner = owner
|
handler.repourl = repourl
|
||||||
handler.repo = repo
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *searchHandler) search(request clients.SearchRequest) (clients.SearchResponse, error) {
|
func (handler *searchHandler) search(request clients.SearchRequest) (clients.SearchResponse, error) {
|
||||||
|
if !strings.EqualFold(handler.repourl.commitSHA, clients.HeadSHA) {
|
||||||
|
return clients.SearchResponse{}, fmt.Errorf(
|
||||||
|
"%w: Search only supported for HEAD queries", clients.ErrUnsupportedFeature)
|
||||||
|
}
|
||||||
query, err := handler.buildQuery(request)
|
query, err := handler.buildQuery(request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clients.SearchResponse{}, fmt.Errorf("handler.buildQuery: %w", err)
|
return clients.SearchResponse{}, fmt.Errorf("handler.buildQuery: %w", err)
|
||||||
@ -63,7 +65,9 @@ func (handler *searchHandler) buildQuery(request clients.SearchRequest) (string,
|
|||||||
// that should be replaced with a space.
|
// that should be replaced with a space.
|
||||||
// See https://docs.github.com/en/search-github/searching-on-github/searching-code#considerations-for-code-search
|
// See https://docs.github.com/en/search-github/searching-on-github/searching-code#considerations-for-code-search
|
||||||
// for reference.
|
// for reference.
|
||||||
fmt.Sprintf("%s repo:%s/%s", strings.ReplaceAll(request.Query, "/", " "), handler.owner, handler.repo)); err != nil {
|
fmt.Sprintf("%s repo:%s/%s",
|
||||||
|
strings.ReplaceAll(request.Query, "/", " "),
|
||||||
|
handler.repourl.owner, handler.repourl.repo)); err != nil {
|
||||||
return "", fmt.Errorf("WriteString: %w", err)
|
return "", fmt.Errorf("WriteString: %w", err)
|
||||||
}
|
}
|
||||||
if request.Filename != "" {
|
if request.Filename != "" {
|
||||||
|
@ -27,32 +27,37 @@ func TestBuildQuery(t *testing.T) {
|
|||||||
searchReq clients.SearchRequest
|
searchReq clients.SearchRequest
|
||||||
expectedErrType error
|
expectedErrType error
|
||||||
name string
|
name string
|
||||||
owner string
|
repourl *repoURL
|
||||||
repo string
|
|
||||||
expectedQuery string
|
expectedQuery string
|
||||||
hasError bool
|
hasError bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Basic",
|
name: "Basic",
|
||||||
owner: "testowner",
|
repourl: &repoURL{
|
||||||
repo: "testrepo",
|
owner: "testowner",
|
||||||
|
repo: "testrepo",
|
||||||
|
},
|
||||||
searchReq: clients.SearchRequest{
|
searchReq: clients.SearchRequest{
|
||||||
Query: "testquery",
|
Query: "testquery",
|
||||||
},
|
},
|
||||||
expectedQuery: "testquery repo:testowner/testrepo",
|
expectedQuery: "testquery repo:testowner/testrepo",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "EmptyQuery",
|
name: "EmptyQuery",
|
||||||
owner: "testowner",
|
repourl: &repoURL{
|
||||||
repo: "testrepo",
|
owner: "testowner",
|
||||||
|
repo: "testrepo",
|
||||||
|
},
|
||||||
searchReq: clients.SearchRequest{},
|
searchReq: clients.SearchRequest{},
|
||||||
hasError: true,
|
hasError: true,
|
||||||
expectedErrType: errEmptyQuery,
|
expectedErrType: errEmptyQuery,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "WithFilename",
|
name: "WithFilename",
|
||||||
owner: "testowner",
|
repourl: &repoURL{
|
||||||
repo: "testrepo",
|
owner: "testowner",
|
||||||
|
repo: "testrepo",
|
||||||
|
},
|
||||||
searchReq: clients.SearchRequest{
|
searchReq: clients.SearchRequest{
|
||||||
Query: "testquery",
|
Query: "testquery",
|
||||||
Filename: "filename1.txt",
|
Filename: "filename1.txt",
|
||||||
@ -60,9 +65,11 @@ func TestBuildQuery(t *testing.T) {
|
|||||||
expectedQuery: "testquery repo:testowner/testrepo in:file filename:filename1.txt",
|
expectedQuery: "testquery repo:testowner/testrepo in:file filename:filename1.txt",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "WithPath",
|
name: "WithPath",
|
||||||
owner: "testowner",
|
repourl: &repoURL{
|
||||||
repo: "testrepo",
|
owner: "testowner",
|
||||||
|
repo: "testrepo",
|
||||||
|
},
|
||||||
searchReq: clients.SearchRequest{
|
searchReq: clients.SearchRequest{
|
||||||
Query: "testquery",
|
Query: "testquery",
|
||||||
Path: "dir1/file1.txt",
|
Path: "dir1/file1.txt",
|
||||||
@ -70,9 +77,11 @@ func TestBuildQuery(t *testing.T) {
|
|||||||
expectedQuery: "testquery repo:testowner/testrepo path:dir1/file1.txt",
|
expectedQuery: "testquery repo:testowner/testrepo path:dir1/file1.txt",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "WithFilenameAndPath",
|
name: "WithFilenameAndPath",
|
||||||
owner: "testowner",
|
repourl: &repoURL{
|
||||||
repo: "testrepo",
|
owner: "testowner",
|
||||||
|
repo: "testrepo",
|
||||||
|
},
|
||||||
searchReq: clients.SearchRequest{
|
searchReq: clients.SearchRequest{
|
||||||
Query: "testquery",
|
Query: "testquery",
|
||||||
Filename: "filename1.txt",
|
Filename: "filename1.txt",
|
||||||
@ -81,9 +90,11 @@ func TestBuildQuery(t *testing.T) {
|
|||||||
expectedQuery: "testquery repo:testowner/testrepo in:file filename:filename1.txt path:dir1/dir2",
|
expectedQuery: "testquery repo:testowner/testrepo in:file filename:filename1.txt path:dir1/dir2",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "WithFilenameAndPathWithSeparator",
|
name: "WithFilenameAndPathWithSeparator",
|
||||||
owner: "testowner",
|
repourl: &repoURL{
|
||||||
repo: "testrepo",
|
owner: "testowner",
|
||||||
|
repo: "testrepo",
|
||||||
|
},
|
||||||
searchReq: clients.SearchRequest{
|
searchReq: clients.SearchRequest{
|
||||||
Query: "testquery/query",
|
Query: "testquery/query",
|
||||||
Filename: "filename1.txt",
|
Filename: "filename1.txt",
|
||||||
@ -99,8 +110,7 @@ func TestBuildQuery(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
handler := searchHandler{
|
handler := searchHandler{
|
||||||
owner: testcase.owner,
|
repourl: testcase.repourl,
|
||||||
repo: testcase.repo,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
query, err := handler.buildQuery(testcase.searchReq)
|
query, err := handler.buildQuery(testcase.searchReq)
|
||||||
|
@ -17,6 +17,7 @@ package githubrepo
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/google/go-github/v38/github"
|
"github.com/google/go-github/v38/github"
|
||||||
|
|
||||||
@ -25,21 +26,22 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type statusesHandler struct {
|
type statusesHandler struct {
|
||||||
client *github.Client
|
client *github.Client
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
owner string
|
repourl *repoURL
|
||||||
repo string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *statusesHandler) init(ctx context.Context, owner, repo string) {
|
func (handler *statusesHandler) init(ctx context.Context, repourl *repoURL) {
|
||||||
handler.ctx = ctx
|
handler.ctx = ctx
|
||||||
handler.owner = owner
|
handler.repourl = repourl
|
||||||
handler.repo = repo
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *statusesHandler) listStatuses(ref string) ([]clients.Status, error) {
|
func (handler *statusesHandler) listStatuses(ref string) ([]clients.Status, error) {
|
||||||
statuses, _, err := handler.client.Repositories.ListStatuses(handler.ctx, handler.owner, handler.repo, ref,
|
if !strings.EqualFold(handler.repourl.commitSHA, clients.HeadSHA) {
|
||||||
&github.ListOptions{})
|
return nil, fmt.Errorf("%w: ListStatuses only supported for HEAD queries", clients.ErrUnsupportedFeature)
|
||||||
|
}
|
||||||
|
statuses, _, err := handler.client.Repositories.ListStatuses(
|
||||||
|
handler.ctx, handler.repourl.owner, handler.repourl.repo, ref, &github.ListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("ListStatuses: %v", err))
|
return nil, sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("ListStatuses: %v", err))
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import (
|
|||||||
|
|
||||||
"github.com/google/go-github/v38/github"
|
"github.com/google/go-github/v38/github"
|
||||||
|
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
sce "github.com/ossf/scorecard/v4/errors"
|
sce "github.com/ossf/scorecard/v4/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -96,7 +97,7 @@ func (handler *tarballHandler) init(ctx context.Context, repo *github.Repository
|
|||||||
func (handler *tarballHandler) getTarball(ctx context.Context, repo *github.Repository, commitSHA string) error {
|
func (handler *tarballHandler) getTarball(ctx context.Context, repo *github.Repository, commitSHA string) error {
|
||||||
url := repo.GetArchiveURL()
|
url := repo.GetArchiveURL()
|
||||||
url = strings.Replace(url, "{archive_format}", "tarball/", 1)
|
url = strings.Replace(url, "{archive_format}", "tarball/", 1)
|
||||||
if strings.EqualFold(commitSHA, "HEAD") {
|
if strings.EqualFold(commitSHA, clients.HeadSHA) {
|
||||||
url = strings.Replace(url, "{/ref}", "", 1)
|
url = strings.Replace(url, "{/ref}", "", 1)
|
||||||
} else {
|
} else {
|
||||||
url = strings.Replace(url, "{/ref}", commitSHA, 1)
|
url = strings.Replace(url, "{/ref}", commitSHA, 1)
|
||||||
|
@ -17,6 +17,7 @@ package githubrepo
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/google/go-github/v38/github"
|
"github.com/google/go-github/v38/github"
|
||||||
|
|
||||||
@ -25,21 +26,23 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type workflowsHandler struct {
|
type workflowsHandler struct {
|
||||||
client *github.Client
|
client *github.Client
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
owner string
|
repourl *repoURL
|
||||||
repo string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *workflowsHandler) init(ctx context.Context, owner, repo string) {
|
func (handler *workflowsHandler) init(ctx context.Context, repourl *repoURL) {
|
||||||
handler.ctx = ctx
|
handler.ctx = ctx
|
||||||
handler.owner = owner
|
handler.repourl = repourl
|
||||||
handler.repo = repo
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (handler *workflowsHandler) listSuccessfulWorkflowRuns(filename string) ([]clients.WorkflowRun, error) {
|
func (handler *workflowsHandler) listSuccessfulWorkflowRuns(filename string) ([]clients.WorkflowRun, error) {
|
||||||
|
if !strings.EqualFold(handler.repourl.commitSHA, clients.HeadSHA) {
|
||||||
|
return nil, fmt.Errorf(
|
||||||
|
"%w: ListWorkflowRunsByFileName only supported for HEAD queries", clients.ErrUnsupportedFeature)
|
||||||
|
}
|
||||||
workflowRuns, _, err := handler.client.Actions.ListWorkflowRunsByFileName(
|
workflowRuns, _, err := handler.client.Actions.ListWorkflowRunsByFileName(
|
||||||
handler.ctx, handler.owner, handler.repo, filename, &github.ListWorkflowRunsOptions{
|
handler.ctx, handler.repourl.owner, handler.repourl.repo, filename, &github.ListWorkflowRunsOptions{
|
||||||
Status: "success",
|
Status: "success",
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/google/go-cmp/cmp/cmpopts"
|
"github.com/google/go-cmp/cmp/cmpopts"
|
||||||
|
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/log"
|
"github.com/ossf/scorecard/v4/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ func TestClient_CreationAndCaching(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
client := CreateLocalDirClient(ctx, logger)
|
client := CreateLocalDirClient(ctx, logger)
|
||||||
if err := client.InitRepo(repo, "HEAD"); err != nil {
|
if err := client.InitRepo(repo, clients.HeadSHA); err != nil {
|
||||||
t.Errorf("InitRepo: %v", err)
|
t.Errorf("InitRepo: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,9 @@ import "errors"
|
|||||||
// ErrUnsupportedFeature indicates an API that is not supported by the client.
|
// ErrUnsupportedFeature indicates an API that is not supported by the client.
|
||||||
var ErrUnsupportedFeature = errors.New("unsupported feature")
|
var ErrUnsupportedFeature = errors.New("unsupported feature")
|
||||||
|
|
||||||
|
// HeadSHA is default commitSHA value used to denote git HEAD.
|
||||||
|
const HeadSHA = "HEAD"
|
||||||
|
|
||||||
// RepoClient interface is used by Scorecard checks to access a repo.
|
// RepoClient interface is used by Scorecard checks to access a repo.
|
||||||
type RepoClient interface {
|
type RepoClient interface {
|
||||||
InitRepo(repo Repo, commitSHA string) error
|
InitRepo(repo Repo, commitSHA string) error
|
||||||
|
@ -63,7 +63,7 @@ var rootCmd = &cobra.Command{
|
|||||||
func init() {
|
func init() {
|
||||||
rootCmd.Flags().StringVar(&flagRepo, "repo", "", "repository to check")
|
rootCmd.Flags().StringVar(&flagRepo, "repo", "", "repository to check")
|
||||||
rootCmd.Flags().StringVar(&flagLocal, "local", "", "local folder to check")
|
rootCmd.Flags().StringVar(&flagLocal, "local", "", "local folder to check")
|
||||||
rootCmd.Flags().StringVar(&flagCommit, "commit", "HEAD", "commit to analyze")
|
rootCmd.Flags().StringVar(&flagCommit, "commit", clients.HeadSHA, "commit to analyze")
|
||||||
rootCmd.Flags().StringVar(
|
rootCmd.Flags().StringVar(
|
||||||
&flagLogLevel,
|
&flagLogLevel,
|
||||||
"verbosity",
|
"verbosity",
|
||||||
@ -148,7 +148,7 @@ func scorecardCmd(cmd *cobra.Command, args []string) {
|
|||||||
if flagLocal != "" {
|
if flagLocal != "" {
|
||||||
requiredRequestTypes = append(requiredRequestTypes, checker.FileBased)
|
requiredRequestTypes = append(requiredRequestTypes, checker.FileBased)
|
||||||
}
|
}
|
||||||
if !strings.EqualFold(flagCommit, "HEAD") {
|
if !strings.EqualFold(flagCommit, clients.HeadSHA) {
|
||||||
requiredRequestTypes = append(requiredRequestTypes, checker.CommitBased)
|
requiredRequestTypes = append(requiredRequestTypes, checker.CommitBased)
|
||||||
}
|
}
|
||||||
enabledChecks, err := getEnabledChecks(policy, flagChecksToRun, requiredRequestTypes)
|
enabledChecks, err := getEnabledChecks(policy, flagChecksToRun, requiredRequestTypes)
|
||||||
@ -225,7 +225,7 @@ func validateCmdFlags() {
|
|||||||
if flagFormat == formatRaw {
|
if flagFormat == formatRaw {
|
||||||
log.Panic("raw option not supported yet")
|
log.Panic("raw option not supported yet")
|
||||||
}
|
}
|
||||||
if flagCommit != "HEAD" {
|
if flagCommit != clients.HeadSHA {
|
||||||
log.Panic("--commit option not supported yet")
|
log.Panic("--commit option not supported yet")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,8 @@ var serveCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
defer ossFuzzRepoClient.Close()
|
defer ossFuzzRepoClient.Close()
|
||||||
ciiClient := clients.DefaultCIIBestPracticesClient()
|
ciiClient := clients.DefaultCIIBestPracticesClient()
|
||||||
repoResult, err := pkg.RunScorecards(ctx, repo, "HEAD" /*commitSHA*/, false /*raw*/, checks.AllChecks, repoClient,
|
repoResult, err := pkg.RunScorecards(
|
||||||
|
ctx, repo, clients.HeadSHA /*commitSHA*/, false /*raw*/, checks.AllChecks, repoClient,
|
||||||
ossFuzzRepoClient, ciiClient, vulnsClient)
|
ossFuzzRepoClient, ciiClient, vulnsClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(err, "running enabled scorecard checks on repo")
|
logger.Error(err, "running enabled scorecard checks on repo")
|
||||||
|
@ -85,7 +85,7 @@ func processRequest(ctx context.Context,
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
repo.AppendMetadata(repo.Metadata()...)
|
repo.AppendMetadata(repo.Metadata()...)
|
||||||
result, err := pkg.RunScorecards(ctx, repo, "HEAD" /*commitSHA*/, false /*raw*/, checksToRun,
|
result, err := pkg.RunScorecards(ctx, repo, clients.HeadSHA /*commitSHA*/, false /*raw*/, checksToRun,
|
||||||
repoClient, ossFuzzRepoClient, ciiClient, vulnsClient)
|
repoClient, ossFuzzRepoClient, ciiClient, vulnsClient)
|
||||||
if errors.Is(err, sce.ErrRepoUnreachable) {
|
if errors.Is(err, sce.ErrRepoUnreachable) {
|
||||||
// Not accessible repo - continue.
|
// Not accessible repo - continue.
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -35,7 +36,7 @@ var _ = Describe("E2E TEST:"+checks.CheckBinaryArtifacts, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf/scorecard")
|
repo, err := githubrepo.MakeGithubRepo("ossf/scorecard")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
|
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
@ -61,7 +62,7 @@ var _ = Describe("E2E TEST:"+checks.CheckBinaryArtifacts, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-binary-artifacts-e2e")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-binary-artifacts-e2e")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
|
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
@ -123,7 +124,7 @@ var _ = Describe("E2E TEST:"+checks.CheckBinaryArtifacts, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-binary-artifacts-e2e-4-binaries")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-binary-artifacts-e2e-4-binaries")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
|
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -33,7 +34,7 @@ var _ = Describe("E2E TEST:"+checks.CheckBranchProtection, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
Ctx: context.Background(),
|
Ctx: context.Background(),
|
||||||
@ -63,7 +64,7 @@ var _ = Describe("E2E TEST:"+checks.CheckBranchProtection, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e-none")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e-none")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
Ctx: context.Background(),
|
Ctx: context.Background(),
|
||||||
@ -93,7 +94,7 @@ var _ = Describe("E2E TEST:"+checks.CheckBranchProtection, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e-patch-1")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-branch-protection-e2e-patch-1")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
Ctx: context.Background(),
|
Ctx: context.Background(),
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -33,7 +34,7 @@ var _ = Describe("E2E TEST:"+checks.CheckCITests, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/airflow")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/airflow")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
Ctx: context.Background(),
|
Ctx: context.Background(),
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -35,7 +36,7 @@ var _ = Describe("E2E TEST:CodeReview", func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/airflow")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/airflow")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
|
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -33,7 +34,7 @@ var _ = Describe("E2E TEST:"+checks.CheckContributors, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf/scorecard")
|
repo, err := githubrepo.MakeGithubRepo("ossf/scorecard")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
Ctx: context.Background(),
|
Ctx: context.Background(),
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -32,7 +33,7 @@ var _ = Describe("E2E TEST:"+checks.CheckTokenPermissions, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-dangerous-workflow-e2e")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-dangerous-workflow-e2e")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
Ctx: context.Background(),
|
Ctx: context.Background(),
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -35,7 +36,7 @@ var _ = Describe("E2E TEST:"+checks.CheckDependencyUpdateTool, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf/scorecard")
|
repo, err := githubrepo.MakeGithubRepo("ossf/scorecard")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
|
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
@ -66,7 +67,7 @@ var _ = Describe("E2E TEST:"+checks.CheckDependencyUpdateTool, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("netlify/netlify-cms")
|
repo, err := githubrepo.MakeGithubRepo("netlify/netlify-cms")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
|
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -33,7 +34,7 @@ var _ = Describe("E2E TEST:"+checks.CheckFuzzing, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("tensorflow/tensorflow")
|
repo, err := githubrepo.MakeGithubRepo("tensorflow/tensorflow")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
ossFuzzRepoClient, err := githubrepo.CreateOssFuzzRepoClient(context.Background(), logger)
|
ossFuzzRepoClient, err := githubrepo.CreateOssFuzzRepoClient(context.Background(), logger)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
@ -61,7 +62,7 @@ var _ = Describe("E2E TEST:"+checks.CheckFuzzing, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-fuzzing-cflite")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-fuzzing-cflite")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
ossFuzzRepoClient, err := githubrepo.CreateOssFuzzRepoClient(context.Background(), logger)
|
ossFuzzRepoClient, err := githubrepo.CreateOssFuzzRepoClient(context.Background(), logger)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
@ -89,7 +90,7 @@ var _ = Describe("E2E TEST:"+checks.CheckFuzzing, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-packaging-e2e")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-packaging-e2e")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
ossFuzzRepoClient, err := githubrepo.CreateOssFuzzRepoClient(context.Background(), logger)
|
ossFuzzRepoClient, err := githubrepo.CreateOssFuzzRepoClient(context.Background(), logger)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -32,7 +33,7 @@ var _ = Describe("E2E TEST:"+checks.CheckLicense, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-license-e2e")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-license-e2e")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
Ctx: context.Background(),
|
Ctx: context.Background(),
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -33,7 +34,7 @@ var _ = Describe("E2E TEST:"+checks.CheckMaintained, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("apache/airflow")
|
repo, err := githubrepo.MakeGithubRepo("apache/airflow")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
Ctx: context.Background(),
|
Ctx: context.Background(),
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -33,7 +34,7 @@ var _ = Describe("E2E TEST:"+checks.CheckPackaging, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-packaging-e2e")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-packaging-e2e")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
Ctx: context.Background(),
|
Ctx: context.Background(),
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -32,7 +33,7 @@ var _ = Describe("E2E TEST:"+checks.CheckTokenPermissions, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-token-permissions-e2e")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-token-permissions-e2e")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
Ctx: context.Background(),
|
Ctx: context.Background(),
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -34,7 +35,7 @@ var _ = Describe("E2E TEST:"+checks.CheckPinnedDependencies, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-pinned-dependencies-e2e")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-pinned-dependencies-e2e")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
|
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -33,7 +34,7 @@ var _ = Describe("E2E TEST:"+checks.CheckSAST, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/airflow")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/airflow")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
Ctx: context.Background(),
|
Ctx: context.Background(),
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -32,7 +33,7 @@ var _ = Describe("E2E TEST:SecurityPolicy", func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("tensorflow/tensorflow")
|
repo, err := githubrepo.MakeGithubRepo("tensorflow/tensorflow")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
|
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
@ -62,7 +63,7 @@ var _ = Describe("E2E TEST:SecurityPolicy", func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("randombit/botan")
|
repo, err := githubrepo.MakeGithubRepo("randombit/botan")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
|
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/ossf/scorecard/v4/checker"
|
"github.com/ossf/scorecard/v4/checker"
|
||||||
"github.com/ossf/scorecard/v4/checks"
|
"github.com/ossf/scorecard/v4/checks"
|
||||||
|
"github.com/ossf/scorecard/v4/clients"
|
||||||
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
"github.com/ossf/scorecard/v4/clients/githubrepo"
|
||||||
scut "github.com/ossf/scorecard/v4/utests"
|
scut "github.com/ossf/scorecard/v4/utests"
|
||||||
)
|
)
|
||||||
@ -33,7 +34,7 @@ var _ = Describe("E2E TEST:"+checks.CheckSignedReleases, func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-signed-releases-e2e")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-signed-releases-e2e")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
req := checker.CheckRequest{
|
req := checker.CheckRequest{
|
||||||
Ctx: context.Background(),
|
Ctx: context.Background(),
|
||||||
|
@ -33,7 +33,7 @@ var _ = Describe("E2E TEST:Vulnerabilities", func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf/scorecard")
|
repo, err := githubrepo.MakeGithubRepo("ossf/scorecard")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
|
|
||||||
dl := scut.TestDetailLogger{}
|
dl := scut.TestDetailLogger{}
|
||||||
@ -66,7 +66,7 @@ var _ = Describe("E2E TEST:Vulnerabilities", func() {
|
|||||||
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-vulnerabilities-open62541")
|
repo, err := githubrepo.MakeGithubRepo("ossf-tests/scorecard-check-vulnerabilities-open62541")
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
repoClient := githubrepo.CreateGithubRepoClient(context.Background(), logger)
|
||||||
err = repoClient.InitRepo(repo, "HEAD")
|
err = repoClient.InitRepo(repo, clients.HeadSHA)
|
||||||
Expect(err).Should(BeNil())
|
Expect(err).Should(BeNil())
|
||||||
|
|
||||||
dl := scut.TestDetailLogger{}
|
dl := scut.TestDetailLogger{}
|
||||||
|
Loading…
Reference in New Issue
Block a user