audit

package
v1.13.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AuditLoggerHeaders = envvar.New("AuditLoggerHeaders", func(s string) (ServiceHeaders, error) {
	sh := make(ServiceHeaders, 0)
	err := sh.UnmarshalText([]byte(s))
	if err != nil {
		return nil, err
	}
	return sh, nil
})

Functions

This section is empty.

Types

type AuditLogger

type AuditLogger interface {
	services.ServiceCtx

	Audit(eventID EventID, data Data)
}
var NoopLogger AuditLogger = &AuditLoggerService{}

func NewAuditLogger

func NewAuditLogger(logger logger.Logger, config Config) (AuditLogger, error)

NewAuditLogger returns a buffer push system that ingests audit log events and asynchronously pushes them up to an HTTP log service. Parses and validates the AUDIT_LOGS_* environment values and returns an enabled AuditLogger instance. If the environment variables are not set, the logger is disabled and short circuits execution via enabled flag.

type AuditLoggerConfig

type AuditLoggerConfig struct {
	Enabled        *bool
	ForwardToUrl   *models.URL
	JsonWrapperKey *string
	Headers        *[]ServiceHeader
}

func (*AuditLoggerConfig) SetFrom

func (p *AuditLoggerConfig) SetFrom(f *AuditLoggerConfig)

type AuditLoggerService

type AuditLoggerService struct {
	// contains filtered or unexported fields
}

func (*AuditLoggerService) Audit

func (l *AuditLoggerService) Audit(eventID EventID, data Data)

Entrypoint for new audit logs. This buffers all logs that come in they will sent out by the goroutine that was started when the AuditLoggerService was created. If this service was not enabled, this immeidately returns.

This function never blocks.

func (*AuditLoggerService) Close

func (l *AuditLoggerService) Close() error

Stops the logger and will close the channel.

func (*AuditLoggerService) HealthReport added in v1.13.0

func (l *AuditLoggerService) HealthReport() map[string]error

func (*AuditLoggerService) Healthy

func (l *AuditLoggerService) Healthy() error

func (*AuditLoggerService) Name added in v1.13.0

func (l *AuditLoggerService) Name() string

func (*AuditLoggerService) Ready

func (l *AuditLoggerService) Ready() error

func (*AuditLoggerService) SetLoggingClient

func (l *AuditLoggerService) SetLoggingClient(newClient HTTPAuditLoggerInterface)

func (*AuditLoggerService) Start

Start the audit logger and begin processing logs on the channel

type Config

type Config interface {
	AuditLoggerEnabled() bool
	AuditLoggerForwardToUrl() (models.URL, error)
	AuditLoggerEnvironment() string
	AuditLoggerJsonWrapperKey() string
	AuditLoggerHeaders() (ServiceHeaders, error)
}

type Data

type Data = map[string]any

type EventID

type EventID string
const (
	AuthLoginFailedEmail    EventID = "AUTH_LOGIN_FAILED_EMAIL"
	AuthLoginFailedPassword EventID = "AUTH_LOGIN_FAILED_PASSWORD"
	AuthLoginFailed2FA      EventID = "AUTH_LOGIN_FAILED_2FA"
	AuthLoginSuccessWith2FA EventID = "AUTH_LOGIN_SUCCESS_WITH_2FA"
	AuthLoginSuccessNo2FA   EventID = "AUTH_LOGIN_SUCCESS_NO_2FA"
	Auth2FAEnrolled         EventID = "AUTH_2FA_ENROLLED"
	AuthSessionDeleted      EventID = "SESSION_DELETED"

	PasswordResetAttemptFailedMismatch EventID = "PASSWORD_RESET_ATTEMPT_FAILED_MISMATCH"
	PasswordResetSuccess               EventID = "PASSWORD_RESET_SUCCESS"

	APITokenCreateAttemptPasswordMismatch EventID = "API_TOKEN_CREATE_ATTEMPT_PASSWORD_MISMATCH"
	APITokenCreated                       EventID = "API_TOKEN_CREATED"
	APITokenDeleteAttemptPasswordMismatch EventID = "API_TOKEN_DELETE_ATTEMPT_PASSWORD_MISMATCH"
	APITokenDeleted                       EventID = "API_TOKEN_DELETED"

	FeedsManCreated EventID = "FEEDS_MAN_CREATED"
	FeedsManUpdated EventID = "FEEDS_MAN_UPDATED"

	FeedsManChainConfigCreated EventID = "FEEDS_MAN_CHAIN_CONFIG_CREATED"
	FeedsManChainConfigUpdated EventID = "FEEDS_MAN_CHAIN_CONFIG_UPDATED"
	FeedsManChainConfigDeleted EventID = "FEEDS_MAN_CHAIN_CONFIG_DELETED"

	CSAKeyCreated  EventID = "CSA_KEY_CREATED"
	CSAKeyImported EventID = "CSA_KEY_IMPORTED"
	CSAKeyExported EventID = "CSA_KEY_EXPORTED"
	CSAKeyDeleted  EventID = "CSA_KEY_DELETED"

	OCRKeyBundleCreated  EventID = "OCR_KEY_BUNDLE_CREATED"
	OCRKeyBundleImported EventID = "OCR_KEY_BUNDLE_IMPORTED"
	OCRKeyBundleExported EventID = "OCR_KEY_BUNDLE_EXPORTED"
	OCRKeyBundleDeleted  EventID = "OCR_KEY_BUNDLE_DELETED"

	OCR2KeyBundleCreated  EventID = "OCR2_KEY_BUNDLE_CREATED"
	OCR2KeyBundleImported EventID = "OCR2_KEY_BUNDLE_IMPORTED"
	OCR2KeyBundleExported EventID = "OCR2_KEY_BUNDLE_EXPORTED"
	OCR2KeyBundleDeleted  EventID = "OCR2_KEY_BUNDLE_DELETED"

	KeyCreated  EventID = "KEY_CREATED"
	KeyUpdated  EventID = "KEY_UPDATED"
	KeyImported EventID = "KEY_IMPORTED"
	KeyExported EventID = "KEY_EXPORTED"
	KeyDeleted  EventID = "KEY_DELETED"

	EthTransactionCreated    EventID = "ETH_TRANSACTION_CREATED"
	SolanaTransactionCreated EventID = "SOLANA_TRANSACTION_CREATED"

	JobCreated EventID = "JOB_CREATED"
	JobDeleted EventID = "JOB_DELETED"

	ChainAdded       EventID = "CHAIN_ADDED"
	ChainSpecUpdated EventID = "CHAIN_SPEC_UPDATED"
	ChainDeleted     EventID = "CHAIN_DELETED"

	ChainRpcNodeAdded   EventID = "CHAIN_RPC_NODE_ADDED"
	ChainRpcNodeDeleted EventID = "CHAIN_RPC_NODE_DELETED"

	BridgeCreated EventID = "BRIDGE_CREATED"
	BridgeUpdated EventID = "BRIDGE_UPDATED"
	BridgeDeleted EventID = "BRIDGE_DELETED"

	ForwarderCreated EventID = "FORWARDER_CREATED"
	ForwarderDeleted EventID = "FORWARDER_DELETED"

	ExternalInitiatorCreated EventID = "EXTERNAL_INITIATOR_CREATED"
	ExternalInitiatorDeleted EventID = "EXTERNAL_INITIATOR_DELETED"

	JobProposalSpecApproved EventID = "JOB_PROPOSAL_SPEC_APPROVED"
	JobProposalSpecUpdated  EventID = "JOB_PROPOSAL_SPEC_UPDATED"
	JobProposalSpecCanceled EventID = "JOB_PROPOSAL_SPEC_CANCELED"
	JobProposalSpecRejected EventID = "JOB_PROPOSAL_SPEC_REJECTED"

	ConfigUpdated            EventID = "CONFIG_UPDATED"
	ConfigSqlLoggingEnabled  EventID = "CONFIG_SQL_LOGGING_ENABLED"
	ConfigSqlLoggingDisabled EventID = "CONFIG_SQL_LOGGING_DISABLED"
	GlobalLogLevelSet        EventID = "GLOBAL_LOG_LEVEL_SET"

	JobErrorDismissed EventID = "JOB_ERROR_DISMISSED"
	JobRunSet         EventID = "JOB_RUN_SET"

	EnvNoncriticalEnvDumped EventID = "ENV_NONCRITICAL_ENV_DUMPED"

	UnauthedRunResumed EventID = "UNAUTHED_RUN_RESUMED"
)

Static audit log event type constants

type HTTPAuditLoggerInterface

type HTTPAuditLoggerInterface interface {
	Do(req *http.Request) (*http.Response, error)
}

type ServiceHeader

type ServiceHeader struct {
	Header string
	Value  string
}

ServiceHeader is an HTTP header to include in POST to log service.

func (*ServiceHeader) MarshalText

func (h *ServiceHeader) MarshalText() ([]byte, error)

func (*ServiceHeader) UnmarshalText

func (h *ServiceHeader) UnmarshalText(input []byte) error

type ServiceHeaders

type ServiceHeaders []ServiceHeader

func (*ServiceHeaders) MarshalText

func (sh *ServiceHeaders) MarshalText() ([]byte, error)

func (*ServiceHeaders) UnmarshalText

func (sh *ServiceHeaders) UnmarshalText(input []byte) error

Jump to

Keyboard shortcuts

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