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.

hanson1014 hanson1014 Full-stack developer experienced in fixing and deploying AI-generated apps from Lovable, Bolt.new, Cursor, and Replit. I specialize in debugging Supabase integration issues (auth flows, RLS policies, database connections), fixing broken deployments, resolving routing/blank screen problems, and cleaning up messy React/Vite codebases. I also build production apps with the Claude API and have shipped a Mac desktop dev tool (Nexterm from scratch. Based in Hong Kong, fast turnaround. Costea Adrian Costea Adrian Embedded Engineer specilizing in perception systems. Latest project was a adas camera calibration system. Basel Issmail Basel Issmail ’m a Senior Full-Stack Developer and Tech Lead with experience designing and building scalable web platforms. I work across the full development lifecycle, from translating business requirements into technical architecture to delivering reliable production systems. My work focuses on modern web technologies, including TypeScript, Angular, Node.js, and cloud-based architectures. I enjoy solving complex technical problems and helping teams turn product ideas and prototypes into working platforms that can grow and scale. In addition to development, I often collaborate closely with product managers, business analysts, designers, and QA teams to ensure that solutions align with both technical and business goals. I enjoy working with startups and product teams where I can contribute both as a hands-on engineer and as a technical partner in designing and delivering impactful software. Rudra Bhikadiya Rudra Bhikadiya I build and fix web apps across Next.js, Node.js, and DBs. Comfortable jumping into messy code, broken APIs, and mysterious bugs. If your project works in theory but not in reality, I help close that gap. PawelPloszaj PawelPloszaj I'm fronted developer with 10+ years of experience with big projects. I have small backend background too Daniel Vázquez Daniel Vázquez Software Engineer with over 10 years of experience on Startups, Government, big tech industry & consulting. Anthony Akpan Anthony Akpan Developer with 8 years of experience building softwares fro startups 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. 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. Vlad Temian Vlad Temian 15+ years shipping production infrastructure for startups. Former CTO at qed.builders (acquired by The Sandbox). Cursor ambassador and agentic tooling builder. I've scaled systems, automated deployments, and built observability tools for AI coding workflows. I specialize in taking vibe-coded apps from broken prototype to production-ready: fixing Supabase auth/RLS, Stripe integrations, deployment pipelines, and cleaning up AI-generated spaghetti. I build tools in this space (agentprobe, claudebin, micode) and understand both sides: how AI generates code and why it breaks. https://blog.vtemian.com/

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