fix(security): require auth for /v1/models when management auth is configured (#9320)

This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-08-04 21:36:41 -03:00
committed by GitHub
parent 7e55abbc41
commit b07182c72a
3 changed files with 103 additions and 1 deletions

View File

@@ -14,7 +14,9 @@ export async function getModelCatalogAuthRejection(
settings: Record<string, any>,
headers: Record<string, string>
): Promise<Response | null> {
if (settings.requireAuthForModels !== true || !(await isAuthRequired(request))) return null;
const authRequired = await isAuthRequired(request);
if (!authRequired) return null;
if (settings.requireAuthForModels === false) return null;
const apiKey = extractApiKey(request);
if (apiKey) {