r/ChatGPTCoding
•
u/cryptoviksant
Professional Nerd
•
Oct 05 '25
•
2
1
Resources And Tips How to ACTUALLY make your (vibe coded) apps secure (from an actual hacker)
I'm a pentester (ethical hacker) who codes SaaS part-time. I've reviewed hundreds of apps over the years, and honestly? Most have the same holes. Here's what actually keeps you safe.
- AI code review catches most issues (fr)
Look, I get it. You're shipping fast. But let Coderabbit review every pull request. It'll catch SQL injection, exposed credentials, broken auth before anything goes live.
Here's a wild one: during a recent pentest, I found a race condition in a client's payment system that was double-charging customers. The dev wrote it late night with AI help. Looked totally fine to them. Would've been an absolute nightmare in production.
- Rate limiting stops the spam (and saves your wallet)
I've seen apps get absolutely hammered with 10,000+ fake registrations in minutes. Rate limiting shuts that down real quick.
Without it, you're basically paying for spam. Your database fills with garbage, your email service burns through the monthly quota, and boom: One client ended up with a $500+ AWS bill from a single bot attack. Not fun lol
Start strict: 100 requests/hour per IP. You can always loosen it later if real users complain, but honestly? They won't.
- Enable RLS from day 0
Row Level Security means users can only see their own data. Postgres enforces it at the database level, which is exactly where you want it.
Found a dashboard during a pentest once with no RLS. I changed one URL parameter and suddenly I'm looking at everyone's data. That's literally how most data leaks happen - someone forgets this one thing.
Let AI write your RLS policies if you want, but double-check them and actually try to break them yourself.
- Hide your API keys (seriously)
API keys in code will get stolen. Not maybe. Will.
During pentests, I find exposed AWS keys, Stripe tokens, database passwords in repos all the time. GitHub bots are scraping for these 24/7: they'll find yours in minutes.
Google Secret Manager or AWS Secrets Manager. That's it. Keys live there, not in your repo. And rotate them every 90 days. Takes like 10 minutes.
- CAPTCHA stops bots
I've tested tons of apps with and without CAPTCHA. The difference is honestly massive - we're talking 99% spam reduction.
Without it? You're looking at 200+ garbage submissions daily. "Buy our SEO services" and crypto scams filling up your database. It's annoying as hell.
Use invisible mode so real people never even see it. Bots get challenged. Slap it everywhere: contact forms, registration, login, password reset.
- HTTPS isn't optional
Every endpoint needs HTTPS. Redirect HTTP automatically. Zero exceptions here.
I intercept unencrypted traffic during pentests constantly, and you'd be shocked what I see. Session tokens, passwords, API keys - all just sitting there in plain text. It's 2025, people.
Let's Encrypt gives you free certificates. There's literally no excuse.
- Sanitize every input
Validate on the frontend. Validate again on the backend. Trust nothing users send you - and I mean nothing.
During pentests, I'm injecting malicious code through forms, URL parameters, file uploads. Most apps fail this test. Don't be most apps.
- Update your dependencies
Old packages have known vulnerabilities. When I'm testing security, those are the first things I go after.
Turn on Dependabot or Renovate. Update monthly at minimum. Security patches? Apply them the same day. This one's non-negotiable.
AI makes you fast. But speed without security is just... well, it's just speed toward disaster.
Here's what works: one AI writes your code. Another AI (Coderabbit) audits it. You review the audit. Three layers catching issues before they become problems.
Also, rate limiting protects you when things go right too. Your app goes viral? Traffic spikes 1000x overnight? Limits keep your servers up and your costs reasonable.
From pentesting hundreds of apps: these controls stop 95% of attacks. The other 5% requires skills most hackers don't have, so you're good.
Seriously: I've seen apps lose 40% of users after breaches. $50,000+ incident response bills. Reputations take years to recover.
These controls work. Clients stay. They send referrals.
39
u/geek_404 Oct 05 '25
As a fellow security geek I echo everything said and I’ll add a couple more.
Data privacy: only collect data you actually need I see a lot of products that over collect data just because they can.
Encryption: in the cloud it’s easy use it everywhere. In transit, at rest, disk encryption, if your DB supports it use it. These days it doesn’t slow things down. A
PaaS and IaaS: use cloud service providers tools where it makes sense. Spend a bit more than hosting that DB on an vm. On a VM you need to patch the OS, the DB and anything else you installed. If you use IaaS or PaaS you don’t have to worry about any of that patching. The cloud provider will do it as part of their shared responsibility model.
Default deny inbound and outbound: there is no reason in 2025 to not restrict traffic outbound as well. Even something innocuous as http and https can be utilized by attackers.
Dependencies and Supply chain management: In enterprise software we are seeing a big push for SBOM’s so if you are going to be selling to companies set something up early to manage this. Enable code signing to ensure you can trust everything in your repo.
Programming Languages: What language you choose matters. Node and JavaScript maybe easy and fast but it is a serious target of supply chain attackers because it is easy and wide spread. I am learning Rust for this very reason. It is a memory safe language.
Lastly a plug for all the great open source security software out there. DependencyTrack, Grype and Syft among the others. Far too many to list but spend some time researching them. I have found ChatGPT and Claude helpful in identification and evaluating.
Happy vibe coding.
11
u/GRK-- Oct 05 '25
Why use coderabbit when /review mode in Claude and Codex using the best models do a better job? Or when prompting them to trace all data flows and write the data flow graphs into a file, and then prompting them again to assess the security of those data flows by following each path through the graph.
7
u/bitsperhertz Oct 05 '25
This is written by chatgpt, did the client examples actually happen or are they stories invented by AI?
3
u/thewritingwallah Oct 06 '25
Unnecessary complexity is probably the single biggest problem in the software industry. It spawns a host of problems.
Write exactly what you need to write to solve the problem at hand, not one semicolon more.
The best time to review your code is when you use it. That is, continuous review is better than what amounts to a waterfall review phase. For one thing, the reviewer has a vested interest in assuring that the code they're about to use is high quality. Furthermore, you are reviewing the code in a real-world context, not in isolation, so you are better able to see if the code is suitable for its intended purpose. Continuous review, of course, also leads to a culture of continuous refactoring. You review everything you look at, and when you find issues, you fix them.
My experience is that PR-driven reviews rarely find real bugs. They don't improve quality in ways that matter. They DO create bottlenecks, dependencies, and context-swap overhead, however, and all that pushes out delivery time and increases the cost of development with no balancing benefit.
2
u/grpx7 Oct 06 '25
Now this was useful. Thanks for writing it!
3
u/Initial-Ambition235 Oct 05 '25
This is amazing thank you for this valuable info
2
u/tinkeringidiot Oct 05 '25
Adding to the Cybersecurity pile here:
Sanitize all the inputs, even the ones you don't think of as input
Environment variables, input events, "standard" header fields, returns from calls to dependencies, syscalls, query results...all of it, every byte. If it didn't originate entirely in your own code, sanitize it. Because everything is an attack vector. Pentesters won't always go down that rabbit hole (because cost), but someone out there wants you badly enough to feed your app malicious accelerometer data or some similar ridiculous thing.
Actually understand your dependencies
Dependabot is great, but it can't see past your package manager. Every one of those packages you installed has its own dependencies that aren't being checked or updated. You still have Heartbleed and log4j kicking around somewhere. Dependencies of your dependencies are your dependencies too.
Don't do stupid crap
This one is harder to quantify, but around the time you're having to explain that <horrible exploit> in your application isn't actually a bug but an intentional feature, you'll figure it out. Application security isn't some box you check with a bunch of CI addons (even really cool AI ones) and third-party services. It's something you have to actually choose to do and follow through on.
1
u/fredkzk Oct 05 '25
Can AI bots figure out captcha ?
1
u/Fit-Palpitation-7427 Oct 05 '25
What about creating a agent or command we can run so all of this get listed, checked, reviewed and tested? Is that what coderabbit does? Thanks for all this info!
1
u/Watashinonamae Oct 05 '25
Interesting
1
u/sqdcn Oct 06 '25
Miss an important one: WRITE TESTS. If you are lazy, let AI write them for you.
Another one that's more my personal opinion: instruct the LLM to write typed code and setup type checking (applies to Python and Typescript). Even better, code in something with stronger type system like Java or C#.
1
u/djav1985 Oct 06 '25
I usually put some kind of web application firewall in front of everything. Even if it's just something custom coded for that application. Have it blacklist IP addresses if it detects any sort of type of injection. Anyone attempting to break into something is probably going to have to at least make a couple attempts before they're successful. So if you can catch them on their first attempt and block them you could at least slow them down.
1
u/codechisel Oct 06 '25
If you're an ivy league MBA this is called a feature, not a bug.
1
u/michaelsoft__binbows Oct 07 '25
What I want to understand is why captchas still work. A vlm can easily read the most mangled looking one. I guess they are more about employing a whole bag of tricks on the client side to detect non human use?
1
u/AvoidSpirit Oct 07 '25
In your dashboard example, how does rls help? Would you create a database role/user per dashboard user?
1
u/Low-Opening25 Oct 07 '25
prompt “make my app secure from hackers”, problem solved. /s
1
u/Director-on-reddit Oct 08 '25
Wish i could bookmark this
1
u/xFloaty Oct 10 '25
Coderabbit is a garbage software and this is an ad. You don’t need a separate AI wrapper to make your software secure. You can use your main AI coding tool to do this.
1
u/Intrepid_Resist_4333 Mar 03 '26
For someone who is not a coder, and wants to learn vibe coding and is only doing this as practice, how do you recommend safety? I don't know half of what you mentioned above
3
u/ThomasPopp Oct 05 '25
I have so much to learn.
Thank you team.
2
u/tantej Oct 05 '25
Thank you so much!!
2
u/Apprehensive-Fun7596 Oct 06 '25
Thanks! As someone who's only coded small things and is building a pretty substantial vibe coded project, this has been my biggest concern. I've been extraordinarily proactive with almost everything you mentioned, but there were some great insights! Blunders sink businesses, and I'd like to avoid that.
2
u/Mister-R-NL Nov 02 '25
brooo!! My whole repo is full of API keys!! Removed them all. Thank you for that
0
u/kidajske Oct 05 '25
Good post, all common sense stuff when you've been programming for a while. But it all requires effort which most vibesharts arent interested in so it'll fall on deaf ears. They're still circle jerking each other about what the best magic one shot prompt is to find every vulnerability in the entire app.
1
u/buddhist-truth Oct 05 '25
How do you validate uploads (media files) that are saved directly to S3 using a presigned URL?
1
u/NovaKaldwin Oct 08 '25
Down vote
1
u/RepresentativeFar610 Oct 08 '25
Saved. Thank you so much for this 🙏🏽
1
u/StupidHuise Oct 22 '25
This text was AI generated.
1
u/Radius314 Dec 14 '25
Yeah you need in-depth defense. Don't implicitly trust the model's outputs.
1
u/Alive_Nobody_Home Dec 20 '25
Just wanted to say thank you for this post. 🙏🏻
1
u/Alive_Nobody_Home Dec 20 '25
Just wanted to say thank you for this post. 🙏🏻
1
u/Fun-Moment-4051 Dec 29 '25
Hey👋, you can check out shipsec studio
1
u/[deleted] Jan 05 '26
Thanks man
1
u/Watashinonamae May 02 '26
saved
1
u/SRed3 Oct 04 '26
With you esp. on RLS, that is really powerful, and simple enough on Postgres, Dynamo et al (just assume another role) - maybe one more: outsource authentication (i.e. OAuth) & check API endpoints to be closed by default
1
u/Da_ha3ker Oct 05 '25
Glad to see someone calling this out
0
u/[deleted] Oct 05 '25
[deleted] — view deleted comment
1
u/[deleted] Oct 06 '25
[removed] — view removed comment
1
u/[deleted] Oct 07 '25
[removed] — view removed comment
1
u/[deleted] Oct 06 '25
[removed] — view removed comment
1
u/[deleted] Oct 06 '25
[removed] — view removed comment
1
u/[deleted] Oct 06 '25
[removed] — view removed comment
1
u/[deleted] Oct 07 '25
[removed] — view removed comment
1
u/[deleted] Oct 07 '25
[removed] — view removed comment
1
u/[deleted] Oct 08 '25
[removed] — view removed comment
1
u/[deleted] Oct 10 '25
[removed] — view removed comment
1
u/[deleted] Oct 12 '25
[removed] — view removed comment
1
u/[deleted] Oct 22 '25
[removed] — view removed comment
1
u/[deleted] Oct 29 '25
[removed] — view removed comment
1
u/[deleted] Nov 06 '25
[removed] — view removed comment
1
u/[deleted] Nov 06 '25
[removed] — view removed comment
1
u/[deleted] Nov 06 '25
[removed] — view removed comment
1
u/[deleted] Nov 08 '25
[removed] — view removed comment
1
u/[deleted] Feb 17 '26
[removed] — view removed comment
1
u/[deleted] Feb 27 '26
[removed] — view removed comment
1
u/[deleted] Mar 04 '26
[removed] — view removed comment
1
u/[unknown] Mar 31 '26
[removed] — view removed comment
1
u/[deleted] Jun 03 '26
[removed] — view removed comment
1
u/[deleted] Jun 19 '26
[removed] — view removed comment
1
u/[deleted] Jun 20 '26
[removed] — view removed comment
1
u/[deleted] Jun 20 '26
[removed] — view removed comment
1
u/[deleted] Jun 20 '26
[removed] — view removed comment
1
u/[deleted] Jun 20 '26
[removed] — view removed comment
1
u/[deleted] Jun 20 '26
[removed] — view removed comment
1
u/[deleted] Jun 20 '26
[removed] — view removed comment
1
u/[unknown] Jun 20 '26
[removed] — view removed comment
1
u/[deleted] Jun 20 '26
[removed] — view removed comment
0
u/[deleted] Oct 06 '25
[deleted] — view deleted comment
0
u/[deleted] Jun 20 '26
[deleted] — view deleted comment
0
u/[deleted] Jun 20 '26
[deleted] — view deleted comment