default deny empty downstream key exposure

This commit is contained in:
cita
2026-03-20 00:22:17 +08:00
parent ee6eeaddeb
commit 5403a946c6
9 changed files with 311 additions and 22 deletions
@@ -234,7 +234,7 @@ export async function isModelAllowedByPolicyOrAllowedRoutes(model: string, polic
const hasPatternRules = patterns.length > 0;
const hasRouteRules = allowedRouteIds.length > 0;
if (!hasPatternRules && !hasRouteRules) return true;
if (!hasPatternRules && !hasRouteRules) return false;
if (hasPatternRules && patterns.some((pattern) => matchesDownstreamModelPattern(model, pattern))) {
return true;