Added length checking for authorization header
This commit is contained in:
@ -244,6 +244,11 @@ public class RestAPI extends SafeHttpHandler {
|
||||
}
|
||||
|
||||
String[] cerd = new String(Base64.getDecoder().decode(authParts[1])).split(":");
|
||||
if (cerd.length != 2) {
|
||||
text(exchange, 401, "Invalid cerdentials format");
|
||||
return;
|
||||
}
|
||||
|
||||
Profile profile = Database.getProfileByName(cerd[0]);
|
||||
|
||||
if (profile == null || !Profile.generateHash(cerd[1], profile.getSalt()).equals(profile.getPassword())) {
|
||||
|
||||
Reference in New Issue
Block a user