Documentation
¶
Overview ¶
Package enhance is patchy's public plugin interface for context enhancement. An Enhancer adds first- or third-party context (CMDB ownership, associated infrastructure, runbooks) to a newly opened finding. It returns structured attributes the pipeline consumes (most importantly the owners used for assignment) and optional markdown. context-controller writes the result to the Finding's status, and integration-controller projects the markdown onto the tracking issue as one sticky comment per enhancer.
Implementations may live outside this repository, so the exported API is 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, such as 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 repository 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.