fix(api): make api key check case insensitive

This commit is contained in:
Waleed Latif
2025-03-03 23:56:07 -08:00
parent 39b3c61d3c
commit 2472e28f85
+8 -2
View File
@@ -33,8 +33,14 @@ export async function validateWorkflowAccess(
}
// API key authentication
const apiKey =
request.headers.get('x-api-key') || request.nextUrl.searchParams.get('X-API-KEY')
let apiKey = null
for (const [key, value] of request.headers.entries()) {
if (key.toLowerCase() === 'x-api-key' && value) {
apiKey = value
break
}
}
if (!apiKey || !workflow.apiKey || apiKey !== workflow.apiKey) {
return {
error: {