labels

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 2 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 labels renders the human-facing security-* label vocabulary the issue projection stamps on tracking issues: source, advisories, the finding's phase, severity, priority, and the investigation's verdict. The Finding custom resource is the state machine — these labels are a one-way projection for humans and issue searches, never parsed back into state.

GitHub caps label names at 50 characters, so Render truncates; anything a label abbreviates lives in full on the Finding.

Index

Constants

View Source
const (
	KeySource         = "security-source"
	KeyAdvisory       = "security-advisory"
	KeyFinding        = "security-finding"
	KeySeverity       = "security-severity"
	KeyPriority       = "security-priority"
	KeyRecommendation = "security-recommendation"
	KeyContext        = "security-context"
)

Label keys. Every patchy label is "<key>: <value>"; the multi-valued advisory key emits one label per value. This is the full human-facing vocabulary the issue projection renders — the Finding CR is the state, so no machine or usage labels exist.

View Source
const MaxLen = 50

MaxLen is GitHub's label-name length cap; Render never emits a longer name.

Variables

This section is empty.

Functions

func Diff

func Diff(prev, next Set) (add, remove []string)

Diff returns the label names to add to and remove from an issue to move it from prev to next. Labels outside the security- namespace are never touched.

func Name

func Name(key, value string) string

Name renders a single label name ("key: value"), enforcing MaxLen — the form used for GitHub label filters and search queries.

Types

type Level

type Level string

Level is a severity or priority value.

const (
	LevelLow      Level = "low"
	LevelMedium   Level = "medium"
	LevelHigh     Level = "high"
	LevelCritical Level = "critical"
)

The severity/priority scale.

type Recommendation

type Recommendation string

Recommendation is the investigation's verdict — the same vocabulary the agent writes in its report frontmatter (internal/report.Recommendation).

const (
	RecommendationRemediate Recommendation = "remediate"
	RecommendationIgnore    Recommendation = "ignore"
	RecommendationManual    Recommendation = "manual"
)

The investigation verdicts.

type Set

type Set struct {
	Source         string
	Advisories     []string
	Finding        State
	Severity       Level
	Priority       Level
	Recommendation Recommendation
	// Context carries enhancer attributes, one "security-context: k=v" label
	// per entry.
	Context map[string]string
}

Set is the typed view of one issue's patchy labels. Zero fields render no label.

func Parse

func Parse(names []string) Set

Parse builds a Set from raw GitHub label names. It is tolerant: labels without the security- prefix, unknown keys, and unparseable values are ignored — issues carry human labels too, and a foreign security-* label must never wedge the pipeline.

func (Set) Render

func (s Set) Render() []string

Render emits the label names for the set, deterministically ordered, each within MaxLen. Zero fields emit nothing.

type State

type State string

State is the security-finding label value: the kebab-case rendering of the Finding's phase.

Jump to

Keyboard shortcuts

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