fix: make sensitive trace payloads opt-in by default - #4550
fix: make sensitive trace payloads opt-in by default#4550sylvesterkaczmarek wants to merge 4 commits into
Conversation
By default, trace_include_sensitive_data was set to True, which meant sensitive data (tool inputs/outputs, LLM generations) was included in traces without explicit user consent. This is a security risk as it could lead to accidental data leakage of PII, secrets, or confidential info. This change makes the SDK secure-by-default: - Changed OPENAI_AGENTS_TRACE_INCLUDE_SENSITIVE_DATA env default from 'true' to 'false' - Changed VoicePipelineConfig.trace_include_sensitive_data default from True to False - Updated tests to reflect new secure-by-default behavior Users can still opt-in to include sensitive data by: 1. Setting OPENAI_AGENTS_TRACE_INCLUDE_SENSITIVE_DATA=true environment variable 2. Explicitly passing trace_include_sensitive_data=True to RunConfig or VoicePipelineConfig Security impact: Prevents accidental exposure of sensitive data in production deployments.
Replay the focused openai#2393 default changes from the stale upstream draft onto current main for a fresh reviewed contribution.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c5cdcb000
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Similarly, Audio spans include base64-encoded PCM data for input and output audio by default. You can disable capturing this audio data by configuring [`VoicePipelineConfig.trace_include_sensitive_audio_data`][agents.voice.pipeline_config.VoicePipelineConfig.trace_include_sensitive_audio_data]. | ||
|
|
||
| By default, `trace_include_sensitive_data` is `True`. You can set the default without code by exporting the `OPENAI_AGENTS_TRACE_INCLUDE_SENSITIVE_DATA` environment variable to `true/1` or `false/0` before running your app. | ||
| By default, `trace_include_sensitive_data` is `False`. Applications that intentionally need model and tool inputs/outputs in traces must opt in explicitly, either in code: |
There was a problem hiding this comment.
Move unreleased tracing guidance to a docs-only change
This line documents the new opt-in default introduced by the accompanying runtime change, so it is not accurate for the latest published package until that behavior is released. Repository policy requires documentation for unreleased behavior to be handled in a separate docs-only pull request coordinated with the release; remove this documentation change from the runtime fix.
AGENTS.md reference: AGENTS.md:L76-L78
Useful? React with 👍 / 👎.
| trace_include_sensitive_data: bool = True | ||
| """Whether to include sensitive data in traces. Defaults to `True`. This is specifically for the | ||
| voice pipeline, and not for anything that goes on inside your Workflow.""" | ||
| trace_include_sensitive_data: bool = False |
There was a problem hiding this comment.
Align the voice constructor's static default
When static analysis is active, the handwritten VoicePipelineConfig.__init__ declaration below this field still advertises trace_include_sensitive_data=True, although construction now produces False. Editors and other consumers of the static signature therefore report the old security-sensitive default; update that declaration alongside the dataclass field.
AGENTS.md reference: AGENTS.md:L100-L100
Useful? React with 👍 / 👎.
|
Thanks for sending this. However, we decide when to switch the default settings. So let me close this PR for now. |
This pull request fixes the default handling of potentially sensitive trace payloads by making
trace_include_sensitive_dataopt-in when no explicit configuration is provided.RunConfignow treats an unsetOPENAI_AGENTS_TRACE_INCLUDE_SENSITIVE_DATAenvironment variable asfalse, while preserving every existing explicit override. The voice pipeline's corresponding non-audio sensitive-data setting also defaults toFalse. Audio tracing remains unchanged.This is an intentional default-behavior change. Applications that rely on model generations or tool inputs/outputs being present in traces can preserve the previous behavior with either
RunConfig(trace_include_sensitive_data=True)orOPENAI_AGENTS_TRACE_INCLUDE_SENSITIVE_DATA=true. The tracing guide now documents that migration path directly.Existing tests continue to cover explicit true/false environment values and explicit
RunConfigoverrides, and the default expectation now verifies the secure-by-default behavior.The earlier draft #2392 implemented the same core direction but was closed automatically after going stale without a maintainer rejection. This refreshes that focused change on current
mainand adds migration documentation requested in the issue discussion.This pull request resolves #2393.