Documentation
¶
Overview ¶
Package policy provides a hook interface for future policy engines (OPA, etc.). In the MVP, hooks are no-ops. The interface is designed for extensibility.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowAll ¶
type AllowAll struct{}
AllowAll is the default no-op implementation that permits everything.
func (AllowAll) EvalCommand ¶
type DenyAll ¶
type DenyAll struct{ Reason string }
DenyAll rejects every request with the given reason. Useful for tests.
func (DenyAll) EvalCommand ¶
type Hook ¶
type Hook interface {
// EvalCommand determines whether a command may execute in the given session.
EvalCommand(ctx context.Context, sessionID uuid.UUID, command string, args []string) Decision
// EvalFileAccess determines whether a file path may be accessed.
EvalFileAccess(ctx context.Context, sessionID uuid.UUID, path string, write bool) Decision
}
Hook is the extension point for policy enforcement.
type OPAHook ¶
type OPAHook struct {
// contains filtered or unexported fields
}
OPAHook evaluates commands and file access against an embedded Rego policy. The module must live in package vaultrun and define:
allow_command (boolean) — whether the command may run allow_file (boolean) — whether the file path may be accessed deny_reason (string, optional) — human-readable denial message
func NewOPAHook ¶
NewOPAHook compiles a Rego module string into an OPAHook ready for evaluation.
func NewOPAHookFromFile ¶
NewOPAHookFromFile reads a Rego policy file and compiles it.
func (*OPAHook) EvalCommand ¶
Click to show internal directories.
Click to hide internal directories.