Movatterモバイル変換


[0]ホーム

URL:


audit

package
v2.23.0Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License:AGPL-3.0Imports:15Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

View Source
const (// ActionIgnore ignores diffing for the field.ActionIgnore = "ignore"// ActionTrack includes the value in the diff if the value changed.ActionTrack = "track"// ActionSecret includes a zero value of the same type if the value changed.// It lets you indicate that a value changed, but without leaking its// contents.ActionSecret = "secret")

Variables

View Source
var AuditActionMap = map[string][]codersdk.AuditAction{"GitSSHKey":       {codersdk.AuditActionCreate},"Template":        {codersdk.AuditActionWrite,codersdk.AuditActionDelete},"TemplateVersion": {codersdk.AuditActionCreate,codersdk.AuditActionWrite},"User":            {codersdk.AuditActionCreate,codersdk.AuditActionWrite,codersdk.AuditActionDelete},"Workspace":       {codersdk.AuditActionCreate,codersdk.AuditActionWrite,codersdk.AuditActionDelete},"WorkspaceBuild":  {codersdk.AuditActionStart,codersdk.AuditActionStop},"Group":           {codersdk.AuditActionCreate,codersdk.AuditActionWrite,codersdk.AuditActionDelete},"APIKey":          {codersdk.AuditActionLogin,codersdk.AuditActionLogout,codersdk.AuditActionRegister,codersdk.AuditActionCreate,codersdk.AuditActionDelete},"License":         {codersdk.AuditActionCreate,codersdk.AuditActionDelete},"WorkspaceAgent":  {codersdk.AuditActionConnect,codersdk.AuditActionDisconnect},"WorkspaceApp":    {codersdk.AuditActionOpen,codersdk.AuditActionClose},}

This mapping creates a relationship between an Auditable Resourceand the Audit Actions we track for that resource.It is important to maintain this mapping when adding a new Auditable Resource to theAuditableResources map (below) as our documentation - generated in scripts/auditdocgen/main.go -depends upon it.

View Source
var AuditableResources = auditMap(auditableResourcesTypes)

AuditableResources contains a definitive list of all auditable resources andwhich fields are auditable. All resource types must be valid audit.Auditabletypes.

Functions

funcNewAuditor

func NewAuditor(dbdatabase.Store, filterFilter, backends ...Backend)audit.Auditor

Types

typeAction

type Actionstring

func (Action)String

func (tAction) String()string

typeActoradded inv2.1.5

type Actor struct {IDuuid.UUID `json:"id"`Emailstring    `json:"email"`Usernamestring    `json:"username"`}

typeBackend

type Backend interface {// Decision determines the FilterDecisions that the backend tolerates.Decision()FilterDecision// Export sends an audit log to the backend.Export(ctxcontext.Context, alogdatabase.AuditLog, detailsBackendDetails)error}

Backends can store or send audit logs to arbitrary locations.

typeBackendDetailsadded inv2.1.5

type BackendDetails struct {Actor *Actor}

typeFilter

type Filter interface {Check(ctxcontext.Context, alogdatabase.AuditLog) (FilterDecision,error)}

Filters produce a FilterDecision for a given audit log.

DefaultFilter is the default filter used when exporting audit logs. It allowsstorage and exporting for all audit logs.

typeFilterDecision

type FilterDecisionuint8

FilterDecision is a bitwise flag describing the actions a given filter allowsfor a given audit log.

const (// FilterDecisionDrop indicates that the audit log should be dropped. It// should not be stored or exported anywhere.FilterDecisionDropFilterDecision = 0// FilterDecisionStore indicates that the audit log should be allowed to be// stored in the Coder database.FilterDecisionStoreFilterDecision = 1 <<iota// FilterDecisionExport indicates that the audit log should be exported// externally of Coder.FilterDecisionExport)

typeFilterFunc

type FilterFunc func(ctxcontext.Context, alogdatabase.AuditLog) (FilterDecision,error)

FilterFunc constructs a Filter from a simple function.

func (FilterFunc)Check

typeTable

type Table map[string]map[string]Action

Table is a map of struct names to a map of field names that indicate thatfield's AuditType.

Source Files

View all Source files

Directories

PathSynopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp