mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-28 01:32:17 +00:00
fix(custom_hooks): redact x-trust token after verification to prevent replay
Redact x-trust token from metadata after verification.
This commit is contained in:
parent
dde6943d37
commit
02f08956a6
1 changed files with 3 additions and 0 deletions
|
|
@ -59,6 +59,9 @@ class XTrustHook(CustomLogger):
|
|||
payload = self._verify(token) if token else None
|
||||
score = payload["score"] if payload else 0.0
|
||||
trusted = payload is not None and score >= self.min_score
|
||||
# Redact token after verification to prevent replay via logging
|
||||
if "headers" in data.get("metadata", {}):
|
||||
data["metadata"]["headers"].pop("x-trust", None)
|
||||
if "metadata" not in data:
|
||||
data["metadata"] = {}
|
||||
data["metadata"]["x_trust"] = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue