Documentation
¶
Overview ¶
Package dbauthz is the single place that decides whether a caller may use a database explorer route (ADR 082). Every explorer route goes through Resolve.
Index ¶
Constants ¶
const ( ReasonOK = "ok" ReasonBadInput = "invalid action or resource" ReasonNoEngine = "no policy engine" ReasonEngineError = "policy evaluation failed" ReasonExplicitDeny = "explicit policy deny" ReasonNoAbility = "missing ability" ReasonHidden = "resource not visible" ReasonStepUp = "step up required" PolicyNone = "none" PolicyDenied = "deny" PolicyAllowed = "allow" )
Reasons and policy decision values.
const ResourcePrefix = "database:"
ResourcePrefix is the policy resource namespace for databases.
Variables ¶
var Actions = []Action{ActionRead, ActionQuery, ActionWrite, ActionExport, ActionAdmin}
Actions lists every known db action, for policy validation.
Functions ¶
func DenyNames ¶
DenyNames lists the action names whose explicit Deny also blocks action: a Deny on db:read blocks query and export, a Deny on db:query blocks export. Write and admin Denies stay their own.
func EffectiveAbility ¶
EffectiveAbility is the flat ability an action needs today; unknown actions map to root so a mistake fails closed.
Types ¶
type Action ¶
type Action string
Action is a database explorer action, also valid in IAM policy documents.
type Decision ¶
type Decision struct {
Allowed bool
Hidden bool
Reason string
Abilities []string
PolicyDecision string
Limits Limits
RequiredStepUp bool
}
Decision is the outcome of Resolve.
type PolicyEngine ¶
type PolicyEngine interface {
Evaluate(ctx context.Context, c Caller, ability string, action Action, resource string) (Verdict, error)
}
PolicyEngine is the IAM evaluation the API supplies. One call applies visibility, team, environment and policy rules for the effective ability and the db action; an explicit Deny on either always wins.