Documentation
¶
Overview ¶
Package audit defines the append-only audit contract. The Postgres store is the system of record; sinks fan events out (OTLP, syslog, SIEM). Audit is free forever — never gate it.
Index ¶
- func DelegationFrom(ctx context.Context) (types.DelegationVia, bool)
- func LogWriteFailure(ctx context.Context, ev types.AuditEvent, err error)
- func StampDelegation(ctx context.Context, data json.RawMessage) json.RawMessage
- func WithDelegation(ctx context.Context, via types.DelegationVia) context.Context
- type DelegationRecorder
- type Recorder
- type Sink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DelegationFrom ¶ added in v0.8.0
func DelegationFrom(ctx context.Context) (types.DelegationVia, bool)
DelegationFrom reports the portal and delegated token ctx's request came through, when it did.
func LogWriteFailure ¶ added in v0.3.1
func LogWriteFailure(ctx context.Context, ev types.AuditEvent, err error)
LogWriteFailure reports a dropped audit write at ERROR level so an operator can alert on it; it must never block the caller.
ev.Data is deliberately NOT logged: it can carry sensitive per-action payloads (grant scopes, jti, approval ids). Callers must not add it here.
func StampDelegation ¶ added in v0.8.0
func StampDelegation(ctx context.Context, data json.RawMessage) json.RawMessage
StampDelegation returns data with the portal added under "via" when ctx is a delegated request, and data unchanged otherwise. Data that is not a JSON object is kept whole under "data", so no delegated row can lack the stamp.
func WithDelegation ¶ added in v0.8.0
WithDelegation marks ctx as a request made through via.
Types ¶
type DelegationRecorder ¶ added in v0.8.0
type DelegationRecorder struct{ Inner Recorder }
DelegationRecorder stamps data.via on every event recorded under a delegated context, whoever wrote it. cmd/wardynd puts it at the head of the shared chain.
func (DelegationRecorder) Record ¶ added in v0.8.0
func (r DelegationRecorder) Record(ctx context.Context, ev types.AuditEvent) error
Record stamps ev when ctx is delegated and hands it on.