Documentation
¶
Overview ¶
Package enhance is patchy's public plugin seam for context enhancement. An Enhancer augments a newly opened security-finding issue with first/third party context — CMDB ownership, associated infrastructure, runbooks — as a comment (the issue body is owned by the accumulator) plus structured attributes the pipeline consumes, most importantly the owners used for assignment.
Implementations may live outside this repository; the exported API is deliberately self-contained and depends on nothing under internal/. Enhancers run as an ordered chain and must be best-effort: a failing enhancer is logged and skipped, never blocking the pipeline.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Enhancer ¶
type Enhancer interface {
// ID names the enhancer, for logs and comment attribution.
ID() string
// Enhance returns the enrichment for the issue, or (nil, nil) when the
// enhancer has nothing to contribute.
Enhance(ctx context.Context, issue Issue) (*Enrichment, error)
}
Enhancer is the interface a context-enhancement plugin implements.
type Enrichment ¶
type Enrichment struct {
// Owners are GitHub logins responsible for the affected repository, in
// preference order; the pipeline uses them for issue assignment.
Owners []string
// CommentMarkdown is arbitrary content, kept as one sticky comment per
// enhancer on the tracking issue. Empty means no comment. Semi-structured
// facts belong in Attributes, not here.
CommentMarkdown string
// Attributes are semi-structured facts (system name, environment, tier),
// projected as tracking labels; carried verbatim.
Attributes map[string]string
// Repository is a repository the enhancer resolved for a finding that
// arrived without one — a cloud finding whose resource carries ownership
// labels. Ignored when the finding already has a repository: the value is
// written to the Finding exactly once and never revised, because the
// rollup ledger, the clone artifact, and the agent Jobs all snapshot it
// independently. Where several enhancers return one, the first in the
// chain wins.
Repository *source.RepositoryRef
}
Enrichment is what an Enhancer contributes to an issue.
type Issue ¶
type Issue struct {
Repo source.Repo
Number int
Title string
Body string
Labels []string
// CloudResource is set when the finding is about a cloud resource rather
// than repository code. Enhancers key on it both to skip findings they do
// not cover and to look the resource up with the platform's own API.
CloudResource *source.CloudResource
}
Issue is the minimal view of a security-finding issue an Enhancer sees.