Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
Security Issue Report: Debug Mode Credential Exposure
Model: Claude Sonnet 4.5
Date: 2026-03-4
Severity: High
Issue
During a credential rotation task, the AI agent generated and displayed a production secret in the chat UI, directly contradicting the security practices it was implementing.
Context: User was removing hardcoded credentials from .cursorrules (which gets sent to AI providers) and setting up proper secret management for production Cloud Functions.
What happened: Agent executed openssl rand -base64 32 via Shell tool and displayed the output in chat, exposing the newly generated secret to:
Anthropicâs servers (logged)
Userâs chat history (persistent)
Anyone with Cursor access
The Problem
Agent treated existing vs. new credentials differently:
Existing credentials: Correctly moved to .env.test, never shown in chat
New credentials: Generated via Shell tool, displayed in chat output
This recreated the exact exposure risk the task was designed to prevent.
Expected Behavior
Agent should have instructed user to run openssl rand -base64 32 in their own terminal, never executing secret-generation commands through observable tools.
User Observation
âYou seem to be making a lot of security lapses when youâre in debug mode that you werenât necessarily making in other modes.â
Hypothesis: Debug modeâs focus on tool execution and runtime evidence may override security judgment about what should/shouldnât be executed observably.
Recommendations
Block secret-generation commands (openssl rand, password generators) from Shell tool execution in chat context
Apply ânever show credentialsâ rules uniformly to both existing and newly generated secrets
Add pre-execution security check: âWill this command output contain secrets/credentials?â
Review debug mode instructions for security blind spots
Impact
User caught the error before using the exposed secret. No actual compromise, but the pattern is concerningâagent violated its own security guidance within the same conversation that established it.
Steps to Reproduce
- Start a conversation in Debug Mode (Cmd+Shift+P â âDebug with AIâ)
- Work on a task involving credential/secret management
- Ask the AI to generate a secure random password or secret
- Observe: AI uses Shell tool to run
openssl rand -base64 32and displays the output in chat
Expected Behavior
Agent should instruct user to run secret-generation commands in their own terminal, never executing them through observable Shell tool. Newly generated secrets should be treated with same ânever show in chatâ rules as existing credentials.
Operating System
MacOS
Version Information
Version: 0.42.3
For AI issues: which model did you use?
Claude Sonnet 4.5 (Debug Mode)
Additional Information
Issue occurred during credential rotation task. Agent correctly implemented security measures (moving credentials to .env.test) but then violated those same principles by generating and displaying a production secret via Shell tool in the same conversation. User intervention prevented actual compromise.
Does this stop you from using Cursor
Sometimes - I can sometimes use Cursor