Documentation
¶
Overview ¶
Package audit provides public types and helpers reusable across the codebase.
Index ¶
- Variables
- func AuditLogNotFoundError(id shared.ID) error
- func InvalidFilterError(reason string) error
- type Action
- type AuditLog
- func (a *AuditLog) Action() Action
- func (a *AuditLog) ActorAgent() string
- func (a *AuditLog) ActorEmail() string
- func (a *AuditLog) ActorID() *shared.ID
- func (a *AuditLog) ActorIP() string
- func (a *AuditLog) Category() string
- func (a *AuditLog) Changes() *Changes
- func (a *AuditLog) GenerateMessage() string
- func (a *AuditLog) HasChanges() bool
- func (a *AuditLog) ID() shared.ID
- func (a *AuditLog) IsCritical() bool
- func (a *AuditLog) IsDenied() bool
- func (a *AuditLog) IsFailure() bool
- func (a *AuditLog) IsHighOrCritical() bool
- func (a *AuditLog) IsSuccess() bool
- func (a *AuditLog) Message() string
- func (a *AuditLog) Metadata() map[string]any
- func (a *AuditLog) RequestID() string
- func (a *AuditLog) ResourceID() string
- func (a *AuditLog) ResourceName() string
- func (a *AuditLog) ResourceType() ResourceType
- func (a *AuditLog) Result() Result
- func (a *AuditLog) SessionID() string
- func (a *AuditLog) Severity() Severity
- func (a *AuditLog) TenantID() *shared.ID
- func (a *AuditLog) Timestamp() time.Time
- func (a *AuditLog) WithActor(actorID shared.ID, email string) *AuditLog
- func (a *AuditLog) WithActorAgent(agent string) *AuditLog
- func (a *AuditLog) WithActorIP(ip string) *AuditLog
- func (a *AuditLog) WithChanges(changes *Changes) *AuditLog
- func (a *AuditLog) WithMessage(message string) *AuditLog
- func (a *AuditLog) WithMetadata(key string, value any) *AuditLog
- func (a *AuditLog) WithRequestID(requestID string) *AuditLog
- func (a *AuditLog) WithResourceName(name string) *AuditLog
- func (a *AuditLog) WithSessionID(sessionID string) *AuditLog
- func (a *AuditLog) WithSeverity(severity Severity) *AuditLog
- func (a *AuditLog) WithTenantID(tenantID shared.ID) *AuditLog
- type ChainEntry
- type Changes
- type Filter
- func (f Filter) IsEmpty() bool
- func (f Filter) WithActions(actions ...Action) Filter
- func (f Filter) WithActorID(actorID shared.ID) Filter
- func (f Filter) WithCategories(categories ...string) Filter
- func (f Filter) WithExcludeSystem(exclude bool) Filter
- func (f Filter) WithRequestID(requestID string) Filter
- func (f Filter) WithResourceID(resourceID string) Filter
- func (f Filter) WithResourceTypes(types ...ResourceType) Filter
- func (f Filter) WithResults(results ...Result) Filter
- func (f Filter) WithSearchTerm(term string) Filter
- func (f Filter) WithSessionID(sessionID string) Filter
- func (f Filter) WithSeverities(severities ...Severity) Filter
- func (f Filter) WithSince(since time.Time) Filter
- func (f Filter) WithSort(sortBy, sortOrder string) Filter
- func (f Filter) WithTenantID(tenantID shared.ID) Filter
- func (f Filter) WithTimeRange(since, until time.Time) Filter
- func (f Filter) WithUntil(until time.Time) Filter
- type Repository
- type ResourceType
- type Result
- type Severity
Constants ¶
This section is empty.
Variables ¶
var SystemChainTenantID = shared.MustIDFromString("ffffffff-ffff-ffff-ffff-ffffffffffff")
SystemChainTenantID is the chain that tenant-less audit events are appended to.
The hash chain is keyed by tenant, and authentication events genuinely have no tenant: at login a user may belong to several tenants and has not chosen one yet. So they were skipped — and on the live database that meant 925 of 1075 audit rows (86%), including EVERY auth.login, auth.register and auth.failed, carried no tamper evidence at all. An attacker with database access could delete the record of their own login, or of the failed attempts that preceded it, and the chain verifier would report the trail intact, because it only ever walked rows that were chained.
Nothing documented that exclusion — it was a consequence of the per-tenant design, not a decision.
A sentinel is used rather than making audit_log_chain.tenant_id nullable, because that column is a tenant-isolation boundary and loosening it is the more dangerous change. All-Fs is deliberate: its version nibble is 'f', and uuid.NewV7 / uuid.New can only ever emit 7 or 4 there, so no generated ID can collide with it. The all-ZEROS UUID was rejected for the opposite reason — it is the zero value of shared.ID, which several call sites already test with IsZero() to mean "unset".
Functions ¶
func AuditLogNotFoundError ¶
AuditLogNotFoundError returns a not found error for an audit log.
func InvalidFilterError ¶
InvalidFilterError returns a validation error for invalid filter.
Types ¶
type Action ¶
type Action string
Action represents the type of action performed.
const ( // User actions ActionUserCreated Action = "user.created" ActionUserUpdated Action = "user.updated" ActionUserDeleted Action = "user.deleted" ActionUserSuspended Action = "user.suspended" ActionUserActivated Action = "user.activated" ActionUserDeactivated Action = "user.deactivated" ActionUserLogin Action = "user.login" ActionUserLogout Action = "user.logout" // Tenant actions ActionTenantCreated Action = "tenant.created" ActionTenantUpdated Action = "tenant.updated" ActionTenantDeleted Action = "tenant.deleted" ActionTenantSettingsUpdated Action = "tenant.settings_updated" ActionTenantModulesUpdated Action = "tenant.modules_updated" ActionTenantRiskScoringUpdated Action = "tenant.risk_scoring_updated" ActionTenantRiskScoresRecalculated Action = "tenant.risk_scores_recalculated" ActionTenantAssetSourceUpdated Action = "tenant.asset_source_updated" ActionTenantAssetLifecycleUpdated Action = "tenant.asset_lifecycle_updated" // Asset lifecycle transitions. Emitted per batch run (worker) // rather than per asset so the audit log stays scannable. // Metadata carries counts + bounded lists of affected asset IDs. ActionAssetLifecycleRun Action = "asset.lifecycle_run" ActionAssetMarkedStale Action = "asset.marked_stale" ActionAssetReactivated Action = "asset.reactivated" ActionAssetLifecycleSnoozed Action = "asset.lifecycle_snoozed" ActionAssetLifecycleUnsnoozed Action = "asset.lifecycle_unsnoozed" // Membership actions ActionMemberAdded Action = "member.added" ActionMemberRemoved Action = "member.removed" ActionMemberRoleChanged Action = "member.role_changed" ActionMemberSuspended Action = "member.suspended" ActionMemberReactivated Action = "member.reactivated" // Invitation actions ActionInvitationCreated Action = "invitation.created" ActionInvitationAccepted Action = "invitation.accepted" ActionInvitationDeleted Action = "invitation.deleted" ActionInvitationExpired Action = "invitation.expired" // Repository actions ActionRepositoryCreated Action = "repository.created" ActionRepositoryUpdated Action = "repository.updated" ActionRepositoryDeleted Action = "repository.deleted" ActionRepositoryArchived Action = "repository.archived" // Component actions ActionComponentCreated Action = "component.created" ActionComponentUpdated Action = "component.updated" ActionComponentDeleted Action = "component.deleted" // Vulnerability actions ActionVulnerabilityCreated Action = "vulnerability.created" ActionVulnerabilityUpdated Action = "vulnerability.updated" ActionVulnerabilityDeleted Action = "vulnerability.deleted" // Finding actions ActionFindingCreated Action = "finding.created" ActionFindingUpdated Action = "finding.updated" ActionFindingDeleted Action = "finding.deleted" ActionFindingStatusChanged Action = "finding.status_changed" ActionFindingTriaged Action = "finding.triaged" ActionFindingAssigned Action = "finding.assigned" ActionFindingUnassigned Action = "finding.unassigned" ActionFindingCommented Action = "finding.commented" ActionFindingBulkUpdated Action = "finding.bulk_updated" // ActionFindingEvidenceAdded records a manually-attached piece of evidence // (note/file) on a generic (non-pentest) finding. ActionFindingEvidenceAdded Action = "finding.evidence_added" // ActionFindingEvidenceDeleted records the removal of a manually-attached // evidence note from a generic (non-pentest) finding. ActionFindingEvidenceDeleted Action = "finding.evidence_deleted" // ActionFindingRemediationStepAdded records a manually-appended remediation // step on a generic finding. ActionFindingRemediationStepAdded Action = "finding.remediation_step_added" // Branch actions ActionBranchCreated Action = "branch.created" ActionBranchUpdated Action = "branch.updated" ActionBranchDeleted Action = "branch.deleted" ActionBranchScanned Action = "branch.scanned" ActionBranchSetDefault Action = "branch.set_default" // SLA Policy actions ActionSLAPolicyCreated Action = "sla_policy.created" ActionSLAPolicyUpdated Action = "sla_policy.updated" ActionSLAPolicyDeleted Action = "sla_policy.deleted" // Scan actions ActionScanStarted Action = "scan.started" ActionScanCompleted Action = "scan.completed" ActionScanFailed Action = "scan.failed" // Security actions ActionAuthLogin Action = "auth.login" ActionAuthLogout Action = "auth.logout" ActionAuthRegister Action = "auth.register" ActionAuthFailed Action = "auth.failed" ActionPermissionDenied Action = "permission.denied" ActionTokenRevoked Action = "token.revoked" // Settings actions ActionSettingsUpdated Action = "settings.updated" // Data actions ActionDataExported Action = "data.exported" ActionDataImported Action = "data.imported" // Agent actions ActionAgentCreated Action = "agent.created" ActionAgentUpdated Action = "agent.updated" ActionAgentDeleted Action = "agent.deleted" ActionAgentActivated Action = "agent.activated" ActionAgentDeactivated Action = "agent.deactivated" ActionAgentRevoked Action = "agent.revoked" ActionAgentKeyRegenerated Action = "agent.key_regenerated" ActionAgentConnected Action = "agent.connected" ActionAgentDisconnected Action = "agent.disconnected" // Credential (Secret Store) actions ActionCredentialCreated Action = "credential.created" ActionCredentialUpdated Action = "credential.updated" ActionCredentialDeleted Action = "credential.deleted" ActionCredentialAccessed Action = "credential.accessed" // Group actions ActionGroupCreated Action = "group.created" ActionGroupUpdated Action = "group.updated" ActionGroupDeleted Action = "group.deleted" // Capability actions ActionCapabilityCreated Action = "capability.created" ActionCapabilityUpdated Action = "capability.updated" ActionCapabilityDeleted Action = "capability.deleted" // Tool actions ActionToolCreated Action = "tool.created" ActionToolUpdated Action = "tool.updated" ActionToolDeleted Action = "tool.deleted" ActionToolCapabilitiesSet Action = "tool.capabilities_set" // Asset Ownership actions ActionAssetAssigned Action = "asset.assigned" ActionAssetUnassigned Action = "asset.unassigned" ActionAssetOwnershipUpdated Action = "asset.ownership_updated" // Permission Set actions ActionPermissionSetCreated Action = "permission_set.created" ActionPermissionSetUpdated Action = "permission_set.updated" ActionPermissionSetDeleted Action = "permission_set.deleted" ActionPermissionSetAssigned Action = "permission_set.assigned" ActionPermissionSetUnassigned Action = "permission_set.unassigned" // Permission actions ActionPermissionGranted Action = "permission.granted" ActionPermissionRevoked Action = "permission.revoked" // Role actions ActionRoleCreated Action = "role.created" ActionRoleUpdated Action = "role.updated" ActionRoleDeleted Action = "role.deleted" ActionRoleAssigned Action = "role.assigned" ActionRoleUnassigned Action = "role.unassigned" ActionUserRolesUpdated Action = "user.roles_updated" // Pipeline actions ActionPipelineTemplateCreated Action = "pipeline_template.created" ActionPipelineTemplateUpdated Action = "pipeline_template.updated" ActionPipelineTemplateDeleted Action = "pipeline_template.deleted" ActionPipelineTemplateActivated Action = "pipeline_template.activated" ActionPipelineTemplateDeactivated Action = "pipeline_template.deactivated" ActionPipelineStepCreated Action = "pipeline_step.created" ActionPipelineStepUpdated Action = "pipeline_step.updated" ActionPipelineStepDeleted Action = "pipeline_step.deleted" ActionPipelineRunTriggered Action = "pipeline_run.triggered" ActionPipelineRunCompleted Action = "pipeline_run.completed" ActionPipelineRunFailed Action = "pipeline_run.failed" ActionPipelineRunCanceled Action = "pipeline_run.canceled" // Pentest campaign team actions ActionCampaignMemberAdded Action = "campaign.member_added" ActionCampaignMemberRemoved Action = "campaign.member_removed" ActionCampaignMemberRoleChanged Action = "campaign.member_role_changed" ActionCampaignCreated Action = "campaign.created" ActionCampaignUpdated Action = "campaign.updated" ActionCampaignStatusChanged Action = "campaign.status_changed" ActionCampaignDeleted Action = "campaign.deleted" // Scan config actions ActionScanConfigCreated Action = "scan_config.created" ActionScanConfigUpdated Action = "scan_config.updated" ActionScanConfigDeleted Action = "scan_config.deleted" ActionScanConfigTriggered Action = "scan_config.triggered" ActionScanConfigPaused Action = "scan_config.paused" ActionScanConfigActivated Action = "scan_config.activated" ActionScanConfigDisabled Action = "scan_config.disabled" ActionScanConfigExported Action = "scan_config.exported" ActionScanConfigImported Action = "scan_config.imported" // Security events ActionSecurityValidationFailed Action = "security.validation_failed" ActionSecurityCrossTenantAccess Action = "security.cross_tenant_access" // Workflow actions ActionWorkflowCreated Action = "workflow.created" ActionWorkflowUpdated Action = "workflow.updated" ActionWorkflowDeleted Action = "workflow.deleted" ActionWorkflowActivated Action = "workflow.activated" ActionWorkflowDeactivated Action = "workflow.deactivated" ActionWorkflowRunTriggered Action = "workflow_run.triggered" ActionWorkflowRunCompleted Action = "workflow_run.completed" ActionWorkflowRunFailed Action = "workflow_run.failed" ActionWorkflowRunCanceled Action = "workflow_run.canceled" // Rule actions ActionRuleSourceCreated Action = "rule_source.created" ActionRuleSourceUpdated Action = "rule_source.updated" ActionRuleSourceDeleted Action = "rule_source.deleted" ActionRuleOverrideCreated Action = "rule_override.created" ActionRuleOverrideUpdated Action = "rule_override.updated" ActionRuleOverrideDeleted Action = "rule_override.deleted" // Ingest actions (agent upload) ActionIngestStarted Action = "ingest.started" ActionIngestCompleted Action = "ingest.completed" ActionIngestFailed Action = "ingest.failed" ActionIngestPartialSuccess Action = "ingest.partial_success" // AI Triage actions ActionAITriageRequested Action = "ai_triage.requested" ActionAITriageStarted Action = "ai_triage.started" ActionAITriageCompleted Action = "ai_triage.completed" ActionAITriageFailed Action = "ai_triage.failed" ActionAITriageBulk Action = "ai_triage.bulk_requested" ActionAITriageRateLimit Action = "ai_triage.rate_limited" ActionAITriageTokenLimit Action = "ai_triage.token_limit_exceeded" ActionAITriageNeedsReview Action = "ai_triage.needs_review" // validator flagged output ActionAITriageBudgetExhausted Action = "ai_triage.budget_exhausted" // tenant hit monthly token ceiling // MCP actions — read-only Model Context Protocol tool invocations by an // `oct_` API key. Every tools/call is audited (success and error alike). ActionMCPToolCalled Action = "mcp.tool_called" // ActionMCPPromptGotten records a prompts/get: an AI client pulled a report // section template pre-filled with campaign/finding context. Audited because // it reads the same gated pentest data a tools/call does. ActionMCPPromptGotten Action = "mcp.prompt_gotten" )
type AuditLog ¶
type AuditLog struct {
// contains filtered or unexported fields
}
AuditLog represents an audit log entry.
func NewAuditLog ¶
func NewAuditLog( action Action, resourceType ResourceType, resourceID string, result Result, ) (*AuditLog, error)
NewAuditLog creates a new audit log entry.
func Reconstitute ¶
func Reconstitute( id shared.ID, tenantID *shared.ID, actorID *shared.ID, actorEmail string, actorIP string, actorAgent string, action Action, resourceType ResourceType, resourceID string, resourceName string, changes *Changes, result Result, severity Severity, message string, metadata map[string]any, requestID string, sessionID string, timestamp time.Time, ) *AuditLog
Reconstitute recreates an AuditLog from persistence.
func (*AuditLog) ActorAgent ¶
ActorAgent returns the actor user agent.
func (*AuditLog) ActorEmail ¶
ActorEmail returns the actor email.
func (*AuditLog) GenerateMessage ¶
GenerateMessage generates a default message if none is set.
func (*AuditLog) HasChanges ¶
HasChanges checks if there are recorded changes.
func (*AuditLog) IsCritical ¶
IsCritical checks if the severity is critical.
func (*AuditLog) IsHighOrCritical ¶
IsHighOrCritical checks if the severity is high or critical.
func (*AuditLog) ResourceID ¶
ResourceID returns the resource ID.
func (*AuditLog) ResourceName ¶
ResourceName returns the resource name.
func (*AuditLog) ResourceType ¶
func (a *AuditLog) ResourceType() ResourceType
ResourceType returns the resource type.
func (*AuditLog) WithActorAgent ¶
WithActorAgent sets the actor user agent.
func (*AuditLog) WithActorIP ¶
WithActorIP sets the actor IP address. The value is reduced to a single, storable address: callers routinely pass a whole X-Forwarded-For chain, of which only the leftmost entry is the client.
func (*AuditLog) WithChanges ¶
WithChanges sets the changes.
func (*AuditLog) WithMessage ¶
WithMessage sets the message.
func (*AuditLog) WithMetadata ¶
WithMetadata sets a metadata key-value pair.
func (*AuditLog) WithRequestID ¶
WithRequestID sets the request ID.
func (*AuditLog) WithResourceName ¶
WithResourceName sets the resource name.
func (*AuditLog) WithSessionID ¶
WithSessionID sets the session ID.
func (*AuditLog) WithSeverity ¶
WithSeverity sets the severity (overrides default).
type ChainEntry ¶ added in v0.2.0
type ChainEntry struct {
AuditLogID shared.ID
TenantID shared.ID
PrevHash string // "" for the first entry per tenant
Hash string // SHA-256 hex (64 chars)
ChainPosition int64 // monotonic per tenant
CreatedAt time.Time
}
ChainEntry is one row of the tamper-evident audit hash-chain. Mirrors the audit_log_chain table (migration 000154).
type Changes ¶
type Changes struct {
Before map[string]any `json:"before,omitempty"`
After map[string]any `json:"after,omitempty"`
}
Changes represents before/after values for an update operation.
type Filter ¶
type Filter struct {
TenantID *shared.ID
ActorID *shared.ID
Actions []Action
ResourceTypes []ResourceType
ResourceID *string
Results []Result
Severities []Severity
Categories []string
RequestID *string
SessionID *string
Since *time.Time
Until *time.Time
SearchTerm *string // Search in message, resource name, actor email
SortBy string
SortOrder string // "asc" or "desc"
ExcludeSystem bool // Exclude system events
}
Filter defines criteria for filtering audit logs.
func (Filter) WithActions ¶
WithActions sets the actions filter.
func (Filter) WithActorID ¶
WithActorID sets the actor ID filter.
func (Filter) WithCategories ¶
WithCategories sets the categories filter.
func (Filter) WithExcludeSystem ¶
WithExcludeSystem sets the exclude system filter.
func (Filter) WithRequestID ¶
WithRequestID sets the request ID filter.
func (Filter) WithResourceID ¶
WithResourceID sets the resource ID filter.
func (Filter) WithResourceTypes ¶
func (f Filter) WithResourceTypes(types ...ResourceType) Filter
WithResourceTypes sets the resource types filter.
func (Filter) WithResults ¶
WithResults sets the results filter.
func (Filter) WithSearchTerm ¶
WithSearchTerm sets the search term filter.
func (Filter) WithSessionID ¶
WithSessionID sets the session ID filter.
func (Filter) WithSeverities ¶
WithSeverities sets the severities filter.
func (Filter) WithTenantID ¶
WithTenantID sets the tenant ID filter.
func (Filter) WithTimeRange ¶
WithTimeRange sets both since and until time filters.
type Repository ¶
type Repository interface {
// Create persists a new audit log entry.
Create(ctx context.Context, log *AuditLog) error
// CreateBatch persists multiple audit log entries.
CreateBatch(ctx context.Context, logs []*AuditLog) error
// GetByID retrieves an audit log by ID.
GetByID(ctx context.Context, id shared.ID) (*AuditLog, error)
// GetByTenantAndID retrieves an audit log by tenant and ID.
GetByTenantAndID(ctx context.Context, tenantID, id shared.ID) (*AuditLog, error)
// List retrieves audit logs matching the filter with pagination.
List(ctx context.Context, filter Filter, page pagination.Pagination) (pagination.Result[*AuditLog], error)
// Count returns the count of audit logs matching the filter.
Count(ctx context.Context, filter Filter) (int64, error)
// DeleteOlderThan deletes audit logs older than the specified time
// ACROSS ALL TENANTS. Used for platform-wide retention policy enforcement.
//
// F-3: This is a PLATFORM-PRIVILEGED operation — callers MUST ensure the
// operation is driven by platform operators (via the audit retention
// background controller) and never by a tenant-scoped HTTP handler.
// For per-tenant retention use DeleteOlderThanForTenant instead.
DeleteOlderThan(ctx context.Context, before time.Time) (int64, error)
// DeleteOlderThanForTenant deletes audit logs older than the specified
// time, scoped to a single tenant. Intended for per-tenant retention
// policies (e.g. tenant-configured data lifecycle).
DeleteOlderThanForTenant(ctx context.Context, tenantID shared.ID, before time.Time) (int64, error)
// GetLatestByResource retrieves the latest audit log for a resource within a tenant.
// tenantID MUST be provided to prevent cross-tenant reads.
GetLatestByResource(ctx context.Context, tenantID shared.ID, resourceType ResourceType, resourceID string) (*AuditLog, error)
// ListByActor retrieves audit logs for a specific actor within a tenant.
// tenantID MUST be provided to prevent cross-tenant reads — an actor's
// activity is otherwise visible to any tenant that knows the actor id.
ListByActor(ctx context.Context, tenantID, actorID shared.ID, page pagination.Pagination) (pagination.Result[*AuditLog], error)
// ListByResource retrieves audit logs for a specific resource within a tenant.
// tenantID MUST be provided to prevent cross-tenant reads.
ListByResource(ctx context.Context, tenantID shared.ID, resourceType ResourceType, resourceID string, page pagination.Pagination) (pagination.Result[*AuditLog], error)
// CountByAction counts occurrences of an action within a time range.
CountByAction(ctx context.Context, tenantID *shared.ID, action Action, since time.Time) (int64, error)
// LatestChainHash returns the hash of the newest chain entry for
// the tenant, or "" if the tenant has no chain yet. Used by the
// audit service when computing the next hash.
LatestChainHash(ctx context.Context, tenantID shared.ID) (string, error)
// AppendChainEntry inserts a new row into audit_log_chain. Must be
// called AFTER the audit_logs row exists — the FK is enforced.
// Idempotent on (audit_log_id) PK collision so retries don't
// duplicate.
AppendChainEntry(ctx context.Context, entry ChainEntry) error
// GetSystemByID returns a tenant-less audit log by id. It exists so the
// chain verifier can resolve entries on the SystemChainTenantID chain,
// whose audit_logs rows have tenant_id IS NULL.
//
// Deliberately a separate method rather than relaxing GetByTenantAndID:
// that one is a tenant-isolation boundary, and widening it so a sentinel
// matches NULL rows is exactly the kind of change that later leaks a real
// tenant's rows. This one can only ever return rows with no tenant.
GetSystemByID(ctx context.Context, id shared.ID) (*AuditLog, error)
// ListChainEntries returns chain rows for verification. Ordered by
// chain_position ASC.
ListChainEntries(ctx context.Context, tenantID shared.ID, limit int) ([]ChainEntry, error)
// UpdateChainEntryHashes overwrites prev_hash + hash of an existing chain
// entry. Used ONLY by the admin re-baseline operation (re-signing the chain
// after a known-benign hashing change, e.g. the timestamp-precision fix). It
// is intentionally not part of the normal append flow.
UpdateChainEntryHashes(ctx context.Context, auditLogID shared.ID, prevHash, hash string) error
}
Repository defines the interface for audit log persistence.
type ResourceType ¶
type ResourceType string
ResourceType represents the type of resource being acted upon.
const ( ResourceTypeUser ResourceType = "user" ResourceTypeTenant ResourceType = "tenant" ResourceTypeMembership ResourceType = "membership" ResourceTypeInvitation ResourceType = "invitation" ResourceTypeRepository ResourceType = "repository" ResourceTypeBranch ResourceType = "branch" ResourceTypeComponent ResourceType = "component" ResourceTypeVulnerability ResourceType = "vulnerability" ResourceTypeFinding ResourceType = "finding" ResourceTypeFindingComment ResourceType = "finding_comment" ResourceTypeSLAPolicy ResourceType = "sla_policy" ResourceTypeScan ResourceType = "scan" ResourceTypeAsset ResourceType = "asset" ResourceTypeSettings ResourceType = "settings" ResourceTypeToken ResourceType = "token" ResourceTypeAgent ResourceType = "agent" ResourceTypeGroup ResourceType = "group" ResourceTypePermissionSet ResourceType = "permission_set" ResourceTypeRole ResourceType = "role" ResourceTypePipelineTemplate ResourceType = "pipeline_template" ResourceTypeCampaign ResourceType = "pentest_campaign" ResourceTypePipelineStep ResourceType = "pipeline_step" ResourceTypePipelineRun ResourceType = "pipeline_run" ResourceTypeScanConfig ResourceType = "scan_config" ResourceTypeWorkflow ResourceType = "workflow" ResourceTypeWorkflowRun ResourceType = "workflow_run" ResourceTypeCapability ResourceType = "capability" ResourceTypeTool ResourceType = "tool" ResourceTypeRuleSource ResourceType = "rule_source" ResourceTypeRuleOverride ResourceType = "rule_override" ResourceTypeIngest ResourceType = "ingest" ResourceTypeAITriage ResourceType = "ai_triage" ResourceTypeMCPTool ResourceType = "mcp_tool" ResourceTypeMCPPrompt ResourceType = "mcp_prompt" )
func (ResourceType) IsValid ¶
func (r ResourceType) IsValid() bool
IsValid checks if the resource type is valid.
func (ResourceType) String ¶
func (r ResourceType) String() string
String returns the string representation of the resource type.
type Severity ¶
type Severity string
Severity represents the severity level of an audit event.
func SeverityForAction ¶
SeverityForAction returns the default severity for an action.