fix: redact sensitive data from evaluation SDK log messages#45176
fix: redact sensitive data from evaluation SDK log messages#45176slister1001 wants to merge 2 commits intoAzure:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a critical security issue by redacting sensitive user-provided data from log messages in the azure-ai-evaluation SDK that flow into Geneva telemetry. The changes prevent database connection strings and other credentials embedded in user payloads from being exposed in logs and flagged by CredScan tools.
Changes:
- Removed user-provided content (queries, responses, tool definitions) from log message strings
- Downgraded noisy agent-response fallback warnings from
logger.warningtologger.debug - Sanitized upload error messages to emit only exception type names instead of full exception text
- Added proper exception chaining with
from efor maintaining traceback while keeping logs clean
| return response | ||
| return "\n".join(agent_response) | ||
| except: | ||
| # If the agent response cannot be parsed for whatever reason (e.g. the converter format changed), the original response is returned |
There was a problem hiding this comment.
The bare except: clause should specify Exception to avoid catching system-exiting exceptions like KeyboardInterrupt and SystemExit. This is inconsistent with the exception handling patterns used elsewhere in the file (see lines 700 and 786 which use except Exception as e:). Consider changing this to except Exception: for consistency and better practice.
sdk/evaluation/azure-ai-evaluation/azure/ai/evaluation/_common/utils.py
Outdated
Show resolved
Hide resolved
b6281bd to
2092f7c
Compare
Remove user-provided content (queries, responses, tool definitions, exception messages) from log strings that flow into Geneva telemetry. This prevents database connection strings and other credentials embedded in user payloads from being flagged by CredScan. Changes: - Remove f-string interpolation of query/response/tool_definitions in warning and debug log messages - Downgrade noisy agent-response warnings to debug level - Sanitize upload error messages to emit only exception type name - Chain original exception with 'from e' Resolves ICM 738457593
2092f7c to
b5b0674
Compare
PROXY_URL in devtools_testutils.config is now a function, not a constant. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
Redacts user-provided content (queries, responses, tool definitions, exception messages) from log strings in
azure-ai-evaluationthat flow into Geneva telemetry (ViennaExp/Log). This prevents database connection strings and other credentials embedded in user payloads from being flagged by CredScan.Resolves ICM 738457593
Changes
logger.debugtype(e).__name__instead of full exception textfrom efor proper tracebackAll SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines