glaz

package
v19.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package glaz evaluates governance policies through GLAZ's Rego evaluator, the glaz-govern crate, linked into Relay as a static library over the C ABI that GLAZ owns (crates/glaz-ffi in gitlab-org/auth/glaz).

The package is a thin binding in the sense GOVERN-001 requires: it holds no policy data, performs no evaluation of its own, and executes no actions. It crosses the boundary, maps the result, and derives the gating verdict.

Evaluate lives behind the `glaz` build tag, because the omnibus and CNG builds cannot yet fetch the library it links; see engine.go.

Index

Constants

This section is empty.

Variables

View Source
var ErrEnginePanicked = errors.New("glaz: panic at the FFI boundary, engine must be discarded")

ErrEnginePanicked reports a panic caught at the FFI boundary. The engine may be in an unknown state afterwards. Nothing replaces it today: the error reaches the call site and the operation that asked for the decision fails.

Functions

This section is empty.

Types

type Action

type Action struct {
	Type       string
	Message    string
	ParamsJSON string
	Gating     bool
}

Action is something a decision demands of the call site, which carries it out itself. Type is the action kind, "block" being the only one the engine synthesizes today.

Gating says whether the action gates the operation. GLAZ stamps it, so a call site never infers it from Type and an action type this binding has never seen still gates correctly.

type Decision

type Decision struct {
	Actions       []*Action
	Reasons       []*Reason
	EvaluationErr *EvaluationError
}

Decision is the outcome of one evaluation: what to enforce (Actions), why (Reasons), and, when the engine could not evaluate at all, the failure that prevented it.

func (*Decision) Verdict

func (d *Decision) Verdict() Verdict

Verdict derives the gating outcome: undecidable when the engine could not evaluate, deny when any action gates, allow otherwise. GOVERN-001 puts this derivation in every binding so that no two runtimes can disagree on it.

type EvaluationError

type EvaluationError struct {
	Message string
}

EvaluationError is the engine reporting that it could not evaluate: an invalid policy, an oversized document, an exhausted time budget, a result shape it does not recognize.

It travels in-band on Decision rather than as an error from Evaluate because GOVERN-001 wants a call site to journal it and fail closed, not to retry it. Faults that say nothing about the policy stay Go errors from Evaluate.

func (*EvaluationError) Error

func (e *EvaluationError) Error() string

type Reason

type Reason struct {
	Message     string
	DetailsJSON string
}

Reason is one explanation for why a policy matched: one entry per violation/deny element the policy produced.

type Verdict

type Verdict string

Verdict is the gating outcome of an evaluation.

GOVERN-001 derives the verdict from the decision rather than carrying it on the wire, so that a verdict and its actions can never disagree. Only VerdictAllow lets an operation proceed; a call site fails closed on anything else.

const (
	// VerdictAllow means no policy demanded anything of this operation.
	VerdictAllow Verdict = "allow"
	// VerdictDeny means a policy demanded something that gates the operation.
	VerdictDeny Verdict = "deny"
	// VerdictUndecidable means the engine could not evaluate, so nothing is
	// known about the operation and it must not proceed.
	VerdictUndecidable Verdict = "undecidable"
)

Directories

Path Synopsis
vendored

Jump to

Keyboard shortcuts

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