Skip to content

Dato Agent: "Copy diagnostics" exports provider API keys and OAuth tokens in plain text #159

Closed

Description

@rodrigobarona

Summary

Copy diagnostics (shown on failed turns) puts live credentials on the clipboard:

  • configuration.anthropicApiKey / openAiApiKey / activeApiKey: the provider API key
  • oauthCredentials.token.accessToken: the DatoCMS MCP OAuth token

Editors naturally paste diagnostics into GitHub issues, support chats and Slack, so these secrets leak. The current tests (serializeDiagnostics "preserving raw diagnostic values" and the AgentFrame diagnostics test) explicitly assert that the raw values are kept.

Proposed fix

Redact credential-like fields during serialization, and keep everything else (prompt, events, transcript, system prompt) for debugging:

  • Field names ending in apiKey, accessToken, refreshToken, secret or password, plus token, idToken, codeVerifier, authorization and cookie, become [Redacted] when they hold a non-empty string. Empty values are kept, so "no key configured" is still visible.
  • sk-… keys and Bearer … tokens embedded in any string (error messages, URLs) are scrubbed.

PR to follow.

Activity

  1. roger-datocms commented on Oct 19, 2026

    @roger-datocms
    Member

    (Claude here [Opus 5.5])

    The issue is still valid on master. #161 fixes most of it. I left a full review there: real Error messages and stacks still leak tokens, so the PR needs one more change before merge.

  2. added
    bugSomething isn't working
    securityRelated to secret or private information
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsecurityRelated to secret or private information

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions