Windsurf security

Windsurf Committed API Keys and Secrets to Git Repository

Windsurf's Cascade assistant hardcoded API keys, database credentials, JWT secrets, or other sensitive values directly into your source code, and those files were committed to your Git repository. Even if you delete the secrets now, they remain in your Git history and may already be compromised.

This is one of the most common and dangerous security issues with AI-generated code. Cascade focuses on making things work, so when it needs an API key or connection string, it may place the value directly in the code rather than referencing environment variables.

GitHub, GitLab, and other platforms actively scan for leaked credentials, and automated bots scrape public repos for secrets within minutes of them being pushed. If your repo is public, assume any committed secrets have been compromised.

Error Messages You Might See

GitHub push protection blocked: API key detected GitGuardian alert: Secret detected in commit [gitleaks] Detected hardcoded secret WARNING: Potential secret found in src/config/database.ts
GitHub push protection blocked: API key detectedGitGuardian alert: Secret detected in commit[gitleaks] Detected hardcoded secretWARNING: Potential secret found in src/config/database.ts

Common Causes

  • Hardcoded connection strings — Cascade wrote database URLs with username and password directly in config files
  • API keys in source files — Third-party API keys (Stripe, SendGrid, OpenAI) placed directly in service files instead of environment variables
  • JWT secret in auth code — The JWT signing secret was hardcoded in the authentication middleware
  • Missing .gitignore entries — Cascade created .env files but didn't add them to .gitignore, or placed secrets in files that aren't typically ignored
  • Config files with real values — Configuration files contain production credentials instead of placeholder values

How to Fix It

  1. Rotate ALL exposed secrets immediately — Generate new API keys, change passwords, and create new tokens for every credential that was committed. The old ones must be considered compromised
  2. Move secrets to environment variables — Replace every hardcoded value with process.env.VARIABLE_NAME or the equivalent for your framework
  3. Create proper .env and .gitignore — Add a .env file for local development and ensure .env* is in .gitignore. Create a .env.example with placeholder values
  4. Clean Git history — Use git-filter-repo or BFG Repo Cleaner to remove secrets from past commits if the repo is private. For public repos, assume the secrets are already compromised
  5. Install pre-commit hooks — Add tools like git-secrets, detect-secrets, or gitleaks as pre-commit hooks to prevent future credential commits
  6. Enable GitHub secret scanning — Turn on GitHub's secret scanning alerts in your repository settings to get notified of exposed credentials

Real developers can help you.

Pratik Pratik SWE with 15+ years of experience building and maintaining web apps and extensive BE infrastructure Krishna Sai Kuncha Krishna Sai Kuncha Experienced Professional Full stack Developer with 8+ years of experience across react, python, js, ts, golang and react-native. Developed inhouse websearch tooling for AI before websearch was solved : ) Franck Plazanet Franck Plazanet I am a Strategic Engineering Leader with over 8 years of experience building high-availability enterprise systems and scaling high-performing technical teams. My focus is on bridging the gap between complex technology and business growth. Core Expertise: 🚀 Leadership: Managing and coaching teams of 15+ engineers, fostering a culture of accountability and continuous improvement. 🏗️ Architecture: Enterprise Core Systems, Multi-system Integration (ERP/API/ETL), and Core Database Structure. ☁️ Cloud & Scale: AWS Expert; architected systems handling 10B+ monthly requests and managing 100k+ SKUs. 📈 Business Impact: Aligning tech strategy with P&L goals to drive $70k+ in monthly recurring revenue. I thrive on "out-of-the-box" thinking to solve complex technical bottlenecks and am always looking for ways to use automation to improve business productivity. Victor Denisov Victor Denisov Developer PawelPloszaj PawelPloszaj I'm fronted developer with 10+ years of experience with big projects. I have small backend background too Taufan Taufan I’m a product-focused engineer and tech leader who builds scalable systems and turns ideas into production-ready platforms. Over the past years, I’ve worked across startups and fast-moving teams, leading backend architecture, improving system reliability, and shipping products used by thousands of users. My strength is not just writing code — but connecting product vision, technical execution, and business impact. Jaime Orts-Caroff Jaime Orts-Caroff I'm a Senior Android developer, open to work in various fields Anthony Akpan Anthony Akpan Developer with 8 years of experience building softwares fro startups Milan Surelia Milan Surelia Milan Surelia is a Mobile App Developer with 5+ years of experience crafting scalable, cross-platform apps at 7Span and Meticha. At 7Span, he engineers feature-rich Flutter apps with smooth performance and modern UI. As the Co-Founder of Meticha, he builds open-source tools and developer-focused products that solve real-world problems. Expertise: 💡 Developing cross-platform apps using Flutter, Dart, and Jetpack Compose for Android, iOS, and Web. 🖋️ Sharing insights through technical writing, blogging, and open-source contributions. 🤝 Collaborating closely with designers, PMs, and developers to build seamless mobile experiences. Notable Achievements: 🎯 Revamped the Vepaar app into Vepaar Store & CRM with a 2x performance boost and smoother UX. 🚀 Launched Compose101 — a Jetpack Compose starter kit to speed up Android development. 🌟 Open source contributions on Github & StackOverflow for Flutter & Dart 🎖️ Worked on improving app performance and user experience with smart solutions. Milan is always happy to connect, work on new ideas, and explore the latest in technology. rayush33 rayush33 JavaScript (React.js, React Native, Node.js) Developer with demonstrated industry experience of 4+ years, actively looking for opportunities to hone my skills as well as help small-scale business owners with solutions to technical problems

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

Can I just delete the file with secrets and push again?

No. Deleting the file only removes it from the latest commit. The secrets remain in your Git history. Anyone with access to the repo can find them in previous commits. You must rotate the credentials and optionally rewrite Git history.

How do I prevent Cascade from hardcoding secrets in the future?

Include instructions in your Cascade prompts to use environment variables. Create a .env.example file early in the project, and add a pre-commit hook like gitleaks that blocks commits containing credential patterns.

Related Windsurf Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help