importer

package
v0.0.0-...-903239e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Overview

Package importer provides functionality for importing vulnerability records from various sources.

Index

Constants

View Source
const TasksTopic = "tasks"

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, config Config) error

func RunDeletions

func RunDeletions(ctx context.Context, config Config) error

func Validate

func Validate(data []byte) error

Validate checks the given data against the OSV JSON schema.

Types

type Config

type Config struct {
	NumWorkers int

	SourceRepoStore    models.SourceRepositoryStore
	VulnerabilityStore models.VulnerabilityStore
	Publisher          clients.Publisher
	GCSProvider        clients.CloudStorageProvider
	HTTPClient         *http.Client
	GitWorkDir         string

	StrictValidation bool
	DeleteThreshold  float64
	SampleRate       float64
}

type RecordFormat

type RecordFormat int
const (
	RecordFormatUnknown RecordFormat = iota
	RecordFormatJSON
	RecordFormatYAML
)

type RetryableHTTPLeveledLogger

type RetryableHTTPLeveledLogger struct{}

func (RetryableHTTPLeveledLogger) Debug

func (r RetryableHTTPLeveledLogger) Debug(msg string, keysAndValues ...any)

func (RetryableHTTPLeveledLogger) Error

func (r RetryableHTTPLeveledLogger) Error(msg string, keysAndValues ...any)

func (RetryableHTTPLeveledLogger) Info

func (r RetryableHTTPLeveledLogger) Info(msg string, keysAndValues ...any)

func (RetryableHTTPLeveledLogger) Warn

func (r RetryableHTTPLeveledLogger) Warn(msg string, keysAndValues ...any)

type SourceRecord

type SourceRecord interface {
	// Open the source record
	Open(ctx context.Context) (io.ReadCloser, error)
}

type WorkItem

type WorkItem struct {
	// Context is included to propagate tracing spans (links) and cancellation
	// across the worker pool. This is a pragmatic choice for batch job processing.
	Context      context.Context //nolint:containedctx
	SourceRecord SourceRecord

	SourceRepository string
	SourcePath       string
	Format           RecordFormat
	KeyPath          string
	Strict           bool
	IsDeleted        bool
	LastUpdated      time.Time
	HasLastUpdated   bool
	IsReimport       bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL