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.

Simon A. Simon A. I'm a backend developer building APIs, emulators, and interactive game systems. Professionally, I've developed Java/Spring reporting solutions, managed relational and NoSQL databases, and implemented CI/CD workflows. Matt Butler Matt Butler Software Engineer @ AWS Alvin Voo Alvin Voo I’ve watched the tech landscape evolve over the last decade—from the structured days of Java Server Pages to the current "wild west" of Agentic-driven development. While AI can "vibe" a frontend into existence, I specialize in the architecture that keeps it from collapsing. My expertise lies in the critical backend infrastructure: the parts that must be fast, secure, and scalable. I thrive on high-pressure environments, such as when I had only three weeks to architect and launch an Ethereum redemption system with minimal prior crypto knowledge, turning it into a major revenue stream. What I bring to your project: Forensic Debugging: I don't just "patch" bugs; I use tools like Datadog and Explain Analyzers to map out bottlenecks and resolve root causes—like significantly reducing memory usage by optimizing complex DB joins. Full-Stack Context: Deep experience in Node.js and React, ensuring backends play perfectly with mobile and web teams. Sanity in the Age of AI: I bridge the gap between "best practices" and modern speed, ensuring your project isn't just built fast, but built to last. Meïr Ankri Meïr Ankri Full-stack developer specializing in React / Next.js / Node.js with 6+ years of experience. I've worked across various sectors including automotive (Reezocar/Société Générale), healthcare (Medical Link SaaS), and e-commerce (Glasman). I build web apps end-to-end, from architecture to production, with a focus on scalability, performance, and code quality. I also mentor junior developers and contribute to technical decisions and code reviews. Jen Jacobsen Jen Jacobsen I’m a Full-Stack Developer with over 10 years of experience building modern web and mobile applications. I enjoy working across the full product lifecycle — turning ideas into real, well-built products that are intuitive for users and scalable for businesses. I particularly enjoy building mobile apps, modern web platforms, and solving complex technical problems in a way that keeps systems clean, reliable, and easy to maintain. Nam Tran Nam Tran 10 years as fullstack developer Prakash Prajapati Prakash Prajapati I’m a Senior Python Developer specializing in building secure, scalable, and highly available systems. I work primarily with Python, Django, FastAPI, Docker, PostgreSQL, and modern AI tooling such as PydanticAI, focusing on clean architecture, strong design principles, and reliable DevOps practices. I enjoy solving complex engineering problems and designing systems that are maintainable, resilient, and built to scale. Matthew Butler Matthew Butler Systems Development Engineer @ Amazon Web Services Pratik Pratik SWE with 15+ years of experience building and maintaining web apps and extensive BE infrastructure Richard McSorley Richard McSorley Full-Stack Software Engineer with 8+ years building high-performance applications for enterprise clients. Shipped production systems at Walmart (4,000+ stores), Cigna (20M+ users), and Arkansas Blue Cross. 5 patents in retail/supply chain tech. Currently focused on AI integrations, automation tools, and TypeScript-first architectures.

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