grant

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 9 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 grant evaluates whether a principal may Use an item.

Shape follows Infisical's agent-vs-role split and OneCLI's per-agent rules. Ours: the grant is the object (level, actions, expiry), not a vault role.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalHost

func CanonicalHost(u *url.URL) string

CanonicalHost is hostname, plus port when it is not the scheme default.

func Evaluate

func Evaluate(in Input) protocol.UseResult

func HostAllowed

func HostAllowed(item protocol.Item, rawURL string) bool

func ParseDest

func ParseDest(raw string) (*url.URL, error)

ParseDest accepts an absolute URL or a CONNECT host:port.

func Registrable

func Registrable(rawURL string) string

Registrable is eTLD+1 for confirm scope. GitHub fill must not waive Amazon CVV.

func Select

func Select(candidates []protocol.Grant, now time.Time, approved map[string]bool) *protocol.Grant

Select picks the one grant that governs (principal, item) among candidates already filtered to the item and to matching subjects. The order is the documented precedence: an expired edge is dead weight and ranks last; then direct shadows group; then deny beats allow; and among allows a grant that resolves immediately (level2, or level1 with a live approval) beats a bare level1 — "any allow wins" made deterministic.

Types

type Input

type Input struct {
	Principal protocol.Principal
	Item      protocol.Item
	Grant     *protocol.Grant
	// Groups is the principal's resolved group set — a group-subject grant
	// matches only when its id is in it. The store resolves membership at
	// read time; a nil set means group grants never match.
	Groups    map[string]struct{}
	Action    protocol.ActionKind
	TargetURL string
	Approval  *protocol.Approval
	Now       time.Time
}

Jump to

Keyboard shortcuts

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