Documentation
¶
Overview ¶
Package policy decides whether a subject may run an action: allow, deny, confirm (the same person again), reauth (password or TOTP again) or approve (another person).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Roles map[string]Role `yaml:"roles,omitempty" json:"roles,omitempty"`
Bind map[string]string `yaml:"bind,omitempty" json:"bind,omitempty"`
}
Config is rig.yaml's `policy:`. Bind maps user:<name>, group:<name> or ai to a role.
func (*Config) Decide ¶
Decide answers req. For a subject no role binds, the local default applies: reads are allowed; a readonly environment takes no writes; the AI's writes need approval; an agent's writes are allowed unless dangerous, protected or matching its approve globs; danger and writes to a protected environment need confirming. With roles, the most restrictive matching rule wins, an allowed write to a protected environment still needs confirming, and nothing matching is denied.
type Role ¶
type Role struct {
Extends string `yaml:"extends,omitempty" json:"extends,omitempty"`
Allow []string `yaml:"allow,omitempty" json:"allow,omitempty"`
Deny []string `yaml:"deny,omitempty" json:"deny,omitempty"`
Confirm []string `yaml:"confirm,omitempty" json:"confirm,omitempty"`
Reauth []string `yaml:"reauth,omitempty" json:"reauth,omitempty"`
Approve []string `yaml:"approve,omitempty" json:"approve,omitempty"`
}
Role lists rules as action:effect[@env/name] globs, such as *:write@env/local.