Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: scorecard.Run() should accept an http.RoundTripper to be used for all outgoing http requests #4256

Open
jeffmendoza opened this issue Jul 25, 2024 · 3 comments
Labels
kind/enhancement New feature or request Stale

Comments

@jeffmendoza
Copy link
Member

Is your feature request related to a problem? Please describe.

Transports are the universal way to add middleware in Go. For Scorecard to be used as a library it should accept a transport to be used everywhere. Currently you have to investigate the various client options and create clients with custom transports if that is even possible.

Transports are useful for things like:

auth - github token / deps dev api key / etc.
caching
logging and tracing
adding headers (user agent)
retries

Describe the solution you'd like

When running Scorecard as a library, these should all be controllable by the calling program. Scorecard should take a Transport as an option in scorecard.Run() then use that for:

github
deps dev
ossfuzz
osv
BP badge
... etc.

Describe alternatives you've considered
Current method of creating the different clients where allowed.

@jeffmendoza jeffmendoza added the kind/enhancement New feature or request label Jul 25, 2024
@spencerschrock
Copy link
Member

Seems reasonable to have a WithTransport() option which accepts a http.RoundTripper. Scorecard may still choose to wrap the provided transport with MakeRateLimitedTransport or MakeCensusTransport from https://pkg.go.dev/github.com/ossf/scorecard/v5/clients/githubrepo/roundtripper I'm not sure our GitLab client has an analog.

What interaction would you expect if provided both WithTransport() and WithRepoClient()?

@jeffmendoza
Copy link
Member Author

jeffmendoza commented Jul 25, 2024

Scorecard may still choose to wrap the provided transport with MakeRateLimitedTransport or MakeCensusTransport...

Yep, makes sense

What interaction would you expect if provided both WithTransport() and WithRepoClient()?

Probably shouldn't use both, but I would expect the the passed in RepoClient to be used unmodified and take priority, and the transport from WithTransport to be used elsewhere.

Copy link

github-actions bot commented Nov 9, 2024

This issue has been marked stale because it has been open for 60 days with no activity.

@github-actions github-actions bot added the Stale label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request Stale
Projects
Status: No status
Development

No branches or pull requests

2 participants