auditlog

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package auditlog converts persisted audit rows into the normalized public read model.

Authorization, decryption, and sensitive-field blanking remain the responsibility of the gateway and API layers. Keeping those concerns outside this package makes presentation and outcome classification deterministic and reusable by HTTP responses and JSONL exports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClassifyMCPOutcome

func ClassifyMCPOutcome(status int, responseError string) api.AuditLogOutcomeStatus

ClassifyMCPOutcome derives the normalized outcome of an MCP request/response pair from the recorded HTTP status and error. Explicit denial and timeout statuses take precedence over generic errors. A row with no recorded status and no error is classified as unknown.

func NormalizeSourceTypes

func NormalizeSourceTypes(sourceTypes []api.AuditLogSourceType) []api.AuditLogSourceType

NormalizeSourceTypes applies the MCP-only default and removes duplicate source types while preserving their original order. It intentionally preserves unknown values so callers can reject them during validation rather than silently changing the requested source selection.

func Present

Present converts an internal persisted audit-log row into the normalized public read model. The caller is responsible for authorization and for loading the row with the appropriate payload visibility. Present does not mutate the input row and performs no decryption.

Types

type PresentOptions

type PresentOptions struct {
	// IncludeDetails controls whether the event includes typed metadata and payload sections. List
	// callers should leave it false; detail and export callers normally set it true.
	IncludeDetails bool
	// PayloadRedacted records the caller's payload authorization in the public event. It does not
	// perform redaction itself: the gateway client must decrypt or blank sensitive fields before
	// Present is called.
	PayloadRedacted bool
}

PresentOptions controls which authorized portions of an audit event are exposed by Present.

Jump to

Keyboard shortcuts

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