javaowaspcheckmarxcheckmark

Improper Resource Access Authorization error in checkmarx when reading a property


Checkmarx report is showing Improper Resource Access Authorization for the following line.

String endPoint=prop.getProperty("endpoint");

As mentioned in this answer, I have added access control check before reading the property. But checkmarx report is still showing the error.

String user="admin";
if(user.equals("admin")) {
    String endPoint=prop.getProperty("endpoint");
}

Solution

  • Resolved the issue like this

     String endPoint=(String)prop.getOrDefault("endpoint", null );