Details
-
Bug
-
Status: Closed (View Workflow)
-
P3
-
Resolution: Done
-
None
-
None
-
None
-
-
Core: Platform
Description
If a request has a malformed Bearer Authorization header, the system will evaluate it to null and throws Null Pointer exception when trying to comparing null with x-okapi-token, which will return 500 to client. Ideally 4xx should be returned.
String authToken = extractToken(authHeader); if(authToken.equals(okapiTokenHeader)) { ... public String extractToken(String authorizationHeader) { Pattern pattern = null; Matcher matcher = null; String authToken = null; if(authorizationHeader == null) { return null; } pattern = Pattern.compile("Bearer\\s+(.+)"); // Grab anything after 'Bearer' and whitespace matcher = pattern.matcher(authorizationHeader); if(matcher.find() && matcher.groupCount() > 0) { return matcher.group(1); } return null; }
TestRail: Results
Attachments
Issue Links
- relates to
-
MODAT-50 Does not pass X-Okapi-Request-Id
-
- Closed
-