Skip to content

Commit 01d11aa

Browse files
committed
Set OSV User-Agent for scorecard cli and cron workers.
Signed-off-by: kash2104 <kparikh1104@gmail.com>
1 parent 6c8b5db commit 01d11aa

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

cron/internal/worker/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import (
2525
_ "net/http/pprof" //nolint:gosec
2626
"strings"
2727

28+
"github.com/google/osv-scanner/pkg/osv"
2829
"go.opencensus.io/stats/view"
30+
"sigs.k8s.io/release-utils/version"
2931

3032
"github.com/ossf/scorecard/v5/checker"
3133
"github.com/ossf/scorecard/v5/clients"
@@ -325,6 +327,8 @@ func startMetricsExporter() (monitoring.Exporter, error) {
325327
}
326328

327329
func main() {
330+
info := version.GetVersionInfo()
331+
osv.RequestUserAgent = fmt.Sprintf("scorecard-cron/%s", info.GitVersion)
328332
flag.Parse()
329333
if err := config.ReadConfig(); err != nil {
330334
panic(err)

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ require (
4141
github.com/caarlos0/env/v6 v6.10.1
4242
github.com/gobwas/glob v0.2.3
4343
github.com/google/go-github/v53 v53.2.0
44+
github.com/google/osv-scanner v1.9.2
4445
github.com/google/osv-scanner/v2 v2.2.4
4546
github.com/hmarr/codeowners v1.2.1
4647
github.com/in-toto/attestation v1.1.2

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,8 @@ github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9
537537
github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0=
538538
github.com/google/osv-scalibr v0.3.7-0.20251023161426-90e9ac9cc1b3 h1:JNLsaIi+lHdzsKoxcDmMBZCbE/qKi/mt9N3eQRxrThc=
539539
github.com/google/osv-scalibr v0.3.7-0.20251023161426-90e9ac9cc1b3/go.mod h1:XN3PWSKiShu3MXb+9nGtwLGHWXarZ/0lfbovOhPKTRc=
540+
github.com/google/osv-scanner v1.9.2 h1:N5Arl9SA75afbjmX8mKURgOIaKyuK3NUjCaxDlj1KHI=
541+
github.com/google/osv-scanner v1.9.2/go.mod h1:ZTL8Dp9z/7Jr9kkQSOGqo8z6Csqt83qMIr58aZVx+pM=
540542
github.com/google/osv-scanner/v2 v2.2.4 h1:VMaaQ+ZlMPxeIVNa9+Gnabac89+QvUsDWCMv4jfNhDY=
541543
github.com/google/osv-scanner/v2 v2.2.4/go.mod h1:283VGGCrxkTa54P0FArsparfNzHdllI5UH4DwlLhobs=
542544
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
@@ -806,6 +808,8 @@ github.com/otiai10/copy v1.14.1 h1:5/7E6qsUMBaH5AnQ0sSLzzTg1oTECmcCmT6lvF45Na8=
806808
github.com/otiai10/copy v1.14.1/go.mod h1:oQwrEDDOci3IM8dJF0d8+jnbfPDllW6vUjNc3DoZm9I=
807809
github.com/otiai10/mint v1.6.3 h1:87qsV/aw1F5as1eH1zS/yqHY85ANKVMgkDrf9rcxbQs=
808810
github.com/otiai10/mint v1.6.3/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM=
811+
github.com/owenrumney/go-sarif/v2 v2.3.3 h1:ubWDJcF5i3L/EIOER+ZyQ03IfplbSU1BLOE26uKQIIU=
812+
github.com/owenrumney/go-sarif/v2 v2.3.3/go.mod h1:MSqMMx9WqlBSY7pXoOZWgEsVB4FDNfhcaXDA1j6Sr+w=
809813
github.com/owenrumney/go-sarif/v3 v3.2.3 h1:n6mdX5ugKwCrZInvBsf6WumXmpAe3mbmQXgkXlIq34U=
810814
github.com/owenrumney/go-sarif/v3 v3.2.3/go.mod h1:1bV7t8SZg7pX41spaDkEUs8/yEjzk9JapztMoX1XNjg=
811815
github.com/package-url/packageurl-go v0.1.3 h1:4juMED3hHiz0set3Vq3KeQ75KD1avthoXLtmE3I0PLs=

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@
1616
package main
1717

1818
import (
19+
"fmt"
1920
"log"
2021

22+
"github.com/google/osv-scanner/pkg/osv"
23+
"sigs.k8s.io/release-utils/version"
24+
2125
"github.com/ossf/scorecard/v5/cmd"
2226
"github.com/ossf/scorecard/v5/options"
2327
)
2428

2529
func main() {
30+
info := version.GetVersionInfo()
31+
osv.RequestUserAgent = fmt.Sprintf("scorecard-cron/%s", info.GitVersion)
2632
opts := options.New()
2733
if err := cmd.New(opts).Execute(); err != nil {
2834
log.Fatalf("error during command execution: %v", err)

0 commit comments

Comments
 (0)