Skip to content

BUG githubrepo.Client.GetOrgRepoClient() does not use parent Client transport #4255

@jeffmendoza

Description

@jeffmendoza

Describe the bug
githubrepo.Client.GetOrgRepoClient() simply calls CreateGithubRepoClient(). Instead it should call CreateGithubRepoClientWithTransport() and pass in its own client's transport client.repoClient.Client().Transport.

Reproduction steps
Have an authenticated transport, say it

rc := githubrepo.CreateGithubRepoClientWithTransport(ctx, it)
res, err := scorecard.Run(ctx, repo,
	scorecard.WithRepoClient(rc),
	scorecard.WithChecks([]string{"Security-Policy"}),
)

This should work, but you get:

ERRO[0001] GitHub token env var is not set. Please read https://github.com/ossf/scorecard#authentication  error="an error occurred while getting GitHub credentials"

due to: https://github.com/ossf/scorecard/blob/main/checks/raw/security_policy.go#L63

Expected behavior
Auth works.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions