u/ddarol_o_krank

I wrote a tool to catch AI agents disabling RLS. Then I red teamed it and it failed badly.

I wrote a tool to catch AI agents disabling RLS. Then I red teamed it and it failed badly.

Something I kept running into with AI-assisted code: you ask the agent to fix a query, it can't work out the policy, so it just disables RLS. Or a paywall check gets set to false so a demo works. Or email confirmation goes off during testing and never goes back on. The code looks fine afterwards. Nothing errors.

So I wrote a CLI that fails the build on that specific kind of change. MIT, no dependencies:

npx prodguard check --demo
npx prodguard check

The demo runs everything against a fake broken app, so you can see the output without pointing it at anything real.

12 checks. The ones that matter here:

  • ALTER TABLE ... DISABLE ROW LEVEL SECURITY, or a table that never had it turned on
  • service_role key in client code, or sitting behind VITE_ or NEXT_PUBLIC_
  • email_confirm: true / auto-confirm in real auth paths
  • Stripe webhook handler with no signature check
  • JWT decoded but never verified
  • Firebase rules left on allow read, write: if true, including the console's 30 day test mode
  • live keys committed, recovery code files committed, DELETE FROM with no WHERE

Before publishing I spent a day trying to break it, mostly by throwing agents at it to red team the thing. It went badly.

The big one: it was printing the secrets it found. I'd written a redact() function and only wired it into one of the twelve rules. The other ten printed the whole matching line. So when it found a service_role JWT, it printed the JWT. To your terminal and into your CI logs. Bit of a problem for a tool whose whole pitch is protecting that key.

A 512KB file could lock CI up for 159 seconds from regex backtracking. The same broken pattern meant TRUNCATE TABLE never matched anything in the first place.

If you typo'd the path it printed "Nothing dangerous found" and exited 0. So prodguard check ./scr passes. For a build gate that's about the worst failure available.

24 false positives. The worst hit every Supabase project going: run supabase init in an empty folder, scan it, two HIGH findings straight off the stock config. One of those was my email rule firing on enable_confirmations under [auth.sms], which is the phone setting.

Then a red team pass wrote 29 deliberately vulnerable files and ran it. Zero findings, exit 0. Every rule was matching literal strings, so const [locked, setLocked] = useState(false) went straight through, and that's how an agent actually writes it.

All fixed in 0.5.0 with tests for each. Redaction happens in the rule runner now, so no individual rule can skip it.

https://github.com/Felix0731/prodguard

There's a walkthrough on the site too, if you've not run something like this before: https://prodguard.vercel.app

What it doesn't do: it reads text, it doesn't parse your code. Write the same bug a different way and it'll miss it. It gets things wrong sometimes too, there's an ignore list for that. A pass means those 12 checks didn't fire, nothing more. And anything you set in the dashboard instead of your repo it can't see, same as any repo scanner.

If an agent has broken something in your project that this doesn't catch, tell me what the diff looked like and I'll write a rule for it. That's genuinely the most useful thing I could get right now.

u/ddarol_o_krank — 1 day ago

I'm a 19-year-old apprentice electrician. I got sick of watching everyone quote jobs at the kitchen table, so I built an AI that does it in 3 minutes.

I'm 19, apprenticing as an electrician in New Brunswick. One thing drove me nuts on every job: the actual work would wrap up, and then the journeyman or the boss would go home and spend their whole evening building the quote for the next job — pricing panels, breakers, wire, labour hours, one line at a time. Hours of unpaid work after a 10-hour day.

So I spent the last few months building a tool to do it. You describe the job in plain language — "200A service upgrade, 12 circuits, detached garage" — and it spits out a fully itemized estimate: labour hours, material costs, and code flags for the 2024 CEC. About 3 minutes instead of an evening.

Stuff I learned building it that surprised me:

- Material pricing swings hard by supplier and region, so a generic estimator is basically useless — I had to build in real regional pricing for it to be trusted.

- Contractors don't just want a number, they want to know WHERE a job triggers a permit or a panel-schedule correction. The code flags ended up mattering more than the total.

- It's honest about its limits. It prices ordinary branch power well; it can't touch MV switchgear or data-centre-scale stuff, and I made it say so instead of faking confidence.

It's called VoltiQ (usevoltiq.com), Atlantic Canada for now. It's live and a few real contractors are starting to try it.

I'd genuinely love feedback — especially from other electricians or anyone who's built estimating tools. What am I missing? What would it take for you to actually trust an AI number enough to send it to a client?

reddit.com
u/ddarol_o_krank — 27 days ago