Skip to content

Commit

Permalink
handle maformed auth header more gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
plasticviking committed Nov 27, 2023
1 parent 882996c commit e83ad5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/src/utils/auth-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ export const authenticate = async (req: InvasivesRequest) => {

MDC.additionalContext.isPublicURL = isPublicURL;

let token;
let token: string;

try {
token = authHeader.split(/\s/)[1];
} catch (error) {
defaultLog.info({ label: 'authenticate', message: 'malformed auth token received' });

throw {
code: 401,
code: 400,
message: 'Authorization header parse failure',
namespace: 'auth-utils'
};
Expand Down

0 comments on commit e83ad5c

Please sign in to comment.