responseactions

package
v0.16.12 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 18 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 responseactions dispatches admitted policy intents to operator-configured enforcers. Evaluate never waits for network I/O; delivery failure cannot allow a deny.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchStatus

func BatchStatus(receipts []Receipt) string

BatchStatus distinguishes admission from delivery. Effects execute independently in winning-rule declaration order; failures do not roll back preceding effects.

Types

type Broker

type Broker struct {
	Operations *runtimeobs.Monitor
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Broker, error)

func (*Broker) Batch

func (b *Broker) Batch(ids []string) (string, []Receipt)

Batch returns latest delivery receipts for up to MaxEffects winning-rule IDs. Missing/evicted IDs are unknown, never proof that every effect succeeded.

func (*Broker) Close

func (b *Broker) Close() error

func (*Broker) Receipts

func (b *Broker) Receipts() []Receipt

Receipts is a bounded chronological snapshot. No source values or tokens appear.

func (*Broker) Submit

func (b *Broker) Submit(i policy.Intent, trustedSource string) Receipt

Submit requires an independently attributed source from the trusted ingress boundary. Never derive trustedSource from HTTP forwarding headers or policy Attributes/Fields. A duplicate retains its original deadline, including failures. After expiry plus Retention, the same rule/source may start a new lease.

func (*Broker) SubmitFlow

func (b *Broker) SubmitFlow(i policy.Intent, trustedSource string, trustedFlow *enforcer.Flow) Receipt

type Config

type Config struct {
	Scopes    map[string]Scope
	QueueSize int
	// MaxPending bounds both intent IDs and source/scope reservations, including cooldown.
	MaxPending  int
	MaxReceipts int
	Retention   time.Duration
	TLSConfig   *tls.Config
	// MaxActionsPerMinute caps new admissions across all scopes in a fixed window.
	// Duplicates consume no budget. Queue-full attempts do consume budget.
	MaxActionsPerMinute int
}

type Evaluator

type Evaluator struct {
	Policy PolicyEvaluator
	Broker *Broker
	Source SourceResolver
	Flow   func(policy.Event) (enforcer.Flow, bool)
	// Replay prevents dispatch even when wrapping an enforce-mode policy.
	Replay bool
}

func (*Evaluator) Evaluate

func (e *Evaluator) Evaluate(event policy.Event) (policy.Decision, error)

func (*Evaluator) RequiresBody

func (e *Evaluator) RequiresBody(phase string) bool

RequiresBody preserves dependency discovery through the dispatch wrapper. Evaluators without metadata conservatively require bodies in known phases.

type PolicyEvaluator

type PolicyEvaluator interface {
	Evaluate(policy.Event) (policy.Decision, error)
}

type Receipt

type Receipt struct {
	ID        string    `json:"id"`
	Scope     string    `json:"scope"`
	Status    string    `json:"status"`
	Reason    string    `json:"reason,omitempty"`
	At        time.Time `json:"at"`
	ExpiresAt time.Time `json:"expires_at"`
}

type Scope

type Scope struct {
	Profiles map[string]enforcer.Profile
	// Notification makes Endpoint a preconfigured HTTPS sink.
	// It receives bounded intent metadata only, with no event body or policy URL.
	Notification      bool
	NotificationPath  string
	Endpoint          string
	TokenEnv          string
	Network           enforcer.Scope
	ProtectedCIDRs    []string
	ProtectedServices []enforcer.Service
}

Scope is configured by the operator, never by a policy. Endpoint is an HTTPS origin; TokenEnv names an environment variable resolved once at construction.

type SourceResolver

type SourceResolver func(policy.Event, string) (string, bool)

SourceResolver is a trusted integration boundary, not policy configuration. It must authorize each target from ingress attribution (socket peer, validated proxy chain, or packet tuple). Returning event headers/Attributes is unsafe.

Jump to

Keyboard shortcuts

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