java-topology/defects/tomcat/patch/tomcat-diamond-recursion-CLEAN.md
russell@unturf.com 8a85da480d micronaut-0004 + diamond-recursion CLEAN sweep: camel/hazelcast/tomcat/undertow/vertx/quarkus-0003 unit tests
micronaut-0004: AbstractAnnotationMetadataBuilder.processAnnotation O(2^D) diamond recursion
in meta-annotation stereotype traversal. isProcessed() guard tracks only current-path ancestors,
not globally visited nodes — diamond meta-annotation hierarchies cause exponential re-visits
of shared base annotations (e.g. @Transactional + @Retryable both extend @InterceptorBinding).
13x at D=8, 41x at D=10. 10/10 unit tests PASS.

quarkus-0003 unit tests: added to QuarkusTest.java for the existing quarkus-0003
BeanDeployment.recursiveBuild diamond defect. 9/9 PASS.

CLEAN markers: camel, hazelcast, tomcat, undertow, vertx — no diamond recursion pattern found.
Hazelcast uses proper Tarjan algorithm. Tomcat uses iterative constraint propagation.
2026-03-29 17:21:51 -04:00

20 lines
1 KiB
Markdown

# Tomcat — Diamond Recursion (CWE-407 O(2^D)) Scan: CLEAN
**Pattern:** Recursive cycle-detection / dependency traversal without a visited set
(exponential re-visitation on diamond-shaped DAGs)
**Scan date:** 2026-03-29
**Scope:** `java/org/apache/catalina/`, `java/org/apache/tomcat/util/descriptor/web/`
## Methods Checked
| Method | Location | Guard | Result |
|--------|----------|-------|--------|
| `WebXml` fragment ordering (`before`/`after`) | `WebXml.java` | Servlet-spec ordering uses constraint propagation, not recursive graph traversal | CLEAN |
| `ContextConfig` lifecycle | `ContextConfig.java` | No recursive dependency cycle detection found | CLEAN |
| Connector/Mapper initialization | Previously scanned | No recursive traversal | CLEAN (see `tomcat-CLEAN-connectorandmapper.md`) |
## Conclusion
Tomcat's web-fragment ordering algorithm (servlet specification section 8.2.2) propagates
`before`/`after` constraints iteratively rather than recursively traversing a dependency graph.
No diamond-recursion pattern was found.