Skip to content

Conversation

@kash2104
Copy link

What kind of change does this PR introduce?

This PR introduces improvement to OSV API request by configuring versioned User-Agent for Scorecard.

What is the current behavior?

Currently API requests to osv.dev are made without specifying a unique user-agent.

What is the new behavior (if this is a feature change)?**

Now a distinct, versioned user agent is set for the OSV API request:

  • scorecard/{version} for CLI

  • scorecard-cron/{version} for cron workers

  • Tests for the changes have been added (for bug fixes/features)

Which issue(s) this PR fixes

Fixes #4029

Special notes for your reviewer

osv-scanner/1.9.2 has been installed.

Does this PR introduce a user-facing change?

No

For user-facing changes, please add a concise, human-readable release note to
the release-note

(In particular, describe what changes users might need to make in their
application as a result of this pull request.)

Signed-off-by: kash2104 <kparikh1104@gmail.com>
@kash2104 kash2104 requested a review from a team as a code owner December 16, 2025 12:49
@kash2104 kash2104 requested review from AdamKorcz and jeffmendoza and removed request for a team December 16, 2025 12:49
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Dec 16, 2025
Comment on lines 27 to +28

"github.com/google/osv-scanner/pkg/osv"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be "github.com/google/osv-scanner/v2/pkg/osv"

Comment on lines +44 to 45
github.com/google/osv-scanner v1.9.2
github.com/google/osv-scanner/v2 v2.2.4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when you fix this import this accidental import of v1 should go away

"fmt"
"log"

"github.com/google/osv-scanner/pkg/osv"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment about v2 import


func main() {
info := version.GetVersionInfo()
osv.RequestUserAgent = fmt.Sprintf("scorecard-cron/%s", info.GitVersion)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have scorecard-cron/ here too, which is a copy/paste error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Specify a user agent for OSV.dev

2 participants