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

all: update claircore #134

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/cli/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"path/filepath"
"strings"
"time"

"github.com/quay/claircore/enricher/cvss"
"github.com/quay/claircore/indexer"
Expand Down Expand Up @@ -166,8 +167,12 @@ func report(c *cli.Context) error {
if err != nil {
return fmt.Errorf("error creating sqlite backend: %v", err)
}
cl := &http.Client{
Timeout: 10 * time.Second,
}

matcherOpts := &libvuln.Options{
Client: cl,
Store: matcherStore,
Locker: NewLocalLockSource(),
DisableBackgroundUpdates: true,
Expand Down
9 changes: 8 additions & 1 deletion cmd/cli/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package main

import (
"fmt"
"net/http"
"time"

"github.com/quay/claircore/libvuln"
_ "github.com/quay/claircore/updater/defaults"
Expand All @@ -12,7 +14,7 @@ import (

var updateCmd = &cli.Command{
Name: "update",
Aliases: []string{"r"},
Aliases: []string{"u"},
Usage: "update the database",
Action: update,
Flags: []cli.Flag{
Expand All @@ -33,7 +35,12 @@ func update(c *cli.Context) error {
return fmt.Errorf("error creating sqlite backend: %v", err)
}

cl := &http.Client{
Timeout: 10 * time.Second,
}

matcherOpts := &libvuln.Options{
Client: cl,
Store: matcherStore,
Locker: NewLocalLockSource(),
DisableBackgroundUpdates: true,
Expand Down
8 changes: 6 additions & 2 deletions datastore/sqlite_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (ms *sqliteMatcherStore) UpdateVulnerabilities(ctx context.Context, updater
hashKind, hash,
vuln.Name, vuln.Updater, vuln.Description, vuln.Issued.Format(time.RFC3339), vuln.Links, vuln.Severity, vuln.NormalizedSeverity,
pkg.Name, pkg.Version, pkg.Module, pkg.Arch, pkg.Kind,
dist.DID, dist.Name, dist.Version, dist.VersionCodeName, dist.VersionID, dist.Arch, dist.CPE, dist.PrettyName,
dist.DID, dist.Name, dist.Version, dist.VersionCodeName, dist.VersionID, dist.Arch, &dist.CPE, dist.PrettyName,
repo.Name, repo.Key, repo.URI,
vuln.FixedInVersion, vuln.ArchOperation, vKind, strings.Join([]string{vrLower, vrUpper}, "__"),
); err != nil {
Expand Down Expand Up @@ -495,7 +495,6 @@ func (ms *sqliteMatcherStore) GetLatestUpdateRef(context.Context, driver.UpdateK
// In diff(1) terms, this is like
//
// diff prev cur
//
func (ms *sqliteMatcherStore) GetUpdateDiff(context.Context, uuid.UUID, uuid.UUID) (*driver.UpdateDiff, error) {
return nil, nil
}
Expand Down Expand Up @@ -530,3 +529,8 @@ func (ms *sqliteMatcherStore) RecordUpdaterStatus(context.Context, string, time.
func (ms *sqliteMatcherStore) RecordUpdaterSetStatus(context.Context, string, time.Time) error {
return nil
}

// RecordUpdaterSetStatus records that all updaters from an updater set are up to date with vulnerabilities at this time
func (ms *sqliteMatcherStore) DeltaUpdateVulnerabilities(context.Context, string, driver.Fingerprint, []*claircore.Vulnerability, []string) (uuid.UUID, error) {
panic("not implemented") // TODO: Implement when VEX updater is merged
}
33 changes: 16 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/google/uuid v1.6.0
github.com/hashicorp/go-version v1.6.0
github.com/klauspost/compress v1.17.7
github.com/quay/claircore v1.5.20
github.com/quay/claircore v1.5.25
github.com/quay/zlog v1.1.8
github.com/remind101/migrate v0.0.0-20170729031349-52c1edff7319
github.com/rs/zerolog v1.32.0
Expand All @@ -28,10 +28,9 @@ require (
github.com/docker/docker v24.0.0+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.1 // indirect
Expand All @@ -48,16 +47,16 @@ require (
github.com/lib/pq v1.10.3 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc3 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/quay/claircore/toolkit v1.1.1 // indirect
github.com/quay/claircore/updater/driver v1.0.0 // indirect
github.com/quay/goval-parser v0.8.8 // indirect
Expand All @@ -66,16 +65,16 @@ require (
github.com/sirupsen/logrus v1.9.1 // indirect
github.com/vbatts/tar-split v0.11.3 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.opentelemetry.io/otel v1.18.0 // indirect
go.opentelemetry.io/otel/metric v1.18.0 // indirect
go.opentelemetry.io/otel/trace v1.18.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/mod v0.14.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.17.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.4.0 // indirect
golang.org/x/tools v0.18.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
modernc.org/libc v1.41.0 // indirect
Expand Down
Loading