Files
threshold/internal/observability/event/data_classification.go
T
Jim 5f46207e76 Events: add redact/encrypt node for audit events to Eventer (#1490)
* feat (events): Add new options needed for AuditConfig

WithAuditWrapper and WithFilterOperations all for optional paramters
when creating AuditConfig types.

* refactor (event): Change EventerConfig.Sinks to a ptr

We need to modify the SinkConfig.AuditConfig during the NewEventer factory, so we have to use a ptr not a ref.

* feat (events): Add audit configuration types

* feat (events): add audit config to sink configuration.

* feat (events): add redact/encrypt node for audit events to Eventer

Integrate the encrypt.Filter node from the eventlogger into the
event.Eventer, so audit events can be redacted/encrypted based
on data classifications.

* test (events) Add test protobufs for events

Add test protobufs along with a test service for testing
the audit event encrypt node
2021-08-30 19:02:48 -04:00

34 lines
1.1 KiB
Go

package event
import "fmt"
// DataClassification defines a data classification (public, sensitive, secret, etc)
type DataClassification string
const (
UnknownClassification DataClassification = "unknown"
// PublicClassification declares a field as public data. No filter
// operations are ever performed on public data.
PublicClassification DataClassification = "public"
// SensitiveClassification declares a field as sensitive data. By default,
// sensitive data is encrypted unless there are AuditConfig.FilterOverrides
SensitiveClassification DataClassification = "sensitive"
// SecretClassification declares a field as secret data. By default,
// secret data is redacted unless there are AuditConfig.FilterOverrides
SecretClassification DataClassification = "secret"
)
// Validate the DataClassification
func (dc DataClassification) Validate() error {
const op = "event.(DataClassification).Validate"
switch dc {
case PublicClassification, SensitiveClassification, SecretClassification:
return nil
default:
return fmt.Errorf("%s: invalid data classification '%s': %w", op, dc, ErrInvalidParameter)
}
}