Repository navigation
fix(llmobs): stop recording hosted MCP credentials in OpenAI Agents spans - #21463
Conversation
…pans OpenAI Agents agent manifests copied the hosted MCP tool_config verbatim, including headers, authorization and the full server URL, and response span metadata copied the server_url OpenAI echoes back. Record an allowlisted view of hosted MCP tools instead, with server_url reduced to its origin through the new ddtrace.internal.utils.http.url_origin helper. APPSEC-71467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dependency direction analysis
|
Codeowners resolved asResolved from the full PR diff against |
BenchmarksBenchmark execution time: 2026-11-03 15:15:25 Comparing candidate commit 15747b7 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 600 metrics, 10 unstable metrics, 1 flaky benchmarks without significant changes.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
More details
Static review and isolated execution checks support removal of MCP credentials from both manifests and response metadata while preserving non-MCP tools. Full integration execution remains unverified because dependencies were unavailable.
🤖 Bits Code Review · Commit dc65642
…rom OpenAI Agents spans Code interpreter and image generation tool configs were copied verbatim into the agent manifest, including container network policy domain secret values, and model_settings recorded extra_headers, extra_query, extra_body and extra_args. Record tool configs through safe_tool_config, which drops domain secret values, apply it to every tool in response metadata, and filter model settings with ALLOWED_MODEL_SETTINGS_KEYS. APPSEC-71467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 15747b7 | Docs | View more details | Give us feedback! |
sabrenner
left a comment
There was a problem hiding this comment.
one suggestion but not blocking, thanks for doing this!
…igurable Rename the hosted MCP field allowlist to _SAFE_OPENAI_MCP_TOOL_FIELDS and let safe_mcp_tool_config, safe_tool_config and _safe_response_tools take a keyword-only allowlist so other integrations can reuse them. server_url is reduced to its origin whatever the allowlist. APPSEC-71467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KowalskiThomas
left a comment
There was a problem hiding this comment.
Proposal to make the release not a bit more concise.
…c2e23460dd3806.yaml Co-authored-by: Thomas Kowalski <thomas.kowalski@datadoghq.com>
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
Build pipeline has failing jobs for 666cf29: What to do next?
This build will be kept for 3h more. During that period, you can retry the pipeline or the failing jobs and then re-run the same command! |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
Build pipeline has failing jobs for ac15ac9: What to do next?
This build will be kept for 3h more. During that period, you can retry the pipeline or the failing jobs and then re-run the same command! |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
Description
Jira: APPSEC-71467
The LLM Observability OpenAI Agents integration recorded credentials from agent tool and model configuration:
OpenAIAgentsIntegration._extract_tools_from_agent): thehosted_mcptool'stool_configwas copied verbatim. That config is the application's own, so it heldheaders,authorizationand the fullserver_urlin clear text.tool_configwas also copied verbatim, including containernetwork_policy.domain_secrets[].value._extract_model_settings_from_agent):ModelSettingswas recorded in full, includingextra_headers,extra_query,extra_bodyandextra_args, which can carry proxy or provider credentials.OaiSpanAdapter.llmobs_metadata):toolswas copied fromresponse.tools. OpenAI redacts header values in that echo but returnsserver_urlexactly as sent, so userinfo, path tokens (for example/api/mcp/s/<token>/mcp) and query keys were recorded.Changes:
safe_tool_config()records tool configurations safely, in both the manifest and response metadata.type,server_label,server_description,connector_id,require_approval,allowed_tools, andserver_urlreduced to its origin (scheme://host[:port]).domainandname.code_interpreterandshellcontainers are covered if OpenAI echoes their policies.ALLOWED_MODEL_SETTINGS_KEYSandis_flat_scalar_value(), as the pydantic_ai integration already does.ddtrace.internal.utils.http.url_origin, provides the origin.Nonefor URLs it cannot parse.Testing
tests/contrib/openai_agents/test_openai_agents_llmobs.py, all built from real SDK types (agents.HostedMCPTool,agents.CodeInterpreterTool,agents.ModelSettings, and the OpenAIMcp,CodeInterpreterandFunctionShellTooltools):extra_headers,extra_query,extra_bodyandextra_argsnever reach the manifest, while inference params do;Reverting any of the fixes makes the matching test fail.
tests/tracer/test_utils.py:url_origincases (path tokens, userinfo, query, fragment, default ports, IPv6, invalid input).Locally:
llmobs::openai_agentspasses on openai-agents 0.0.x (Python 3.9), 0.14 and latest: 44 passed, 2 skipped each.llmobs::openai(openai 1.66): 282 passed.tests/tracer/test_utils.pypasses.scripts/lint checksis clean.Risks
Agent manifests and response metadata carry fewer fields:
headers,authorizationand the URL path;value;model_settingskeeps only inference params, so fields such asreasoningortruncationare no longer shown.Queries matching on those fields will no longer match.
Additional Notes
toolsis not part of its metadata.🤖 Generated with Claude Code