Improper Resource Access Authorization error in checkmarx when reading a property

2.4k views Asked by At

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");
}
1

There are 1 answers

0
din_oops On BEST ANSWER

Resolved the issue like this

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