From cb99d2999b5c66c00ea0c22afc3d4d10ee661d5b Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Thu, 11 Aug 2022 19:52:27 +0200 Subject: [PATCH] Add action recording for sensitive data search --- compose/service/record.go | 4 +++- compose/service/record_actions.gen.go | 20 ++++++++++++++++++++ compose/service/record_actions.yaml | 4 ++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/compose/service/record.go b/compose/service/record.go index e5ca5b4fa..ba8ee2870 100644 --- a/compose/service/record.go +++ b/compose/service/record.go @@ -327,6 +327,8 @@ func (svc record) SearchSensitive(ctx context.Context) (set []types.SensitiveRec namespaces types.NamespaceSet modules types.ModuleSet + aProps = &recordActionProps{} + userID = auth.GetIdentityFromContext(ctx).Identity() ) @@ -364,7 +366,7 @@ func (svc record) SearchSensitive(ctx context.Context) (set []types.SensitiveRec return nil }() - return set, err + return set, svc.recordAction(ctx, aProps, RecordActionSearchSensitive, err) } func (svc record) searchSensitive(ctx context.Context, userID uint64, namespace *types.Namespace, module *types.Module, filter types.RecordFilter) (out types.SensitiveRecordSet, err error) { diff --git a/compose/service/record_actions.gen.go b/compose/service/record_actions.gen.go index aa1ced423..5c2485adb 100644 --- a/compose/service/record_actions.gen.go +++ b/compose/service/record_actions.gen.go @@ -452,6 +452,26 @@ func RecordActionSearch(props ...*recordActionProps) *recordAction { return a } +// RecordActionSearchSensitive returns "compose:record.searchSensitive" action +// +// This function is auto-generated. +// +func RecordActionSearchSensitive(props ...*recordActionProps) *recordAction { + a := &recordAction{ + timestamp: time.Now(), + resource: "compose:record", + action: "searchSensitive", + log: "searched for records with sensitive data", + severity: actionlog.Info, + } + + if len(props) > 0 { + a.props = props[0] + } + + return a +} + // RecordActionLookup returns "compose:record.lookup" action // // This function is auto-generated. diff --git a/compose/service/record_actions.yaml b/compose/service/record_actions.yaml index 52499b2b4..46b90fea8 100644 --- a/compose/service/record_actions.yaml +++ b/compose/service/record_actions.yaml @@ -46,6 +46,10 @@ actions: log: "searched for records" severity: info + - action: searchSensitive + log: "searched for records with sensitive data" + severity: info + - action: lookup log: "looked-up for a {{record}}" severity: info