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 ¶
- func CanonicalHost(u *url.URL) string
- func Evaluate(in Input) protocol.UseResult
- func HostAllowed(item protocol.Item, rawURL string) bool
- func ParseDest(raw string) (*url.URL, error)
- func Registrable(rawURL string) string
- func Select(candidates []protocol.Grant, now time.Time, approved map[string]bool) *protocol.Grant
- type Input
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalHost ¶
CanonicalHost is hostname, plus port when it is not the scheme default.
func Registrable ¶
Registrable is eTLD+1 for confirm scope. GitHub fill must not waive Amazon CVV.
func Select ¶
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
}