elsa-core/test/unit/Elsa.Bpmn.Interchange.UnitTests
Sipke Schoorstra 933d1739bd
fix(bpmn): refuse documents with duplicate element ids before recursion (#8080)
* fix(bpmn): refuse documents with duplicate element ids before recursion

A subProcess nested inside another subProcess with the same id made
EnsureCapabilitiesSatisfied, BpmnWorkBinder.BindScope and the interchange
library's own BpmnXmlWriter recurse without terminating, overflowing the
stack and killing the process (.NET cannot catch StackOverflowException).
Refuse such a document up front, coded bpmn.import.duplicate-element-id
(422), on POST bpmn/import and PUT bpmn/definitions/{id}/document, listing
the duplicated ids.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(bpmn): include process ids in the duplicate-id check

EnsureElementIdsUnique only pooled element ids, never a process
definition's own ProcessId. A top-level process's id is never one of
its own elements, so a subprocess reusing its parent's id (or two
top-level processes sharing an id) went undetected and still
overflowed the stack in EnsureCapabilitiesSatisfied, BpmnWorkBinder
and BpmnXmlWriter the same way a repeated element id does. Add every
top-level process's own id to the pool; a nested process definition's
own id needs no equivalent addition since it is always exactly the
element id that opens it, already counted once via its owner's
elements.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-12 11:26:07 -07:00
..
BpmnErrorResponseMappingTests.cs fix(bpmn): refuse documents with duplicate element ids before recursion (#8080) 2026-09-12 11:26:07 -07:00
BpmnInterchangeDocumentServiceCapabilityTests.cs feat(bpmn): interchange endpoints (analyze, import, export) (#7954) 2026-08-18 05:20:42 +02:00
BpmnInterchangeDocumentServiceDuplicateElementIdTests.cs fix(bpmn): refuse documents with duplicate element ids before recursion (#8080) 2026-09-12 11:26:07 -07:00
BpmnInterchangeFeatureTests.cs feat(bpmn): scaffold Elsa.Bpmn and Elsa.Bpmn.Interchange modules (#7938) 2026-08-13 01:17:46 +02:00
BpmnInterchangeWiringTests.cs feat(bpmn): scaffold Elsa.Bpmn and Elsa.Bpmn.Interchange modules (#7938) 2026-08-13 01:17:46 +02:00
BpmnLibraryDuplicationGuardTests.cs feat(bpmn): the work binder and the elsa: binding format (#7946) 2026-08-14 17:38:03 +02:00
Elsa.Bpmn.Interchange.UnitTests.csproj feat(bpmn): scaffold Elsa.Bpmn and Elsa.Bpmn.Interchange modules (#7938) 2026-08-13 01:17:46 +02:00