mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:07:30 +00:00
fix: actions v2 circular check for includes (#7563)
Add a check for circular includes in action v2 executions, so that no self-includes or infinite loops can happen. Closes #7445 ### Definition of Ready - [x] I am happy with the code - [x] Short description of the feature/issue is added in the pr description - [x] PR is linked to the corresponding user story - [x] Acceptance criteria are met - [x] All open todos and follow ups are defined in a new ticket and justified - [x] Deviations from the acceptance criteria and design are agreed with the PO and documented. - [x] No debug or dead code - [x] My code has no repetitions - [x] Critical parts are tested automatically - [x] Where possible E2E tests are implemented - [x] Documentation/examples are up-to-date - [x] All non-functional requirements are met - [x] Functionality of the acceptance criteria is checked manually on the dev system. --------- Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package command
|
||||
import (
|
||||
"slices"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/domain"
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
"github.com/zitadel/zitadel/internal/repository/execution"
|
||||
)
|
||||
@@ -15,6 +16,16 @@ type ExecutionWriteModel struct {
|
||||
ExecutionTargets []*execution.Target
|
||||
}
|
||||
|
||||
func (e *ExecutionWriteModel) IncludeList() []string {
|
||||
includes := make([]string, 0)
|
||||
for i := range e.ExecutionTargets {
|
||||
if e.ExecutionTargets[i].Type == domain.ExecutionTargetTypeInclude {
|
||||
includes = append(includes, e.ExecutionTargets[i].Target)
|
||||
}
|
||||
}
|
||||
return includes
|
||||
}
|
||||
|
||||
func (e *ExecutionWriteModel) Exists() bool {
|
||||
return len(e.ExecutionTargets) > 0 || len(e.Includes) > 0 || len(e.Targets) > 0
|
||||
}
|
||||
|
Reference in New Issue
Block a user