Skip to content
Snippets Groups Projects
Commit 3db4cf50 authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Fix security vulnerability in account management API

parent 9c210c10
No related merge requests found
......@@ -95,7 +95,7 @@ public class UserController extends AbstractController {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
}
@RequestMapping(value = { "/{username}" }, method = RequestMethod.DELETE)
@RequestMapping(value = { "/{username}/" }, method = RequestMethod.DELETE)
public final void activate(
@PathVariable final String username,
final HttpServletRequest request,
......
......@@ -408,7 +408,7 @@ public class UserService implements IUserService {
public DbUser deleteDbUser(String username) {
User user = getCurrentUser();
if (!user.getUsername().equals(username)
&& SecurityContextHolder.getContext().getAuthentication().getAuthorities()
&& !SecurityContextHolder.getContext().getAuthentication().getAuthorities()
.contains(new SimpleGrantedAuthority("ROLE_ADMIN"))) {
throw new UnauthorizedException();
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment