r/ChatGPTCoding • Professional Nerd • Oct 05 '25 • Bless Up 2 Helpful 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.

832 Upvotes

196 comments sorted by

View all comments

Show parent comment

1

u/AvoidSpirit Oct 07 '25

I'm not asking what rls is though, am I...
I'm asking how exactly one would use it in this particular scenario.

1

u/cryptoviksant Professional Nerd Oct 07 '25

RLS would prevent me from seeing other user's data.

This would be a mix of solving IDOR + Broken access control vulnerability

1

u/AvoidSpirit Oct 07 '25

The question is: "How would you use RLS to prevent that in the scenario you described?" Preferably with details like how one would still use connection pooling with it.

Stop substituting it for the basic: "What is RLS" or "What does RLS usually solve".
Cause this makes me think you have no idea what you're talking about.

1

u/cryptoviksant Professional Nerd Oct 07 '25

Those types of doubts can be solved by Google my friend. I do have idea what I’m talking about but I don’t have the time to be wiring detailed responses and writeups for every single comment.

The RLS is enabled on the database side, which means that whenever the client queries the database, it will ONLY be able to read his own data using the JWT from the authentication. Then supabase itself will filter the user UID and return the accessible information.

TLDR: you enable RLS on your supabase configuration, not your source code.

Hope all this make sense

1

u/cryptoviksant Professional Nerd Oct 07 '25

The explanation of how RLS works responds to your question. In an investment app let’s say, I don’t want user A accessing User B portfolio and vice versa, hence implementing the RLS isolation would prevent this.

1

u/AvoidSpirit Oct 07 '25

Yup, you have zero clue.

1

u/cryptoviksant Professional Nerd Oct 07 '25

Explain it to me then, master.

1

u/AvoidSpirit Oct 07 '25 edited Oct 07 '25
  1. To use RLS you need to be logging in with different database users.
  2. Which means you need a database user per your dashboard client
  3. You can't have multiple users on the same connection.
  4. If you want to scale you can't run connection/client - this consumes too much memory.

So you need to run proxy level authentication where you login with your "main" user and then switch to a rls-related user/role within the confines of the connection which would be way less on the "security guaranteed" side.

You would know this if you had any experience with actually implementing any of it.
And judging by your replies you're just copying/rephrasing the gpt answers. Cause it's exactly how it answers those practical questions(if they're not too frequently asked) - very broad strokes, rarely diving into any details and every time trying to get conversation back to the high level overview.

1

u/cryptoviksant Professional Nerd Oct 07 '25
  1. You don't need different database users per client, because all clients connect as the "authenticated" role (via service_role key proxy through Supabase Auth), with RLS policies using the "auth.uid()" (as I've literally said before) to filter data per-user.
  2. What you are saying it's misleading. YOU CAN have multiple users on the same connection. They are literally identified by the JWT (As I've also mentioned before)
  3. This depends on the database provider u are using. Supabase (the one I'm using) client connects with the anon/service key and for every user it wants to identify uses the JWT from the header.

Kind regards.

1

u/AvoidSpirit Oct 07 '25

Supabase is a wrapper on top. It does not matter. The underlying principal is the same. In the Supabase example, Supabase is your authentication proxy.

So it will be multiple supabase users on the same connection but the connection to the actual postgres instance will use a single user/a pool of users.

1

u/cryptoviksant Professional Nerd Oct 07 '25

You're correct, but theprinciple holds regardless of implementation layer.

→ More replies