getAuthority()上AuthorizationService中的SonarQube警告>> [

问题描述 投票:0回答:1
我有一个Spring Boot应用程序,并且在调用getAuthority()的行上的方法上收到以下SonarQube警告。我该如何解决?

控制权限对安全性敏感。在过去,它导致了以下漏洞:

  • @Service public class AuthorizationService implements UserDetailsService { @Autowired private MRepository mRepository; public UserDetails loadUserByUsername(String userId) { MEntity user = mRepository.findByName(userId); if (user == null) { throw new UsernameNotFoundException("Invalid username or password."); } return new User(user.getName(), user.getPassword(), getAuthority()); } private List<SimpleGrantedAuthority> getAuthority() { //here i get the warning return Arrays.asList(new SimpleGrantedAuthority("ROLE_ADMIN")); }
  • 我有一个Spring Boot应用程序,并且在调用getAuthority()的行上的方法上收到以下SonarQube警告。我该如何解决?控制权限是安全性...
    java spring spring-security oauth-2.0 sonarqube
    1个回答
    0
    投票
    较新版本的SonarQube不仅为您提供代码味道,问题和错误警告,而且还为您提供安全热点。这些并不是您的代码本身的问题。
    © www.soinside.com 2019 - 2024. All rights reserved.