Documentation
¶
Overview ¶
Package eventpolicy provides a built-in event publish policy that enforces module capability checks on event publication.
When no PublishPolicyProvider is registered, the event bus denies all event publication (deny-by-default). Deployments must explicitly wire a policy — either this built-in one or a custom module-provided one.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuiltinPolicy ¶
type BuiltinPolicy struct {
// contains filtered or unexported fields
}
BuiltinPolicy is the default event publish policy that enforces module capability checks. When strict mode is enabled (MUXCORE_STRICT_PUBLISH_POLICY=true), events from modules that lack a matching capability for the event type are denied. In non-strict mode (default), all events are allowed but capability mismatches are logged as warnings — this provides soft enforcement during migration.
func NewBuiltinPolicy ¶
func NewBuiltinPolicy(reg contracts.Registry) *BuiltinPolicy
NewBuiltinPolicy creates a policy backed by the given registry. Set MUXCORE_STRICT_PUBLISH_POLICY=true to enable hard denial of capability-mismatched event publication.
func (*BuiltinPolicy) CanPublish ¶
CanPublish implements contracts.PublishPolicyProvider. Core (bootstrap) events with an empty caller ID are always allowed. Module events are checked against the caller's declared capabilities.
func (*BuiltinPolicy) Strict ¶
func (p *BuiltinPolicy) Strict() bool
Strict reports whether hard denial is active.