OpenAPITools / OpenAPITools/openapi-generator

[BUG][JAVA] Coverity giving High risk severity issue in ApiClient code - Filesystem path, filename, or URI manipulation

Open
#15,799 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

Coverity code analysis tool is raising the security issue of type Filesystem path, filename, or URI manipulation in the ApiClient code.

  1. Calling "deserialize". This call uses "response" for sensitive computation. (The virtual call resolves to "client.api.ApiClient.deserialize(jakarta.ws.rs.core.Response, jakarta.ws.rs.core.GenericType)".)
Impacted code
public <T> ApiResponse<T> invokeAPI(...) {
    [...]

    if (statusCode == Status.NO_CONTENT.getStatusCode()) {
        return new ApiResponse<T>(statusCode, responseHeaders);
    } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) {
        if (returnType == null) {
            return new ApiResponse<T>(statusCode, responseHeaders);
        } else {
            return new ApiResponse<T>(statusCode, responseHeaders, deserialize(response, returnType));
        }
    } else {
    
    [...]
}

The issue is raised on this specific line :

return new ApiResponse<T>(statusCode, responseHeaders, deserialize(response, returnType));

Is there any way to fix or to avoid this issue ?

openapi-generator version

openapi-generator-maven-plugin, version 6.6.0

Generation Details

Java generator, using jersey3 as library

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Java jersey3 ApiClient.invokeAPI path around the deserialize(response, returnType) call and review how Coverity interprets that flow. Reproduce the finding with openapi-generator-maven-plugin version 6.6.0, then validate that the generated client still behaves correctly and the reported filesystem path, filename, or URI manipulation issue is resolved or appropriately addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.