igbuend/grimbard/debug-mode-production-anti-pattern
Claude Code and agent skill by igbuend/grimbard
- community
Checking that the SKILL.md file is still in the repository.
Security anti-pattern for debug mode in production (CWE-215). Use when generating or reviewing code that configures application settings, deployment configurations, or error handling. Detects hardcoded debug flags and development-only features in production.
Install
npx vskill@latest install igbuend/grimbard/debug-mode-production-anti-patternSKILL.md
Debug Mode in Production Anti-Pattern
Severity: High
Summary
Debug mode in production exposes sensitive system information and creates backdoors. Occurs when development settings remain enabled in deployment. Common in AI-generated code that hardcodes debug flags or fails to differentiate environments.
The Anti-Pattern
This anti-pattern manifests in two primary ways:
- Hardcoded Debug Flags: Global flag
DEBUG = Truenever changes, so the application runs in debug mode in all environments. - Unprotected Debug Endpoints: Debug routes (
/debug/env,/_debug/sql) included in production builds provide attack vectors.
BAD Code Example
GOOD Code Example
JavaScript/Node.js Examples
BAD:
GOOD:
Java/Spring Boot Examples
BAD:
GOOD:
Detection
Python/Flask/Django:
DEBUG = Truein source codedebug=Truein Flask configDEBUG = Truein Django settings.py- Debug routes:
@app.route("/debug/
JavaScript/Node.js/Express:
const DEBUG = truein source codeprocess.env.NODE_ENV !== 'production'checks missing- Debug middleware always enabled
- Routes:
app.get('/debug/
Java/Spring Boot:
debug=truein application.propertieslogging.level.root=DEBUGin production- Debug endpoints without
@Profile("dev") spring.devtools.restart.enabled=truein prod
PHP:
error_reporting(E_ALL)in productiondisplay_errors = Onin php.iniAPP_DEBUG=truein .env
Configuration Files:
.envfiles withDEBUG=true- YAML configs with
debug: true - JSON configs with
"debug": true
Search Patterns:
- Grep:
DEBUG.*=.*[Tt]rue|debug.*:.*true|\/debug\/|process\.env\.NODE_ENV - Development dependencies in production builds
- Stack traces exposed in error responses
- Verbose error messages with file paths
Prevention
- [ ] Use environment variables to control debug mode and other environment-specific settings.
- [ ] Never hardcode `DEBUG = True`.
- [ ] Conditionally register debug routes so they are not included in production builds.
- [ ] Implement a startup check in the application that aborts if it detects debug mode is enabled in a production environment.
- [ ] Use separate configuration files for each environment (development, staging, production) to avoid overlap.
- [ ] Review your CI/CD pipeline to ensure that the correct environment variables are being injected and that development artifacts are excluded from the final build.
Testing for Debug Mode
Manual Testing:
- Check environment variables:
echo $DEBUG,echo $APP_ENV - Access debug endpoints:
/debug,/_debug,/debug/env - Trigger errors and check for stack traces
- Review HTTP headers for debug information (X-Debug, Server versions)
Automated Testing:
- Static Analysis: Semgrep, Bandit (Python), ESLint, SonarQube
- Configuration Scanning: Detect hardcoded
DEBUG = Truein code - Runtime Testing: Burp Suite, OWASP ZAP to find debug endpoints
- CI/CD Checks: Fail builds with debug flags enabled
Example Test:
CI/CD Pipeline Check:
Remediation Steps
- Identify debug configurations - Use detection patterns above
- Check current environment - Determine if debug mode is active
- Create environment-based config - Use environment variables
- Remove hardcoded flags - Replace
DEBUG = Truewith env lookup - Conditional debug routes - Register only in development
- Add startup checks - Abort if debug mode in production
- Test the fix - Verify debug disabled in production config
- Update CI/CD - Add validation to deployment pipeline
Related Security Patterns & Anti-Patterns
- Verbose Error Messages Anti-Pattern: A common consequence of running in debug mode.
- Hardcoded Secrets Anti-Pattern: Secrets are often exposed through debug information.
- Missing Security Headers Anti-Pattern: Can provide defense-in-depth by controlling how browsers handle content.
References
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/debug-mode-production-anti-pattern/SKILL.md
Popularity
- Repository stars
- 4
- Repository forks
- 1
- 7-day trend score
- 8
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 16 Mar 2026, 8 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/igbuend/grimbard/debug-mode-production-anti-pattern)