mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(api): make api key check case insensitive
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user