enrich

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package enrich is the sixth pipeline stage: it derives tier, scopes, org, first_seen, age and dollars at risk per day from verify evidence and the spend registry.

Index

Constants

View Source
const Noop = "noop"

Noop is the name of the adapter that changes nothing.

View Source
const Spend = "spend"

Spend is the name of the adapter that prices exposure from the spend registry.

Variables

This section is empty.

Functions

func ApplyFirstSeen

func ApplyFirstSeen(f *model.Finding, generatedAt time.Time)

ApplyFirstSeen sets FirstSeen and AgeDays on f from its commit Locations. It runs after the barrier, once every Location of the finding has been merged, because an enricher that runs per candidate cannot see them all.

FirstSeen is the earliest commit Location: the smallest date, then the smallest commit id. AgeDays is the whole days from that date to generatedAt, never below 0. A finding with no dated commit Location keeps its FirstSeen and AgeDays as they are (nil for a fresh finding). It sets no other field.

func Register

func Register(name string, f Factory)

Register adds an enrich adapter. Adapters call it from init().

Types

type Enricher

type Enricher interface {
	Enrich(ctx context.Context, f *model.Finding)
}

Enricher is the enrich stage interface. Enrich sets only the enrichment fields (Tier, Scopes, Org, FirstSeen, AgeDays and the dollar fields).

type Factory

type Factory func(Options) (Enricher, error)

Factory builds an Enricher.

func Lookup

func Lookup(name string) (Factory, bool)

Lookup returns the enrich adapter registered under name.

type Options

type Options struct {
	// Registry supplies the spend registry for the spend adapter.
	Registry *registry.Registry
}

Options configures an enricher.

Jump to

Keyboard shortcuts

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