Explorar el Código

chore(core): Properly polynomial regex vulnerability

Michael Bromley hace 4 años
padre
commit
74250eaa12
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      packages/core/src/api/common/extract-session-token.ts

+ 1 - 1
packages/core/src/api/common/extract-session-token.ts

@@ -35,7 +35,7 @@ function getFromCookie(req: Request): string | undefined {
 function getFromHeader(req: Request): string | undefined {
     const authHeader = req.get('Authorization');
     if (authHeader) {
-        const matches = authHeader.match(/bearer\s(.+)$/i);
+        const matches = authHeader.trim().match(/^bearer\s(.+)$/i);
         if (matches) {
             return matches[1];
         }