title: Spring data JPA Checkmarx vulnerability- Improper Resource Access Authorization for @Query annotation
body: <p>We are currently working on web application with persistence layer implemented using Spring data JPA and its working out really well for us however while scanning our code using checkmarx it complains for <strong>"Improper Resource Access Authorization"</strong> error for all input parameter in below code snippet.Not sure how to resolve it.Based of my understanding we tried following approach but that didn't help either  </p>
  
  <ul>
  <li>Whitelist input parameter using using <code>@valid</code> and <code>@Pattern</code> 
  annotations</li>
  <li><p>Secure method using <code>@Secured("ROLE_TEST")</code> annotation of spring security.</p>
  
  <pre><code>@Repository
  public interface EmployeeAddressRepository extends JpaRepository&lt;EmployeeAddress, Integer&gt; {
  
    @Query("select empAdd from EmployeeAddress empAdd where empAdd.Employee.employeeId=?1 and (endDate) ORDER BY empAdd.lastUpdateTimeStamp DESC")
    List&lt;EmployeeAddress&gt; findEmployeeAddressByEmployeeId(String employeeId, LocalDate date) throws PersistenceException;
  }
  </code></pre></li>
  </ul>
  
  <p>Looking forward for any pointer here to move forward in right direction</p>