Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ai.go
Original file line number Diff line number Diff line change
Expand Up @@ -3236,6 +3236,8 @@ func expandShuffleApps(authHeader string, foundApp WorkflowApp, apps []WorkflowA
fmt.Sprintf("/apps"),
user.ActiveOrg.Id,
true,
"LOW",
"ai",
)

if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions db-connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 5 additions & 1 deletion notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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 := ""
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 2 additions & 0 deletions oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
22 changes: 21 additions & 1 deletion shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,7 @@
if user.Role != "admin" {
log.Printf("[WARNING] Need to be admin to add appauth group")
resp.WriteHeader(401)
resp.Write([]byte(`{"success": false}`))

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

Sensitive data returned by an access to apikey
flows to a logging call.
return
}

Expand Down Expand Up @@ -3336,7 +3336,7 @@
// 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
}

Expand Down Expand Up @@ -8900,6 +8900,8 @@
fmt.Sprintf("/workflows/%s", workflow.ID),
user.ActiveOrg.Id,
true,
"MEDIUM",
"git",
)

if err != nil {
Expand Down Expand Up @@ -16769,6 +16771,8 @@
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++
Expand Down Expand Up @@ -16806,6 +16810,8 @@
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++
Expand Down Expand Up @@ -16848,6 +16854,8 @@
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++
Expand Down Expand Up @@ -17269,6 +17277,8 @@
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++
Expand All @@ -17295,6 +17305,8 @@
fmt.Sprintf("/workflows/%s?execution_id=%s&node=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId, actionResult.Action.ID),
workflowExecution.ExecutionOrg,
true,
"CRITICAL",
"app_error",
)
}
}
Expand Down Expand Up @@ -25646,6 +25658,8 @@
fmt.Sprintf("/workflows/%s?execution_id=%s", workflowExecution.Workflow.ID, workflowExecution.ExecutionId),
workflowExecution.ExecutionOrg,
true,
"MEDIUM",
"KMS_DECRYPT_FAILURE",
)
}
}
Expand Down Expand Up @@ -25825,6 +25839,8 @@
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))
Expand Down Expand Up @@ -25977,6 +25993,8 @@
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
Expand Down Expand Up @@ -26077,6 +26095,8 @@
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
Expand Down
3 changes: 3 additions & 0 deletions structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading