3
0

Tweaked severity on action log actions

This commit is contained in:
Denis Arh
2020-07-22 22:41:07 +02:00
parent fafb14860e
commit ed0fc88690
29 changed files with 91 additions and 85 deletions
@@ -265,7 +265,7 @@ func AccessControlActionGrant(props ...*accessControlActionProps) *accessControl
resource: "compose:access_control",
action: "grant",
log: "grant",
severity: actionlog.Error,
severity: actionlog.Notice,
}
if len(props) > 0 {
+1 -1
View File
@@ -4,7 +4,7 @@ resource: compose:access_control
service: accessControl
# Default sensitivity for actions
defaultActionSeverity: note
defaultActionSeverity: notice
# default severity for errors
defaultErrorSeverity: alert
+5 -5
View File
@@ -425,7 +425,7 @@ func ChartActionCreate(props ...*chartActionProps) *chartAction {
resource: "compose:chart",
action: "create",
log: "created {chart}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -445,7 +445,7 @@ func ChartActionUpdate(props ...*chartActionProps) *chartAction {
resource: "compose:chart",
action: "update",
log: "updated {chart}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -465,7 +465,7 @@ func ChartActionDelete(props ...*chartActionProps) *chartAction {
resource: "compose:chart",
action: "delete",
log: "deleted {chart}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -485,7 +485,7 @@ func ChartActionUndelete(props ...*chartActionProps) *chartAction {
resource: "compose:chart",
action: "undelete",
log: "undeleted {chart}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -505,7 +505,7 @@ func ChartActionReorder(props ...*chartActionProps) *chartAction {
resource: "compose:chart",
action: "reorder",
log: "reordered {chart}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
+1 -1
View File
@@ -4,7 +4,7 @@ resource: compose:chart
service: chart
# Default sensitivity for actions
defaultActionSeverity: info
defaultActionSeverity: notice
# default severity for errors
defaultErrorSeverity: error
+4 -4
View File
@@ -434,7 +434,7 @@ func ModuleActionCreate(props ...*moduleActionProps) *moduleAction {
resource: "compose:module",
action: "create",
log: "created {module}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -454,7 +454,7 @@ func ModuleActionUpdate(props ...*moduleActionProps) *moduleAction {
resource: "compose:module",
action: "update",
log: "updated {module}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -474,7 +474,7 @@ func ModuleActionDelete(props ...*moduleActionProps) *moduleAction {
resource: "compose:module",
action: "delete",
log: "deleted {module}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -494,7 +494,7 @@ func ModuleActionUndelete(props ...*moduleActionProps) *moduleAction {
resource: "compose:module",
action: "undelete",
log: "undeleted {module}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
+1 -1
View File
@@ -4,7 +4,7 @@ resource: compose:module
service: module
# Default sensitivity for actions
defaultActionSeverity: info
defaultActionSeverity: notice
# default severity for errors
defaultErrorSeverity: error
+5 -5
View File
@@ -389,7 +389,7 @@ func NamespaceActionCreate(props ...*namespaceActionProps) *namespaceAction {
resource: "compose:namespace",
action: "create",
log: "created {namespace}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -409,7 +409,7 @@ func NamespaceActionUpdate(props ...*namespaceActionProps) *namespaceAction {
resource: "compose:namespace",
action: "update",
log: "updated {namespace}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -429,7 +429,7 @@ func NamespaceActionDelete(props ...*namespaceActionProps) *namespaceAction {
resource: "compose:namespace",
action: "delete",
log: "deleted {namespace}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -449,7 +449,7 @@ func NamespaceActionUndelete(props ...*namespaceActionProps) *namespaceAction {
resource: "compose:namespace",
action: "undelete",
log: "undeleted {namespace}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -469,7 +469,7 @@ func NamespaceActionReorder(props ...*namespaceActionProps) *namespaceAction {
resource: "compose:namespace",
action: "reorder",
log: "reordered {namespace}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
+1 -1
View File
@@ -4,7 +4,7 @@ resource: compose:namespace
service: namespace
# Default sensitivity for actions
defaultActionSeverity: info
defaultActionSeverity: notice
# default severity for errors
defaultErrorSeverity: error
+5 -5
View File
@@ -446,7 +446,7 @@ func PageActionCreate(props ...*pageActionProps) *pageAction {
resource: "compose:page",
action: "create",
log: "created {page}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -466,7 +466,7 @@ func PageActionUpdate(props ...*pageActionProps) *pageAction {
resource: "compose:page",
action: "update",
log: "updated {page}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -486,7 +486,7 @@ func PageActionDelete(props ...*pageActionProps) *pageAction {
resource: "compose:page",
action: "delete",
log: "deleted {page}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -506,7 +506,7 @@ func PageActionUndelete(props ...*pageActionProps) *pageAction {
resource: "compose:page",
action: "undelete",
log: "undeleted {page}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -526,7 +526,7 @@ func PageActionReorder(props ...*pageActionProps) *pageAction {
resource: "compose:page",
action: "reorder",
log: "reordered {page}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
+1 -1
View File
@@ -4,7 +4,7 @@ resource: compose:page
service: page
# Default sensitivity for actions
defaultActionSeverity: info
defaultActionSeverity: notice
# default severity for errors
defaultErrorSeverity: error
+13 -13
View File
@@ -550,7 +550,7 @@ func RecordActionBulk(props ...*recordActionProps) *recordAction {
resource: "compose:record",
action: "bulk",
log: "bulk record operation",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -570,7 +570,7 @@ func RecordActionCreate(props ...*recordActionProps) *recordAction {
resource: "compose:record",
action: "create",
log: "created {record}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -590,7 +590,7 @@ func RecordActionUpdate(props ...*recordActionProps) *recordAction {
resource: "compose:record",
action: "update",
log: "updated {record}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -610,7 +610,7 @@ func RecordActionDelete(props ...*recordActionProps) *recordAction {
resource: "compose:record",
action: "delete",
log: "deleted {record}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -630,7 +630,7 @@ func RecordActionUndelete(props ...*recordActionProps) *recordAction {
resource: "compose:record",
action: "undelete",
log: "undeleted {record}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -650,7 +650,7 @@ func RecordActionImport(props ...*recordActionProps) *recordAction {
resource: "compose:record",
action: "import",
log: "records imported",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -670,7 +670,7 @@ func RecordActionExport(props ...*recordActionProps) *recordAction {
resource: "compose:record",
action: "export",
log: "records exported",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -690,7 +690,7 @@ func RecordActionOrganize(props ...*recordActionProps) *recordAction {
resource: "compose:record",
action: "organize",
log: "records organized",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -710,7 +710,7 @@ func RecordActionIteratorInvoked(props ...*recordActionProps) *recordAction {
resource: "compose:record",
action: "iteratorInvoked",
log: "iterator invoked",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -730,7 +730,7 @@ func RecordActionIteratorIteration(props ...*recordActionProps) *recordAction {
resource: "compose:record",
action: "iteratorIteration",
log: "processed record iteration",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -750,7 +750,7 @@ func RecordActionIteratorClone(props ...*recordActionProps) *recordAction {
resource: "compose:record",
action: "iteratorClone",
log: "cloned record in iteration",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -770,7 +770,7 @@ func RecordActionIteratorUpdate(props ...*recordActionProps) *recordAction {
resource: "compose:record",
action: "iteratorUpdate",
log: "updated record in iteration",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -790,7 +790,7 @@ func RecordActionIteratorDelete(props ...*recordActionProps) *recordAction {
resource: "compose:record",
action: "iteratorDelete",
log: "deleted record in iteration",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
+1 -1
View File
@@ -4,7 +4,7 @@ resource: compose:record
service: record
# Default sensitivity for actions
defaultActionSeverity: info
defaultActionSeverity: notice
# default severity for errors
defaultErrorSeverity: error
@@ -265,7 +265,7 @@ func AccessControlActionGrant(props ...*accessControlActionProps) *accessControl
resource: "messaging:access_control",
action: "grant",
log: "grant",
severity: actionlog.Error,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -4,7 +4,7 @@ resource: messaging:access_control
service: accessControl
# Default sensitivity for actions
defaultActionSeverity: note
defaultActionSeverity: notice
# default severity for errors
defaultErrorSeverity: alert
+10 -10
View File
@@ -371,7 +371,7 @@ func ChannelActionCreate(props ...*channelActionProps) *channelAction {
resource: "messaging:channel",
action: "create",
log: "created {channel}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -391,7 +391,7 @@ func ChannelActionUpdate(props ...*channelActionProps) *channelAction {
resource: "messaging:channel",
action: "update",
log: "updated {channel}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -411,7 +411,7 @@ func ChannelActionDelete(props ...*channelActionProps) *channelAction {
resource: "messaging:channel",
action: "delete",
log: "deleted {channel}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -431,7 +431,7 @@ func ChannelActionUndelete(props ...*channelActionProps) *channelAction {
resource: "messaging:channel",
action: "undelete",
log: "undeleted {channel}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -451,7 +451,7 @@ func ChannelActionArchive(props ...*channelActionProps) *channelAction {
resource: "messaging:channel",
action: "archive",
log: "archived {channel}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -471,7 +471,7 @@ func ChannelActionUnarchive(props ...*channelActionProps) *channelAction {
resource: "messaging:channel",
action: "unarchive",
log: "unarchived {channel}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -491,7 +491,7 @@ func ChannelActionSetFlag(props ...*channelActionProps) *channelAction {
resource: "messaging:channel",
action: "setFlag",
log: "set flag {flag} on {channel}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -511,7 +511,7 @@ func ChannelActionInviteMember(props ...*channelActionProps) *channelAction {
resource: "messaging:channel",
action: "inviteMember",
log: "member {memberID} invited to {channel}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -531,7 +531,7 @@ func ChannelActionRemoveMember(props ...*channelActionProps) *channelAction {
resource: "messaging:channel",
action: "removeMember",
log: "member {memberID} removed from {channel}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -551,7 +551,7 @@ func ChannelActionAddMember(props ...*channelActionProps) *channelAction {
resource: "messaging:channel",
action: "addMember",
log: "member {memberID} added to {channel}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
+1 -1
View File
@@ -4,7 +4,7 @@ resource: messaging:channel
service: channel
# Default sensitivity for actions
defaultActionSeverity: info
defaultActionSeverity: notice
# default severity for errors
defaultErrorSeverity: error
+1 -1
View File
@@ -7,7 +7,7 @@ func MakeDebugPolicy() policyMatcher {
func MakeProductionPolicy() policyMatcher {
return NewPolicyAll(
// Ignore debug actions
NewPolicyNegate(NewPolicyMatchSeverity(Debug)),
NewPolicyNegate(NewPolicyMatchSeverity(Debug, Info)),
)
}
+2 -2
View File
@@ -18,8 +18,8 @@ func TestCannedPolies(t *testing.T) {
true,
},
{
"production policy should record info",
&Action{Severity: Info},
"production policy should record notice",
&Action{Severity: Notice},
MakeProductionPolicy(),
true,
},
+6
View File
@@ -77,6 +77,12 @@ func TestPolicyMatchers(t *testing.T) {
NewPolicyMatchSeverity(Emergency, Debug, Warning),
true,
},
{
"should not match one of severity",
&Action{Severity: Info},
NewPolicyNegate(NewPolicyMatchSeverity(Emergency, Debug, Warning)),
true,
},
{
"complex match",
&Action{Severity: Warning, Resource: "foo", Action: "do"},
+1 -1
View File
@@ -265,7 +265,7 @@ func AccessControlActionGrant(props ...*accessControlActionProps) *accessControl
resource: "system:access_control",
action: "grant",
log: "grant",
severity: actionlog.Error,
severity: actionlog.Notice,
}
if len(props) > 0 {
+1 -1
View File
@@ -4,7 +4,7 @@ resource: system:access_control
service: accessControl
# Default sensitivity for actions
defaultActionSeverity: note
defaultActionSeverity: notice
# default severity for errors
defaultErrorSeverity: alert
+4 -4
View File
@@ -395,7 +395,7 @@ func ApplicationActionCreate(props ...*applicationActionProps) *applicationActio
resource: "system:application",
action: "create",
log: "created {application}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -415,7 +415,7 @@ func ApplicationActionUpdate(props ...*applicationActionProps) *applicationActio
resource: "system:application",
action: "update",
log: "updated {application}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -435,7 +435,7 @@ func ApplicationActionDelete(props ...*applicationActionProps) *applicationActio
resource: "system:application",
action: "delete",
log: "deleted {application}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -455,7 +455,7 @@ func ApplicationActionUndelete(props ...*applicationActionProps) *applicationAct
resource: "system:application",
action: "undelete",
log: "undeleted {application}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
+1 -1
View File
@@ -4,7 +4,7 @@ resource: system:application
service: application
# Default sensitivity for actions
defaultActionSeverity: info
defaultActionSeverity: notice
# default severity for errors
defaultErrorSeverity: error
+13 -13
View File
@@ -365,7 +365,7 @@ func AuthActionAuthenticate(props ...*authActionProps) *authAction {
resource: "system:auth",
action: "authenticate",
log: "successfully authenticated with {credentials.kind}",
severity: actionlog.Warning,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -385,7 +385,7 @@ func AuthActionIssueToken(props ...*authActionProps) *authAction {
resource: "system:auth",
action: "issueToken",
log: "token '{credentials.kind}' issued",
severity: actionlog.Warning,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -405,7 +405,7 @@ func AuthActionValidateToken(props ...*authActionProps) *authAction {
resource: "system:auth",
action: "validateToken",
log: "token '{credentials.kind}' validated",
severity: actionlog.Warning,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -425,7 +425,7 @@ func AuthActionChangePassword(props ...*authActionProps) *authAction {
resource: "system:auth",
action: "changePassword",
log: "password changed",
severity: actionlog.Warning,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -445,7 +445,7 @@ func AuthActionInternalSignup(props ...*authActionProps) *authAction {
resource: "system:auth",
action: "internalSignup",
log: "{user.email} signed-up",
severity: actionlog.Warning,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -465,7 +465,7 @@ func AuthActionConfirmEmail(props ...*authActionProps) *authAction {
resource: "system:auth",
action: "confirmEmail",
log: "email {user.email} confirmed",
severity: actionlog.Warning,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -485,7 +485,7 @@ func AuthActionExternalSignup(props ...*authActionProps) *authAction {
resource: "system:auth",
action: "externalSignup",
log: "{user.email} signed-up after successful external authentication via {credentials.kind}",
severity: actionlog.Warning,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -505,7 +505,7 @@ func AuthActionSendEmailConfirmationToken(props ...*authActionProps) *authAction
resource: "system:auth",
action: "sendEmailConfirmationToken",
log: "confirmation notification sent to {email}",
severity: actionlog.Warning,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -525,7 +525,7 @@ func AuthActionSendPasswordResetToken(props ...*authActionProps) *authAction {
resource: "system:auth",
action: "sendPasswordResetToken",
log: "password reset token sent to {email}",
severity: actionlog.Warning,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -545,7 +545,7 @@ func AuthActionExchangePasswordResetToken(props ...*authActionProps) *authAction
resource: "system:auth",
action: "exchangePasswordResetToken",
log: "password reset token exchanged",
severity: actionlog.Warning,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -565,7 +565,7 @@ func AuthActionAutoPromote(props ...*authActionProps) *authAction {
resource: "system:auth",
action: "autoPromote",
log: "auto-promoted to {role}",
severity: actionlog.Warning,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -585,7 +585,7 @@ func AuthActionUpdateCredentials(props ...*authActionProps) *authAction {
resource: "system:auth",
action: "updateCredentials",
log: "credentials {credentials.kind} updated",
severity: actionlog.Warning,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -605,7 +605,7 @@ func AuthActionCreateCredentials(props ...*authActionProps) *authAction {
resource: "system:auth",
action: "createCredentials",
log: "new credentials {credentials.kind} created",
severity: actionlog.Warning,
severity: actionlog.Notice,
}
if len(props) > 0 {
+1 -1
View File
@@ -4,7 +4,7 @@ resource: system:auth
service: auth
# Default sensitivity for actions
defaultActionSeverity: warning
defaultActionSeverity: notice
# default severity for errors
defaultErrorSeverity: alert
+5 -5
View File
@@ -434,7 +434,7 @@ func ReminderActionCreate(props ...*reminderActionProps) *reminderAction {
resource: "system:reminder",
action: "create",
log: "created {reminder}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -454,7 +454,7 @@ func ReminderActionUpdate(props ...*reminderActionProps) *reminderAction {
resource: "system:reminder",
action: "update",
log: "updated {reminder}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -474,7 +474,7 @@ func ReminderActionDelete(props ...*reminderActionProps) *reminderAction {
resource: "system:reminder",
action: "delete",
log: "deleted {reminder}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -494,7 +494,7 @@ func ReminderActionDismiss(props ...*reminderActionProps) *reminderAction {
resource: "system:reminder",
action: "dismiss",
log: "deleted {reminder}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -514,7 +514,7 @@ func ReminderActionSnooze(props ...*reminderActionProps) *reminderAction {
resource: "system:reminder",
action: "snooze",
log: "deleted {reminder}",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
+1 -1
View File
@@ -4,7 +4,7 @@ resource: system:reminder
service: reminder
# Default sensitivity for actions
defaultActionSeverity: info
defaultActionSeverity: notice
# default severity for errors
defaultErrorSeverity: error
+2 -2
View File
@@ -359,7 +359,7 @@ func SinkActionPreprocess(props ...*sinkActionProps) *sinkAction {
resource: "system:sink",
action: "preprocess",
log: "preprocess",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
@@ -379,7 +379,7 @@ func SinkActionRequest(props ...*sinkActionProps) *sinkAction {
resource: "system:sink",
action: "request",
log: "sink request processed",
severity: actionlog.Info,
severity: actionlog.Notice,
}
if len(props) > 0 {
+1 -1
View File
@@ -4,7 +4,7 @@ resource: system:sink
service: sink
# Default sensitivity for actions
defaultActionSeverity: info
defaultActionSeverity: notice
# default severity for errors
defaultErrorSeverity: alert