mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-06 18:40:57 +00:00
fix(security): redact JWT tokens in server logs (#4325)
Add "token" to sensitive field patterns in redact_sensitive_fields() to prevent JWT tokens from being logged in plaintext. Previously only api_key, api_token, password, and secret were filtered. This prevents tokens like server.auth.provider_config.jwks.token from being exposed in server logs. Closes: #4324 Signed-off-by: Derek Higgins <derekh@redhat.com>
This commit is contained in:
parent
fc4fc03606
commit
8998000aec
1 changed files with 1 additions and 1 deletions
|
|
@ -9,7 +9,7 @@ from typing import Any
|
||||||
|
|
||||||
def redact_sensitive_fields(data: dict[str, Any]) -> dict[str, Any]:
|
def redact_sensitive_fields(data: dict[str, Any]) -> dict[str, Any]:
|
||||||
"""Redact sensitive information from config before printing."""
|
"""Redact sensitive information from config before printing."""
|
||||||
sensitive_patterns = ["api_key", "api_token", "password", "secret"]
|
sensitive_patterns = ["api_key", "api_token", "password", "secret", "token"]
|
||||||
|
|
||||||
def _redact_value(v: Any) -> Any:
|
def _redact_value(v: Any) -> Any:
|
||||||
if isinstance(v, dict):
|
if isinstance(v, dict):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue