ZAP fails to import recursive OpenAPI definitions
See original GitHub issueDescribe the bug
When attempting to import an OAS definition which happens to have recursions, it causes a stack overflow in ZAP, and the import fails.
Steps to reproduce the behavior
- Create an OAS, that contains some recursions. e.g.:
1 {
2 "components": {
[...]
307 "schemas": {
[...]
1730 "SystemProfileNestedObject": {
1731 "additionalProperties": {
1732 "oneOf": [
1733 {
1734 "$ref":
"#/components/schemas/SystemProfileNestedObject"
1738 },
[...]
- Load it in ZAP ( “import” -> “Import an OpenAPI definition…”
- Select the API you have created earlier, and click ‘Import’
- … nothing happens
Expected behavior
Recursion should not prevent the OAS to be imported.
Software versions
ZAP 2.11.1
Screenshots
No response
Errors from the zap.log file
2022-06-13 16:30:01,587 [ZAP-ProxyThread-78] ERROR UncaughtExceptionLogger - Exception in thread "ZAP-ProxyThread-78"
java.lang.StackOverflowError: null
at io.swagger.v3.parser.util.ResolverFully.resolveSchema(ResolverFully.java:413) ~[?:?]
at io.swagger.v3.parser.util.ResolverFully.resolveSchema(ResolverFully.java:350) ~[?:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
at io.swagger.v3.parser.util.ResolverFully.resolveSchema(ResolverFully.java:413) ~[?:?]
at io.swagger.v3.parser.util.ResolverFully.resolveSchema(ResolverFully.java:350) ~[?:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
at io.swagger.v3.parser.util.ResolverFully.resolveSchema(ResolverFully.java:413) ~[?:?]
at io.swagger.v3.parser.util.ResolverFully.resolveSchema(ResolverFully.java:350) ~[?:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
at io.swagger.v3.parser.util.ResolverFully.resolveSchema(ResolverFully.java:413) ~[?:?]
at io.swagger.v3.parser.util.ResolverFully.resolveSchema(ResolverFully.java:350) ~[?:?]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
at io.swagger.v3.parser.util.ResolverFully.resolveSchema(ResolverFully.java:413) ~[?:?]
at io.swagger.v3.parser.util.ResolverFully.resolveSchema(ResolverFully.java:350) ~[?:?]
[...]
Additional context
No response
Would you like to help fix this issue?
- Yes
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Problem importing OpenAPI definition file ... - Google Groups
I'm trying to import a swagger json file into ZAP using OpenAPI support add-on. The problem I am getting is a StackOverflowError error....
Read more >Zap fails to parse OpenApi definition LongProperty cannot be ...
I am importing a swagger OpenApi v2 export .json with full endpoint descriptions. I am importing this in ZAP to scan api endpoints....
Read more >Automated Pen Testing With ZAP CLI - mydeveloperplanet.com
Execute the automated scan;; Inspect the results. Beware that an automated scan will not find all vulnerabilities! It is always necessary to ...
Read more >Artifactory REST API - JFrog - JFrog Documentation
"failFast" : true // fail and abort the operation upon receiving an error. ... If the artifact is a folder, then recursively calculates...
Read more >October 2020 ~ Ozkary
With the evolution of Web tooling and Cloud computing, we can continue to use SOAP APIs by importing a WSDL definition and creating...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Reported to Swagger : https://github.com/swagger-api/swagger-parser/issues/1751
The stack overflow still happens with the latest version (tested in isolation and with ZAP).