Endava / cats

CATS is a REST API Fuzzer and negative testing tool for OpenAPI endpoints. CATS automatically generates, runs and reports tests with minimum configuration and no coding effort. Tests are self-healing and do not require maintenance.
Apache License 2.0
1.11k stars 76 forks source link

Error when liniting file `com.jayway.jsonpath.PathNotFoundException` #87

Closed qarmin closed 7 months ago

qarmin commented 7 months ago

Describe the bug When trying to lint fastapi openapi file, I'm having this error (key is different each time)

./cats lint --contract=/home/rafal/Pobrane/openapi.json

[******][*******] ▶ Starting cats-10.0.0, build time 2023-11-06T16:17:48Z UTC, platform Linux-6.2.0-36-generic-amd64 
[******][*******] ⚙ OpenAPI specs: /home/rafal/Pobrane/openapi.json 
[******][*******] ⚙ API base url: empty 
[******][*******] ⚙ Reporting path: cats-report 
[******][*******] ⚙ 9 configured fuzzers out of 122 total fuzzers 
[******][*******] ⚙ 28 configured paths out of 28 total OpenAPI paths 
[******][*******] ⚙ HTTP methods in scope: [POST, PUT, GET, TRACE, DELETE, PATCH, HEAD] 
[******][*******] ⚙ Total number of OpenAPI operations: 34 

====================================================================================================== FUZZING ======================================================================================================
com.jayway.jsonpath.PathNotFoundException: No results for Key locANY_OF#BTABROZPA found in map!

I cannot provide openapi file, but it is 3.0.3 version from fastapi 0.92.0 and 0.104.1(tested both versions, but without success - openapi-fuzzer works only with second version)

I tested this also on openapi 3.0.3 in rust code(actix + utoipa) and there everything worked fine

Expected behaviour Fuzzing/Linting should run

Environment: Ubuntu 22.04 Cats downloaded from release page

cats-10.0.0, build time 2023-11-06T16:17:48Z UTC, platform Linux-6.2.0-36-generic-amd64
en-milie commented 7 months ago

Hi @qarmin. Would you please check if this is reproducible with: https://github.com/Endava/cats/releases/tag/cats-10.1.0?

qarmin commented 7 months ago

First problem was fixed, but now I see this error

java.lang.IllegalArgumentException: count is negative: -1
    at java.base@20.0.2/java.lang.String.repeat(String.java:4427)
    at com.endava.cats.util.ConsoleUtils.renderRow(ConsoleUtils.java:65)
    at com.endava.cats.util.ConsoleUtils.renderSameRow(ConsoleUtils.java:52)
    at com.endava.cats.report.TestCaseListener.notifySummaryObservers(TestCaseListener.java:194)
    at com.endava.cats.report.TestCaseListener_Subclass.notifySummaryObservers$$superforward(Unknown Source)
    at com.endava.cats.report.TestCaseListener_Subclass$$function$$16.apply(Unknown Source)
    at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:73)
    at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:62)
    at com.endava.cats.aop.DryRunAspect.intercept(DryRunAspect.java:116)
    at com.endava.cats.aop.DryRunAspect_Bean.intercept(Unknown Source)
    at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
    at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:30)
    at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:27)
    at com.endava.cats.report.TestCaseListener_Subclass.notifySummaryObservers(Unknown Source)
    at com.endava.cats.report.TestCaseListener.afterFuzz(TestCaseListener.java:110)
    at com.endava.cats.report.TestCaseListener_Subclass.afterFuzz$$superforward(Unknown Source)
    at com.endava.cats.report.TestCaseListener_Subclass$$function$$10.apply(Unknown Source)
    at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:73)
    at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:62)
    at com.endava.cats.aop.DryRunAspect.intercept(DryRunAspect.java:116)
    at com.endava.cats.aop.DryRunAspect_Bean.intercept(Unknown Source)
    at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
    at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:30)
    at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:27)
    at com.endava.cats.report.TestCaseListener_Subclass.afterFuzz(Unknown Source)
    at com.endava.cats.report.TestCaseListener_ClientProxy.afterFuzz(Unknown Source)
    at com.endava.cats.command.CatsCommand.lambda$runFuzzers$8(CatsCommand.java:364)
    at java.base@20.0.2/java.util.ArrayList.forEach(ArrayList.java:1511)
    at com.endava.cats.command.CatsCommand.runFuzzers(CatsCommand.java:359)
    at com.endava.cats.command.CatsCommand.fuzzPath(CatsCommand.java:349)
    at com.endava.cats.command.CatsCommand.startFuzzing(CatsCommand.java:265)
    at com.endava.cats.command.CatsCommand.doLogic(CatsCommand.java:208)
    at com.endava.cats.command.CatsCommand.run(CatsCommand.java:152)
    at com.endava.cats.command.LintCommand.run(LintCommand.java:57)
    at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
    at picocli.CommandLine.access$1500(CommandLine.java:148)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
    at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
    at picocli.CommandLine.execute(CommandLine.java:2170)
    at com.endava.cats.CatsMain.run(CatsMain.java:39)
    at com.endava.cats.CatsMain_ClientProxy.run(Unknown Source)
    at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:132)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
    at io.quarkus.runner.GeneratedMain.main(Unknown Source)
en-milie commented 7 months ago

Would it be possible to paste some logs when running with: --verbosity detailed -D?

qarmin commented 7 months ago

I cannot reproduce now problem, looks that this happened only once, but I will create new issue when it will happen again