trust

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package trust provides the boolean-combinator trust-decision framework for the maintainer-watcher-github-pr. Callers compose leaves with And, Or, and Not to express compound trust policies without modifying the watcher core.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type And

type And []Trust

And succeeds only if every member succeeds. Evaluates ALL members (no short-circuit) to produce a complete audit trail. An empty And returns vacuous success — callers must ensure non-empty slices for security-relevant decisions (startup validation enforces this).

func (And) IsTrusted

func (a And) IsTrusted(ctx context.Context, pr PR) (Result, error)

type Func

type Func func(ctx context.Context, pr PR) (Result, error)

Func adapts a plain function to the Trust interface. Useful for inline trust checks without struct boilerplate.

func (Func) IsTrusted

func (f Func) IsTrusted(ctx context.Context, pr PR) (Result, error)

type Or

type Or []Trust

Or succeeds if any member succeeds. Evaluates ALL members (no short-circuit) to produce a complete audit trail. An empty Or returns vacuous failure — callers must ensure non-empty slices for security-relevant decisions.

func (Or) IsTrusted

func (o Or) IsTrusted(ctx context.Context, pr PR) (Result, error)

type PR

type PR struct {
	AuthorLogin string
}

PR is the trust-evaluation input derived from a GitHub pull request. Only the fields needed for trust decisions are included.

type Result

type Result interface {
	Success() bool
	Description() string
}

Result captures a trust decision and a human-readable description. The description is the audit trail: why was this PR trusted or denied?

func NewResult

func NewResult(success bool, description string) Result

NewResult constructs a Result with the given outcome and description.

type Trust

type Trust interface {
	IsTrusted(ctx context.Context, pr PR) (Result, error)
}

Trust is the single-method trust-decision interface. Each implementation returns both an outcome (trusted/denied) and a human-readable description forming the audit trail for the decision.

func NewAuthorAllowlist

func NewAuthorAllowlist(members []string) Trust

NewAuthorAllowlist returns a Trust leaf that grants trust by exact GitHub login membership (case-sensitive byte equality).

Fail-safe rules:

  • Empty members list → always denies.
  • PR with empty AuthorLogin → always denies (author unknown).

Operators are responsible for matching GitHub's stored casing.

func Not

func Not(t Trust) Trust

Not inverts the decision of the wrapped Trust, preserving the description.

Jump to

Keyboard shortcuts

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