Skip to content

Commit bf2633d

Browse files
authored
Limit task actions to 10 (#1964)
1 parent 3e3a561 commit bf2633d

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

server/api/graphql_root_playbook.go

+4
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,10 @@ func validateUpdateTaskActions(checklists []UpdateChecklist) error {
531531
for _, checklist := range checklists {
532532
for _, item := range checklist.Items {
533533
if taskActions := item.TaskActions; taskActions != nil {
534+
// Limit task actions to 10
535+
if len(*taskActions) > 10 {
536+
return errors.Errorf("playbook cannot have more than 10 task actions")
537+
}
534538
for _, ta := range *taskActions {
535539
if err := app.ValidateTrigger(ta.Trigger); err != nil {
536540
return err

server/api/playbooks.go

+5
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,11 @@ func validatePreAssignment(pb app.Playbook) error {
264264
// validateTaskActions validates the taskactions in the given checklist
265265
// NOTE: Any changes to this function must be made to function 'validateUpdateTaskActions' for the GraphQL endpoint.
266266
func validateTaskActions(taskActions []app.TaskAction) error {
267+
// Limit task actions to 10
268+
if len(taskActions) > 10 {
269+
return errors.Errorf("playbook cannot have more than 10 task actions")
270+
}
271+
267272
for _, ta := range taskActions {
268273
if err := app.ValidateTrigger(ta.Trigger); err != nil {
269274
return err

0 commit comments

Comments
 (0)