authz

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 10 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 = action.VerbApprove
	// VerbRetry is the custom RBAC verb behind the retry action (recover a
	// Failed finding to the state it failed from).
	VerbRetry = action.VerbRetry
	// VerbExpedite is the custom RBAC verb behind the expedite action (skip
	// the waiting stages: accumulation, minimum age, queue position).
	VerbExpedite = action.VerbExpedite
	// VerbSuspend is the custom RBAC verb behind the suspend action.
	VerbSuspend = action.VerbSuspend
	// VerbResume is the custom RBAC verb behind the resume action.
	VerbResume = action.VerbResume
	// VerbBackfill is the custom RBAC verb (on integrations) behind the
	// backfill action: list an integration's pre-existing open alerts into
	// findings.
	VerbBackfill = action.VerbBackfill
	// VerbReplay is the custom RBAC verb (on integrations) behind the
	// replay action (redeliver the webhook delivery log — demo tooling).
	VerbReplay = action.VerbReplay
	// VerbReset is the custom RBAC verb (on integrations) behind the reset
	// action (delete every pipeline resource — demo tooling).
	VerbReset = action.VerbReset
)

The verb vocabulary is owned by internal/action, which also holds the state-machine gating behind each verb; authz only resolves who may use them. Re-exported here so the server keeps reading its grants and its actions from one place.

Variables

View Source
var ActionVerbs = action.ActionVerbs

ActionVerbs lists the per-finding custom verbs in the order the UI receives them.

View Source
var AdminVerbs = action.AdminVerbs

AdminVerbs lists the demo-tooling custom verbs the user menu renders, resolved on integrations like every integration-scoped verb.

View Source
var IntegrationVerbs = action.IntegrationVerbs

IntegrationVerbs lists the integration-scoped 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
	// Config reports native get on integrations — the configuration-view
	// read gate.
	Config bool
	// Verbs are the granted custom action verbs, in ActionVerbs order.
	Verbs []string
	// Integration are the granted integration-scoped verbs, in
	// IntegrationVerbs order.
	Integration []string
	// Admin are the granted demo-tooling verbs (the AdminVerbs subset of
	// Integration), kept separate so the user menu and the adminActions
	// wire field stay stable.
	Admin []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 the per-finding verb is granted.

func (Grants) AllowsAdmin added in v0.5.4

func (g Grants) AllowsAdmin(verb string) bool

AllowsAdmin reports whether the demo-tooling verb is granted.

func (Grants) AllowsIntegration added in v0.10.0

func (g Grants) AllowsIntegration(verb string) bool

AllowsIntegration reports whether the integration-scoped verb is granted.

type ResourceReviewer added in v0.9.3

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

ResourceReviewer answers "may this identity <verb> <resource>?" through SubjectAccessReviews, cached briefly per identity+verb. It is the resource-parameterized sibling of Reviewer (which is findings-specific and grant-shaped); the evaluation API uses it with native verbs only — create/get/delete on evaluations — so RBAC is the whole authorization surface, no admission-policy change involved.

func NewResourceReviewer added in v0.9.3

func NewResourceReviewer(c client.Client, namespace, group, resource string, ttl time.Duration) *ResourceReviewer

NewResourceReviewer builds a ResourceReviewer for one resource in one namespace. ttl <= 0 uses the package default.

func (*ResourceReviewer) Allowed added in v0.9.3

func (r *ResourceReviewer) Allowed(ctx context.Context, id auth.Identity, verb string) (bool, error)

Allowed reports whether the identity may verb the resource.

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 and on integrations for Config, then one review per custom verb on its own resource (~10 SARs per identity per TTL window).

Jump to

Keyboard shortcuts

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