fix(cloud): harden edge gateways, api-server ssrf, supabase fail-closed quota, and web/admin lifecycle
This commit is contained in:
parent
2a009e421a
commit
c68e81e0aa
46 changed files with 2553 additions and 294 deletions
|
|
@ -73,7 +73,14 @@ public class LlmProxyService : ILlmProxyService
|
|||
{
|
||||
try
|
||||
{
|
||||
using var client = _httpClientFactory.CreateClient();
|
||||
if (!EndpointUrlPolicy.IsValidEndpointUrl(
|
||||
endpoint.EndpointUrl,
|
||||
EndpointUrlPolicy.AllowsLoopbackForLlmProvider(endpoint.Provider)))
|
||||
{
|
||||
throw new InvalidOperationException("Configured model endpoint URL is not permitted.");
|
||||
}
|
||||
|
||||
using var client = _httpClientFactory.CreateClient("UpstreamNoRedirect");
|
||||
client.Timeout = TimeSpan.FromSeconds(60);
|
||||
|
||||
var payload = new
|
||||
|
|
@ -93,9 +100,10 @@ public class LlmProxyService : ILlmProxyService
|
|||
Content = new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json")
|
||||
};
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(endpoint.ApiKey))
|
||||
var trimmedKey = endpoint.ApiKey?.Trim();
|
||||
if (!string.IsNullOrWhiteSpace(trimmedKey))
|
||||
{
|
||||
httpRequest.Headers.Authorization = new AuthenticationHeaderValue("Bearer", endpoint.ApiKey);
|
||||
httpRequest.Headers.Authorization = new AuthenticationHeaderValue("Bearer", trimmedKey);
|
||||
}
|
||||
|
||||
using var httpResponse = await client.SendAsync(httpRequest, cancellationToken);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue