saga

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 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 saga defines the Draugr descriptor ("Saga") — the declarative account of an application's security surface (repositories, images, hosts, infrastructure) plus the controller configuration that drives a scan. It also handles parsing, validation, env-var substitution, and assembly of distributed meta-sources.

See docs/ARCHITECTURE.md and docs/naming.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	Name           string                        `yaml:"name"`
	Labels         map[string]string             `yaml:"labels,omitempty"`
	Repositories   []Repository                  `yaml:"repositories,omitempty"`
	Images         []Image                       `yaml:"images,omitempty"`
	Hosts          []Host                        `yaml:"hosts,omitempty"`
	Infrastructure []Infrastructure              `yaml:"infrastructure,omitempty"`
	Controllers    map[string]ControllerSettings `yaml:"controllers,omitempty"`
}

Component is one logical part of an application: its repositories, images, hosts, and infrastructure, plus optional per-component controller overrides.

func (Component) ControllerEnabled

func (comp Component) ControllerEnabled(name string, project Config) bool

ControllerEnabled reports whether the named controller is enabled for this component, falling back to the project-level setting when the component has no override.

type Config

type Config struct {
	Controllers map[string]ControllerSettings `yaml:"controllers,omitempty"`
}

Config holds global, per-controller configuration. Each controller's config tree is free-form (scanner-specific keys live under it); use ControllerEnabled to read the common "enabled" flag.

func (Config) ControllerEnabled

func (c Config) ControllerEnabled(name string) bool

ControllerEnabled reports whether the named controller is enabled at the project level. A controller is enabled when its config entry exists and its "enabled" key is not explicitly false. Absent entries are considered disabled.

type ControllerSettings

type ControllerSettings map[string]any

ControllerSettings is a free-form configuration tree for one controller.

type Fragment

type Fragment struct {
	Components []Component `yaml:"components,omitempty"`
}

Fragment is a partial Saga contributed by a Surveyor (one of "the Ravens"). The engine merges fragments into the Model.

type Host

type Host struct {
	Name string `yaml:"name"`
	URL  string `yaml:"url"`
	Type string `yaml:"type,omitempty"`
}

Host is a running endpoint. Type is "api" or "web".

type Image

type Image struct {
	Image string `yaml:"image"`
}

Image is a container image reference.

type Infrastructure

type Infrastructure struct {
	Kind string `yaml:"kind"`
	Ref  string `yaml:"ref,omitempty"`
}

Infrastructure is an infrastructure surface. Kind is e.g. "kubernetes"; Ref names the concrete instance.

type MetaSource

type MetaSource struct {
	RepoURL  string `yaml:"repoUrl"`
	Path     string `yaml:"path"`
	Revision string `yaml:"revision,omitempty"`
}

MetaSource points at a Saga fragment kept close to a component's source.

type Model

type Model struct {
	Release               Release      `yaml:"release"`
	Config                Config       `yaml:"config,omitempty"`
	Components            []Component  `yaml:"components,omitempty"`
	ComponentsMetaSources []MetaSource `yaml:"componentsMetaSources,omitempty"`
	References            []Reference  `yaml:"references,omitempty"`
}

Model is a parsed Saga descriptor — the declarative account of an application's security surface plus the controller configuration that drives a scan.

func Load

func Load(data []byte) (*Model, error)

Load parses a Saga descriptor from YAML bytes, substituting ${{ VAR }} references from the environment and validating the result.

func LoadFile

func LoadFile(path string) (*Model, error)

LoadFile reads and parses a Saga descriptor from a file path.

func (*Model) Validate

func (m *Model) Validate() error

Validate checks the descriptor for structural correctness, returning all problems at once (joined) rather than only the first.

type Reference

type Reference struct {
	Type string `yaml:"type"`
	Link string `yaml:"link"`
}

Reference links a manual/human security control (e.g. threat model, architecture diagram).

type Release

type Release struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
	Stage   string `yaml:"stage,omitempty"`
}

Release identifies what is being assessed.

type Repository

type Repository struct {
	URL      string   `yaml:"url"`
	Revision string   `yaml:"revision,omitempty"`
	Paths    []string `yaml:"paths,omitempty"`
}

Repository is a source repository at a revision, optionally scoped to paths.

Jump to

Keyboard shortcuts

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