provenance

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeSourceORMs

func MergeSourceORMs(dst, src []*pb.SourceORM) ([]*pb.SourceORM, bool)

MergeSourceORMs unions `src` into `dst`: every contribution in src whose identity is not already present in dst is appended. It returns the merged slice and whether dst grew.

This is the provenance-survives-as-union primitive that underpins the whole feature: when the ingest/merge fold folds two records that denote the same object (the same host, the same credential), their contributing tools must ACCUMULATE — a second tool enriching an existing object must never silently drop the first tool's provenance. Every domain merge (credential.MergeCore, host merge, …) routes its Sources through here so the union semantics stay identical across domains.

func MergeSources

func MergeSources(dst, src []*pb.Source) ([]*pb.Source, bool)

MergeSources is the PB-level counterpart to MergeSourceORMs, with identical union semantics: the in-memory host merge (host/merge.go) folds user-facing *pb.Source values, whereas credential's ORM-level MergeCore folds *pb.SourceORM. Both route through the same identity so provenance dedups the same way regardless of which representation is in hand.

func Tools

func Tools(sources []*pb.Source) string

Tools returns the distinct, comma-joined contributing tool names of a set of Sources, for compact display ("nmap, metasploit"). An empty Tool renders as "manual". Shared by every domain's detail view so provenance is presented identically everywhere.

func WhereContributedBy

func WhereContributedBy(joinTable, objectFK, tool string) func(*gorm.DB) *gorm.DB

WhereContributedBy is the code-API "give me only my objects" scope: it restricts a query to the objects contributed by the named tool, joining through that object's provenance m2m table to the shared sources table. joinTable is the m2m join (e.g. "host_sources", "core_sources") and objectFK its column referencing the queried object's id (e.g. "host_id", "core_id"). An empty tool is a no-op (the default cross-tool shared view), so callers can pass a filter value through unconditionally. Any tool consuming AIMS as a library can therefore scope to just the data it produced with `db.Scopes(provenance.WhereContributedBy("host_sources","host_id",tool))`.

Types

type Source

type Source pb.Source

Source is a native wrapper around the generated provenance.Source, so Go-idiomatic helpers can hang off the type without polluting the generated code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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