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.19k stars 73 forks source link

NullPointerException for getSchema() #16

Closed dehehe-mirai closed 3 years ago

dehehe-mirai commented 3 years ago

version: v6.0.5 running environments: Windows 10(64bit)

openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

command: cats --contract=ghes-2.22.yaml --server=https://api.github.com --paths="/user/repos" --headers=header_github.yml where cats is just java -jar (path)\cats.jar %* error message:


             _____   ___ _____ _____
            /  __ \ / _ \_   _/  ___|
            | /  \// /_\ \| | \ `--.
            | |    |  _  || |  `--. \
            | \__/\| | | || | /\__/ /
             \____/\_| |_/\_/ \____/
           .. ...    -.-. --- --- .-..

[********* ][*****]  note     Proxy configuration to be used: DIRECT
[********* ][*****]  start    Starting CATS, version 6.0.5, build-time 2021-08-30T05:50:13.55 UTC
[********* ][*****]  note     Processing configuration...
[********* ][*****] ? info     No security custom Fuzzer file. SecurityFuzzer will be skipped!
[********* ][*****] ? info     No custom Fuzzer file. CustomFuzzer will be skipped!
[********* ][*****] ? info     No reference data file was supplied! Payloads supplied by Fuzzers will remain unchanged!
[********* ][*****] ? info     No URL parameters supplied!
[********* ][*****]  start    skipXXXForPath supplied arguments: []. Matching with registered fuzzers...
[********* ][*****] ? complete skipXXXForPath list after matching with registered fuzzers: []
[********* ][*****] ? info
[********* ][*****] ? info     Supplied arguments
[********* ][*****] ? info     contract: ghes-2.22.yaml
[********* ][*****] ? info     server: https://api.github.com
[********* ][*****] ? info     maxRequestsPerMinute: empty
[********* ][*****] ? info     fuzzers: all
[********* ][*****] ? info     paths: /user/repos
[********* ][*****] ? info     skipPaths: empty
[********* ][*****] ? info     excludedFuzzers: empty
[********* ][*****] ? info     skipXXXForPath: []
[********* ][*****] ? info     skipFields: empty
[********* ][*****] ? info     httpMethods: empty
[********* ][*****] ? info     checkHeaders: false
[********* ][*****] ? info     checkFields: false
[********* ][*****] ? info     checkHttp: false
[********* ][*****] ? info     checkContract: false
[********* ][*****] ? info     fieldsFuzzingStrategy: ONEBYONE
[********* ][*****] ? info     maxFieldsToRemove: empty
[********* ][*****] ? info     edgeSpacesStrategy: trimAndValidate
[********* ][*****] ? info     sanitizationStrategy: sanitizeAndValidate
[********* ][*****] ? info     useExamples: true
[********* ][*****] ? info     reportingLevel: info
[********* ][*****] ? info     log: empty
[********* ][*****] ? info     printExecutionStatistics: false
[********* ][*****] ? info     timestampReports: empty
[********* ][*****] ? info     reportFormat: htmlJs
[********* ][*****] ? info     urlParams: empty
[********* ][*****] ? info     headers: header_github.yml
[********* ][*****] ? info     refData: empty
[********* ][*****] ? info     customFuzzerFile: empty
[********* ][*****] ? info     securityFuzzerFile: empty
[********* ][*****] ? info     proxyPort: 0
[********* ][*****] ? info     proxyHost: empty
[********* ][*****] ? info     sslKeystore: empty
[********* ][*****] ? info     sslKeystorePwd: empty
[********* ][*****] ? info     sslKeyPwd: empty
[********* ][*****] ? info     basicauth: empty
[********* ][*****] ? complete Finished parsing the contract in 1074 ms
[
(...)
[********* ][*****]  skipping Skipping path /user/projects
[********* ][*****]  skipping Skipping path /user/public_emails
[********* ][*****] ? error    Something went wrong while running CATS!
java.lang.NullPointerException: null
        at com.endava.cats.CatsMain.addToSchemas(CatsMain.java:131)
        at com.endava.cats.CatsMain.lambda$getSchemas$1(CatsMain.java:115)
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
        at com.endava.cats.CatsMain.getSchemas(CatsMain.java:115)
        at com.endava.cats.CatsMain.fuzzPath(CatsMain.java:360)
        at com.endava.cats.CatsMain.startFuzzing(CatsMain.java:180)
        at com.endava.cats.CatsMain.doLogic(CatsMain.java:171)
        at com.endava.cats.CatsMain.run(CatsMain.java:149)
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:791)
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:775)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:345)
        at com.endava.cats.CatsMain.main(CatsMain.java:102)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
        at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:467)

spec file:https://github.com/github/rest-api-description/blob/main/descriptions/ghes-2.22/ghes-2.22.yaml header file:

all:
  Authorization: token (personal token)

I've tried with --paths="/user/repo", then it runs successfuly with all skipped.

en-milie commented 3 years ago

This is now fixed and will be released in 6.0.6.

en-milie commented 3 years ago

Fixed in 6.0.6