mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-29 07:49:14 +01:00
[proxy] Exempt non-inference endpoints from the model allowlist gate
GET /v1/models carries no model, and management's per-model allowlist fails closed on an undetermined one, so gateway model discovery denied with model_blocked for every account that enables a model allowlist. The client treats a failed discovery as silent and falls back to its built-in list, so the operator sees an empty picker with no error to chase. The router already classifies these paths and authorises the route against the caller's groups before allowing them, so mark them non-inference there and let the limits gate skip a pre-flight that has no model to evaluate and no tokens to book. The marker comes from the router's own path classification, never from client input, so an inference request cannot set it to escape the allowlist.
This commit is contained in:
@@ -84,6 +84,15 @@ func (m *Middleware) Invoke(ctx context.Context, in *middleware.Input) (*middlew
|
||||
return allowNoAttribution(), nil
|
||||
}
|
||||
|
||||
// Model-listing and other non-inference endpoints carry no model, and
|
||||
// management's per-model allowlist fails closed on an empty one. The
|
||||
// router has already authorised the route against the caller's groups
|
||||
// and the request consumes no tokens, so gating it on a model that
|
||||
// cannot exist would only break gateway model discovery.
|
||||
if lookupKV(in.Metadata, middleware.KeyLLMNonInference) == "true" {
|
||||
return allowNoAttribution(), nil
|
||||
}
|
||||
|
||||
providerID := lookupKV(in.Metadata, middleware.KeyLLMResolvedProviderID)
|
||||
if providerID == "" {
|
||||
// llm_router didn't emit a resolved provider id — usually
|
||||
|
||||
Reference in New Issue
Block a user