mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-12-06 11:03:52 +00:00
fix(security): audit run-4 fixes and run-3 leftovers (#26)
Corrects passthrough metering, the cost gate, credential redaction, reload drain, response headers and the discovery cap.
This commit is contained in:
@@ -181,6 +181,7 @@ func effectiveTTL(c *responseCache, grp *group) time.Duration {
|
||||
// Body automatically (it is a []byte field), matching spec §2's "value:
|
||||
// JSON {status, contentType, body(base64)}".
|
||||
type cachedResponse struct {
|
||||
// ContentType is upstream-chosen and replayed verbatim on a hit.
|
||||
ContentType string `json:"contentType"`
|
||||
Body []byte `json:"body"`
|
||||
Status int `json:"status"`
|
||||
@@ -459,12 +460,12 @@ func cacheKey(provider, upstreamModel, requestedModel, endpoint string, req map[
|
||||
}
|
||||
|
||||
// normalizeBetaSet canonicalises anthropic-beta header values into one
|
||||
// sorted, de-duplicated, lower-case comma list; "" when no value is set.
|
||||
// sorted, de-duplicated comma list; names keep their case, as Anthropic documents the exact name as the value; "" when no value is set.
|
||||
func normalizeBetaSet(values []string) string {
|
||||
var parts []string
|
||||
for _, v := range values {
|
||||
for _, f := range strings.Split(v, ",") {
|
||||
f = strings.ToLower(strings.TrimSpace(f))
|
||||
f = strings.TrimSpace(f)
|
||||
if f != "" {
|
||||
parts = append(parts, f)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user