Documentation
¶
Index ¶
- Constants
- Variables
- func AuthoringCeiling(ctx context.Context, operator bool) string
- func DenialMessage(decision Decision) string
- func NarrowGrant(existing, ceiling string) string
- func WithOrigin(ctx context.Context, origin Origin) context.Context
- type AccessRecord
- type ActorKind
- type ActorRef
- type AuditEmitter
- type Consent
- type Decision
- type DecisionSource
- type DefaultPolicy
- type Denial
- type Deps
- type Mode
- type Origin
- type Policy
- type Request
- type Seam
- type SessionConsentCache
- type SessionFacts
- type SessionFactsSource
- type TargetKind
- type TargetRef
Constants ¶
const DenialHint = "cross-workspace access is denied by this session's permission mode; " +
"ask the operator to set the agent's permissions.mode to approve-all, or approve the prompt when asked"
DenialHint is the canonical operator guidance returned by workspace-access seams.
const Unrestricted = "unrestricted"
const UserSelector = "@user"
UserSelector is the reserved workspace selector naming the User scope.
Variables ¶
var ErrInvalidRequest = errors.New("workspace access: invalid request")
ErrInvalidRequest identifies a structurally invalid workspace-access request.
Functions ¶
func DenialMessage ¶
DenialMessage explains which axis refused the decision and what would allow it. It never names the target, so the message is identical whether or not a named target exists.
func NarrowGrant ¶
Types ¶
type AccessRecord ¶
type AccessRecord struct {
ActorProfileID string
Target TargetRef
Actor ActorRef
TargetID string
Allowed bool
Source DecisionSource
Mode Mode
Seam Seam
Err string
}
AccessRecord is the audit representation of one authorization decision.
type ActorKind ¶
type ActorKind string
ActorKind identifies the trusted runtime origin of an access request.
const ActorApp ActorKind = "app"
ActorApp marks work created through an app token. App tokens never carry the unrestricted grant (USW Extensibility, Authority Matrix), so app-originated work gets no ceiling.
type ActorRef ¶
type ActorRef struct {
Kind ActorKind
SessionID string
WorkspaceID string
AgentName string
Operator bool
}
ActorRef carries daemon-validated actor identity into the policy.
type AuditEmitter ¶
type AuditEmitter interface {
EmitWorkspaceAccess(ctx context.Context, record AccessRecord) error
}
AuditEmitter appends one best-effort record per decision.
type Consent ¶
type Consent string
Consent is a session-lifetime answer captured from an ACP prompt.
type Decision ¶
type Decision struct {
Allowed bool
Source DecisionSource
PromptEligible bool
// Denial names the axis that refused a denied decision; empty when allowed.
Denial Denial
// NeedsGrantAfterConsent marks a prompt-eligible write to another profile or through an
// aggregate: an operator "allow" grants reach, but the write itself still needs the grant.
NeedsGrantAfterConsent bool
}
Decision is the fail-closed result of one authorization request.
type DecisionSource ¶
type DecisionSource string
DecisionSource records the policy branch that produced a decision.
const ( SourceAgentGrant DecisionSource = "agent_grant" SourceOperator DecisionSource = "operator" SourceSameWorkspace DecisionSource = "same_workspace" SourcePermissionMode DecisionSource = "permission_mode" SourceSessionConsent DecisionSource = "session_consent" SourceDenied DecisionSource = "denied" )
type DefaultPolicy ¶
type DefaultPolicy struct {
// contains filtered or unexported fields
}
DefaultPolicy applies the fixed workspace-access decision chain.
func New ¶
func New(deps Deps) (*DefaultPolicy, error)
New constructs the fail-closed default policy.
type Denial ¶
type Denial string
Denial names the decision-chain branch that refused an access request.
const ( // DenialInvalid covers structural, lookup, and unknown-state failures. DenialInvalid Denial = "invalid" // DenialNotAgentSession covers non-operator actors that are not agent sessions. DenialNotAgentSession Denial = "not_agent_session" // DenialModeDenyAll is the deny-all permission mode, which never crosses. DenialModeDenyAll Denial = "mode_deny_all" // DenialConsentRequired is an approve-reads crossing without a recorded operator answer. DenialConsentRequired Denial = "consent_required" // DenialConsentRejected is an approve-reads crossing the operator rejected for the session. DenialConsentRejected Denial = "consent_rejected" // DenialNeedsGrant is a write to another profile or through an aggregate without the grant. DenialNeedsGrant Denial = "needs_grant" )
type Deps ¶
type Deps struct {
Facts SessionFactsSource
Consent SessionConsentCache
Audit AuditEmitter
Log *slog.Logger
}
Deps contains every dependency required by DefaultPolicy.
type Origin ¶
func OriginFromContext ¶
type Seam ¶
type Seam string
Seam identifies the runtime boundary requesting cross-workspace access.
type SessionConsentCache ¶
type SessionConsentCache interface {
ConsentFor(ctx context.Context, sessionID string) (Consent, bool)
PutConsent(ctx context.Context, sessionID string, consent Consent)
}
SessionConsentCache stores one cross-workspace answer per live session.
type SessionFacts ¶
ModeSource resolves the effective permission mode of a live session.
type SessionFactsSource ¶
type SessionFactsSource interface {
SessionFacts(ctx context.Context, sessionID string) (SessionFacts, error)
}
type TargetKind ¶
type TargetKind string
const ( TargetWorkspace TargetKind = "workspace" TargetUser TargetKind = "user" TargetAggregate TargetKind = "aggregate" // TargetUnresolved is a named target, such as a session id, that resolves to no visible // owner. The policy treats it as outside the actor's workspace and profile so a denied // caller learns nothing about whether the target exists. TargetUnresolved TargetKind = "unresolved" )