question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ZAP fails to import recursive OpenAPI definitions

See original GitHub issue

Describe 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

  1. 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                         },
[...]
  1. Load it in ZAP ( “import” -> “Import an OpenAPI definition…”
  2. Select the API you have created earlier, and click ‘Import’
  3. … 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:open
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cedricbucommented, Jun 15, 2022
0reactions
thc202commented, Jun 16, 2022

The stack overflow still happens with the latest version (tested in isolation and with ZAP).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found