"Guys, I’m under attack"
I came across this post where a founder shared how his SaaS got exploited right after he started sharing how he built his SaaS using Cursor.
I came across this post where a founder shared how his SaaS got exploited right after he started sharing how he built his SaaS using Cursor.
As he shared, some weird people: ❌ Maxed out his API usage ❌ Bypassed subscriptions ❌ Even messed with his database.
The scariest part? He admitted he wasn’t technical, so fixing it took much longer than expected.
If you are vibe coding, I’m sure you don’t want to end up like him.
A couple of basic practices can save you from a lot of pain later:
—
- Do not hardcode your API keys in code
If your code gets exposed, so do your keys. Always use environment variables instead.
For example, if you see something like this in your code: const apiKey = “sk-…”;
You should prompt the AI to: “Move the API key to a .env file and load it as an environment variable.”
Your new code should look like this after that: const apiKey = process.env.API_KEY;
And your .env file will have: API_KEY=“sk-…”
If you have been working on your code for a while, ask the AI to: “Scan this project and move any hardcoded passwords, API keys or secrets in the code to .env and load them from environment variables.”
If the AI detects any such code, it likely means you have already committed that code to your Git repo.
In this case, you should invalidate all existing keys and replace them with new ones.
As a future-proofing step, you should instruct the AI to add a rule to your .cursor/rules (or CLAUDE.md or GEMINI.md): “Do not hardcode passwords, API, and secret keys in code. Do not provide default passwords, API, and secret keys in code. Always load from environment variables.”
A caveat: AI doesn’t guarantee it will follow your rules. They treat them as suggestions. This only lowers the risk. You should still review the code in the future.
—
- Do not commit your .env file to your Git repo
Your .env file contains sensitive secrets. If it’s pushed to GitHub, attackers can gain access if your code leaks . Use .gitignore to keep it out of version control.
Your .gitignore file should have an entry like: .env*
This instructs Git not to commit any files start with .env.
Important: You should back up your .env file elsewhere.
—
Disclaimer:
These are basic but important security tips, intended to be beginner-friendly. They won’t help you achieve top-notch security, but they will prevent you from making the most basic mistakes.
More advanced techniques exist, like storing secret keys in a third-party vault or secret manager.
Security isn’t just for “big companies.” Even small SaaS projects or side hustles can be targets once they’re public.
Build fast, but build securely.
What’re other security mistakes you’ve seen or made that others can learn from?
—
I share practical tips about business, marketing and AI 🔔 Follow me to learn more! ♻️ Re-post this to help others! 🔖 Save this for future reference! 💬 DM me for collaboration!
#VibeCoding #security #Cursor #ClaudeCode #GeminiCli
Enjoyed this? Subscribe for more.
Practical insights on AI, growth, and independent learning. No spam.
More in AI Security
I finally concede that AI is smarter than me.
For 2 years, I held onto reasons like “AI can't solve my kid's homework” or “It can't play tic-tac-toe” to believe I was still smarter.
Two products that are changing the world started as random experiments.
I recently watched 2 videos. A Lenny's Podcast with Boris, the creator of Claude Code. And a TED talk by Peter, the creator of OpenClaw. I noticed a common t...
When we tell people we use AI to do SEO, no one pays attention.
The truth is, GEO is fundamentally 80% SEO.
I caught Cursor trying to be lazy.
The AI agent couldn’t solve the typing error, so it cast the variable to 'any' to suppress the error, just like a sloppy software engineer would.
Vibe coding has been around longer than we think...
I once asked a developer to explain his code when it broke due to edge cases. He told me he didn't know because he copied it from Google. At least he was hon...
Too many people are wasting energy sending soulless cold messages crafted by AI.
The best I could do to recover some value from that wasted energy is to turn it into AI security research.
I finally concede that AI is smarter than me.
For 2 years, I held onto reasons like “AI can't solve my kid's homework” or “It can't play tic-tac-toe” to believe I was still smarter.
When we tell people we use AI to do SEO, no one pays attention.
The truth is, GEO is fundamentally 80% SEO.
Vibe coding has been around longer than we think...
I once asked a developer to explain his code when it broke due to edge cases. He told me he didn't know because he copied it from Google. At least he was hon...
Two products that are changing the world started as random experiments.
I recently watched 2 videos. A Lenny's Podcast with Boris, the creator of Claude Code. And a TED talk by Peter, the creator of OpenClaw. I noticed a common t...
I caught Cursor trying to be lazy.
The AI agent couldn’t solve the typing error, so it cast the variable to 'any' to suppress the error, just like a sloppy software engineer would.
Too many people are wasting energy sending soulless cold messages crafted by AI.
The best I could do to recover some value from that wasted energy is to turn it into AI security research.