Documentation
¶
Overview ¶
Package authz defines the trusted authorization boundary for native capability calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDenied = errors.New("authorization denied")
ErrDenied classifies a recognized authorization denial.
An authorizer may wrap ErrDenied with trusted diagnostic context. Callers must not expose the wrapped error text to untrusted clients.
Functions ¶
func WithSubject ¶
WithSubject returns a child context containing a trusted authenticated subject.
Hosts must derive subject from their authentication boundary before calling WithSubject. Tool arguments, program source, and MCP request metadata are not trusted identity sources.
Types ¶
type AllowAllAuthorizer ¶
type AllowAllAuthorizer struct{}
AllowAllAuthorizer explicitly permits every authorization input.
func AllowAll ¶
func AllowAll() AllowAllAuthorizer
AllowAll returns an explicit authorizer that permits every invocation.
func (AllowAllAuthorizer) Authorize ¶
func (AllowAllAuthorizer) Authorize(context.Context, AuthorizationInput) error
Authorize permits the invocation without inspecting its input.
type AuthorizationInput ¶
type AuthorizationInput struct {
// Subject is the authenticated identity resolved from trusted host context.
Subject Subject
// CapabilityID is the capability's stable policy identity.
CapabilityID string
// CapabilityName is the model-facing dotted capability name.
CapabilityName string
// Arguments is a fresh canonical JSON-shaped projection of validated arguments.
Arguments map[string]any
}
AuthorizationInput contains the complete trusted input for one authorization decision.
type Authorizer ¶
type Authorizer interface {
// Authorize returns nil to allow the invocation, an error wrapping ErrDenied for a recognized denial,
// or another error when policy evaluation fails.
Authorize(context.Context, AuthorizationInput) error
}
Authorizer decides whether a subject may perform one validated native invocation.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mocks contains generated test doubles for authorization ports.
|
Package mocks contains generated test doubles for authorization ports. |
|
Package rego implements authz.Authorizer with one prepared in-process Rego decision.
|
Package rego implements authz.Authorizer with one prepared in-process Rego decision. |