Search code examples
javahttpservicerequestcoverity

Tainted_source JAVA


I analyzed the code of some services in java with Coverity and they throw the following security problems in the controller: "tainted_source: entering this function as a framework entry point. parameter bodyparams is tainted because it comes from an http request." What is the correct way to deal with this type of parameter?

enter image description here


Solution

  • The output shown in your question is only one portion of the complete finding. It shows why service_id is considered to be "tainted" (i.e., under potential control of an attacker), but does not show what happens to the tainted data, and hence we can't know what the code is trying to do or how to fix it.

    In the Coverity GUI there is an "events panel" in the lower-right corner that can be used to navigate to the rest of the finding. By clicking on the events in that panel you should be able to see what happens to service_id, and there is sometimes a recommendation from the tool about how to fix it.

    Disclosure: I used to work for Coverity/Synopsys.