shared

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package shared holds value objects and errors common to all domain packages. It must not import any other internal package (innermost layer of the onion).

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrValidation = errors.New("validation error")
	ErrNotFound   = errors.New("not found")
	ErrForbidden  = errors.New("forbidden")        // scope / authorization-window violations
	ErrConflict   = errors.New("conflict")         // optimistic-concurrency version mismatch (lost-update guard)
	ErrSaturated  = errors.New("system saturated") // bounded admission rejected (backpressure → 503)
)

Sentinel errors mapped to transport status codes by the adapter layer.

Functions

func CVSSv3BaseScore

func CVSSv3BaseScore(vector string) (float64, bool)

CVSSv3BaseScore computes the CVSS v3.0/v3.1 base score from a vector string (e.g. "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"). Returns (score, true) for a well-formed v3 vector, else (0, false). v4.0 vectors are not scored here.

func SeverityRank

func SeverityRank(s Severity) int

SeverityRank orders severity from unknown (0) to critical (5); used for thresholds and tie-breaks.

Types

type Audit

type Audit struct {
	CreatedAt time.Time
	UpdatedAt time.Time
	// CreatedBy / UpdatedBy attribute a record to the actor that created / last modified it
	// (ownership). Empty = system/unknown (legacy rows, or write paths not yet wired).
	// Engagements persist these; other record types carry the fields and adopt persistence
	// incrementally – the canonical home so ownership is one shape across the domain.
	CreatedBy string
	UpdatedBy string
}

Audit holds common audit timestamps embedded by entities.

type ID

type ID string

ID is a domain identifier (opaque string; generated by the platform layer).

func (ID) IsZero

func (id ID) IsZero() bool

func (ID) String

func (id ID) String() string

type Severity

type Severity string

Severity is the normalized severity scale shared by findings and vulnerabilities.

const (
	SeverityCritical Severity = "critical"
	SeverityHigh     Severity = "high"
	SeverityMedium   Severity = "medium"
	SeverityLow      Severity = "low"
	SeverityInfo     Severity = "info"
	SeverityUnknown  Severity = "unknown"
)

func SeverityFromScore

func SeverityFromScore(score float64) Severity

SeverityFromScore maps a CVSS base score to the qualitative severity band.

func (Severity) Valid

func (s Severity) Valid() bool

Valid reports whether s is a known severity label.

Jump to

Keyboard shortcuts

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