Help us shape the future of Go! Take the 2026 Go Developer Survey

audit

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessEvent

type AccessEvent struct {
	UserID    string
	RepoName  string
	FilePath  string
	Action    string // "browse", "raw_download", "view_blob"
	ClientIP  string
	Timestamp time.Time
}

AccessEvent records a file or repository access.

type AuditLogger

type AuditLogger interface {
	LogSearch(ctx context.Context, event SearchEvent)
	LogAccess(ctx context.Context, event AccessEvent)
	LogReplace(ctx context.Context, event ReplaceEvent)
	LogOperation(ctx context.Context, event OperationEvent)
}

AuditLogger records user actions for compliance and observability. The default NoOpAuditLogger discards all events. Enterprise implementations can persist to a database, send to SIEM, etc.

type NoOpAuditLogger

type NoOpAuditLogger struct{}

NoOpAuditLogger is the default logger that discards all events. Used in the open-source core where audit logging is not required.

func (*NoOpAuditLogger) LogAccess

func (n *NoOpAuditLogger) LogAccess(_ context.Context, _ AccessEvent)

func (*NoOpAuditLogger) LogOperation

func (n *NoOpAuditLogger) LogOperation(_ context.Context, _ OperationEvent)

func (*NoOpAuditLogger) LogReplace

func (n *NoOpAuditLogger) LogReplace(_ context.Context, _ ReplaceEvent)

func (*NoOpAuditLogger) LogSearch

func (n *NoOpAuditLogger) LogSearch(_ context.Context, _ SearchEvent)

type OperationEvent

type OperationEvent struct {
	UserID       string
	Action       string         // "create", "update", "delete", "sync", "exclude", "include", "restore", "assign"
	ResourceType string         // "repo", "connection", "role", "user", "token"
	ResourceID   string         // ID of the resource
	ResourceName string         // Human-readable name
	Details      map[string]any // Action-specific details
	ClientIP     string
	Timestamp    time.Time
}

OperationEvent records a generic management operation (create, update, delete, etc.).

type ReplaceEvent

type ReplaceEvent struct {
	UserID     string
	Query      string
	ReposCount int
	FilesCount int
	ClientIP   string
	Timestamp  time.Time
}

ReplaceEvent records a search-and-replace operation.

type SearchEvent

type SearchEvent struct {
	UserID    string
	Query     string
	Results   int
	Duration  time.Duration
	ClientIP  string
	Timestamp time.Time
}

SearchEvent records a search operation.

Jump to

Keyboard shortcuts

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