authz

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ObligationKeyGlobalRoles is the key the policy engine writes on a
	// role:list decision to indicate whether the caller may see global
	// (org-less) roles alongside the org-scoped ones. Independent of the
	// "org" obligation.
	ObligationKeyGlobalRoles = "global_roles"

	// ObligationGlobalRolesTrue is the obligation value that grants
	// visibility into global roles.
	ObligationGlobalRolesTrue = "true"

	// ObligationGlobalRolesFalse is the obligation value that explicitly
	// denies visibility into global roles.
	ObligationGlobalRolesFalse = "false"
)
View Source
const (
	// ObligationKeyRecord is the key the policy engine writes when expressing a
	// session recording obligation. The enforcer reads this key and activates
	// the appropriate recording backends before the session begins.
	ObligationKeyRecord = "record"

	// ObligationRecordNone explicitly disables all session recording.
	ObligationRecordNone = "none"

	// Recording channel name tokens used as comma-separated values of the
	// "record" obligation key.
	ObligationRecordShell       = "shell"
	ObligationRecordExec        = "exec"
	ObligationRecordDirectTCPIP = "direct-tcpip"
	ObligationRecordSFTP        = "sftp"
)
View Source
const (
	// ObligationKeyScopes is the key the policy engine writes to restrict the
	// scopes a newly created token may carry. The value is a JSON-encoded array
	// of scope strings (e.g. ["token:read","workspace:start"]).
	ObligationKeyScopes = "scopes"

	// ObligationKeyExpiresIn is the key the policy engine writes to cap a
	// token's lifetime. The value is a Go duration string (e.g. "720h") or the
	// literal "never" to permit a non-expiring token.
	ObligationKeyExpiresIn = "expires_in"

	// ObligationExpiresInNever is the sentinel value meaning no expiry.
	ObligationExpiresInNever = "never"
)
View Source
const (
	// ObligationKeySudo is the key the policy engine writes when expressing a
	// sudo obligation. The enforcer reads this key and applies the value to the
	// user record before completing admin-driven creation.
	ObligationKeySudo = "sudo"

	// ObligationSudoTrue is the obligation value that grants sudo access.
	ObligationSudoTrue = "true"

	// ObligationSudoFalse is the obligation value that explicitly denies sudo access.
	ObligationSudoFalse = "false"
)
View Source
const (
	// ObligationKeyAuthMethods is the key the policy engine writes to indicate
	// which SSH authentication methods are available to the user. The value is
	// a JSON-encoded array of method strings (e.g. ["publickey","password"]).
	ObligationKeyAuthMethods = "auth_methods"
)
View Source
const (
	// ObligationKeyBlueprints is the key the policy engine writes to assign
	// allowed blueprints during admin-driven creation. The value is a
	// comma-separated list of blueprint names; "*" grants access to all
	// blueprints.
	ObligationKeyBlueprints = "blueprints"
)
View Source
const (
	// ObligationKeyOrg is the key the policy engine writes to scope a user:list
	// result to a single organization. The value is an organization name.
	ObligationKeyOrg = "org"
)
View Source
const (
	// ObligationKeyPatchPrefix is the prefix the policy engine uses to express
	// blueprint patch obligations for workspace:provision. Each key of the form
	// "patch:<json-pointer>" (RFC 6901) names a location in the blueprint YAML
	// document; the corresponding value is the string to set at that path.
	// Example: "patch:/resources/cpu" → "2000m".
	ObligationKeyPatchPrefix = "patch:"
)
View Source
const (
	// ObligationKeyRoles is the key the policy engine writes to assign roles
	// during admin-driven creation. The value is a JSON-encoded array of role
	// name strings.
	ObligationKeyRoles = "roles"
)
View Source
const (
	// ObligationKeyUsername is the key the policy engine writes to scope a
	// session:list result to a single session owner. The value is a username.
	ObligationKeyUsername = "username"
)

Variables

View Source
var (
	// ErrTokenExpired is returned when the token's expiry time has passed.
	ErrTokenExpired = errors.New("jwt: token has expired")

	// ErrTokenInvalidSignature is returned when the token signature does not
	// match the expected signing key.
	ErrTokenInvalidSignature = errors.New("jwt: token signature is invalid")

	// ErrTokenMalformed is returned when the token string is not a valid JWT.
	ErrTokenMalformed = errors.New("jwt: token is malformed")
)

Sentinel errors returned by JWTVerifier.VerifyToken. Use errors.Is to distinguish failure reasons.

Functions

func ApplyProvisionPatches

func ApplyProvisionPatches(bp *models.Blueprint, patches []ProvisionPatch) (*models.Blueprint, error)

ApplyProvisionPatches applies a slice of ProvisionPatch obligations to a Blueprint and returns the modified copy. The blueprint is round-tripped through YAML so that path tokens match yaml struct tag names. Each patch value is YAML-decoded before being written, so "false" becomes bool(false), "2000m" stays as a string, etc. Returns the original pointer unchanged when patches is empty.

func ScopeAllows

func ScopeAllows(scopes []string, action string, satisfied ...ScopeConstraint) bool

ScopeAllows reports whether any scope in the list permits action. satisfied lists the constraints the caller has determined the current request meets (e.g. pass ScopeConstraintSelf when resource.id == subject.username) — the scope layer has no resource awareness of its own, so this is how a caller tells it "self" applies here.

Matching rules (strict):

  • "*" matches any action
  • "prefix:*" matches any action that starts with "prefix:"
  • an exact scope matches only when scope == action
  • a scope with a trailing ":constraint" additionally requires that constraint to be present in satisfied; an unconstrained scope matches regardless of satisfied, so a token holding the broad "user:read:profile" scope still covers its own profile

func ValidateScope

func ValidateScope(s string) error

ValidateScope reports whether s is a well-formed, recognized scope string. A scope is valid when it is:

  • the bare wildcard "*"
  • a known exact action string from the registry
  • a known wildcard prefix followed by ":*"
  • any of the above (except the bare wildcard) followed by ":constraint", provided the "domain:action" prefix accepts a constraint suffix

func ValidateScopes

func ValidateScopes(scopes []string) error

ValidateScopes validates every scope in the slice. Returns the first error encountered, or nil when all scopes are valid. At least one scope is required.

Types

type AuditListEvalRequest added in v0.39.0

type AuditListEvalRequest struct{}

AuditListEvalRequest is the validated, typed model for audit:list policy evaluation. No resource id is required; the subject claims determine access.

func AuditListEvalRequestFromProto added in v0.39.0

func AuditListEvalRequestFromProto(req *authzv1.EvaluateRequest) (*AuditListEvalRequest, error)

AuditListEvalRequestFromProto converts a gRPC EvaluateRequest into a validated AuditListEvalRequest.

func NewAuditListEvalRequest added in v0.39.0

func NewAuditListEvalRequest() *AuditListEvalRequest

NewAuditListEvalRequest returns an AuditListEvalRequest ready to be built.

func (*AuditListEvalRequest) Build added in v0.39.0

Build returns the request. It is the required terminator for the builder chain.

func (*AuditListEvalRequest) ToProto added in v0.39.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*AuditListEvalRequest) Validate added in v0.39.0

func (r *AuditListEvalRequest) Validate() error

Validate is a no-op for audit:list; no fields are required. Implements EvalRequest.

type AuthMethodsObligation added in v0.30.9

type AuthMethodsObligation struct {
	// Methods is the list of authentication methods the policy permits for
	// the user (any of UserAuthMethodPublicKey, UserAuthMethodPassword).
	Methods []UserAuthMethod
}

AuthMethodsObligation is the typed representation of the "auth_methods" obligation key returned by the policy engine in a PolicyResult for user:auth.

func ParseAuthMethodsObligation added in v0.30.9

func ParseAuthMethodsObligation(obligations map[string]string) (AuthMethodsObligation, bool)

ParseAuthMethodsObligation reads the "auth_methods" key from the obligations map. Returns (obligation, true) when the key is present, (zero value, false) when the policy did not set an auth_methods obligation — in that case the enforcer should offer no authentication methods.

type AuthSurface added in v0.32.1

type AuthSurface string

AuthSurface identifies which login surface a user:auth check is evaluating. publickey is only meaningful for AuthSurfaceSSH; AuthSurfaceWeb is password-only in practice, though the contract does not enforce that.

const (
	AuthSurfaceSSH AuthSurface = "ssh"
	AuthSurfaceWeb AuthSurface = "web"
)

type BlueprintReadEvalRequest added in v0.36.0

type BlueprintReadEvalRequest struct{}

BlueprintReadEvalRequest is the validated, typed model for blueprints:read policy evaluation. No resource id is required; the subject claims determine access.

func BlueprintReadEvalRequestFromProto added in v0.36.0

func BlueprintReadEvalRequestFromProto(req *authzv1.EvaluateRequest) (*BlueprintReadEvalRequest, error)

BlueprintReadEvalRequestFromProto converts a gRPC EvaluateRequest into a validated BlueprintReadEvalRequest.

func NewBlueprintReadEvalRequest added in v0.36.0

func NewBlueprintReadEvalRequest() *BlueprintReadEvalRequest

NewBlueprintReadEvalRequest returns a BlueprintReadEvalRequest ready to be built.

func (*BlueprintReadEvalRequest) Build added in v0.36.0

Build returns the request. It is the required terminator for the builder chain.

func (*BlueprintReadEvalRequest) ToProto added in v0.36.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*BlueprintReadEvalRequest) Validate added in v0.36.0

func (r *BlueprintReadEvalRequest) Validate() error

Validate is a no-op for blueprints:read; no fields are required. Implements EvalRequest.

type BlueprintsObligation

type BlueprintsObligation struct {
	// Blueprints is the list of blueprint names the policy assigns to the user.
	// An entry of "*" grants access to all blueprints.
	Blueprints []string
}

BlueprintsObligation is the typed representation of the "blueprints" obligation key returned by the policy engine in a PolicyResult for user:create.

func ParseBlueprintsObligation

func ParseBlueprintsObligation(obligations map[string]string) (BlueprintsObligation, bool)

ParseBlueprintsObligation reads the "blueprints" key from the obligations map. The value is a JSON-encoded array of blueprint name strings (e.g. ["bp1","bp2"]). Returns (obligation, true) when the key is present, (zero value, false) when the policy did not set a blueprints obligation — in that case the enforcer should preserve its existing default rather than overwriting it.

type CapabilityCheck added in v0.32.1

type CapabilityCheck struct {
	// Action is the display action label, e.g. "workspace:connect:webshell".
	// Matches the literal action string except for compound actions where the
	// qualifier (connect type, app op, data type, auth surface) is folded in,
	// mirroring the PAT scope convention in scope.go.
	Action string

	// Package is the OPA policy package this action is evaluated under.
	Package string

	// Scope is the PAT token_scopes string that caps this action, in the same
	// "domain:action[:qualifier]" form ScopeAllows expects.
	Scope string

	// SelfOnly marks an action whose contract only makes sense when the
	// subject is the resource itself — user:auth (you can only authenticate
	// as yourself). Callers building a report for a resource owner other than
	// the subject should skip SelfOnly checks entirely: there is no honest
	// answer to "can Z authenticate as X" for Z != X.
	SelfOnly bool

	// Build constructs the representative EvalRequest for this action from
	// ctx. It may return an error when required data isn't available in
	// ctx — callers should treat that as "unevaluated", not "denied".
	Build func(ctx CapabilityContext) (EvalRequest, error)
}

CapabilityCheck is a self-describing, representative probe for one authz action: enough metadata to build a syntactically valid (if synthetic) EvalRequest for a "what can I do" report, without needing a real resource to exist.

func CapabilityChecks added in v0.32.1

func CapabilityChecks() []CapabilityCheck

CapabilityChecks returns every registered capability probe. The slice is a copy; callers may filter/reorder freely without affecting the registry.

type CapabilityContext added in v0.32.1

type CapabilityContext struct {
	// ResourceOwner is the username whose resources the check is scoped to —
	// workspace/session/ssh owner, or the target user record itself.
	ResourceOwner string

	// IDP and Org are ResourceOwner's real identity source and organization,
	// required by user:auth, and used by user:create/delete.
	// Leave empty when unknown (e.g. ResourceOwner doesn't exist yet) — the
	// affected Build funcs then fail Validate() and the check is reported as
	// unevaluated rather than answered against a fabricated identity.
	IDP, Org string

	// BlueprintName and Blueprint feed workspace:provision. BlueprintName
	// empty means "not supplied" — Build leaves the request's required
	// blueprint context unset on purpose, so Validate() fails and the check
	// comes back unevaluated rather than silently denied.
	BlueprintName string
	Blueprint     *models.Blueprint
}

CapabilityContext carries every synthetic/representative value a capability probe might need to build a syntactically valid EvalRequest without a real resource existing. Not every action uses every field — each CapabilityCheck.Build pulls only what its contract requires.

type EvalRequest

type EvalRequest interface {
	// Validate checks the request against its domain contract. It is called
	// automatically by Build and FromProto, but can be called explicitly if
	// the struct was mutated after construction.
	Validate() error

	// ToProto serializes the typed request into a gRPC EvaluateRequest,
	// attaching the supplied JWT token. Use this on the client side to
	// produce the wire message from the typed, validated struct.
	ToProto(token string) *authzv1.EvaluateRequest
}

EvalRequest is the common interface for every typed policy evaluation request. Each policy domain (ssh, blueprint, ...) provides a concrete implementation.

On the client side, build the concrete type with its With* builder and call ToProto to produce the gRPC message. On the server side, convert the incoming gRPC message with the domain's FromProto function, which validates the contract and returns the typed struct.

type ExpiresInObligation

type ExpiresInObligation struct {
	// Duration is the maximum lifetime of the token. A nil value means the
	// policy permits a non-expiring token (ObligationExpiresInNever).
	Duration *time.Duration
}

ExpiresInObligation is the typed representation of the "expires_in" obligation key returned by the policy engine in a PolicyResult for token:create.

func ParseExpiresInObligation

func ParseExpiresInObligation(obligations map[string]string) (ExpiresInObligation, bool)

ParseExpiresInObligation reads the "expires_in" key from the obligations map. Returns (obligation, true) when the key is present, (zero value, false) when the policy did not set an expires_in obligation. The sentinel "never" yields an obligation with a nil Duration.

type GlobalRolesObligation added in v0.35.0

type GlobalRolesObligation struct {
	// Granted is true when the policy allows the caller to see global roles.
	Granted bool
}

GlobalRolesObligation is the typed representation of the "global_roles" obligation key returned by the policy engine in a PolicyResult for role:list.

func ParseGlobalRolesObligation added in v0.35.0

func ParseGlobalRolesObligation(obligations map[string]string) (GlobalRolesObligation, bool)

ParseGlobalRolesObligation reads the "global_roles" key from the obligations map. Returns (obligation, true) when the key is present, (zero value, false) when the policy did not set it. Either way, the enforcer should treat visibility as denied unless Granted is true — the zero value already defaults to false, so callers can use Granted directly without checking the second return value.

type JWTIssuer

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

JWTIssuer creates and signs JWT tokens for authenticated users.

func NewJWTIssuer

func NewJWTIssuer(cfg JWTIssuerConfig) (*JWTIssuer, error)

NewJWTIssuer constructs a JWTIssuer from the provided configuration. Returns an error when the configuration is invalid or keying material cannot be loaded.

func (*JWTIssuer) IssueToken

func (j *JWTIssuer) IssueToken(user *models.User) (claims *UserClaims, signed string, err error)

IssueToken creates a signed JWT string for the given user. The token includes both standard registered claims and k8Shell-specific user attributes as additional claims.

type JWTIssuerConfig

type JWTIssuerConfig struct {
	// Enabled toggles JWT issuance. When false, the issuer is not initialized.
	Enabled bool `yaml:"enabled"`

	// Issuer is the value placed in the "iss" claim.
	Issuer string `yaml:"issuer"`

	// Audience is the value placed in the "aud" claim.
	Audience string `yaml:"audience"`

	// Expiry is the token lifetime (e.g. "1h", "8h", "24h").
	// Defaults to 1 hour when unset.
	Expiry time.Duration `yaml:"expiry"`

	// SigningMethod selects the signing algorithm. Supported values:
	//   hs256 (default) – HMAC-SHA-256, requires SecretKey
	//   rs256            – RSA-SHA-256,  requires PrivateKeyFile
	//   es256            – ECDSA-P256,   requires PrivateKeyFile
	SigningMethod string `yaml:"signingMethod"`

	// SecretKey is the HMAC signing secret (used with hs256).
	SecretKey string `yaml:"secretKey"`

	// PrivateKeyFile is the path to a PEM-encoded RSA or ECDSA private key
	// (used with rs256 / es256).
	PrivateKeyFile string `yaml:"privateKeyFile"`
}

JWTIssuerConfig contains configuration for JWT token issuance.

type JWTVerifier

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

JWTVerifier validates JWT tokens, checking both signature integrity and expiration. It can be used independently from JWTIssuer.

func NewJWTVerifier

func NewJWTVerifier(cfg JWTVerifierConfig) (*JWTVerifier, error)

NewJWTVerifier constructs a JWTVerifier from the provided configuration.

For hs256 SecretKey is used for verification. For rs256 / es256 the verification key is resolved in this order:

  1. PublicKeyFile (if set)
  2. Public key extracted from PrivateKeyFile

func (*JWTVerifier) VerifyToken

func (v *JWTVerifier) VerifyToken(tokenStr string) (*UserClaims, error)

VerifyToken parses and validates tokenStr. It returns the embedded UserClaims on success, or one of the sentinel errors on failure:

  • ErrTokenExpired – token exists but has expired
  • ErrTokenInvalidSignature – signature does not match the key
  • ErrTokenMalformed – string is not a valid JWT
  • any other error – audience/issuer mismatch or internal failure

type JWTVerifierConfig

type JWTVerifierConfig struct {
	// Issuer is the expected "iss" claim value. When set, tokens with a
	// different issuer are rejected.
	Issuer string `yaml:"issuer"`

	// Audience is the expected "aud" claim value. When set, tokens without
	// this audience are rejected.
	Audience string `yaml:"audience"`

	// SigningMethod must match the algorithm used to sign the tokens.
	// Supported values: hs256 (default), rs256, es256.
	SigningMethod string `yaml:"signingMethod"`

	// SecretKey is the HMAC verification secret (used with hs256).
	SecretKey string `yaml:"secretKey"`

	// PublicKey is the PEM-encoded RSA or ECDSA public key as an inline string
	// (used with rs256 / es256). Takes precedence over PublicKeyFile.
	PublicKey string `yaml:"publicKey"`

	// PublicKeyFile is the path to a PEM-encoded RSA or ECDSA public key
	// (used with rs256 / es256). Takes precedence over PrivateKey and PrivateKeyFile.
	PublicKeyFile string `yaml:"publicKeyFile"`

	// PrivateKey is the PEM-encoded RSA or ECDSA private key as an inline string.
	// The public key is extracted from it and used for verification when
	// PublicKey and PublicKeyFile are not set.
	PrivateKey string `yaml:"privateKey"`

	// PrivateKeyFile is the path to a PEM-encoded RSA or ECDSA private key.
	// The public key is extracted from it and used for verification when
	// PublicKey, PublicKeyFile, and PrivateKey are not set.
	PrivateKeyFile string `yaml:"privateKeyFile"`
}

JWTVerifierConfig contains configuration for JWT token verification.

func (JWTVerifierConfig) GetPublicKey

func (c JWTVerifierConfig) GetPublicKey() (string, error)

GetPublicKey returns the PEM-encoded public key for this JWT configuration. Resolution order: PublicKey (inline) → PublicKeyFile → PrivateKey (inline) → PrivateKeyFile.

type OnboardRuleCreateEvalRequest added in v0.36.0

type OnboardRuleCreateEvalRequest struct {
	Resource OnboardRuleResource
}

OnboardRuleCreateEvalRequest is the validated, typed model for onboardrule:create policy evaluation. Use NewOnboardRuleCreateEvalRequest to start building, then chain With* methods and call Build to get a validated instance.

func NewOnboardRuleCreateEvalRequest added in v0.36.0

func NewOnboardRuleCreateEvalRequest(usernamePattern string) *OnboardRuleCreateEvalRequest

NewOnboardRuleCreateEvalRequest begins building an OnboardRuleCreateEvalRequest for the given proposed username pattern. Chain With* methods to supply additional fields, then call Build to validate and obtain the final struct.

func OnboardRuleCreateEvalRequestFromProto added in v0.36.0

func OnboardRuleCreateEvalRequestFromProto(req *authzv1.EvaluateRequest) (*OnboardRuleCreateEvalRequest, error)

OnboardRuleCreateEvalRequestFromProto converts a gRPC EvaluateRequest into a validated OnboardRuleCreateEvalRequest.

func (*OnboardRuleCreateEvalRequest) Build added in v0.36.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*OnboardRuleCreateEvalRequest) ToProto added in v0.36.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*OnboardRuleCreateEvalRequest) Validate added in v0.36.0

func (r *OnboardRuleCreateEvalRequest) Validate() error

Validate checks the request against the onboardrule:create contract. Implements EvalRequest.

func (*OnboardRuleCreateEvalRequest) WithIDP added in v0.36.0

WithIDP sets the identity provider the new rule applies to.

func (*OnboardRuleCreateEvalRequest) WithOrg added in v0.36.0

WithOrg sets the organization the new rule will be scoped to.

type OnboardRuleDeleteEvalRequest added in v0.36.0

type OnboardRuleDeleteEvalRequest struct {
	Resource OnboardRuleResource
}

OnboardRuleDeleteEvalRequest is the validated, typed model for onboardrule:delete policy evaluation. Use NewOnboardRuleDeleteEvalRequest to start building, then chain WithOrg and call Build to get a validated instance.

func NewOnboardRuleDeleteEvalRequest added in v0.36.0

func NewOnboardRuleDeleteEvalRequest(id string) *OnboardRuleDeleteEvalRequest

NewOnboardRuleDeleteEvalRequest begins building an OnboardRuleDeleteEvalRequest for the given rule id (as a decimal string). Chain WithOrg to supply the rule's organization, then call Build to validate and obtain the final struct.

func OnboardRuleDeleteEvalRequestFromProto added in v0.36.0

func OnboardRuleDeleteEvalRequestFromProto(req *authzv1.EvaluateRequest) (*OnboardRuleDeleteEvalRequest, error)

OnboardRuleDeleteEvalRequestFromProto converts a gRPC EvaluateRequest into a validated OnboardRuleDeleteEvalRequest.

func (*OnboardRuleDeleteEvalRequest) Build added in v0.36.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*OnboardRuleDeleteEvalRequest) ToProto added in v0.36.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*OnboardRuleDeleteEvalRequest) Validate added in v0.36.0

func (r *OnboardRuleDeleteEvalRequest) Validate() error

Validate checks the request against the onboardrule:delete contract. Implements EvalRequest.

func (*OnboardRuleDeleteEvalRequest) WithOrg added in v0.36.0

WithOrg sets the organization the rule being deleted is scoped to.

type OnboardRuleListEvalRequest added in v0.36.0

type OnboardRuleListEvalRequest struct {
	Resource OnboardRuleResource
}

OnboardRuleListEvalRequest is the validated, typed model for onboardrule:list policy evaluation. Use NewOnboardRuleListEvalRequest to start building, then call Build to get a validated instance.

func NewOnboardRuleListEvalRequest added in v0.36.0

func NewOnboardRuleListEvalRequest(org string) *OnboardRuleListEvalRequest

NewOnboardRuleListEvalRequest begins building an OnboardRuleListEvalRequest for the given organization. Call Build to validate and obtain the final struct.

func OnboardRuleListEvalRequestFromProto added in v0.36.0

func OnboardRuleListEvalRequestFromProto(req *authzv1.EvaluateRequest) (*OnboardRuleListEvalRequest, error)

OnboardRuleListEvalRequestFromProto converts a gRPC EvaluateRequest into a validated OnboardRuleListEvalRequest.

func (*OnboardRuleListEvalRequest) Build added in v0.36.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*OnboardRuleListEvalRequest) ToProto added in v0.36.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*OnboardRuleListEvalRequest) Validate added in v0.36.0

func (r *OnboardRuleListEvalRequest) Validate() error

Validate checks the request against the onboardrule:list contract. Implements EvalRequest.

type OnboardRuleResource added in v0.36.0

type OnboardRuleResource struct {
	// ID is the resource id (resource.id in the EvaluateRequest) — the
	// rule's numeric id (as a decimal string) for update/delete, or the
	// proposed username pattern for create, where no id exists yet.
	ID string

	// Org is the organization the rule is (or will be) scoped to
	// (resource.attributes["org"]). Always required.
	Org string

	// IDP is the identity provider the rule applies to
	// (resource.attributes["idp"]). Only set for onboardrule:create.
	IDP string
}

OnboardRuleResource holds the resource-scoped attributes for an onboard rule policy check.

type OnboardRuleUpdateEvalRequest added in v0.36.0

type OnboardRuleUpdateEvalRequest struct {
	Resource OnboardRuleResource
}

OnboardRuleUpdateEvalRequest is the validated, typed model for onboardrule:update policy evaluation. Use NewOnboardRuleUpdateEvalRequest to start building, then chain WithOrg and call Build to get a validated instance.

func NewOnboardRuleUpdateEvalRequest added in v0.36.0

func NewOnboardRuleUpdateEvalRequest(id string) *OnboardRuleUpdateEvalRequest

NewOnboardRuleUpdateEvalRequest begins building an OnboardRuleUpdateEvalRequest for the given rule id (as a decimal string). Chain WithOrg to supply the rule's organization, then call Build to validate and obtain the final struct.

func OnboardRuleUpdateEvalRequestFromProto added in v0.36.0

func OnboardRuleUpdateEvalRequestFromProto(req *authzv1.EvaluateRequest) (*OnboardRuleUpdateEvalRequest, error)

OnboardRuleUpdateEvalRequestFromProto converts a gRPC EvaluateRequest into a validated OnboardRuleUpdateEvalRequest.

func (*OnboardRuleUpdateEvalRequest) Build added in v0.36.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*OnboardRuleUpdateEvalRequest) ToProto added in v0.36.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*OnboardRuleUpdateEvalRequest) Validate added in v0.36.0

func (r *OnboardRuleUpdateEvalRequest) Validate() error

Validate checks the request against the onboardrule:update contract. Implements EvalRequest.

func (*OnboardRuleUpdateEvalRequest) WithOrg added in v0.36.0

WithOrg sets the organization the rule being updated is scoped to.

type OrgObligation added in v0.30.6

type OrgObligation struct {
	// Org is the organization the enforcer should restrict the listing to.
	Org string
}

OrgObligation is the typed representation of the "org" obligation key returned by the policy engine in a PolicyResult for user:list.

func ParseOrgObligation added in v0.30.6

func ParseOrgObligation(obligations map[string]string) (OrgObligation, bool)

ParseOrgObligation reads the "org" key from the obligations map. Returns (obligation, true) when the key is present, (zero value, false) when the policy did not set an org obligation — in that case the enforcer should not scope the listing by organization.

type OrganizationCreateEvalRequest added in v0.35.0

type OrganizationCreateEvalRequest struct {
	Resource OrganizationResource
}

OrganizationCreateEvalRequest is the validated, typed model for org:create policy evaluation. Use NewOrganizationCreateEvalRequest to start building, then call Build to get a validated instance.

func NewOrganizationCreateEvalRequest added in v0.35.0

func NewOrganizationCreateEvalRequest(name string) *OrganizationCreateEvalRequest

NewOrganizationCreateEvalRequest begins building an OrganizationCreateEvalRequest for the given proposed organization name. Call Build to validate and obtain the final struct.

func OrganizationCreateEvalRequestFromProto added in v0.35.0

func OrganizationCreateEvalRequestFromProto(req *authzv1.EvaluateRequest) (*OrganizationCreateEvalRequest, error)

OrganizationCreateEvalRequestFromProto converts a gRPC EvaluateRequest into a validated OrganizationCreateEvalRequest.

func (*OrganizationCreateEvalRequest) Build added in v0.35.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*OrganizationCreateEvalRequest) ToProto added in v0.35.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*OrganizationCreateEvalRequest) Validate added in v0.35.0

func (r *OrganizationCreateEvalRequest) Validate() error

Validate checks the request against the org:create contract. Implements EvalRequest.

type OrganizationDeleteEvalRequest added in v0.35.0

type OrganizationDeleteEvalRequest struct {
	Resource OrganizationResource
}

OrganizationDeleteEvalRequest is the validated, typed model for org:delete policy evaluation. Use NewOrganizationDeleteEvalRequest to start building, then call Build to get a validated instance.

func NewOrganizationDeleteEvalRequest added in v0.35.0

func NewOrganizationDeleteEvalRequest(name string) *OrganizationDeleteEvalRequest

NewOrganizationDeleteEvalRequest begins building an OrganizationDeleteEvalRequest for the given organization name. Call Build to validate and obtain the final struct.

func OrganizationDeleteEvalRequestFromProto added in v0.35.0

func OrganizationDeleteEvalRequestFromProto(req *authzv1.EvaluateRequest) (*OrganizationDeleteEvalRequest, error)

OrganizationDeleteEvalRequestFromProto converts a gRPC EvaluateRequest into a validated OrganizationDeleteEvalRequest.

func (*OrganizationDeleteEvalRequest) Build added in v0.35.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*OrganizationDeleteEvalRequest) ToProto added in v0.35.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*OrganizationDeleteEvalRequest) Validate added in v0.35.0

func (r *OrganizationDeleteEvalRequest) Validate() error

Validate checks the request against the org:delete contract. Implements EvalRequest.

type OrganizationListEvalRequest added in v0.35.0

type OrganizationListEvalRequest struct{}

OrganizationListEvalRequest is the validated, typed model for org:list policy evaluation. No resource id is required; the subject claims determine access.

func NewOrganizationListEvalRequest added in v0.35.0

func NewOrganizationListEvalRequest() *OrganizationListEvalRequest

NewOrganizationListEvalRequest returns an OrganizationListEvalRequest ready to be built.

func OrganizationListEvalRequestFromProto added in v0.35.0

func OrganizationListEvalRequestFromProto(req *authzv1.EvaluateRequest) (*OrganizationListEvalRequest, error)

OrganizationListEvalRequestFromProto converts a gRPC EvaluateRequest into a validated OrganizationListEvalRequest.

func (*OrganizationListEvalRequest) Build added in v0.35.0

Build returns the request. It is the required terminator for the builder chain.

func (*OrganizationListEvalRequest) ToProto added in v0.35.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*OrganizationListEvalRequest) Validate added in v0.35.0

func (r *OrganizationListEvalRequest) Validate() error

Validate is a no-op for org:list; no fields are required. Implements EvalRequest.

type OrganizationReadEvalRequest added in v0.36.0

type OrganizationReadEvalRequest struct {
	Resource OrganizationResource
}

OrganizationReadEvalRequest is the validated, typed model for org:read policy evaluation. Use NewOrganizationReadEvalRequest to start building, then call Build to get a validated instance.

func NewOrganizationReadEvalRequest added in v0.36.0

func NewOrganizationReadEvalRequest(name string) *OrganizationReadEvalRequest

NewOrganizationReadEvalRequest begins building an OrganizationReadEvalRequest for the given organization name. Call Build to validate and obtain the final struct.

func OrganizationReadEvalRequestFromProto added in v0.36.0

func OrganizationReadEvalRequestFromProto(req *authzv1.EvaluateRequest) (*OrganizationReadEvalRequest, error)

OrganizationReadEvalRequestFromProto converts a gRPC EvaluateRequest into a validated OrganizationReadEvalRequest.

func (*OrganizationReadEvalRequest) Build added in v0.36.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*OrganizationReadEvalRequest) ToProto added in v0.36.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*OrganizationReadEvalRequest) Validate added in v0.36.0

func (r *OrganizationReadEvalRequest) Validate() error

Validate checks the request against the org:read contract. Implements EvalRequest.

type OrganizationResource added in v0.35.0

type OrganizationResource struct {
	// ID is the organization name (resource.id in the EvaluateRequest).
	ID string
}

OrganizationResource holds the resource-scoped attributes for an organization policy check.

type OrganizationUpdateEvalRequest added in v0.35.0

type OrganizationUpdateEvalRequest struct {
	Resource OrganizationResource
}

OrganizationUpdateEvalRequest is the validated, typed model for org:update policy evaluation. Use NewOrganizationUpdateEvalRequest to start building, then call Build to get a validated instance.

func NewOrganizationUpdateEvalRequest added in v0.35.0

func NewOrganizationUpdateEvalRequest(name string) *OrganizationUpdateEvalRequest

NewOrganizationUpdateEvalRequest begins building an OrganizationUpdateEvalRequest for the given organization name. Call Build to validate and obtain the final struct.

func OrganizationUpdateEvalRequestFromProto added in v0.35.0

func OrganizationUpdateEvalRequestFromProto(req *authzv1.EvaluateRequest) (*OrganizationUpdateEvalRequest, error)

OrganizationUpdateEvalRequestFromProto converts a gRPC EvaluateRequest into a validated OrganizationUpdateEvalRequest.

func (*OrganizationUpdateEvalRequest) Build added in v0.35.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*OrganizationUpdateEvalRequest) ToProto added in v0.35.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*OrganizationUpdateEvalRequest) Validate added in v0.35.0

func (r *OrganizationUpdateEvalRequest) Validate() error

Validate checks the request against the org:update contract. Implements EvalRequest.

type PolicyInput

type PolicyInput struct {
	Username  string
	Roles     []string
	Package   string
	Action    string
	Resource  PolicyResource
	Context   map[string]string
	Blueprint map[string]any // non-nil for workspace:* actions; decoded from context["blueprint"]

	// Scope is the compound "domain:action[:qualifier]" display form of
	// Action for actions whose qualifier (auth surface, credential type,
	// connect type, ...) is folded in for display — the same convention
	// CapabilityCheck.Action uses for the synthetic probe registry (see
	// capability.go), computed here from this request's actual context
	// instead of a fixed representative value. Equal to Action for actions
	// with no such qualifier.
	//
	// This is a display/audit convenience only — it must never be used for
	// policy routing or PAT scope matching, both of which stay keyed on the
	// base Action. The two can legitimately diverge: workspace:create's PAT
	// Scope stays "workspace:create" regardless of provision mode (a token
	// scoped for it may create either), while Scope here still distinguishes
	// "workspace:create:inject" from "workspace:create:standalone" so a
	// capability listing or audit trail can show which was actually used.
	Scope string

	// CapabilityCheck marks this evaluation as a synthetic "what can I do"
	// probe rather than a real access attempt. It is not set by
	// BuildPolicyInput — since capability_check is a BatchEvaluateRequest-level
	// flag, the caller of BatchEvaluate must propagate it onto each request's
	// PolicyInput after construction. Policy-decision audit logging should
	// record and classify these separately from genuine authorization
	// decisions.
	CapabilityCheck bool
}

PolicyInput is the assembled input to a policy evaluation engine (e.g. OPA). It combines the decoded JWT subject with the validated, normalized fields from the gRPC EvaluateRequest. Construct via BuildPolicyInput.

func BuildPolicyInput

func BuildPolicyInput(req *authzv1.EvaluateRequest) (*PolicyInput, error)

BuildPolicyInput parses the JWT from req, validates the request against the appropriate domain contract, and assembles the PolicyInput for the policy engine. It is the single entry point for all incoming EvaluateRequests on the server side — no per-domain routing is needed at the call site.

type PolicyResource

type PolicyResource struct {
	Type       string
	ID         string
	Attributes map[string]string
}

PolicyResource holds the resource fields for policy evaluation, mirroring the proto Resource message.

type PolicyResult

type PolicyResult struct {
	Allowed     bool
	Reason      string
	Obligations map[string]string
}

PolicyResult holds the outcome of a single policy evaluation.

func PolicyResultFromProto

func PolicyResultFromProto(resp *authzv1.EvaluateResponse) *PolicyResult

PolicyResultFromProto converts a gRPC EvaluateResponse into a PolicyResult.

func (*PolicyResult) ToProto

func (r *PolicyResult) ToProto() *authzv1.EvaluateResponse

ToProto converts a PolicyResult into a gRPC EvaluateResponse.

type ProvisionPatch

type ProvisionPatch struct {
	Path  string // e.g. "/resources/cpu"
	Value string
}

ProvisionPatch is a single blueprint mutation expressed by the policy engine as part of a workspace:provision obligation. Path is a JSON Pointer (RFC 6901) addressing a field in the blueprint YAML document.

func ParseProvisionPatchObligations

func ParseProvisionPatchObligations(obligations map[string]string) []ProvisionPatch

ParseProvisionPatchObligations extracts all patch obligations from the obligations map. Every key with the ObligationKeyPatchPrefix prefix is interpreted as a JSON Pointer path; the map value is the string to write there. Returns nil when no patch obligations are present.

type RecordObligation

type RecordObligation struct {
	Shell       bool
	Exec        bool
	DirectTCPIP bool
	SFTP        bool
}

RecordObligation is the typed representation of the "record" obligation key returned by the policy engine in a PolicyResult for session:start. Each field corresponds to one recording channel; all default to false.

func ParseRecordObligation

func ParseRecordObligation(obligations map[string]string) (RecordObligation, bool)

ParseRecordObligation reads the "record" key from the obligations map. The value is a comma-separated list of channel tokens ("shell", "exec", "direct-tcpip", "sftp"); "none" or an unrecognised value leaves all fields false. Returns (obligation, true) when the key is present, (zero, false) when the policy did not set a record obligation — the enforcer should then apply its configured default (typically no recording).

type RoleCreateEvalRequest added in v0.35.0

type RoleCreateEvalRequest struct {
	Resource RoleResource
}

RoleCreateEvalRequest is the validated, typed model for role:create policy evaluation. Use NewRoleCreateEvalRequest to start building, then chain With* methods and call Build to get a validated instance.

func NewRoleCreateEvalRequest added in v0.35.0

func NewRoleCreateEvalRequest(name string) *RoleCreateEvalRequest

NewRoleCreateEvalRequest begins building a RoleCreateEvalRequest for the given proposed role name. Chain With* methods to supply additional fields, then call Build to validate and obtain the final struct.

func RoleCreateEvalRequestFromProto added in v0.35.0

func RoleCreateEvalRequestFromProto(req *authzv1.EvaluateRequest) (*RoleCreateEvalRequest, error)

RoleCreateEvalRequestFromProto converts a gRPC EvaluateRequest into a validated RoleCreateEvalRequest.

func (*RoleCreateEvalRequest) Build added in v0.35.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*RoleCreateEvalRequest) ToProto added in v0.35.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*RoleCreateEvalRequest) Validate added in v0.35.0

func (r *RoleCreateEvalRequest) Validate() error

Validate checks the request against the role:create contract. Implements EvalRequest.

func (*RoleCreateEvalRequest) WithOrg added in v0.35.0

WithOrg sets the organization the new role will be scoped to.

type RoleDeleteEvalRequest added in v0.35.0

type RoleDeleteEvalRequest struct {
	Resource RoleResource
}

RoleDeleteEvalRequest is the validated, typed model for role:delete policy evaluation. Use NewRoleDeleteEvalRequest to start building, then call Build to get a validated instance.

func NewRoleDeleteEvalRequest added in v0.35.0

func NewRoleDeleteEvalRequest(name string) *RoleDeleteEvalRequest

NewRoleDeleteEvalRequest begins building a RoleDeleteEvalRequest for the given role name. Chain WithOrg to supply the role's organization, then call Build to validate and obtain the final struct.

func RoleDeleteEvalRequestFromProto added in v0.35.0

func RoleDeleteEvalRequestFromProto(req *authzv1.EvaluateRequest) (*RoleDeleteEvalRequest, error)

RoleDeleteEvalRequestFromProto converts a gRPC EvaluateRequest into a validated RoleDeleteEvalRequest.

func (*RoleDeleteEvalRequest) Build added in v0.35.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*RoleDeleteEvalRequest) ToProto added in v0.35.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*RoleDeleteEvalRequest) Validate added in v0.35.0

func (r *RoleDeleteEvalRequest) Validate() error

Validate checks the request against the role:delete contract. Implements EvalRequest.

func (*RoleDeleteEvalRequest) WithOrg added in v0.35.0

WithOrg sets the organization the role being deleted is scoped to.

type RoleListEvalRequest added in v0.35.0

type RoleListEvalRequest struct{}

RoleListEvalRequest is the validated, typed model for role:list policy evaluation. No resource id is required; the subject claims determine access.

func NewRoleListEvalRequest added in v0.35.0

func NewRoleListEvalRequest() *RoleListEvalRequest

NewRoleListEvalRequest returns a RoleListEvalRequest ready to be built.

func RoleListEvalRequestFromProto added in v0.35.0

func RoleListEvalRequestFromProto(req *authzv1.EvaluateRequest) (*RoleListEvalRequest, error)

RoleListEvalRequestFromProto converts a gRPC EvaluateRequest into a validated RoleListEvalRequest.

func (*RoleListEvalRequest) Build added in v0.35.0

Build returns the request. It is the required terminator for the builder chain.

func (*RoleListEvalRequest) ToProto added in v0.35.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*RoleListEvalRequest) Validate added in v0.35.0

func (r *RoleListEvalRequest) Validate() error

Validate is a no-op for role:list; no fields are required. Implements EvalRequest.

type RoleResource added in v0.35.0

type RoleResource struct {
	// ID is the role name (resource.id in the EvaluateRequest).
	ID string

	// Org is the organization the role is scoped to (resource.attributes["org"]).
	// Required; global roles cannot be created, deleted, or updated.
	Org string
}

RoleResource holds the resource-scoped attributes for a role policy check. Used by role:create, role:delete, and role:update — all three require a non-empty Org, since global (org-less) roles can only ever be listed.

type RoleUpdateEvalRequest added in v0.35.0

type RoleUpdateEvalRequest struct {
	Resource RoleResource
}

RoleUpdateEvalRequest is the validated, typed model for role:update policy evaluation. Use NewRoleUpdateEvalRequest to start building, then chain With* methods and call Build to get a validated instance.

func NewRoleUpdateEvalRequest added in v0.35.0

func NewRoleUpdateEvalRequest(name string) *RoleUpdateEvalRequest

NewRoleUpdateEvalRequest begins building a RoleUpdateEvalRequest for the given role name. Chain WithOrg to supply the role's organization, then call Build to validate and obtain the final struct.

func RoleUpdateEvalRequestFromProto added in v0.35.0

func RoleUpdateEvalRequestFromProto(req *authzv1.EvaluateRequest) (*RoleUpdateEvalRequest, error)

RoleUpdateEvalRequestFromProto converts a gRPC EvaluateRequest into a validated RoleUpdateEvalRequest.

func (*RoleUpdateEvalRequest) Build added in v0.35.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*RoleUpdateEvalRequest) ToProto added in v0.35.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*RoleUpdateEvalRequest) Validate added in v0.35.0

func (r *RoleUpdateEvalRequest) Validate() error

Validate checks the request against the role:update contract. Implements EvalRequest.

func (*RoleUpdateEvalRequest) WithOrg added in v0.35.0

WithOrg sets the organization the role being updated is scoped to.

type RolesObligation

type RolesObligation struct {
	// Roles is the list of roles the policy assigns to the user.
	Roles []models.Role
}

RolesObligation is the typed representation of the "roles" obligation key returned by the policy engine in a PolicyResult for user:create.

func ParseRolesObligation

func ParseRolesObligation(obligations map[string]string) (RolesObligation, bool)

ParseRolesObligation reads the "roles" key from the obligations map. Returns (obligation, true) when the key is present, (zero value, false) when the policy did not set a roles obligation — in that case the enforcer should preserve its existing default rather than overwriting it.

type SSHAction

type SSHAction string

SSHAction is the typed representation of an SSH policy action.

const (
	// SSHActionShell is an interactive PTY session (session channel + shell request).
	SSHActionShell SSHAction = "ssh:shell"

	// SSHActionExec is a non-interactive command execution (session channel + exec request).
	// Also covers SCP.
	SSHActionExec SSHAction = "ssh:exec"

	// SSHActionSFTP is a subsystem "sftp" request on a session channel.
	SSHActionSFTP SSHAction = "ssh:sftp"

	// SSHActionDirectTCPIP is a client-initiated TCP port forward (direct-tcpip channel).
	SSHActionDirectTCPIP SSHAction = "ssh:direct-tcpip"

	// SSHActionDirectStreamlocal is a Unix domain socket forward
	// (direct-streamlocal@openssh.com channel).
	SSHActionDirectStreamlocal SSHAction = "ssh:direct-streamlocal"

	// SSHActionAgentForward is SSH agent forwarding
	// (auth-agent-req@openssh.com session request).
	SSHActionAgentForward SSHAction = "ssh:agent-forward"
)

type SSHContext

type SSHContext struct {
	// PTY is true when a pseudo-terminal was requested (context["pty"] == "true").
	PTY bool

	// Command is the exact command string for ssh:exec channels (context["command"]).
	Command string

	// Host is the destination host for ssh:direct-tcpip channels (context["host"]).
	Host string

	// Port is the destination port for ssh:direct-tcpip channels (context["port"]).
	Port string

	// SocketPath is the Unix socket path for ssh:direct-streamlocal channels
	// (context["socket_path"]).
	SocketPath string

	// AsUser is the Linux user the session runs as inside the workspace
	// (context["as_user"]). Optional; empty means the workspace default user.
	AsUser string
}

SSHContext holds the ambient SSH channel/request attributes supplied by the ssh-proxy in the context map of the EvaluateRequest.

type SSHEvalRequest

type SSHEvalRequest struct {
	Action   SSHAction
	Resource WorkspaceResource
	Context  SSHContext
}

SSHEvalRequest is the validated, typed model for SSH policy evaluation. Use NewSSHEvalRequest to start building, then chain With* methods and call Build to get a validated instance. Use SSHEvalRequestFromProto to convert directly from a gRPC EvaluateRequest.

func NewSSHEvalRequest

func NewSSHEvalRequest(action SSHAction, workspaceID string) *SSHEvalRequest

NewSSHEvalRequest begins building an SSHEvalRequest for the given action and workspace ID. Chain With* methods to supply additional fields, then call Build to validate and obtain the final struct.

func SSHEvalRequestFromProto

func SSHEvalRequestFromProto(req *authzv1.EvaluateRequest) (*SSHEvalRequest, error)

SSHEvalRequestFromProto converts a gRPC EvaluateRequest into a validated SSHEvalRequest. Returns an error if the request does not conform to the SSH policy contract.

func (*SSHEvalRequest) Build

func (r *SSHEvalRequest) Build() (*SSHEvalRequest, error)

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*SSHEvalRequest) ToProto

func (r *SSHEvalRequest) ToProto(token string) *authzv1.EvaluateRequest

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Only non-empty / non-default context fields are included in the context map. Implements EvalRequest.

func (*SSHEvalRequest) Validate

func (r *SSHEvalRequest) Validate() error

Validate checks the request against the SSH policy contract: the action must be recognized, core resource fields must be present, and each action enforces its own required context fields. Implements EvalRequest.

func (*SSHEvalRequest) WithAsUser

func (r *SSHEvalRequest) WithAsUser(user string) *SSHEvalRequest

WithAsUser sets the Linux user the session runs as inside the workspace. Optional for SSHActionShell and SSHActionExec; empty means the workspace default user.

func (*SSHEvalRequest) WithBlueprint

func (r *SSHEvalRequest) WithBlueprint(blueprint string) *SSHEvalRequest

WithBlueprint sets the blueprint name on the resource.

func (*SSHEvalRequest) WithCommand

func (r *SSHEvalRequest) WithCommand(cmd string) *SSHEvalRequest

WithCommand sets the command string; required for SSHActionExec.

func (*SSHEvalRequest) WithHost

func (r *SSHEvalRequest) WithHost(host string) *SSHEvalRequest

WithHost sets the destination host; required for SSHActionDirectTCPIP.

func (*SSHEvalRequest) WithOwner

func (r *SSHEvalRequest) WithOwner(owner string) *SSHEvalRequest

WithOwner sets the workspace owner on the resource.

func (*SSHEvalRequest) WithPTY

func (r *SSHEvalRequest) WithPTY(pty bool) *SSHEvalRequest

WithPTY records whether a pseudo-terminal was requested.

func (*SSHEvalRequest) WithPort

func (r *SSHEvalRequest) WithPort(port string) *SSHEvalRequest

WithPort sets the destination port; required for SSHActionDirectTCPIP.

func (*SSHEvalRequest) WithSocketPath

func (r *SSHEvalRequest) WithSocketPath(path string) *SSHEvalRequest

WithSocketPath sets the Unix socket path; required for SSHActionDirectStreamlocal.

type Scope

type Scope string

Scope is a PAT access token scope string. It is either an exact action string from the registry (e.g. "workspace:list") or a wildcard pattern with "*" as the last segment (e.g. "workspace:connect:*"), optionally narrowed by a trailing constraint (e.g. "user:read:profile:self").

Grammar:

scope      = "*"
           | domain ":" action
           | domain ":" action ":" qualifier
           | domain ":" action ":" qualifier ":" constraint
           | domain ":" action ":" "*"
           | domain ":" action ":" "*" ":" constraint
           | domain ":" "*"

Matching is strict (Option A): a scope without a wildcard matches only its exact action string. To cover all qualifiers of an action, the scope must carry an explicit ":*" suffix (e.g. "workspace:connect:*").

A constraint is an additional, orthogonal condition evaluated against the request rather than the action string — it doesn't change which action the scope matches, only whether the scope applies to this particular request. A plain (unconstrained) scope keeps matching regardless of any constraint state, so a token already holding the broad "user:read:profile" scope is unaffected by a caller also being able to satisfy "self". See ScopeConstraint for the constraint vocabulary and ScopeAllows for how constraint satisfaction is supplied by the caller.

type ScopeCatalog added in v0.36.0

type ScopeCatalog struct {
	Global  *ScopeCatalogEntry   `json:"global"`
	Domains []ScopeCatalogDomain `json:"domains"`
}

ScopeCatalog is the full set of selectable PAT scopes, grouped for rendering as a checkbox tree. Global is the bare "*" scope — it grants every action across every domain and is surfaced separately since it doesn't belong to any one domain.

func ScopeCatalogDoc added in v0.36.0

func ScopeCatalogDoc() ScopeCatalog

ScopeCatalogDoc returns the full, ordered catalog of selectable PAT scopes for UI rendering and editing.

type ScopeCatalogAction added in v0.36.0

type ScopeCatalogAction struct {
	Action  string              `json:"action"`
	Label   string              `json:"label"`
	Entries []ScopeCatalogEntry `json:"entries"`
}

ScopeCatalogAction groups the scope entries for one "domain:action" prefix, e.g. every workspace:connect:* qualifier.

type ScopeCatalogDomain added in v0.36.0

type ScopeCatalogDomain struct {
	Domain      string               `json:"domain"`
	Label       string               `json:"label"`
	Description string               `json:"description,omitempty"`
	Wildcard    *ScopeCatalogEntry   `json:"wildcard,omitempty"`
	Actions     []ScopeCatalogAction `json:"actions"`
}

ScopeCatalogDomain groups all actions under one scope domain (workspace, user, token, ...). Wildcard, when non-nil, is the "domain:*" entry that grants every action in the domain at once.

type ScopeCatalogEntry added in v0.36.0

type ScopeCatalogEntry struct {
	// Scope is the literal scope string to store, e.g. "workspace:connect:webshell"
	// or "workspace:connect:*".
	Scope       string `json:"scope"`
	Label       string `json:"label"`
	Description string `json:"description,omitempty"`
	// Wildcard is true when Scope ends in ":*" and covers every sibling
	// entry in the same action group.
	Wildcard bool `json:"wildcard"`
	// Constraints lists the constraint suffixes this scope accepts (today,
	// only "self"). A UI may offer these as a toggle that appends
	// ":<constraint>" to Scope rather than exposing the raw syntax.
	Constraints []string `json:"constraints,omitempty"`
}

ScopeCatalogEntry describes one selectable PAT scope for UI rendering.

type ScopeConstraint added in v0.33.0

type ScopeConstraint string

ScopeConstraint is the optional 4th segment of a scope string. It narrows a scope to requests that satisfy some condition the scope grammar alone can't express — one the caller must evaluate against the actual request and report back to ScopeAllows (e.g. "is the resource being accessed the token's own subject?"). New constraints are added to validScopeConstraints; domains opt individual domain:action prefixes into accepting a constraint suffix via scopeConstrainablePrefixes.

const (
	// ScopeConstraintSelf restricts a scope to requests where the resource
	// being accessed belongs to the token's own subject, i.e.
	// resource.id == subject.username. Callers determine this themselves
	// (the scope layer has no resource awareness) and pass ScopeConstraintSelf
	// to ScopeAllows when true.
	ScopeConstraintSelf ScopeConstraint = "self"
)

type ScopesObligation

type ScopesObligation struct {
	// Scopes is the list of scopes the policy permits on the new token.
	Scopes []string
}

ScopesObligation is the typed representation of the "scopes" obligation key returned by the policy engine in a PolicyResult for token:create.

func ParseScopesObligation

func ParseScopesObligation(obligations map[string]string) (ScopesObligation, bool)

ParseScopesObligation reads the "scopes" key from the obligations map. Returns (obligation, true) when the key is present, (zero value, false) when the policy did not set a scopes obligation.

type SessionAction

type SessionAction string

SessionAction is the typed representation of a session policy action.

const (
	// SessionActionStart is the action evaluated when a new session is being
	// established. The policy result may carry a "record" obligation that
	// instructs the enforcer what kind of recording to apply to the session.
	SessionActionStart SessionAction = "session:start"

	// SessionActionList is the action evaluated when listing sessions. The
	// scope is controlled by the resource fields: both id and owner set scopes
	// to one workspace; owner only scopes to a user; neither means all sessions.
	SessionActionList SessionAction = "session:list"
)

type SessionContext

type SessionContext struct {
	// Type is the kind of session being established (context["session_type"]).
	Type SessionType

	// Source is the component that initiated the session (context["session_source"]).
	Source SessionSource
}

SessionContext holds the ambient session attributes supplied by the caller in the context map of the EvaluateRequest.

type SessionListEvalRequest

type SessionListEvalRequest struct {
	Resource WorkspaceResource
}

SessionListEvalRequest is the validated, typed model for session:list policy evaluation. Both resource fields are optional; their combination controls the listing scope (see the contract comment at the top of this file).

func NewSessionListEvalRequest

func NewSessionListEvalRequest() *SessionListEvalRequest

NewSessionListEvalRequest returns a SessionListEvalRequest ready to be built. Chain WithWorkspace and/or WithOwner to narrow the scope, then call Build.

func SessionListEvalRequestFromProto

func SessionListEvalRequestFromProto(req *authzv1.EvaluateRequest) (*SessionListEvalRequest, error)

SessionListEvalRequestFromProto converts a gRPC EvaluateRequest into a validated SessionListEvalRequest.

func (*SessionListEvalRequest) Build

Build validates the request and returns it if all constraints are satisfied.

func (*SessionListEvalRequest) ToProto

ToProto serializes the typed request into a gRPC EvaluateRequest. Implements EvalRequest.

func (*SessionListEvalRequest) Validate

func (r *SessionListEvalRequest) Validate() error

Validate checks the request: if a workspace id is set, owner must also be set. Implements EvalRequest.

func (*SessionListEvalRequest) WithOwner

WithOwner sets the owner username.

func (*SessionListEvalRequest) WithWorkspace

func (r *SessionListEvalRequest) WithWorkspace(workspaceID string) *SessionListEvalRequest

WithWorkspace sets the workspace name; requires WithOwner to also be called.

type SessionSource

type SessionSource string

SessionSource identifies the component that initiated the session.

const (
	// SessionSourceSSHProxy is set when the session originates from the SSH proxy.
	SessionSourceSSHProxy SessionSource = "ssh-proxy"

	// SessionSourceAPIServer is set when the session originates from the API server.
	SessionSourceAPIServer SessionSource = "api-server"
)

type SessionStartEvalRequest

type SessionStartEvalRequest struct {
	Action   SessionAction
	Resource WorkspaceResource
	Context  SessionContext
}

SessionStartEvalRequest is the validated, typed model for session policy evaluation. Use NewSessionStartEvalRequest to start building, then chain With* methods and call Build to get a validated instance. Use SessionStartEvalRequestFromProto to convert directly from a gRPC EvaluateRequest.

func NewSessionStartEvalRequest

func NewSessionStartEvalRequest(action SessionAction, workspaceID string, sessionType SessionType) *SessionStartEvalRequest

NewSessionStartEvalRequest begins building a SessionStartEvalRequest for the given action, workspace ID, and session type. Chain With* methods to supply additional fields, then call Build to validate and obtain the final struct.

func SessionStartEvalRequestFromProto

func SessionStartEvalRequestFromProto(req *authzv1.EvaluateRequest) (*SessionStartEvalRequest, error)

SessionStartEvalRequestFromProto converts a gRPC EvaluateRequest into a validated SessionStartEvalRequest. Returns an error if the request does not conform to the session policy contract.

func (*SessionStartEvalRequest) Build

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*SessionStartEvalRequest) ToProto

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Only non-empty resource attributes are included. Implements EvalRequest.

func (*SessionStartEvalRequest) Validate

func (r *SessionStartEvalRequest) Validate() error

Validate checks the request against the session policy contract: the action must be recognized, core resource fields must be present, and the session type must be a known value. Implements EvalRequest.

func (*SessionStartEvalRequest) WithBlueprint

func (r *SessionStartEvalRequest) WithBlueprint(blueprint string) *SessionStartEvalRequest

WithBlueprint sets the blueprint name on the resource.

func (*SessionStartEvalRequest) WithOwner

WithOwner sets the workspace owner on the resource.

func (*SessionStartEvalRequest) WithSource

WithSource sets the session source on the context.

type SessionType

type SessionType string

SessionType describes the kind of session being established.

const (
	// SessionTypeShell is an interactive shell/PTY session (terminal recording).
	SessionTypeShell SessionType = "shell"

	// SessionTypeTCPIP is a TCP/IP port-forwarding session (network traffic recording).
	SessionTypeTCPIP SessionType = "tcpip"

	// SessionTypeExec is a non-interactive exec session (single command, no PTY).
	SessionTypeExec SessionType = "exec"

	// SessionTypeSFTP is an SFTP subsystem session (file transfer).
	SessionTypeSFTP SessionType = "sftp"
)

type SudoObligation

type SudoObligation struct {
	// Granted is true when the policy grants sudo access, false when it denies it.
	Granted bool
}

SudoObligation is the typed representation of the "sudo" obligation key returned by the policy engine in a PolicyResult for user:create.

func ParseSudoObligation

func ParseSudoObligation(obligations map[string]string) (SudoObligation, bool)

ParseSudoObligation reads the "sudo" key from the obligations map. Returns (obligation, true) when the key is present, (zero value, false) when the policy did not set a sudo obligation — in that case the enforcer should preserve its existing default rather than overwriting it.

type TokenCreateContext

type TokenCreateContext struct {
	// Source is how the token creation was initiated (context["source"]).
	Source TokenCreateSource
}

TokenCreateContext holds the ambient attributes for a token:create request.

type TokenCreateSource

type TokenCreateSource string

TokenCreateSource identifies how the token creation was initiated.

const (
	// TokenCreateSourceWebFlow is set when the token is issued at the end of an
	// OAuth/device login flow initiated by the CLI.
	TokenCreateSourceWebFlow TokenCreateSource = "web-flow"

	// TokenCreateSourceAPI is set when the token is created via a direct API request.
	TokenCreateSourceAPI TokenCreateSource = "api"
)

type UserAuthContext

type UserAuthContext struct {
	// Surface is the login surface being authenticated (context["surface"]).
	Surface AuthSurface
}

UserAuthContext holds the context-scoped attributes for a user:auth policy check.

type UserAuthEvalRequest

type UserAuthEvalRequest struct {
	Resource UserResource
	Context  UserAuthContext
}

UserAuthEvalRequest is the validated, typed model for user:auth policy evaluation. Use NewUserAuthEvalRequest to start building, then chain With* methods and call Build to get a validated instance.

func NewUserAuthEvalRequest

func NewUserAuthEvalRequest(username string) *UserAuthEvalRequest

NewUserAuthEvalRequest begins building a UserAuthEvalRequest for the given username. Chain With* methods to supply additional fields, then call Build to validate and obtain the final struct.

func UserAuthEvalRequestFromProto

func UserAuthEvalRequestFromProto(req *authzv1.EvaluateRequest) (*UserAuthEvalRequest, error)

UserAuthEvalRequestFromProto converts a gRPC EvaluateRequest into a validated UserAuthEvalRequest. Returns an error if the request does not conform to the user:auth contract.

func (*UserAuthEvalRequest) Build

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*UserAuthEvalRequest) ToProto

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*UserAuthEvalRequest) Validate

func (r *UserAuthEvalRequest) Validate() error

Validate checks the request against the user:auth contract: ID and IDP are required, and surface must be a recognized value. Implements EvalRequest.

func (*UserAuthEvalRequest) WithIDP

WithIDP sets the identity provider name on the resource.

func (*UserAuthEvalRequest) WithOrg

WithOrg sets the organization on the resource.

func (*UserAuthEvalRequest) WithSurface added in v0.32.1

func (r *UserAuthEvalRequest) WithSurface(surface AuthSurface) *UserAuthEvalRequest

WithSurface sets the login surface being authenticated on the context.

type UserAuthMethod

type UserAuthMethod string

UserAuthMethod is the typed representation of a user authentication method.

const (
	UserAuthMethodPublicKey UserAuthMethod = "publickey"
	UserAuthMethodPassword  UserAuthMethod = "password"
)

type UserClaims

type UserClaims struct {
	jwt.RegisteredClaims

	// Email is the user's email address.
	Email string `json:"email,omitempty"`

	// Name is the user's full name.
	Name string `json:"name,omitempty"`

	// UID is the POSIX user-id of the user.
	UID uint32 `json:"uid"`

	// GID is the POSIX primary group-id of the user.
	GID uint32 `json:"gid"`

	// Roles lists the roles granted to the user.
	Roles []models.Role `json:"roles,omitempty"`

	// Organization is the user's organisation.
	Organization string `json:"org,omitempty"`

	// Source identifies the identity provider that owns this user record.
	Source string `json:"source,omitempty"`

	// Shell is the user's default login shell.
	Shell string `json:"shell,omitempty"`

	// Sudo indicates whether the user has sudo privileges.
	Sudo bool `json:"sudo,omitempty"`
}

UserClaims are the JWT claims embedded in tokens issued for a user. Standard registered claims are promoted from jwt.RegisteredClaims; the remaining fields carry k8Shell-specific user attributes.

func ParseUnverifiedClaims

func ParseUnverifiedClaims(tokenStr string, checkExp bool) (*UserClaims, error)

ParseUnverifiedClaims decodes the claims from tokenStr without verifying the signature or validating any registered claims (exp, iss, aud, etc.). Use this only where the token has already been verified by another means, or when you need to inspect claims (e.g. check expiry) before a full verify.

func (*UserClaims) GetUsername

func (c *UserClaims) GetUsername() string

type UserCreateEvalRequest added in v0.32.0

type UserCreateEvalRequest struct {
	Resource UserResource
}

UserCreateEvalRequest is the validated, typed model for user:create policy evaluation. Use NewUserCreateEvalRequest to start building, then chain With* methods and call Build to get a validated instance.

user:create authorizes an admin to create a brand-new local user record with no backing identity provider. The acting principal is the admin performing the creation, not the new user, so callers evaluate this with the admin's own token rather than one issued for the user being created.

func NewUserCreateEvalRequest added in v0.32.0

func NewUserCreateEvalRequest(username string) *UserCreateEvalRequest

NewUserCreateEvalRequest begins building a UserCreateEvalRequest for the given username. Chain With* methods to supply additional fields, then call Build to validate and obtain the final struct.

func UserCreateEvalRequestFromProto added in v0.32.0

func UserCreateEvalRequestFromProto(req *authzv1.EvaluateRequest) (*UserCreateEvalRequest, error)

UserCreateEvalRequestFromProto converts a gRPC EvaluateRequest into a validated UserCreateEvalRequest. Returns an error if the request does not conform to the user:create contract.

func (*UserCreateEvalRequest) Build added in v0.32.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*UserCreateEvalRequest) ToProto added in v0.32.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*UserCreateEvalRequest) Validate added in v0.32.0

func (r *UserCreateEvalRequest) Validate() error

Validate checks the request against the user:create contract. Implements EvalRequest.

func (*UserCreateEvalRequest) WithOrg added in v0.32.0

WithOrg sets the organization the new user will belong to.

type UserCredentialContext added in v0.38.0

type UserCredentialContext struct {
	// CredentialType is the external service the credential authenticates to
	// (context["credential_type"]). Required when DataType is
	// UserDataTypeCredentials, ignored otherwise.
	CredentialType UserCredentialType
}

UserCredentialContext holds the credential_type context qualifier shared by user:read and user:write when their data_type is UserDataTypeCredentials.

type UserCredentialType added in v0.38.0

type UserCredentialType string

UserCredentialType identifies which external service a stored user credential authenticates to. It is required in context whenever user:read/user:write's data_type is UserDataTypeCredentials, so policy can grant access to one credential type (e.g. "dev may write git credentials") without implicitly granting it to the other two.

const (
	UserCredentialTypeKubernetes UserCredentialType = "kubernetes"
	UserCredentialTypeGit        UserCredentialType = "git"
	UserCredentialTypeRegistry   UserCredentialType = "registry"
)

type UserDataType

type UserDataType string

UserDataType identifies which slice of user data is being accessed in user:read and user:write. UserDataTypeSudo, UserDataTypeLocked, UserDataTypeOrg, UserDataTypePosix, and UserDataTypePassword are write-only values: user:read never selects them individually, since UserDataTypeProfile already returns the full profile view including sudo, locked, org, and uid/gid, and a password is never readable at all. UserDataTypeRepos is read-only in the other direction: it addresses the user's identity-provider repository catalog (owners and repos), which is never written through user:write.

const (
	UserDataTypeProfile     UserDataType = "profile"
	UserDataTypeCredentials UserDataType = "credentials"
	UserDataTypeBlueprints  UserDataType = "blueprints"
	UserDataTypeRoles       UserDataType = "roles"
	UserDataTypeKeys        UserDataType = "keys"
	UserDataTypeRepos       UserDataType = "repos"
	UserDataTypeSudo        UserDataType = "sudo"
	UserDataTypeLocked      UserDataType = "locked"
	UserDataTypeOrg         UserDataType = "org"
	UserDataTypePosix       UserDataType = "posix"
	UserDataTypePassword    UserDataType = "password"
)

type UserDeleteEvalRequest added in v0.32.0

type UserDeleteEvalRequest struct {
	Resource UserResource
}

UserDeleteEvalRequest is the validated, typed model for user:delete policy evaluation. Use NewUserDeleteEvalRequest to start building, then chain With* methods and call Build to get a validated instance.

Like user:create, the acting principal is the admin performing the deletion, not the user being deleted, so callers evaluate this with the admin's own token.

func NewUserDeleteEvalRequest added in v0.32.0

func NewUserDeleteEvalRequest(username string) *UserDeleteEvalRequest

NewUserDeleteEvalRequest begins building a UserDeleteEvalRequest for the given username. Chain With* methods to supply additional fields, then call Build to validate and obtain the final struct.

func UserDeleteEvalRequestFromProto added in v0.32.0

func UserDeleteEvalRequestFromProto(req *authzv1.EvaluateRequest) (*UserDeleteEvalRequest, error)

UserDeleteEvalRequestFromProto converts a gRPC EvaluateRequest into a validated UserDeleteEvalRequest. Returns an error if the request does not conform to the user:delete contract.

func (*UserDeleteEvalRequest) Build added in v0.32.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*UserDeleteEvalRequest) ToProto added in v0.32.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*UserDeleteEvalRequest) Validate added in v0.32.0

func (r *UserDeleteEvalRequest) Validate() error

Validate checks the request against the user:delete contract. Implements EvalRequest.

func (*UserDeleteEvalRequest) WithOrg added in v0.32.0

WithOrg sets the user's organization on the resource.

type UserExistsEvalRequest added in v0.36.0

type UserExistsEvalRequest struct {
	Field UserExistsField
}

UserExistsEvalRequest is the validated, typed model for user:exists policy evaluation. No resource id is required — the check targets an arbitrary, possibly nonexistent, username or email supplied by the caller, not a record the subject already has standing to act on.

func NewUserExistsEvalRequest added in v0.36.0

func NewUserExistsEvalRequest(field UserExistsField) *UserExistsEvalRequest

NewUserExistsEvalRequest begins building a UserExistsEvalRequest for the given field. Call Build to validate and obtain the final struct.

func UserExistsEvalRequestFromProto added in v0.36.0

func UserExistsEvalRequestFromProto(req *authzv1.EvaluateRequest) (*UserExistsEvalRequest, error)

UserExistsEvalRequestFromProto converts a gRPC EvaluateRequest into a validated UserExistsEvalRequest.

func (*UserExistsEvalRequest) Build added in v0.36.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*UserExistsEvalRequest) ToProto added in v0.36.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*UserExistsEvalRequest) Validate added in v0.36.0

func (r *UserExistsEvalRequest) Validate() error

Validate checks the request against the user:exists contract. Implements EvalRequest.

type UserExistsField added in v0.36.0

type UserExistsField string

UserExistsField identifies which identifier user:exists is checking.

const (
	UserExistsFieldUsername UserExistsField = "username"
	UserExistsFieldEmail    UserExistsField = "email"
)

type UserListEvalRequest

type UserListEvalRequest struct{}

UserListEvalRequest is the validated, typed model for user:list policy evaluation. No resource id is required; the subject claims determine access.

func NewUserListEvalRequest

func NewUserListEvalRequest() *UserListEvalRequest

NewUserListEvalRequest returns a UserListEvalRequest ready to be built.

func UserListEvalRequestFromProto

func UserListEvalRequestFromProto(req *authzv1.EvaluateRequest) (*UserListEvalRequest, error)

UserListEvalRequestFromProto converts a gRPC EvaluateRequest into a validated UserListEvalRequest.

func (*UserListEvalRequest) Build

Build returns the request. It is the required terminator for the builder chain.

func (*UserListEvalRequest) ToProto

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*UserListEvalRequest) Validate

func (r *UserListEvalRequest) Validate() error

Validate is a no-op for user:list; no fields are required. Implements EvalRequest.

type UserReadEvalRequest

type UserReadEvalRequest struct {
	Resource UserResource
	DataType UserDataType
	Context  UserCredentialContext
}

UserReadEvalRequest is the validated, typed model for user:read policy evaluation. Use NewUserReadEvalRequest to start building, then call Build to get a validated instance.

func NewUserReadEvalRequest

func NewUserReadEvalRequest(username string) *UserReadEvalRequest

NewUserReadEvalRequest begins building a UserReadEvalRequest for the given target username.

func UserReadEvalRequestFromProto

func UserReadEvalRequestFromProto(req *authzv1.EvaluateRequest) (*UserReadEvalRequest, error)

UserReadEvalRequestFromProto converts a gRPC EvaluateRequest into a validated UserReadEvalRequest.

func (*UserReadEvalRequest) Build

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*UserReadEvalRequest) ToProto

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*UserReadEvalRequest) Validate

func (r *UserReadEvalRequest) Validate() error

Validate checks the request against the user:read contract. Implements EvalRequest.

func (*UserReadEvalRequest) WithCredentialType added in v0.38.0

WithCredentialType sets the credential type being accessed; required when DataType is UserDataTypeCredentials.

func (*UserReadEvalRequest) WithDataType

WithDataType sets the data type being accessed.

type UserResource

type UserResource struct {
	// ID is the username (resource.id in the EvaluateRequest).
	ID string

	// IDP is the identity provider through which the user was onboarded
	// (resource.attributes["idp"]).
	IDP string

	// Org is the user's organization (resource.attributes["org"]).
	Org string
}

UserResource holds the resource-scoped attributes for a user policy check.

type UserTokenCreateEvalRequest

type UserTokenCreateEvalRequest struct {
	Resource UserResource
	Context  TokenCreateContext
}

UserTokenCreateEvalRequest is the validated, typed model for token:create policy evaluation. The resource ID is the username of the token owner.

func NewUserTokenCreateEvalRequest

func NewUserTokenCreateEvalRequest(username string) *UserTokenCreateEvalRequest

NewUserTokenCreateEvalRequest begins building a UserTokenCreateEvalRequest for the given username (the token owner). Call WithSource then Build.

func UserTokenCreateEvalRequestFromProto

func UserTokenCreateEvalRequestFromProto(req *authzv1.EvaluateRequest) (*UserTokenCreateEvalRequest, error)

UserTokenCreateEvalRequestFromProto converts a gRPC EvaluateRequest into a validated UserTokenCreateEvalRequest.

func (*UserTokenCreateEvalRequest) Build

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*UserTokenCreateEvalRequest) ToProto

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*UserTokenCreateEvalRequest) Validate

func (r *UserTokenCreateEvalRequest) Validate() error

Validate checks the request against the token:create contract. Implements EvalRequest.

func (*UserTokenCreateEvalRequest) WithSource

WithSource sets the token creation source on the context.

type UserTokenDeleteEvalRequest added in v0.34.0

type UserTokenDeleteEvalRequest struct {
	Resource UserResource
}

UserTokenDeleteEvalRequest is the validated, typed model for token:delete policy evaluation. The resource ID is the username who owns the token being permanently deleted.

func NewUserTokenDeleteEvalRequest added in v0.34.0

func NewUserTokenDeleteEvalRequest(username string) *UserTokenDeleteEvalRequest

NewUserTokenDeleteEvalRequest begins building a UserTokenDeleteEvalRequest for the given username (the token owner). Call Build to validate.

func UserTokenDeleteEvalRequestFromProto added in v0.34.0

func UserTokenDeleteEvalRequestFromProto(req *authzv1.EvaluateRequest) (*UserTokenDeleteEvalRequest, error)

UserTokenDeleteEvalRequestFromProto converts a gRPC EvaluateRequest into a validated UserTokenDeleteEvalRequest.

func (*UserTokenDeleteEvalRequest) Build added in v0.34.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*UserTokenDeleteEvalRequest) ToProto added in v0.34.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*UserTokenDeleteEvalRequest) Validate added in v0.34.0

func (r *UserTokenDeleteEvalRequest) Validate() error

Validate checks the request against the token:delete contract. Implements EvalRequest.

type UserTokenReadEvalRequest

type UserTokenReadEvalRequest struct {
	Resource UserResource
}

UserTokenReadEvalRequest is the validated, typed model for token:read policy evaluation. The resource ID is the username whose tokens are being read.

func NewUserTokenReadEvalRequest

func NewUserTokenReadEvalRequest(username string) *UserTokenReadEvalRequest

NewUserTokenReadEvalRequest begins building a UserTokenReadEvalRequest for the given username (the token owner). Call Build to validate.

func UserTokenReadEvalRequestFromProto

func UserTokenReadEvalRequestFromProto(req *authzv1.EvaluateRequest) (*UserTokenReadEvalRequest, error)

UserTokenReadEvalRequestFromProto converts a gRPC EvaluateRequest into a validated UserTokenReadEvalRequest.

func (*UserTokenReadEvalRequest) Build

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*UserTokenReadEvalRequest) ToProto

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*UserTokenReadEvalRequest) Validate

func (r *UserTokenReadEvalRequest) Validate() error

Validate checks the request against the token:read contract. Implements EvalRequest.

type UserTokenWriteEvalRequest added in v0.34.0

type UserTokenWriteEvalRequest struct {
	Resource UserResource
}

UserTokenWriteEvalRequest is the validated, typed model for token:write policy evaluation. The resource ID is the username who owns the token being updated (active flag and/or scopes).

func NewUserTokenWriteEvalRequest added in v0.34.0

func NewUserTokenWriteEvalRequest(username string) *UserTokenWriteEvalRequest

NewUserTokenWriteEvalRequest begins building a UserTokenWriteEvalRequest for the given username (the token owner). Call Build to validate.

func UserTokenWriteEvalRequestFromProto added in v0.34.0

func UserTokenWriteEvalRequestFromProto(req *authzv1.EvaluateRequest) (*UserTokenWriteEvalRequest, error)

UserTokenWriteEvalRequestFromProto converts a gRPC EvaluateRequest into a validated UserTokenWriteEvalRequest.

func (*UserTokenWriteEvalRequest) Build added in v0.34.0

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*UserTokenWriteEvalRequest) ToProto added in v0.34.0

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*UserTokenWriteEvalRequest) Validate added in v0.34.0

func (r *UserTokenWriteEvalRequest) Validate() error

Validate checks the request against the token:write contract. Implements EvalRequest.

type UserWriteEvalRequest added in v0.29.11

type UserWriteEvalRequest struct {
	Resource UserResource
	DataType UserDataType
	Context  UserCredentialContext
}

UserWriteEvalRequest is the validated, typed model for user:write policy evaluation. It covers all mutations to a user record: profile fields, roles, blueprints, and auth keys. Use NewUserWriteEvalRequest to build it.

func NewUserWriteEvalRequest added in v0.29.11

func NewUserWriteEvalRequest(username string) *UserWriteEvalRequest

NewUserWriteEvalRequest begins building a UserWriteEvalRequest for the given target username. Call WithDataType then Build to validate and obtain the final struct.

func UserWriteEvalRequestFromProto added in v0.29.11

func UserWriteEvalRequestFromProto(req *authzv1.EvaluateRequest) (*UserWriteEvalRequest, error)

UserWriteEvalRequestFromProto converts a gRPC EvaluateRequest into a validated UserWriteEvalRequest.

func (*UserWriteEvalRequest) Build added in v0.29.11

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*UserWriteEvalRequest) ToProto added in v0.29.11

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. Implements EvalRequest.

func (*UserWriteEvalRequest) Validate added in v0.29.11

func (r *UserWriteEvalRequest) Validate() error

Validate checks the request against the user:write contract. Implements EvalRequest.

func (*UserWriteEvalRequest) WithCredentialType added in v0.38.0

WithCredentialType sets the credential type being mutated; required when DataType is UserDataTypeCredentials.

func (*UserWriteEvalRequest) WithDataType added in v0.29.13

WithDataType sets the data type being mutated.

type UsernameObligation added in v0.30.11

type UsernameObligation struct {
	// Username is the single user the enforcer should restrict the listing to.
	Username string
}

UsernameObligation is the typed representation of the "username" obligation key returned by the policy engine in a PolicyResult for session:list.

func ParseUsernameObligation added in v0.30.11

func ParseUsernameObligation(obligations map[string]string) (UsernameObligation, bool)

ParseUsernameObligation reads the "username" key from the obligations map. Returns (obligation, true) when the key is present, (zero value, false) when the policy did not set a username obligation — in that case the enforcer should not scope the listing to a single user.

type WorkspaceAccessEvalRequest

type WorkspaceAccessEvalRequest struct {
	Action   WorkspaceAction
	Resource WorkspaceResource
}

WorkspaceAccessEvalRequest is the validated, typed model for workspace:read and workspace:delete. The resource id is the workspace name; the owner attribute identifies who owns it.

func NewWorkspaceAccessEvalRequest

func NewWorkspaceAccessEvalRequest(action WorkspaceAction, workspaceName string) *WorkspaceAccessEvalRequest

NewWorkspaceAccessEvalRequest begins building a WorkspaceAccessEvalRequest.

func WorkspaceAccessEvalRequestFromProto

func WorkspaceAccessEvalRequestFromProto(req *authzv1.EvaluateRequest) (*WorkspaceAccessEvalRequest, error)

WorkspaceAccessEvalRequestFromProto converts a gRPC EvaluateRequest into a validated WorkspaceAccessEvalRequest.

func (*WorkspaceAccessEvalRequest) Build

Build validates the request and returns it if all constraints are satisfied.

func (*WorkspaceAccessEvalRequest) ToProto

ToProto serializes the typed request into a gRPC EvaluateRequest. Implements EvalRequest.

func (*WorkspaceAccessEvalRequest) Validate

func (r *WorkspaceAccessEvalRequest) Validate() error

Validate checks the request against the workspace:read / workspace:delete contract. Implements EvalRequest.

func (*WorkspaceAccessEvalRequest) WithOwner

WithOwner sets the owner username on the resource.

type WorkspaceAction

type WorkspaceAction string

WorkspaceAction is the typed representation of a workspace policy action.

const (
	// WorkspaceActionProvision is the action evaluated before a workspace is
	// provisioned. The full blueprint is carried in context["blueprint"] as a
	// YAML string. The policy result may carry patch obligations (keys prefixed
	// with ObligationKeyPatchPrefix) that the enforcer must apply to the
	// blueprint before provisioning proceeds.
	WorkspaceActionProvision WorkspaceAction = "workspace:provision"

	WorkspaceActionList    WorkspaceAction = "workspace:list"
	WorkspaceActionCreate  WorkspaceAction = "workspace:create"
	WorkspaceActionRead    WorkspaceAction = "workspace:read"
	WorkspaceActionDelete  WorkspaceAction = "workspace:delete"
	WorkspaceActionConnect WorkspaceAction = "workspace:connect"
	WorkspaceActionFiles   WorkspaceAction = "workspace:files"
	WorkspaceActionApp     WorkspaceAction = "workspace:app"
)

type WorkspaceAppEvalRequest

type WorkspaceAppEvalRequest struct {
	Resource WorkspaceResource
	App      string
	Op       WorkspaceAppOp
}

WorkspaceAppEvalRequest is the validated, typed model for workspace:app.

func NewWorkspaceAppEvalRequest

func NewWorkspaceAppEvalRequest(workspaceName, appName string) *WorkspaceAppEvalRequest

NewWorkspaceAppEvalRequest begins building a WorkspaceAppEvalRequest for the given workspace name and app name.

func WorkspaceAppEvalRequestFromProto

func WorkspaceAppEvalRequestFromProto(req *authzv1.EvaluateRequest) (*WorkspaceAppEvalRequest, error)

WorkspaceAppEvalRequestFromProto converts a gRPC EvaluateRequest into a validated WorkspaceAppEvalRequest.

func (*WorkspaceAppEvalRequest) Build

Build validates the request and returns it if all constraints are satisfied.

func (*WorkspaceAppEvalRequest) ToProto

ToProto serializes the typed request into a gRPC EvaluateRequest. Implements EvalRequest.

func (*WorkspaceAppEvalRequest) Validate

func (r *WorkspaceAppEvalRequest) Validate() error

Validate checks the request against the workspace:app contract. Implements EvalRequest.

func (*WorkspaceAppEvalRequest) WithOp

WithOp sets the app operation.

func (*WorkspaceAppEvalRequest) WithOwner

WithOwner sets the owner username on the resource.

type WorkspaceAppOp

type WorkspaceAppOp string

WorkspaceAppOp is the operation applied to an app for workspace:app.

const (
	WorkspaceAppOpRead    WorkspaceAppOp = "read"
	WorkspaceAppOpInstall WorkspaceAppOp = "install"
	WorkspaceAppOpStart   WorkspaceAppOp = "start"
	WorkspaceAppOpStop    WorkspaceAppOp = "stop"
)

type WorkspaceConnectContext

type WorkspaceConnectContext struct {
	Type WorkspaceConnectType
	Port string // non-empty only when Type is WorkspaceConnectTypePortForward
}

WorkspaceConnectContext holds the session type and optional port for workspace:connect.

type WorkspaceConnectEvalRequest

type WorkspaceConnectEvalRequest struct {
	Resource WorkspaceResource
	Context  WorkspaceConnectContext
}

WorkspaceConnectEvalRequest is the validated, typed model for workspace:connect.

func NewWorkspaceConnectEvalRequest

func NewWorkspaceConnectEvalRequest(workspaceName string) *WorkspaceConnectEvalRequest

NewWorkspaceConnectEvalRequest begins building a WorkspaceConnectEvalRequest for the given workspace name.

func WorkspaceConnectEvalRequestFromProto

func WorkspaceConnectEvalRequestFromProto(req *authzv1.EvaluateRequest) (*WorkspaceConnectEvalRequest, error)

WorkspaceConnectEvalRequestFromProto converts a gRPC EvaluateRequest into a validated WorkspaceConnectEvalRequest.

func (*WorkspaceConnectEvalRequest) Build

Build validates the request and returns it if all constraints are satisfied.

func (*WorkspaceConnectEvalRequest) ToProto

ToProto serializes the typed request into a gRPC EvaluateRequest. Implements EvalRequest.

func (*WorkspaceConnectEvalRequest) Validate

func (r *WorkspaceConnectEvalRequest) Validate() error

Validate checks the request against the workspace:connect contract. Implements EvalRequest.

func (*WorkspaceConnectEvalRequest) WithOwner

WithOwner sets the owner username on the resource.

func (*WorkspaceConnectEvalRequest) WithPort

WithPort sets the port; required when type is WorkspaceConnectTypePortForward.

func (*WorkspaceConnectEvalRequest) WithType

WithType sets the connection type.

type WorkspaceConnectType

type WorkspaceConnectType string

WorkspaceConnectType is the kind of interactive session for workspace:connect.

const (
	WorkspaceConnectTypeWebshell    WorkspaceConnectType = "webshell"
	WorkspaceConnectTypeWebfiles    WorkspaceConnectType = "webfiles"
	WorkspaceConnectTypePortForward WorkspaceConnectType = "portforward"
)

type WorkspaceEvalRequest

type WorkspaceEvalRequest struct {
	Action   WorkspaceAction
	Resource WorkspaceResource
	Context  WorkspaceProvisionContext
}

WorkspaceEvalRequest is the validated, typed model for workspace policy evaluation. Use NewWorkspaceEvalRequest to start building, then chain With* methods and call Build to get a validated instance. Use WorkspaceEvalRequestFromProto to convert directly from a gRPC EvaluateRequest.

func NewWorkspaceEvalRequest

func NewWorkspaceEvalRequest(action WorkspaceAction, workspaceID string) *WorkspaceEvalRequest

NewWorkspaceEvalRequest begins building a WorkspaceEvalRequest for the given action and workspace ID. Chain With* methods to supply additional fields, then call Build to validate and obtain the final struct.

func WorkspaceEvalRequestFromProto

func WorkspaceEvalRequestFromProto(req *authzv1.EvaluateRequest) (*WorkspaceEvalRequest, error)

WorkspaceEvalRequestFromProto converts a gRPC EvaluateRequest into a validated WorkspaceEvalRequest. Returns an error if the request does not conform to the workspace policy contract.

func (*WorkspaceEvalRequest) Build

Build validates the request and returns it if all constraints are satisfied. It is the required terminator for the builder chain.

func (*WorkspaceEvalRequest) ToProto

ToProto serializes the typed request into a gRPC EvaluateRequest, attaching the supplied JWT token. The blueprint is marshaled to YAML and carried in context["blueprint"]. Implements EvalRequest.

func (*WorkspaceEvalRequest) Validate

func (r *WorkspaceEvalRequest) Validate() error

Validate checks the request against the workspace policy contract: the action must be recognized, and resource ID, owner, and blueprint context are all required for workspace:provision. Implements EvalRequest.

func (*WorkspaceEvalRequest) WithBlueprint

WithBlueprint sets the full blueprint struct in the provision context; required for WorkspaceActionProvision.

func (*WorkspaceEvalRequest) WithBlueprintName

func (r *WorkspaceEvalRequest) WithBlueprintName(name string) *WorkspaceEvalRequest

WithBlueprintName sets the blueprint name on the resource attributes.

func (*WorkspaceEvalRequest) WithMode

WithMode sets the provisioning mode; required for WorkspaceActionProvision.

func (*WorkspaceEvalRequest) WithOwner

func (r *WorkspaceEvalRequest) WithOwner(owner string) *WorkspaceEvalRequest

WithOwner sets the username of the user provisioning the workspace.

func (*WorkspaceEvalRequest) WithWorkload

func (r *WorkspaceEvalRequest) WithWorkload(name, namespace, kind string) *WorkspaceEvalRequest

WithWorkload sets the target workload fields; required when mode is WorkspaceProvisionModeInject.

type WorkspaceFilesEvalRequest

type WorkspaceFilesEvalRequest struct {
	Resource WorkspaceResource
	Op       WorkspaceFilesOp
}

WorkspaceFilesEvalRequest is the validated, typed model for workspace:files.

func NewWorkspaceFilesEvalRequest

func NewWorkspaceFilesEvalRequest(workspaceName string) *WorkspaceFilesEvalRequest

NewWorkspaceFilesEvalRequest begins building a WorkspaceFilesEvalRequest for the given workspace name.

func WorkspaceFilesEvalRequestFromProto

func WorkspaceFilesEvalRequestFromProto(req *authzv1.EvaluateRequest) (*WorkspaceFilesEvalRequest, error)

WorkspaceFilesEvalRequestFromProto converts a gRPC EvaluateRequest into a validated WorkspaceFilesEvalRequest.

func (*WorkspaceFilesEvalRequest) Build

Build validates the request and returns it if all constraints are satisfied.

func (*WorkspaceFilesEvalRequest) ToProto

ToProto serializes the typed request into a gRPC EvaluateRequest. Implements EvalRequest.

func (*WorkspaceFilesEvalRequest) Validate

func (r *WorkspaceFilesEvalRequest) Validate() error

Validate checks the request against the workspace:files contract. Implements EvalRequest.

func (*WorkspaceFilesEvalRequest) WithOp

WithOp sets the file transfer direction.

func (*WorkspaceFilesEvalRequest) WithOwner

WithOwner sets the owner username on the resource.

type WorkspaceFilesOp

type WorkspaceFilesOp string

WorkspaceFilesOp is the direction of file transfer for workspace:files.

const (
	WorkspaceFilesOpDownload WorkspaceFilesOp = "download"
	WorkspaceFilesOpUpload   WorkspaceFilesOp = "upload"
)

type WorkspaceOwnerContext added in v0.38.0

type WorkspaceOwnerContext struct {
	// Mode is which kind of workspace is being created: standalone or
	// inject. Required for workspace:create.
	Mode WorkspaceProvisionMode
}

WorkspaceOwnerContext holds the context fields for workspace:create. Unused for workspace:list.

type WorkspaceOwnerEvalRequest

type WorkspaceOwnerEvalRequest struct {
	Action   WorkspaceAction
	Resource WorkspaceResource
	Context  WorkspaceOwnerContext
}

WorkspaceOwnerEvalRequest is the validated, typed model for workspace:list and workspace:create. Resource.ID is empty — there is no specific workspace; Resource.Owner identifies whose workspace collection is being accessed or extended.

func NewWorkspaceOwnerEvalRequest

func NewWorkspaceOwnerEvalRequest(action WorkspaceAction, owner string) *WorkspaceOwnerEvalRequest

NewWorkspaceOwnerEvalRequest begins building a WorkspaceOwnerEvalRequest for the given action and owner username.

func WorkspaceOwnerEvalRequestFromProto

func WorkspaceOwnerEvalRequestFromProto(req *authzv1.EvaluateRequest) (*WorkspaceOwnerEvalRequest, error)

WorkspaceOwnerEvalRequestFromProto converts a gRPC EvaluateRequest into a validated WorkspaceOwnerEvalRequest.

func (*WorkspaceOwnerEvalRequest) Build

Build validates the request and returns it if all constraints are satisfied.

func (*WorkspaceOwnerEvalRequest) ToProto

ToProto serializes the typed request into a gRPC EvaluateRequest. Implements EvalRequest.

func (*WorkspaceOwnerEvalRequest) Validate

func (r *WorkspaceOwnerEvalRequest) Validate() error

Validate checks the request against the workspace:list / workspace:create contract. Implements EvalRequest.

func (*WorkspaceOwnerEvalRequest) WithMode added in v0.38.0

WithMode sets the provisioning mode; required for workspace:create.

type WorkspaceProvisionContext

type WorkspaceProvisionContext struct {
	Blueprint         *models.Blueprint
	Mode              WorkspaceProvisionMode
	WorkloadName      string
	WorkloadNamespace string
	WorkloadKind      string
}

WorkspaceProvisionContext holds the full blueprint being provisioned and the provisioning mode. The enforcer must apply any ProvisionPatch obligations to Blueprint before provisioning proceeds.

type WorkspaceProvisionMode

type WorkspaceProvisionMode string

WorkspaceProvisionMode controls how the workspace is attached to its runtime.

const (
	// WorkspaceProvisionModeStandalone creates a new independent workspace pod.
	WorkspaceProvisionModeStandalone WorkspaceProvisionMode = "standalone"

	// WorkspaceProvisionModeInject injects the workspace into an existing
	// workload. WorkloadName, WorkloadNamespace, and WorkloadKind are required.
	WorkspaceProvisionModeInject WorkspaceProvisionMode = "inject"
)

type WorkspaceResource

type WorkspaceResource struct {
	// ID is the workspace name (resource.id in the EvaluateRequest).
	ID string

	// Owner is the username of the user provisioning the workspace
	// (resource.attributes["owner"]).
	Owner string

	// Blueprint is the blueprint name (resource.attributes["blueprint"]).
	Blueprint string
}

WorkspaceResource holds the resource-scoped attributes for a workspace policy check.

Jump to

Keyboard shortcuts

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