Help us shape the future of Go! Take the 2026 Go Developer Survey

listeners

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: AGPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DaemonVEXRuleRecommendations    = "vexrules.recommendations"
	DaemonSBOMGarbageCollection     = "maintain.sbomGarbageCollection"
	DaemonOpenSourceInsights        = "vulndb.opensourceinsights"
	DaemonVulnDB                    = "vulndb.vulndb"
	DaemonFixedVersions             = "vulndb.fixedVersions"
	DaemonAssetPipeline             = "assetPipeline"
	DaemonAssetPipelineAll          = "daemon.assetPipelineAll"
	DaemonAssetPipelineSinglePrefix = "daemon.assetPipelineSingle."
	DaemonExternalEntityGarbage     = "externalEntityGarbageCollection"
)

Daemon keys - they identify the daemons in the CLI and the admin endpoints. The admin endpoints persist them as config keys for their cooldown - do not rename.

View Source
const (
	StageResolveFixedVersions              = "ResolveFixedVersions"
	StageSyncTickets                       = "SyncTickets"
	StageResolveDifferencesInTicketState   = "ResolveDifferencesInTicketState"
	StageScanAsset                         = "ScanAsset"
	StageSyncUpstream                      = "SyncUpstream"
	StageResolveLicenses                   = "ResolveLicenses"
	StageFindLicenseRisks                  = "FindLicenseRisks"
	StageApplyVEXRules                     = "ApplyVEXRules"
	StageCollectStats                      = "CollectStats"
	StageRecalculateRiskForVulnerabilities = "RecalculateRiskForVulnerabilities"
	StageDeleteOldAssetVersions            = "DeleteOldAssetVersions"
)

Asset pipeline stage names. They can be passed via DebugOptions.LimitToStages.

Variables

Functions

This section is empty.

Types

type DaemonRunner

type DaemonRunner struct {
	// contains filtered or unexported fields
}

DaemonRunner encapsulates daemon dependencies and lifecycle

func NewDaemonRunner

func NewDaemonRunner(
	db shared.DB,
	broker events.Broker,
	configService shared.ConfigService,
	rbacProvider shared.RBACProvider,
	integrationAggregate shared.IntegrationAggregate,
	assetVersionService shared.AssetVersionService,
	assetVersionRepository shared.AssetVersionRepository,
	assetRepository shared.AssetRepository,
	projectRepository shared.ProjectRepository,
	orgRepository shared.OrganizationRepository,
	componentRepository shared.ComponentRepository,
	componentService shared.ComponentService,
	licenseRiskService shared.LicenseRiskService,
	dependencyVulnService shared.DependencyVulnService,
	dependencyVulnRepository shared.DependencyVulnRepository,
	componentProjectRepository shared.ComponentProjectRepository,
	statisticsService shared.StatisticsService,
	artifactRepository shared.ArtifactRepository,
	cveRepository shared.CveRepository,
	scanService shared.ScanService,
	vulnDBImportService shared.VulnDBService,
	vexRuleRepository shared.VEXRuleRepository,
	vexRuleRecommendationRepository shared.VEXRuleRecommendationRepository,
	trustedEntityRepository shared.TrustedEntityRepository,
	externalReferenceRepository shared.ExternalReferenceRepository,
	sbomRepository shared.SBOMRepository,
	fixedVersionResolver shared.FixedVersionResolver,
	upstreamVEXRuleRepository shared.UpstreamVEXRuleRepository,
	externalEntityProviderService shared.ExternalEntityProviderService,
	firstPartyVulnService shared.FirstPartyVulnService,
	pool *pgxpool.Pool,
) *DaemonRunner

NewDaemonRunner creates a new daemon runner with injected dependencies

func (*DaemonRunner) CleanupOrphanedRecords

func (runner *DaemonRunner) CleanupOrphanedRecords(ctx context.Context) error

func (*DaemonRunner) CollectExternalEntityGarbage

func (runner *DaemonRunner) CollectExternalEntityGarbage(ctx context.Context) error

func (*DaemonRunner) CollectSBOMGarbage

func (runner *DaemonRunner) CollectSBOMGarbage(ctx context.Context) error

CollectSBOMGarbage removes subtrees no SBOM can reach any more.

Content addressing never updates or deletes an edge in place, so every superseded revision of an SBOM leaves its old spine behind. Only reachability from the sboms table distinguishes those from subtrees another SBOM still shares, which is why this is a mark and sweep rather than reference counting.

The sweep is safe to run alongside ingest: SaveTree writes a tree and the row referencing it in one transaction, so a tree is never visible here without the row that keeps it alive.

func (*DaemonRunner) DebugMode

func (runner *DaemonRunner) DebugMode() bool

func (*DaemonRunner) FetchVulnsToUpdate

func (runner *DaemonRunner) FetchVulnsToUpdate(ctx context.Context) ([]fixedVersionJob, error)

fetches all vulns with no component_fixed_version information and deduplicates them based on purl + cve_id

func (*DaemonRunner) RegisterJobs

func (runner *DaemonRunner) RegisterJobs(schedule bool) error

func (*DaemonRunner) RunAssetPipeline

func (runner *DaemonRunner) RunAssetPipeline(ctx context.Context, forceAll bool)

RunAssetPipeline runs the pipeline for all assets in this process, bypassing the queue. Without forceAll, steps which finished within the pipeline interval are skipped.

func (*DaemonRunner) RunDaemonPipelineForAsset

func (runner *DaemonRunner) RunDaemonPipelineForAsset(ctx context.Context, assetID uuid.UUID) error

func (*DaemonRunner) RunDaemonPipelineForAssets

func (runner *DaemonRunner) RunDaemonPipelineForAssets(ctx context.Context, assetIDs []uuid.UUID) map[uuid.UUID]error

RunDaemonPipelineForAssets runs the pipeline for the given assets and returns the error of every failed asset

func (*DaemonRunner) RunScanDaemon

func (runner *DaemonRunner) RunScanDaemon(ctx context.Context) error

func (*DaemonRunner) RunVEXRuleRecommendationDaemon

func (runner *DaemonRunner) RunVEXRuleRecommendationDaemon(ctx context.Context) error

func (*DaemonRunner) ScanAllAssets

func (runner *DaemonRunner) ScanAllAssets(ctx context.Context) error

ScanAllAssets matches every stored SBOM against the vulndb and opens, associates or fixes dependency vulns for all assets it must finish before the asset pipeline, so the per asset stages see the new vulns

func (*DaemonRunner) SetDebugOptions

func (runner *DaemonRunner) SetDebugOptions(options DebugOptions)

func (*DaemonRunner) StartBenchmarkJobs

func (runner *DaemonRunner) StartBenchmarkJobs(ctx context.Context, stages []string)

StartBenchmarkJobs runs the asset pipeline over all assets with every database write rolled back. stages limits the run to the given pipeline stages, see DebugOptions.LimitToStages for the valid names - pass nil to run all of them.

func (*DaemonRunner) UpdateAllFixedVersions

func (runner *DaemonRunner) UpdateAllFixedVersions(ctx context.Context, updatingJobs []fixedVersionJob) error

updates the dependency vulns passed using a <staging table + copy + update> from approach

func (*DaemonRunner) UpdateFixedVersions

func (runner *DaemonRunner) UpdateFixedVersions(ctx context.Context) error

func (*DaemonRunner) UpdateOpenSourceInsightInformation

func (runner *DaemonRunner) UpdateOpenSourceInsightInformation(ctx context.Context) error

func (*DaemonRunner) UpdateVulnDB

func (runner *DaemonRunner) UpdateVulnDB(ctx context.Context) error

type DebugOptions

type DebugOptions struct {
	LimitToAssetVersionSlug string
	// LimitToStages, when non-empty, skips all pipeline stages not in the list.
	// Valid values match the stage method names: "SyncTickets",
	// "ResolveDifferencesInTicketState", "SyncUpstream",
	// "CollectStats", "RecalculateRiskForVulnerabilities",
	// "DeleteOldAssetVersions", "ResolveFixedVersions".
	LimitToStages []string
	// DryRun skips all database writes. External system mutations are separately
	// intercepted by the dryRunIntegration wrapper.
	DryRun bool
}

Jump to

Keyboard shortcuts

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