Skip to content

Commit 932aef3

Browse files
committed
fix(admin): validate userId and email are strings
1 parent aed0766 commit 932aef3

File tree

1 file changed

+8
-0
lines changed
  • apps/sim/app/api/v1/admin/credits

1 file changed

+8
-0
lines changed

apps/sim/app/api/v1/admin/credits/route.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ export const POST = withAdminAuth(async (request) => {
5151
return badRequestResponse('Either userId or email is required')
5252
}
5353

54+
if (userId && typeof userId !== 'string') {
55+
return badRequestResponse('userId must be a string')
56+
}
57+
58+
if (email && typeof email !== 'string') {
59+
return badRequestResponse('email must be a string')
60+
}
61+
5462
if (typeof amount !== 'number' || !Number.isFinite(amount) || amount <= 0) {
5563
return badRequestResponse('amount must be a positive number')
5664
}

0 commit comments

Comments
 (0)