access

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 4 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: access / policy type: checker job: decide whether a system account may exercise a CRUD right on a branch limits: pure policy from config; no ports, no ctx; core loops it for delete (-> config, core)

Access is this deployment's policy: accounts holding CRUD grants over branch globs, declared in config, never in the graph. The checker answers one (principal, right, branch) question; verifiability never consults it.

A for admin is C on $branches, the branch table being a claim, so creating a branch contributes to it while writing into one is the separate C on that branch. A caveat is a grant of opposite polarity, the effective permission their intersection.

Index

Constants

View Source
const (
	Universe  = "$universe"
	Archive   = "$archive"
	Sequencer = "$sequencer"
	Branches  = "$branches"
)

The reserved branches a grant may target. '$' is illegal in an ordinary name, so no glob confers one by accident.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker struct {
	// contains filtered or unexported fields
}

Checker answers access requests against a fixed set of accounts and grants.

func New

func New(accounts map[string][]string) (*Checker, error)

New builds a checker from the configured accounts, each mapping to compact grant specs. It validates every grant offline and fails on the first malformed one.

func (*Checker) Allow

func (c *Checker) Allow(p Principal, right Right, branch string) bool

Allow reports whether the principal may exercise right on branch: the account's grants and every caveat must allow it. Unknown or ungranted is denied.

Caveats are successive attenuations, each a predicate the request must still satisfy, so one Grant carries a whole step's rights ("RIGHTS glob") — siblings would read as alternatives, and a second narrowing would fail to narrow.

func (*Checker) Grants added in v1.21.0

func (c *Checker) Grants(account string) []string

Grants reports the specs held by one account, for a principal asking what it may do. An unknown account holds none, which is what the checker denies on.

type Grant

type Grant struct {
	// contains filtered or unexported fields
}

Grant confers rights over the branches matching a glob — the unit of both an account grant and a token caveat, the Checker applying the polarity.

func ParseGrant

func ParseGrant(spec string) (Grant, error)

ParseGrant parses one "RIGHTS glob" spec ("CR foo_*", "R $universe"), rejecting unknown letters, malformed globs, and non-R rights on $universe. Caveats reuse it.

func (Grant) Allows

func (g Grant) Allows(right Right, branch string) bool

Allows reports whether this grant carries right and its glob matches branch.

func (Grant) String added in v1.21.0

func (g Grant) String() string

String renders the grant back into the "RIGHTS glob" spec it parsed from, letters in CRUD order so one set of rights has one spelling. ParseGrant accepts what this emits.

type Principal

type Principal struct {
	Account string
	Caveats []Grant
}

Principal is the identity a request acts as: the account the credential resolved to, plus any caveats attenuating its grants (empty = none).

type Right byte

Right is one CRUD access right.

const (
	Contribute Right = 'C' // contribute claims to the branch (creating it if new)
	Read       Right = 'R' // read the branch
	Update     Right = 'U' // overlay an existing claim with a newer version
	Delete     Right = 'D' // delete claims (needs D on every branch that holds the claim)
)

Jump to

Keyboard shortcuts

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