Skip to content

Commit

Permalink
fix: block global API token from /user
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Jun 14, 2024
1 parent dd029c3 commit 7cc042a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/api/src/middlewares/auth/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export function isRouteDisabled(options: Pick<Options, "req">) {
const url = options.req.originalUrl.toLowerCase();
const requestMethod = options.req.method as Method;

const route = DISABLED_API_TOKEN_ROUTES.find(([r]) => url.endsWith(r));
const route = DISABLED_API_TOKEN_ROUTES.find(([pathname]) => {
const urlPathname = new URL(url, "https://example.com").pathname.toLowerCase();
return urlPathname.endsWith(pathname.toLowerCase());
});

if (route) {
const [, methods] = route;
Expand Down

0 comments on commit 7cc042a

Please sign in to comment.