Documentation
¶
Index ¶
- func ActivityNameFromExecute(method string, data []byte) (string, error)
- func CallerAppID(md map[string]*internalv1pb.ListStringValue) string
- func CallerNamespace(md map[string]*internalv1pb.ListStringValue) string
- func IsInternalActorType(actorType string) bool
- func SetCallerIdentity(req *internalv1pb.InternalInvokeRequest, appID, namespace string)
- func StripUntrustedCallerIdentity(md map[string]*internalv1pb.ListStringValue)
- func WorkflowNameFromCreateRequest(data []byte) (string, error)
- func WorkflowOperationFromMethod(method string, parsedAddEvent *backend.HistoryEvent) (wfaclapi.WorkflowOperation, error)
- type CompiledPolicies
- type Holder
- type OperationType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivityNameFromExecute ¶
ActivityNameFromExecute returns the activity name from an Execute method payload. An empty name with nil error means the method is not Execute (no other activity methods are subject to access control).
func CallerAppID ¶
func CallerAppID(md map[string]*internalv1pb.ListStringValue) string
func CallerNamespace ¶
func CallerNamespace(md map[string]*internalv1pb.ListStringValue) string
func IsInternalActorType ¶
IsInternalActorType reports whether actorType is a Dapr-reserved internal actor type (workflow, activity, executor, retentioner, ...). User-facing actor APIs (state, reminder, timer) must reject these because the workflow runtime owns their lifecycle. Direct access from a user would corrupt state or bypass per-operation policy enforcement.
func SetCallerIdentity ¶
func SetCallerIdentity(req *internalv1pb.InternalInvokeRequest, appID, namespace string)
Callers MUST authenticate the identity before stamping (mTLS/SPIFFE for remote calls, local sidecar trust for local calls); this helper does not.
func StripUntrustedCallerIdentity ¶
func StripUntrustedCallerIdentity(md map[string]*internalv1pb.ListStringValue)
StripUntrustedCallerIdentity removes the caller-identity headers from metadata that arrived from an untrusted source (a user-facing API like InvokeActor or onDirectActorMessage that copies client metadata verbatim). Without this, a local app could spoof another app's identity by setting the caller-app-id / caller-namespace headers in their request. Trusted code paths (the CallActor gRPC handler stamping SPIFFE identity, the router stamping the local sidecar's identity) re-set these headers after stripping.
func WorkflowOperationFromMethod ¶
func WorkflowOperationFromMethod(method string, parsedAddEvent *backend.HistoryEvent) (wfaclapi.WorkflowOperation, error)
WorkflowOperationFromMethod returns the WorkflowOperation for a workflow actor method. An empty operation with nil error means the method is not subject to access control (an internal/system method). AddWorkflowEvent's operation is encoded in the HistoryEvent payload; parsedAddEvent must be non-nil for that method so we don't unmarshal twice on the hot path.
Types ¶
type CompiledPolicies ¶
type CompiledPolicies struct {
// contains filtered or unexported fields
}
CompiledPolicies holds pre-processed workflow access policies for a single target app, built from one or more WorkflowAccessPolicy resources scoped to the app. The policy is a pure allow-list: presence of a matching rule grants access; absence denies. A nil *CompiledPolicies means no policies are loaded, in which case all calls are allowed.
func Compile ¶
func Compile(policies []wfaclapi.WorkflowAccessPolicy) *CompiledPolicies
func (*CompiledPolicies) Evaluate ¶
func (cp *CompiledPolicies) Evaluate(callerAppID string, opType OperationType, operation wfaclapi.WorkflowOperation, opName string) bool
Evaluate returns true if any rule grants the caller access to perform the operation on opName. A nil *CompiledPolicies means no policies are loaded and all calls are allowed.
type Holder ¶
type Holder struct {
// contains filtered or unexported fields
}
Holder is shared between the gRPC API and the workflow actors so both read the same atomic snapshot of the compiled policies.
func (*Holder) Load ¶
func (h *Holder) Load() *CompiledPolicies
func (*Holder) Store ¶
func (h *Holder) Store(p *CompiledPolicies)
type OperationType ¶
type OperationType string
OperationType represents the type of workflow operation being performed.
const ( OperationTypeWorkflow OperationType = "workflow" OperationTypeActivity OperationType = "activity" )
func ParseActorType ¶
func ParseActorType(actorType string) (OperationType, bool)
ParseActorType determines if an actor type represents a workflow or activity actor. Returns the operation type and true if it is a workflow/activity actor, or empty string and false otherwise.