diff --git a/ai.go b/ai.go index 9cb52906..f9e20e35 100644 --- a/ai.go +++ b/ai.go @@ -3236,6 +3236,8 @@ func expandShuffleApps(authHeader string, foundApp WorkflowApp, apps []WorkflowA fmt.Sprintf("/apps"), user.ActiveOrg.Id, true, + "LOW", + "ai", ) if err != nil { diff --git a/db-connector.go b/db-connector.go index 9b872929..f1b8d7c8 100755 --- a/db-connector.go +++ b/db-connector.go @@ -13514,6 +13514,8 @@ func SetDatastoreKeyBulk(ctx context.Context, allKeys []CacheKeyData) ([]Datasto fmt.Sprintf("/admin?tab=datastore&category=%s", cacheData.Category), cacheData.OrgId, true, + "MEDIUM", + "Datastore_Automation_Error", ) } }(cacheData, automation) @@ -13728,6 +13730,8 @@ func SetDatastoreKey(ctx context.Context, cacheData CacheKeyData) error { fmt.Sprintf("/admin?tab=datastore&category=%s", cacheData.Category), cacheData.OrgId, true, + "MEDIUM", + "Datastore_Automation_Error", ) } }(cacheData, automation) @@ -15564,6 +15568,8 @@ func ValidateFinished(ctx context.Context, extra int, workflowExecution Workflow fmt.Sprintf("/workflows/%s?execution_id=%s&view=executions", workflowExecution.Workflow.ID, workflowExecution.ExecutionId), workflowExecution.ExecutionOrg, true, + "MEDIUM", + "workflow_long_execution", ) if err != nil { diff --git a/notifications.go b/notifications.go index 1240a5f5..5aa5a4d9 100755 --- a/notifications.go +++ b/notifications.go @@ -624,7 +624,7 @@ func forwardNotificationRequest(ctx context.Context, title, description, referen return nil } -func CreateOrgNotification(ctx context.Context, title, description, referenceUrl, orgId string, adminsOnly bool) error { +func CreateOrgNotification(ctx context.Context, title, description, referenceUrl, orgId string, adminsOnly bool, severity string, origin string) error { if len(orgId) == 0 { log.Printf("[ERROR] No org ID provided to create notification '%s'", title) return errors.New("no org ID provided") @@ -728,6 +728,8 @@ func CreateOrgNotification(ctx context.Context, title, description, referenceUrl Read: false, CreatedAt: int64(time.Now().Unix()), UpdatedAt: int64(time.Now().Unix()), + Severity: severity, + Origin: origin, } selectedApikey := "" @@ -1109,6 +1111,8 @@ func HandleCreateNotification(resp http.ResponseWriter, request *http.Request) { notification.ReferenceUrl, orgId, false, + notification.Severity, + notification.Origin, ) DeleteCache(ctx, fmt.Sprintf("%s_%s", "notifications", user.ActiveOrg.Id)) diff --git a/oauth2.go b/oauth2.go index a9b46b94..b6e70da8 100755 --- a/oauth2.go +++ b/oauth2.go @@ -3926,6 +3926,8 @@ func RunOauth2Request(ctx context.Context, user User, appAuth AppAuthenticationS fmt.Sprintf("/admin?admin_tab=notifications"), appAuth.OrgId, true, + "HIGH", + "oauth", ) if newresp.StatusCode >= 300 { diff --git a/shared.go b/shared.go index 6b8ae5d3..365d82d9 100755 --- a/shared.go +++ b/shared.go @@ -3336,7 +3336,7 @@ func HandleApiAuthentication(resp http.ResponseWriter, request *http.Request) (U // Get the user based on APIkey here userdata, err := GetApikey(ctx, apikeyCheck[1]) if err != nil { - //log.Printf("[WARNING] Apikey %s doesn't exist: %s", apikey, err) + log.Printf("[WARNING] Apikey %s doesn't exist: %s", apikey, err) return User{}, err } @@ -8900,6 +8900,8 @@ func SaveWorkflow(resp http.ResponseWriter, request *http.Request) { fmt.Sprintf("/workflows/%s", workflow.ID), user.ActiveOrg.Id, true, + "MEDIUM", + "git", ) if err != nil { @@ -16769,6 +16771,8 @@ func ParsedExecutionResult(ctx context.Context, workflowExecution WorkflowExecut fmt.Sprintf("/workflows/%s?execution_id=%s&view=executions&node=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId, actionResult.Action.ID), workflowExecution.ExecutionOrg, true, + "CRITICAL", + "workflow_execution", ) workflowExecution.NotificationsCreated++ @@ -16806,6 +16810,8 @@ func ParsedExecutionResult(ctx context.Context, workflowExecution WorkflowExecut fmt.Sprintf("/workflows/%s?execution_id=%s&view=executions&node=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId, actionResult.Action.ID), workflowExecution.ExecutionOrg, true, + "CRITICAL", + "liquid_syntax", ) workflowExecution.NotificationsCreated++ @@ -16848,6 +16854,8 @@ func ParsedExecutionResult(ctx context.Context, workflowExecution WorkflowExecut fmt.Sprintf("/workflows/%s?execution_id=%s&view=executions&node=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId, actionResult.Action.ID), workflowExecution.ExecutionOrg, true, + "CRITICAL", + "action_failure", ) workflowExecution.NotificationsCreated++ @@ -17269,6 +17277,8 @@ func ParsedExecutionResult(ctx context.Context, workflowExecution WorkflowExecut fmt.Sprintf("/workflows/%s?execution_id=%s&view=executions&node=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId, actionResult.Action.ID), workflowExecution.ExecutionOrg, true, + "HIGH", + "workflow_silent_failure", ) workflowExecution.NotificationsCreated++ @@ -17295,6 +17305,8 @@ func ParsedExecutionResult(ctx context.Context, workflowExecution WorkflowExecut fmt.Sprintf("/workflows/%s?execution_id=%s&node=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId, actionResult.Action.ID), workflowExecution.ExecutionOrg, true, + "CRITICAL", + "app_error", ) } } @@ -25646,6 +25658,8 @@ func PrepareWorkflowExecution(ctx context.Context, workflow Workflow, request *h fmt.Sprintf("/workflows/%s?execution_id=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId), workflowExecution.ExecutionOrg, true, + "MEDIUM", + "KMS_DECRYPT_FAILURE", ) } } @@ -25825,6 +25839,8 @@ func GetAuthentication(ctx context.Context, workflowExecution WorkflowExecution, fmt.Sprintf("/workflows/%s?execution_id=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId), workflowExecution.ExecutionOrg, true, + "HIGH", + "AUTH_ID_MISSING", ) //return workflowExecution, ExecInfo{}, fmt.Sprintf("App Auth ID %s doesn't exist for app '%s' among %d auth for org ID '%s'. Please re-authenticate the app (1).", action.AuthenticationId, action.AppName, len(allAuths), workflow.ExecutingOrg.Id), errors.New(fmt.Sprintf("App Auth ID %s doesn't exist for app '%s' among %d auth for org ID '%s'. Please re-authenticate the app (2).", action.AuthenticationId, action.AppName, len(allAuths), workflow.ExecutingOrg.Id)) @@ -25977,6 +25993,8 @@ func GetAuthentication(ctx context.Context, workflowExecution WorkflowExecution, fmt.Sprintf("/workflows/%s?execution_id=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId), workflowExecution.ExecutionOrg, true, + "HIGH", + "OAUTH2_REFRESH_FAILURE", ) // Abort the workflow due to auth being bad @@ -26077,6 +26095,8 @@ func GetAuthentication(ctx context.Context, workflowExecution WorkflowExecution, fmt.Sprintf("/workflows/%s?execution_id=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId), workflowExecution.ExecutionOrg, true, + "HIGH", + "OAUTH2_REFRESH_FAILURE", ) // Adding so it can be used to fail the auth naturally with Outlook diff --git a/structs.go b/structs.go index 4addc629..52282dbb 100755 --- a/structs.go +++ b/structs.go @@ -1653,6 +1653,9 @@ type Notification struct { ModifiedBy string `json:"modified_by" datastore:"modified_by"` Ignored bool `json:"ignored" datastore:"ignored"` ExecutionId string `json:"execution_id" datastore:"execution_id"` + + Severity string `json:"severity" datastore:"severity"` + Origin string `json:"origin" datastore:"origin"` } type NotificationCached struct {