authz

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 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 authz resolves what an identity may do to findings. It asks the cluster directly — SubjectAccessReviews with the identity's user and groups — so the grant grammar is ordinary Kubernetes RBAC: native get on findings gates viewing, and the custom verbs approve, suspend, and resume on findings.patchy.bitwisemedia.uk gate the actions. Reviews run as the server's own ServiceAccount (which needs only create on subjectaccessreviews), never via impersonation.

Index

Constants

View Source
const (
	// VerbApprove is the custom RBAC verb behind the approve action.
	VerbApprove = "approve"
	// VerbRetry is the custom RBAC verb behind the retry action (recover a
	// Failed finding to the state it failed from).
	VerbRetry = "retry"
	// VerbExpedite is the custom RBAC verb behind the expedite action (skip
	// the waiting stages: accumulation, minimum age, queue position).
	VerbExpedite = "expedite"
	// VerbSuspend is the custom RBAC verb behind the suspend action.
	VerbSuspend = "suspend"
	// VerbResume is the custom RBAC verb behind the resume action.
	VerbResume = "resume"
)

Verbs the status server understands.

Variables

ActionVerbs lists the custom verbs in the order the UI receives them.

Functions

This section is empty.

Types

type Full

type Full struct{}

Full is the bypass granter for auth mode none: everything, for everyone.

func (Full) Grants

Grants returns every grant.

type Grants

type Grants struct {
	// View reports native get on findings — the dashboard read gate.
	View bool
	// Verbs are the granted custom action verbs, in ActionVerbs order.
	Verbs []string
}

Grants is what one identity may do in the server's namespace. RBAC is namespace-scoped, so grants apply uniformly across findings.

func (Grants) Allows

func (g Grants) Allows(verb string) bool

Allows reports whether verb is granted.

type Reviewer

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

Reviewer resolves grants through SubjectAccessReviews, cached briefly per identity.

func NewReviewer

func NewReviewer(c client.Client, namespace string, ttl time.Duration) *Reviewer

NewReviewer builds a Reviewer for the server's namespace. ttl <= 0 uses the default.

func (*Reviewer) Grants

func (r *Reviewer) Grants(ctx context.Context, id auth.Identity) (Grants, error)

Grants resolves the identity's grants: native get on findings for View, then one review per custom verb.

Jump to

Keyboard shortcuts

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