Summary
When updating a provider via PUT /providers/{id}, the current implementation allows changing the provider type (e.g., from openai to bedrock) even when models reference that provider via provider_id. Since src/proxy/provider.rs dispatches by provider.provider_type(), such a change silently reroutes every referencing model through a different gateway without validating those model identifiers.
Expected Behavior
When a provider type change is attempted (i.e., the incoming provider.provider_type() differs from the stored provider's type), the update should be rejected with a 400/409 error if any model references that provider_id.
Proposed Solution
In the update helper in src/admin/providers.rs:
- Fetch the existing provider before writing.
- Compare the existing
provider_type() with the incoming one.
- If they differ, check whether any models reference this
provider_id.
- If so, reject the update with an appropriate API error.
This requires a built-in model registry (or an equivalent lookup mechanism) to be implemented first, so that models referencing a given provider_id can be efficiently queried.
References
/cc @bzp2010
Summary
When updating a provider via
PUT /providers/{id}, the current implementation allows changing the providertype(e.g., fromopenaitobedrock) even when models reference that provider viaprovider_id. Sincesrc/proxy/provider.rsdispatches byprovider.provider_type(), such a change silently reroutes every referencing model through a different gateway without validating those model identifiers.Expected Behavior
When a provider type change is attempted (i.e., the incoming
provider.provider_type()differs from the stored provider's type), the update should be rejected with a400/409error if any model references thatprovider_id.Proposed Solution
In the
updatehelper insrc/admin/providers.rs:provider_type()with the incoming one.provider_id.This requires a built-in model registry (or an equivalent lookup mechanism) to be implemented first, so that models referencing a given
provider_idcan be efficiently queried.References
/cc @bzp2010