Documentation
¶
Index ¶
- Constants
- func AppendTruncatedEvidence(out *Output, items []string, prefix, overflowLabel string)
- func BuildCompliantRationale(items []string, emptyMessage, description string) string
- func BuildViolationRationale(items []string, singular, plural string) string
- func FormatScannedItems(items []string) string
- func SetChecksWriter(ctx context.Context, w ChecksWriter) context.Context
- func TruncateEvidence(evidence []string) []string
- func WriteCheckOutputs(ctx context.Context, input dag_impl.Input, checkOutputs []Output) error
- func WriteSummary(ctx context.Context, input dag_impl.Input, summary any) error
- type BaseCheckNode
- func (b *BaseCheckNode) CreateSkippedOutput(reason string, input dag_impl.Input) *Output
- func (b *BaseCheckNode) GetCategories() map[category.RiskCategory]string
- func (b *BaseCheckNode) GetCode() string
- func (b *BaseCheckNode) GetDescription() string
- func (b *BaseCheckNode) GetDisclaimers() []string
- func (b *BaseCheckNode) GetOutcomes() storage.Outcomes
- func (b *BaseCheckNode) GetThresholds() map[string]any
- func (b *BaseCheckNode) GetWhyThisMatters() string
- func (b *BaseCheckNode) Kind() string
- type CheckOutputProvider
- type ChecksWriter
- type Output
- func (o *Output) Metadata() map[string]any
- func (o *Output) WithEvidence(evidence string) *Output
- func (o *Output) WithEvidencef(format string, args ...any) *Output
- func (o *Output) WithMetadata(key string, value any) *Output
- func (o *Output) WithThresholds(thresholds map[string]any) *Output
- func (o *Output) Write(ctx context.Context) error
Constants ¶
const MaxEvidenceItems = 5
Variables ¶
This section is empty.
Functions ¶
func AppendTruncatedEvidence ¶
func BuildCompliantRationale ¶
func BuildViolationRationale ¶
func FormatScannedItems ¶
func SetChecksWriter ¶
func SetChecksWriter(ctx context.Context, w ChecksWriter) context.Context
func TruncateEvidence ¶
func WriteCheckOutputs ¶
Types ¶
type BaseCheckNode ¶
type BaseCheckNode struct {
// UPPER_SNAKE_CASE identifier. Must be unique across all checks.
Code string `json:"code"`
// Single sentence stating the condition this check detects.
// Must read naturally as: "This check fires when: <Description>".
// State the observable fact only — consequences belong in Categories.
Description string `json:"description"`
// One sentence explaining the security or operational risk this check exists to detect.
// Omit when the Description (and Outcomes, if present) already make the risk self-evident.
WhyThisMatters string `json:"why_this_matters,omitempty"`
// Risk category → sentence explaining WHY this check belongs in that category.
// The key determines policy enforcement; the value completes the sentence
// "This check is in the <category> category because: <value>".
// Do NOT restate the Description — explain the consequence or risk.
Categories map[category.RiskCategory]string `json:"categories"`
// What each check status means for this specific check.
// Omit when the Description already makes outcomes self-evident.
Outcomes storage.Outcomes `json:"outcomes,omitempty"`
// Methodology, scope limitations, or default thresholds a customer needs to
// interpret the result correctly. Use fmt.Sprintf for threshold defaults so
// values stay in sync with code. One caveat per entry.
Disclaimers []string `json:"disclaimers,omitempty"`
// Configurable decision boundaries for threshold-based checks.
// Serialized into catalog and check output for customer visibility.
Thresholds map[string]any `json:"thresholds,omitempty"`
}
BaseCheckNode provides common fields and all boilerplate methods for check nodes. Embed this struct to get Kind(), GetCode(), GetDescription(), GetCategories(), and CreateSkippedOutput().
All fields serialize into the catalog (go run src/server/main.go meta catalog) and are visible to customers evaluating the product. Write for a non-technical security audience.
func (*BaseCheckNode) CreateSkippedOutput ¶
func (b *BaseCheckNode) CreateSkippedOutput(reason string, input dag_impl.Input) *Output
func (*BaseCheckNode) GetCategories ¶
func (b *BaseCheckNode) GetCategories() map[category.RiskCategory]string
func (*BaseCheckNode) GetCode ¶
func (b *BaseCheckNode) GetCode() string
func (*BaseCheckNode) GetDescription ¶
func (b *BaseCheckNode) GetDescription() string
func (*BaseCheckNode) GetDisclaimers ¶
func (b *BaseCheckNode) GetDisclaimers() []string
func (*BaseCheckNode) GetOutcomes ¶
func (b *BaseCheckNode) GetOutcomes() storage.Outcomes
func (*BaseCheckNode) GetThresholds ¶
func (b *BaseCheckNode) GetThresholds() map[string]any
func (*BaseCheckNode) GetWhyThisMatters ¶
func (b *BaseCheckNode) GetWhyThisMatters() string
func (*BaseCheckNode) Kind ¶
func (b *BaseCheckNode) Kind() string
type CheckOutputProvider ¶
type CheckOutputProvider interface {
GetCheckOutput() *Output
}
CheckOutputProvider is an interface for types that wrap checks.Output Each check's unique output type should implement this interface
type ChecksWriter ¶
func GetChecksWriter ¶
func GetChecksWriter(ctx context.Context) ChecksWriter
type Output ¶
type Output struct {
dag_impl.BaseOutput `json:",inline"`
Check storage.Check `json:",inline"`
// contains filtered or unexported fields
}
func NewCompliantOutput ¶
func NewSkippedOutput ¶
func NewViolationOutput ¶
func (*Output) WithEvidence ¶
WithEvidencef appends a formatted evidence string and returns the output for chaining
func (*Output) WithEvidencef ¶
WithEvidencef appends a formatted evidence string and returns the output for chaining
func (*Output) WithThresholds ¶
WithThresholds sets the thresholds and returns the output for chaining