Skip to content

Commit

Permalink
add auth token check to rate limiter
Browse files Browse the repository at this point in the history
  • Loading branch information
gowthamsundaresan committed Nov 6, 2024
1 parent a6f0089 commit 025fec9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/api/src/utils/authMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ export const rateLimiter = async (req: Request, res: Response, next: NextFunctio
await refreshStore()
}

const accessLevel: number = authStore.get(`apiToken:${apiToken}:accessLevel`) ?? 0
const accessLevel: number =
process.env.EE_AUTH_TOKEN === apiToken
? 999
: authStore.get(`apiToken:${apiToken}:accessLevel`) ?? 0
req.accessLevel = accessLevel // Access this in route functions to impose limits

switch (accessLevel) {
Expand Down

0 comments on commit 025fec9

Please sign in to comment.