Documentation
¶
Index ¶
- Constants
- Variables
- func IsProblemRank(rank int) bool
- func RankOf(cells map[SecurityStage]SecurityCell) int
- func SortAppPostures(ps []AppSecurityPosture)
- func SortStackPostures(ps []StackSecurityPosture)
- func SummarizeApps(ps []AppSecurityPosture) (AppSecuritySummary, StageCoverage)
- type Alert
- type AlertChannel
- type AlertFilter
- type AlertRule
- type AlertSeverity
- type AppRun
- type AppSecurityGroup
- type AppSecurityPosture
- type AppSecurityRecord
- type AppSecuritySummary
- type CellState
- type ClusterMetrics
- type Dashboard
- type ImageGrade
- type MonitoredStack
- type PipelineMetrics
- type ScanRecord
- type SecretRule
- type SecurityCell
- type SecurityStackRef
- type SecurityStage
- type SourceAlert
- type StackAlert
- type StackImage
- type StackImageInput
- type StackSecurityPosture
- type StackSecuritySummary
- type StageCoverage
- type ToolHealth
- type WorstImage
Constants ¶
const ( RankSecretLeak = 1 // 시크릿 셀이 block · warn — 커밋을 지워도 이미 유출이다 RankBlocked = 2 // 셀 하나라도 block — 배포가 멈춰 있다 RankUndetermined = 3 // 셀 하나라도 error · unrecorded — 상태를 모른다 RankWarning = 4 // 셀 하나라도 warn RankPassing = 5 // 적용된 셀이 모두 pass RankNoStage = 6 // 모든 셀이 not_applied — 보안 단계가 없다 )
위험 순위(설계 §2.3). 작을수록 위험하다.
const ( StackScanScanned = "scanned" StackScanPending = "pending" StackScanNotScanned = "not_scanned" )
스택 설치 이미지 스캔 보고서 상태(스택 모듈의 어휘와 같다).
Variables ¶
var ErrAlertNotFound = fmt.Errorf("alert not found")
ErrAlertNotFound is returned when an alert cannot be found.
var ErrAlertRuleNotFound = fmt.Errorf("alert rule not found")
ErrAlertRuleNotFound is returned when an alert rule cannot be found.
var SecurityStages = []SecurityStage{StageSecretScan, StageDependencyScan, StageSAST, StageImageScan}
SecurityStages 는 열 순서다.
Functions ¶
func IsProblemRank ¶ added in v0.6.0
IsProblemRank 는 "문제 있는 것만" 에 드는 순위(1~4)인지 본다.
func RankOf ¶ added in v0.6.0
func RankOf(cells map[SecurityStage]SecurityCell) int
RankOf 는 셀들로 위험 순위를 매긴다(설계 §2.3).
func SortAppPostures ¶ added in v0.6.0
func SortAppPostures(ps []AppSecurityPosture)
SortAppPostures 는 위험순으로 정렬한다(설계 §2.3) — 순위 → CRITICAL 합 많은 순 → 최근 실행 최근 순 → 이름 순. 화면은 받은 순서를 그대로 쓴다.
func SortStackPostures ¶ added in v0.6.0
func SortStackPostures(ps []StackSecurityPosture)
SortStackPostures 는 조치할 것이 많은 스택부터 둔다 — 스캔한 스택(A → B → C → 수정판 CRITICAL 많은 순) → 스캔 대기 → 스캔 안 함, 같으면 이름 순.
func SummarizeApps ¶ added in v0.6.0
func SummarizeApps(ps []AppSecurityPosture) (AppSecuritySummary, StageCoverage)
SummarizeApps 는 지표와 적용률을 센다. 범위 필터를 거친 앱 전체로 센다 — "문제 있는 것만" 으로 표를 줄여도 KPI 는 그대로다(설계 §3).
Types ¶
type Alert ¶
type Alert struct {
ID string `json:"id"`
RuleID string `json:"rule_id"`
Severity AlertSeverity `json:"severity"`
Message string `json:"message"`
FiredAt time.Time `json:"fired_at"`
ResolvedAt *time.Time `json:"resolved_at,omitempty"`
}
Alert represents a fired alert instance.
type AlertChannel ¶
type AlertChannel string
AlertChannel represents the notification channel for an alert.
const ( AlertChannelSlack AlertChannel = "slack" AlertChannelEmail AlertChannel = "email" )
type AlertFilter ¶ added in v0.6.0
type AlertFilter struct {
// contains filtered or unexported fields
}
AlertFilter 는 알림으로 보낼 경보를 고른다.
func DefaultAlertFilter ¶ added in v0.6.0
func DefaultAlertFilter() AlertFilter
DefaultAlertFilter 는 심각(critical)만 받고, 어디서나 뜨는 잡음을 뺀다.
- Watchdog · InfoInhibitor: 경보 경로가 살아 있음을 알리는 상시 경보와 억제용 경보다.
- 컨트롤 플레인 수집 실패: kube-prometheus-stack 은 controller-manager · scheduler · kube-proxy · etcd 를 kube-system Service 로 긁는데, kind · kubeadm 기본(127.0.0.1 바인드) · 관리형(EKS · GKE · AKS) 클러스터에서는 닿지 않아 늘 "Down" 이 뜬다. 2026-10-13 로컬 kind 에서 심각 경보 4건이 전부 이것이었다. 컨트롤 플레인이 실제로 죽으면 API 서버 · 노드 경보가 함께 뜬다.
func (AlertFilter) Accept ¶ added in v0.6.0
func (f AlertFilter) Accept(a SourceAlert) bool
Accept 는 그 경보를 알림으로 보낼지다.
type AlertRule ¶
type AlertRule struct {
ID string `json:"id"`
Name string `json:"name"`
MetricName string `json:"metric_name"`
Condition string `json:"condition,omitempty"`
WarningThreshold float64 `json:"warning_threshold"`
CriticalThreshold float64 `json:"critical_threshold"`
Threshold float64 `json:"threshold,omitempty"`
Channel AlertChannel `json:"channel"`
Enabled bool `json:"enabled"`
}
AlertRule defines a condition that triggers an alert when met.
type AlertSeverity ¶
type AlertSeverity string
AlertSeverity represents the severity level of a fired alert.
const ( AlertSeverityCritical AlertSeverity = "critical" AlertSeverityWarning AlertSeverity = "warning" AlertSeverityInfo AlertSeverity = "info" )
type AppSecurityGroup ¶ added in v0.6.0
type AppSecurityGroup struct {
StackID string
StackName string
ClusterID string
ClusterName string
Apps int
Blocked int
Secrets int
Critical int
Undetermined int
// Problems 는 문제 있는 앱(순위 1~4) 수다.
Problems int
// contains filtered or unexported fields
}
AppSecurityGroup 은 스택 하나의 묶음 머리다. 스택 없음 묶음은 StackID 가 비어 있다.
func GroupAppsByStack ¶ added in v0.6.0
func GroupAppsByStack(ps []AppSecurityPosture, stacks map[string]SecurityStackRef, clusterNames map[string]string) []AppSecurityGroup
GroupAppsByStack 는 앱을 스택별로 묶고 머리에 집계를 단다. 묶음 순서는 가장 위험한 앱이 있는 묶음부터 → 문제 수 많은 순 → 스택 이름 순이고, 스택 없음 묶음은 맨 뒤다. 클러스터는 스택의 것이다(스택 없음은 비어 있다).
type AppSecurityPosture ¶ added in v0.6.0
type AppSecurityPosture struct {
App AppSecurityRecord
Rank int
Cells map[SecurityStage]SecurityCell
// Critical 은 의존성 + 이미지 셀의 CRITICAL 합이다(정렬용). 모르는 건수는 0 으로 센다.
Critical int
}
AppSecurityPosture 는 앱 하나의 도출 결과다.
func EvaluateApp ¶ added in v0.6.0
func EvaluateApp(app AppSecurityRecord, now time.Time) AppSecurityPosture
EvaluateApp 는 앱 하나의 셀 · 순위 · CRITICAL 합을 도출한다.
type AppSecurityRecord ¶ added in v0.6.0
type AppSecurityRecord struct {
PipelineID string
Name string
// StackID 는 앱이 속한 (지우지 않은) 스택이다. 비면 "스택 없음" 이다.
StackID string
ClusterID string
// StagesKnown 이 거짓이면 단계 기록 전의 파이프라인이다 — 결과가 있으면 보이고 없으면 미적용이다.
StagesKnown bool
// HasStage 는 파이프라인 stages 에 그 단계가 있는지다. StagesKnown 일 때만 뜻이 있다.
HasStage map[SecurityStage]bool
// SecretPolicyOff 는 스택 정책의 시크릿 탐지가 off 인지다. 스택이 없으면 거짓이다(단계 유무로만 본다).
SecretPolicyOff bool
LatestRun *AppRun
Records map[SecurityStage]*ScanRecord
}
AppSecurityRecord 는 앱(파이프라인) 하나의 입력이다. 앱 테이블은 없다 — 파이프라인 한 행이 앱 하나다.
type AppSecuritySummary ¶ added in v0.6.0
type AppSecuritySummary struct {
Apps int
// WithSecurityStage 는 보안 단계가 하나라도 적용된 앱 수다(M1 의 분모).
WithSecurityStage int
// Blocked 는 셀 하나라도 block 인 앱 수다(M1).
Blocked int
// Secrets 는 시크릿 셀이 block 또는 warn 인 앱 수다 — 경고 정책이어도 센다(M2).
Secrets int
// Critical 은 이미지 또는 의존성 셀의 CRITICAL 이 1 이상인 앱 수다(M3, 정책 기준).
Critical int
// Undetermined 는 셀 하나라도 error 또는 unrecorded 인 앱 수다(M4).
Undetermined int
}
AppSecuritySummary 는 앱 축의 지표다(설계 §3, M1~M4). 건수가 아니라 조치할 앱 수로 센다.
type CellState ¶ added in v0.6.0
type CellState string
CellState 는 셀 하나의 상태다(설계 §2.2). 뒤의 셋은 초록으로 보이지 않는다 — 돌지 않은 것을 성공으로 보여주지 않는다(000070 의 교훈).
const ( CellPass CellState = "pass" CellWarn CellState = "warn" CellBlock CellState = "block" // CellError 는 판정 불가다(스캐너 장애 · 리포트 없음). "통과 아님". CellError CellState = "error" // CellUnrecorded 는 파이프라인에 단계는 있는데 결과가 아직 없다는 뜻이다. CellUnrecorded CellState = "unrecorded" // CellNotApplied 는 파이프라인에 단계가 없다는 뜻이다(시크릿은 스택 정책 off 도). CellNotApplied CellState = "not_applied" )
type ClusterMetrics ¶
type ClusterMetrics struct {
CPUUsage float64 `json:"cpu_usage"` // percentage 0-100
MemoryUsage float64 `json:"memory_usage"` // percentage 0-100
StorageUsage float64 `json:"storage_usage"` // percentage 0-100
PodCount int `json:"pod_count"`
}
ClusterMetrics holds resource utilization metrics for a cluster.
type Dashboard ¶
type Dashboard struct {
ClusterMetrics ClusterMetrics `json:"cluster_metrics"`
PipelineMetrics PipelineMetrics `json:"pipeline_metrics"`
ToolHealthList []ToolHealth `json:"tool_health"`
}
Dashboard aggregates all observability data for the platform overview.
type ImageGrade ¶ added in v0.6.0
type ImageGrade string
ImageGrade 는 이미지 단위의 CVE 대응 등급이다(설치 OSS CVE 대응 정책 §3.1 을 이미지 단위로 매긴다, 설계 §3 M5).
const ( // GradeA 는 수정판 있는 CRITICAL + 외부 노출이다. GradeA ImageGrade = "A" // GradeB 는 수정판 있는 CRITICAL + 내부다. GradeB ImageGrade = "B" // GradeC 는 수정판 있는 CRITICAL 은 없고 수정판 있는 HIGH 만 있다. GradeC ImageGrade = "C" // GradeNone 은 조치 대상이 아니거나(수정판 있는 것이 없다) 모른다(스캔 실패). GradeNone ImageGrade = "" )
func GradeImage ¶ added in v0.6.0
func GradeImage(img StackImage) ImageGrade
GradeImage 는 이미지의 등급이다. 정책의 등급은 CVE 단위지만 KPI 는 대상 수이므로, 수정판 있는 CRITICAL 이 하나라도 있으면 그 이미지는 A(외부 노출) 또는 B(내부)다. 수정판 건수를 모르면 등급을 매기지 않는다.
type MonitoredStack ¶ added in v0.6.0
MonitoredStack 은 경보를 가져올 스택이다(설치 완료 · 모니터링 수집을 고른 스택).
type PipelineMetrics ¶
type PipelineMetrics struct {
TotalRuns int `json:"total_runs"`
SuccessRate float64 `json:"success_rate"` // percentage 0-100
AvgBuildTime float64 `json:"avg_build_time_seconds"`
}
PipelineMetrics holds CI/CD pipeline execution statistics.
type ScanRecord ¶ added in v0.6.0
type ScanRecord struct {
// Gate 는 결과의 판정(pass · warn · block · error)이다.
Gate string
DeploymentID string
// Version 은 실행의 표시 번호(#42)다. 모르면 비어 있다.
Version string
At time.Time
// Link 는 리포트(시크릿 · 의존성 · 이미지) 또는 SonarQube 화면(SAST) 주소다.
Link string
// 시크릿 탐지
Findings *int
Rules []SecretRule
// 의존성 · 이미지 스캔. Counts 는 스택 정책(ignore_unfixed)을 따른 건수다.
Counts *shareddomain.SeverityCounts
Targets *int
DBUpdatedAt *time.Time
Image string
// SAST
Vulnerabilities *int
SecurityHotspots *int
FailedConditions []string
}
ScanRecord 는 단계 하나의 최신 결과 기록이다. 모르는 숫자는 nil 이다 — 0 으로 채우지 않는다.
type SecretRule ¶ added in v0.6.0
SecretRule 은 시크릿 탐지 규칙 하나의 건수다.
type SecurityCell ¶ added in v0.6.0
type SecurityCell struct {
State CellState
Record *ScanRecord
// StaleRun 은 셀의 실행이 앱의 최근 실행이 아니라는 뜻이다 — 앞 단계가 막으면 뒤 단계는 돌지 않는다.
StaleRun bool
// DBStale 은 의존성 · 이미지 셀에서 리포트를 읽었을 때만 있다. DB 시각을 모르면 낡은 것으로 본다.
DBStale *bool
}
SecurityCell 은 도출한 셀 하나다. Record 는 상태가 결과에서 왔을 때만 있다.
func CellFor ¶ added in v0.6.0
func CellFor(app AppSecurityRecord, stage SecurityStage, now time.Time) SecurityCell
CellFor 는 앱의 단계 하나의 셀을 도출한다(설계 §2.2).
- 시크릿은 스택 정책이 off 면 미적용이다 — 단계는 돌되 바로 통과하므로 결과가 있어도 탐지한 것이 아니다.
- 단계 목록을 아는 파이프라인: 단계가 없으면 미적용, 있는데 결과가 없으면 기록 없음.
- 단계 목록을 모르는 옛 파이프라인: 결과가 있으면 보이고, 없으면 미적용이다.
type SecurityStackRef ¶ added in v0.6.0
SecurityStackRef 는 스택 하나의 이름과 클러스터다.
type SecurityStage ¶ added in v0.6.0
type SecurityStage string
SecurityStage 는 앱 행의 보안 단계 열이다. 순서는 파이프라인 단계 순서(시크릿 → 의존성 → SAST → 이미지)다.
const ( StageSecretScan SecurityStage = "secret_scan" StageDependencyScan SecurityStage = "dependency_scan" StageSAST SecurityStage = "sast" StageImageScan SecurityStage = "image_scan" )
type SourceAlert ¶ added in v0.6.0
type SourceAlert struct {
Fingerprint string
Labels map[string]string
Annotations map[string]string
StartsAt time.Time
// Suppressed 는 침묵(silence) · 억제(inhibition)된 경보다. 알리지 않지만 "보인 것" 이다 — 침묵을
// 걸었다고 해제로 읽으면 해제 알림이 나가고 침묵이 끝날 때 발생 알림이 다시 나간다.
Suppressed bool
}
SourceAlert 는 Alertmanager 의 활성 경보 하나다.
type StackAlert ¶ added in v0.6.0
type StackAlert struct {
ID string
OrgID string
StackID string
StackName string
Fingerprint string
AlertName string
Severity string
Summary string
Description string
RunbookURL string
Labels map[string]string
StartedAt time.Time
LastSeenAt time.Time
ResolvedAt *time.Time
LastNotifiedAt *time.Time
}
StackAlert 는 플랫폼이 기록하는 스택 경보 하나다 — 발생부터 해제까지.
func NewStackAlert ¶ added in v0.6.0
func NewStackAlert(stack MonitoredStack, a SourceAlert, now time.Time) *StackAlert
NewStackAlert 는 가져온 경보를 기록할 모양으로 옮긴다.
func (*StackAlert) FiredEvent ¶ added in v0.6.0
func (a *StackAlert) FiredEvent(repeat bool) sharednotify.Event
FiredEvent 는 발생 알림이다. repeat 이면 계속 발생 중이라는 다시 알림이다.
func (*StackAlert) Resolve ¶ added in v0.6.0
func (a *StackAlert) Resolve(at time.Time) bool
Resolve 는 해제를 기록한다. 이미 해제됐으면 false 다.
func (*StackAlert) ResolvedEvent ¶ added in v0.6.0
func (a *StackAlert) ResolvedEvent() sharednotify.Event
ResolvedEvent 는 해제 알림이다. 이어진 시간은 마지막으로 본 때까지다 — 해제는 유예가 지난 뒤에 알게 되므로 해제를 안 시각으로 세면 유예만큼 길게 보인다.
func (*StackAlert) Target ¶ added in v0.6.0
func (a *StackAlert) Target() string
Target 은 사람이 찾아갈 수 있는 것 중 가장 구체적인 것이다(파드 · PVC · 노드 · 인스턴스 · 잡).
type StackImage ¶ added in v0.6.0
type StackImage struct {
Image string
Exposed bool
// Scanned 가 거짓이면 그 이미지를 스캔하지 못했다(건수를 모른다).
Scanned bool
Counts *shareddomain.SeverityCounts
Fixable *shareddomain.SeverityCounts
DBUpdatedAt *time.Time
}
StackImage 는 설치 이미지 하나의 스캔 결과다.
type StackImageInput ¶ added in v0.6.0
type StackImageInput struct {
StackID string
StackName string
ClusterID string
// State 는 보고서 상태(scanned · pending · not_scanned)다.
State string
Reason string
Airgap bool
// ScannedAt 은 마지막 스캔 시각이다. 스캔한 적 없으면 nil 이다.
ScannedAt *time.Time
Images []StackImage
}
StackImageInput 은 스택 하나의 설치 이미지 스캔 보고서다.
type StackSecurityPosture ¶ added in v0.6.0
type StackSecurityPosture struct {
StackID string
StackName string
ClusterID string
ClusterName string
State string
Reason string
Airgap bool
Images *int
FailedImages *int
GradeA *int
GradeB *int
GradeC *int
// Fixable 은 수정판 있는 취약점 건수의 합이다(스캔한 이미지).
Fixable *shareddomain.SeverityCounts
WorstImage *WorstImage
ScannedAt *time.Time
// DBUpdatedAt 은 스캔한 이미지 가운데 가장 오래된 취약점 DB 시각이다 — 낡은 쪽을 숨기지 않는다.
DBUpdatedAt *time.Time
DBStale *bool
}
StackSecurityPosture 는 스택 하나의 설치 OSS 행이다. 스캔하지 않은 스택의 숫자는 nil 이다 — "스캔 안 함" 을 0 으로 보이지 않는다(설계 §4.4).
func EvaluateStack ¶ added in v0.6.0
func EvaluateStack(in StackImageInput, now time.Time) StackSecurityPosture
EvaluateStack 은 스택 하나의 설치 OSS 행을 만든다.
type StackSecuritySummary ¶ added in v0.6.0
type StackSecuritySummary struct {
Stacks int
ScannedStacks int
NotScannedStacks int
// ActionImages 는 수정판 있는 CRITICAL 을 가진 이미지 수 = A + B 다.
ActionImages int
GradeAImages int
GradeBImages int
}
StackSecuritySummary 는 설치 OSS 축의 지표다(설계 §3 M5).
func SummarizeStacks ¶ added in v0.6.0
func SummarizeStacks(ps []StackSecurityPosture) StackSecuritySummary
SummarizeStacks 는 설치 OSS 지표를 센다.
type StageCoverage ¶ added in v0.6.0
StageCoverage 는 단계마다 적용된(미적용이 아닌) 앱 수다. KPI 가 아니라 열 머리에 둔다(설계 §3).
type ToolHealth ¶
type ToolHealth struct {
Name string `json:"name"`
Status string `json:"status"` // running, warning, error
Version string `json:"version"`
}
ToolHealth represents the health status of a DevOps tool.