<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Charles Kern on Medium]]></title>
        <description><![CDATA[Stories by Charles Kern on Medium]]></description>
        <link>https://medium.com/@igniteai.ck?source=rss-c3293006e2e4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*NXC63T1lmS3mFQ4U</url>
            <title>Stories by Charles Kern on Medium</title>
            <link>https://medium.com/@igniteai.ck?source=rss-c3293006e2e4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 04:39:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@igniteai.ck/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why Cursor Fixes Firestore Permission Errors by Opening the Rules]]></title>
            <link>https://medium.com/@igniteai.ck/why-cursor-fixes-firestore-permission-errors-by-opening-the-rules-db3d9cac2458?source=rss-c3293006e2e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/db3d9cac2458</guid>
            <dc:creator><![CDATA[Charles Kern]]></dc:creator>
            <pubDate>Fri, 16 Oct 2026 09:43:41 GMT</pubDate>
            <atom:updated>2026-10-16T09:43:41.178Z</atom:updated>
            <content:encoded><![CDATA[<h3>TL;DR</h3><ul><li>When Firestore throws FirebaseError: Missing or insufficient permissions, AI editors often &quot;fix&quot; it by rewriting firestore.rules to allow read, write: if true; or if request.auth != null;.</li><li>Your Firebase config ships in every browser bundle by design, so open rules mean anyone can read or overwrite the data, and auth-only rules mean any signed-up user can.</li><li>The real fix is usually in the query, not the rules: scope rules to the document owner, then add the matching where() so the query fits the rules.</li></ul><p>You ask Cursor or Claude Code to add an orders page to a Firebase app. You load it and the console says FirebaseError: Missing or insufficient permissions. You paste the error back into chat.</p><p>The page loads on the next try. The diff is one file, firestore.rules, and it now lets everyone in.</p><p>This is the same move AI editors make with Supabase RLS errors and Stripe signature errors. The error is the guard doing its job, and the quickest way to make it go away is to remove the guard.</p><h3>The Vulnerable Code</h3><p>The bug is a security rule with no ownership condition. AI editors usually write one of two versions, and both make the error disappear.</p><p>The blunt one:</p><pre>// firestore.rules<br>// CWE-862: no authorization check at all<br>rules_version = &#39;2&#39;;<br>service cloud.firestore {<br>  match /databases/{database}/documents {<br>    match /{document=**} {<br>      allow read, write: if true;<br>    }<br>  }<br>}</pre><p>Firebase’s own “Avoid insecure rules” page shows this exact ruleset with the warning “NEVER use this ruleset in production.” It means anyone who knows your project ID can read, change, or delete every document.</p><p>The version that looks responsible:</p><pre>// firestore.rules<br>// Signed in is not the same as allowed<br>match /orders/{orderId} {<br>  allow read, write: if request.auth != null;<br>}</pre><p>This one feels like a fix because it mentions auth. It is also an example on Firebase’s own “Get started with Cloud Firestore Security Rules” page, which is part of why it shows up so often. But Firebase’s insecure-rules page lists it under “Not recommended: Any logged-in user has read and write access to your entire database.” Anyone can create an account in your app, so anyone can read every order and edit anyone else’s.</p><p>Your project ID is not a secret. Firebase’s API key docs say Firebase API keys are “OK to include in code or checked-in config files” because access to data is controlled by Security Rules and App Check. So with if true, this is the whole attack:</p><pre>curl &quot;https://firestore.googleapis.com/v1/projects/YOUR_PROJECT_ID/databases/(default)/documents/orders&quot;</pre><p>No key, no token. The response is your orders collection.</p><h3>Why This Keeps Happening</h3><p>AI editors open the rules because the error message points at the rules, while the real cause is usually the query. Firestore rules are not filters. Firebase’s “Securely query data” docs say it directly: security rules are not filters, and queries are all or nothing. If a query could return even one document the user is not allowed to read, the whole query fails.</p><p>So when a developer writes good owner-only rules and the AI writes this query:</p><pre>const snap = await getDocs(collection(db, &#39;orders&#39;));</pre><p>Firestore rejects it. The query asks for every order, and the rules only allow your own. The error is correct. But the model sees “insufficient permissions” next to a rules file and widens the rules until the query passes.</p><p>Two more things push it that way. When you create a Firestore database, Firebase offers a test mode that grants access to all users, so plenty of public projects and tutorials start from open rules. And GitHub issues about this error regularly include “my rules are already set to if true&quot; as a debugging step, which makes if true look like a normal thing to try.</p><p>Nothing in the editor flags any of it. The rules file is not JavaScript, there is no type error, and the app works.</p><h3>The Fix</h3><p>Write rules that check ownership, then make every query match them. Store the owner’s uid on each document and compare it to request.auth.uid.</p><p>The rules:</p><pre>// firestore.rules<br>rules_version = &#39;2&#39;;<br>service cloud.firestore {<br>  match /databases/{database}/documents {<br>    match /orders/{orderId} {<br>      allow read, delete: if request.auth != null<br>                          &amp;&amp; request.auth.uid == resource.data.ownerId;<br>      allow create: if request.auth != null<br>                    &amp;&amp; request.auth.uid == request.resource.data.ownerId;<br>      allow update: if request.auth != null<br>                    &amp;&amp; request.auth.uid == resource.data.ownerId<br>                    &amp;&amp; request.resource.data.ownerId == resource.data.ownerId;<br>    }<br>    match /users/{userId} {<br>      allow read: if request.auth != null &amp;&amp; request.auth.uid == userId;<br>      allow update: if request.auth != null &amp;&amp; request.auth.uid == userId<br>                    &amp;&amp; request.resource.data.diff(resource.data)<br>                         .affectedKeys().hasOnly([&#39;displayName&#39;, &#39;photoURL&#39;]);<br>    }<br>  }<br>}</pre><p>The update rule on orders also stops a user from handing a document to someone else by changing ownerId. The affectedKeys().hasOnly() check on users stops a user from writing fields like role or plan into their own profile.</p><p>The query that fits those rules:</p><pre>import { collection, query, where, getDocs, addDoc } from &#39;firebase/firestore&#39;;<br>const uid = auth.currentUser.uid;<br>// Reads: the where() matches the rule, so Firestore allows it<br>const q = query(collection(db, &#39;orders&#39;), where(&#39;ownerId&#39;, &#39;==&#39;, uid));<br>const snap = await getDocs(q);<br>// Writes: always set ownerId to the signed-in user<br>await addDoc(collection(db, &#39;orders&#39;), { ownerId: uid, item, total });</pre><p>Make sure you wait for auth before querying. A query that runs before onAuthStateChanged fires has no request.auth, which produces the same error even with correct rules.</p><p>Then prove it. Run the open-access curl above against your project and confirm it returns a permission error. Sign in as a second test user and confirm you cannot read the first user&#39;s order by ID. The Firebase Emulator Suite with @firebase/rules-unit-testing lets you keep both checks as tests with assertFails, so the next AI edit to firestore.rules breaks the build instead of your data.</p><p>If an admin needs to see every order, do not add an isAdmin field users can write. Set a custom claim from a Cloud Function with setCustomUserClaims and check request.auth.token.admin == true in the rule.</p><h3>FAQ</h3><p><strong>Q: Is it safe to have my Firebase API key in client-side code?</strong></p><p>A: Yes. Firebase’s docs say Firebase API keys are OK to include in code. That is exactly why your Security Rules have to do the work: the key identifies your project, it does not protect your data.</p><p><strong>Q: Is </strong><strong>allow read, write: if request.auth != null secure?</strong></p><p>A: Only if every signed-in user should see and edit every document in that path. For user-owned data, also require request.auth.uid to match an owner field on the document.</p><p><strong>Q: Why does my query fail with “Missing or insufficient permissions” after I tightened the rules?</strong></p><p>A: Firestore rules are not filters. Add a where() clause that matches the rule&#39;s condition, for example where(&#39;ownerId&#39;, &#39;==&#39;, uid), so the query can only return documents the user is allowed to read.</p><p>Want this caught before it ships? <a href="https://tinyurl.com/2c42zjum">SafeWeave</a> hooks into Cursor and Claude Code as an MCP server, and its Firebase checks on Cloud plans flag if true rules (firebase-firestore-open-rules), auth-only writes (firebase-auth-only-write), and open Storage and Realtime Database rules. An App URL scan also checks whether your live Firestore collections are readable by anyone. Even a pre-commit grep for if true in firestore.rules plus one emulator test will catch most of what&#39;s in this post. The important thing is catching it before your data is public, whatever tool you use.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db3d9cac2458" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Cursor Stores Supabase Admin Roles in user_metadata]]></title>
            <link>https://medium.com/@igniteai.ck/why-cursor-stores-supabase-admin-roles-in-user-metadata-8ff701039a58?source=rss-c3293006e2e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ff701039a58</guid>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Charles Kern]]></dc:creator>
            <pubDate>Wed, 14 Oct 2026 18:18:10 GMT</pubDate>
            <atom:updated>2026-10-14T18:18:10.992Z</atom:updated>
            <content:encoded><![CDATA[<h3>TL;DR</h3><ul><li>AI editors keep putting a Supabase user’s role in user_metadata, then gate admin RLS policies and pages on it.</li><li>user_metadata is writable by the user. One supabase.auth.updateUser({ data: { role: &#39;admin&#39; } }) call from the browser console makes anyone an admin.</li><li>Put roles in app_metadata (server-only) or a roles table with no client write policy, and check that instead.</li></ul><p>Ask Cursor or Claude Code to add an admin dashboard to a Supabase app and you will often get something tidy. A role field on sign-up, an RLS policy so admins can read every order, a middleware check that sends non-admins away from /admin. It works on the first run.</p><p>Then open the browser console on a normal, non-admin account and run one line. You are now an admin.</p><p>No exploit, no leaked key. The role was stored in the one place Supabase explicitly lets users edit.</p><h3>The Vulnerable Code</h3><p>The bug is reading authorization from user_metadata, a field the signed-in user controls. Here is the pattern as AI editors usually write it, in three places at once.</p><p>Sign-up stores the role on the user:</p><pre>// signup.js<br>await supabase.auth.signUp({<br>  email,<br>  password,<br>  options: { data: { full_name: name, role: &#39;user&#39; } },<br>});</pre><p>An RLS policy trusts it:</p><pre>-- CWE-269: privilege decided by a value the user can set<br>create policy &quot;Admins can read all orders&quot;<br>on public.orders<br>for select<br>to authenticated<br>using ( (select auth.jwt()) -&gt; &#39;user_metadata&#39; -&gt;&gt; &#39;role&#39; = &#39;admin&#39; );</pre><p>And the app trusts it too:</p><pre>// middleware.js<br>const { data: { user } } = await supabase.auth.getUser();<br>if (user?.user_metadata?.role !== &#39;admin&#39;) {<br>  return NextResponse.redirect(new URL(&#39;/&#39;, request.url));<br>}</pre><p>Here is the whole attack, typed into devtools on any signed-in account:</p><pre>await supabase.auth.updateUser({ data: { role: &#39;admin&#39; } });<br>await supabase.auth.refreshSession();</pre><p>The new token now carries role: admin. The policy passes, the middleware passes, and every order in the table comes back. An attacker does not even need the update call. They can pass role: &#39;admin&#39; straight into signUp and arrive as an admin.</p><p>Supabase’s own docs are blunt about this. The RLS guide says raw_user_meta_data &quot;can be updated by the authenticated user&quot; and that a policy relying on the user_metadata claim &quot;can create security issues in your application.&quot; Supabase&#39;s database linter has a dedicated check for it, 0015 rls_references_user_metadata, at level ERROR. Its rationale: user metadata &quot;is designed to be manipulated by the user themselves&quot; and can be changed &quot;to any value (there is no validation).&quot;</p><h3>The Same Bug, One Step Removed</h3><p>Copying the role into a profiles table at sign-up does not fix it. This trigger is a common AI &quot;improvement&quot;:</p><pre>insert into public.profiles (id, full_name, role)<br>values (<br>  new.id,<br>  new.raw_user_meta_data -&gt;&gt; &#39;full_name&#39;,<br>  coalesce(new.raw_user_meta_data -&gt;&gt; &#39;role&#39;, &#39;user&#39;)<br>);</pre><p>The role still originates from data the user sent at sign-up. And if profiles also has the usual &quot;users can update their own profile&quot; policy, a user can update profiles set role = &#39;admin&#39; on their own row, because RLS checks which row you touch, not which columns.</p><h3>Why This Keeps Happening</h3><p>AI editors put the role in user_metadata because it is the only user field the browser client can write. The code runs with the public anon key, so updateUser and signUp({ options: { data } }) are the tools in reach. Writing to app_metadata needs the admin API and the service_role key, which belongs on a server the AI may not have set up yet.</p><p>The tutorials point the same way. Sign-up examples store full_name and avatar_url in options.data, and a role field looks like one more profile attribute. Both metadata objects show up side by side in auth.jwt(), so a policy reading user_metadata looks exactly as legitimate as one reading app_metadata. Nothing errors. Nothing warns in the editor. The admin page just works, for everyone who asks.</p><h3>The Fix</h3><p>Store roles where only your server can write them, and check them there. You have two good options.</p><p><strong>Option 1: </strong><strong>app_metadata.</strong> Users cannot update it. Set it from a server route or Edge Function with the service_role key, read from a non-public environment variable:</p><pre>// server only. Never import this file in client code.<br>const supabaseAdmin = createClient(<br>  process.env.SUPABASE_URL,<br>  process.env.SUPABASE_SERVICE_ROLE_KEY<br>);<br>await supabaseAdmin.auth.admin.updateUserById(userId, {<br>  app_metadata: { role: &#39;admin&#39; },<br>});</pre><p>Then point the policy at app_metadata:</p><pre>create policy &quot;Admins can read all orders&quot;<br>on public.orders<br>for select<br>to authenticated<br>using ( (select auth.jwt()) -&gt; &#39;app_metadata&#39; -&gt;&gt; &#39;role&#39; = &#39;admin&#39; );</pre><p>One trade-off from Supabase’s docs: a change to app_metadata &quot;will not be reflected using auth.jwt() until the user&#39;s JWT is refreshed.&quot; Demoting an admin takes effect when their token refreshes, not instantly.</p><p><strong>Option 2: a roles table clients cannot write.</strong> This takes effect immediately and keeps roles out of the token:</p><pre>create table public.user_roles (<br>  user_id uuid primary key references auth.users on delete cascade,<br>  role text not null check (role in (&#39;user&#39;, &#39;admin&#39;))<br>);<br>alter table public.user_roles enable row level security;<br>create policy &quot;Users can read their own role&quot;<br>on public.user_roles<br>for select<br>to authenticated<br>using ( (select auth.uid()) = user_id );<br>-- No insert, update or delete policies: only service_role or SQL can change roles.<br>create function public.is_admin()<br>returns boolean<br>language sql<br>stable<br>security definer<br>set search_path = &#39;&#39;<br>as $$<br>  select exists (<br>    select 1 from public.user_roles<br>    where user_id = (select auth.uid()) and role = &#39;admin&#39;<br>  );<br>$$;<br>create policy &quot;Admins can read all orders&quot;<br>on public.orders<br>for select<br>to authenticated<br>using ( (select public.is_admin()) );</pre><p>If you keep a role column on profiles, take it out of what users can update:</p><pre>revoke update on public.profiles from authenticated;<br>grant update (full_name, avatar_url) on public.profiles to authenticated;</pre><p>Drop role from the sign-up options.data and from any trigger that copies metadata into a role column. In middleware, read the role from app_metadata or ask the database, never from user_metadata.</p><p>To test it, sign up a fresh account with options: { data: { role: &#39;admin&#39; } }, then use that session to query an admin-only table. You should get zero rows back. Then grep for the pattern:</p><pre>grep -rn &quot;user_metadata&quot; src/ app/ supabase/migrations/</pre><p>Every hit that makes a yes/no access decision is a bug. In the Supabase dashboard, the Security Advisor runs the 0015 lint across all your policies.</p><h3>FAQ</h3><p><strong>Q: Can Supabase users edit their own user_metadata?</strong> A: Yes. Any signed-in user can change it with supabase.auth.updateUser({ data: { ... } }), and they can set it at sign-up through options.data. Supabase&#39;s docs say it should not be used for security decisions.</p><p><strong>Q: What is the difference between user_metadata and app_metadata in Supabase?</strong> A: user_metadata is profile data the user can write. app_metadata cannot be updated by the user and is set through the admin API with the service_role key, which makes it the right place for roles, plans and team membership.</p><p><strong>Q: Is checking user_metadata in Next.js middleware safe if the page also checks it?</strong> A: No. Both checks read the same user-controlled value, so both pass for an attacker. Move the role to app_metadata or a protected table and check it on the server and in RLS.</p><p>I’ve been running <a href="https://tinyurl.com/25thgjsp">SafeWeave</a> for this. Its repo checks include a rule for roles read from user metadata (supabase-role-from-user-metadata), and the Supabase integration pulls in Supabase&#39;s own security advisors every day, so new policy problems show up without me remembering to look. Those checks are on the Cloud plans. Even without a scanner, the grep and the fresh-account test above catch most of this. The important thing is finding it before someone else opens the console.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ff701039a58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Cursor Ships Your OpenAI Key to Every Visitor (CWE-522)]]></title>
            <link>https://medium.com/@igniteai.ck/why-cursor-ships-your-openai-key-to-every-visitor-cwe-522-a6d65d63a35b?source=rss-c3293006e2e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6d65d63a35b</guid>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Charles Kern]]></dc:creator>
            <pubDate>Tue, 13 Oct 2026 17:35:07 GMT</pubDate>
            <atom:updated>2026-10-13T17:35:07.156Z</atom:updated>
            <content:encoded><![CDATA[<h3>TL;DR</h3><ul><li>When the OpenAI SDK throws “It looks like you’re running in a browser-like environment”, AI editors usually fix it by adding dangerouslyAllowBrowser: true and moving the key into a VITE_ or NEXT_PUBLIC_ variable.</li><li>That ships your secret API key to every visitor. It sits in the JavaScript bundle and in the Authorization header of every request in the Network tab.</li><li>The fix: delete the flag, rotate the key, and call the model from a server route that checks the session, rate limits, and caps tokens.</li></ul><p>You are building an AI feature in a Vite or Next.js app. You install openai, create the client in a React component, and the page crashes with an error that starts &quot;It looks like you&#39;re running in a browser-like environment.&quot; You paste it into Cursor or Claude Code.</p><p>The answer comes back in seconds: add dangerouslyAllowBrowser: true, and since the browser cannot read process.env.OPENAI_API_KEY, rename it to VITE_OPENAI_API_KEY. The chat works. You ship.</p><p>Your key is now public. The error you silenced was the SDK telling you exactly that.</p><h3>The Vulnerable Code</h3><p>The vulnerable pattern is an LLM client constructed in browser code with a key from a public environment variable. Here is the shape that comes back after the AI “fixes” the error in a Vite + React app:</p><pre>// src/components/Chat.tsx<br>// CWE-522: Insufficiently Protected Credentials<br>import OpenAI from &#39;openai&#39;;<br>const openai = new OpenAI({<br>  apiKey: import.meta.env.VITE_OPENAI_API_KEY,<br>  dangerouslyAllowBrowser: true,<br>});<br>export async function ask(prompt: string) {<br>  const res = await openai.chat.completions.create({<br>    model: &#39;gpt-4o-mini&#39;,<br>    messages: [{ role: &#39;user&#39;, content: prompt }],<br>  });<br>  return res.choices[0].message.content;<br>}</pre><p>The Next.js version is the same with process.env.NEXT_PUBLIC_OPENAI_API_KEY in a &#39;use client&#39; component.</p><p>Two things make this a leak, not a risk:</p><ol><li>Vite inlines every VITE_ variable into the built JavaScript, and Next.js does the same with NEXT_PUBLIC_. The key is a string in a file anyone can download.</li><li>The browser calls the provider directly, so the key is sent as Authorization: Bearer sk-... on every request. Open DevTools, click the Network tab, send one chat message, and copy it.</li></ol><p>No exploit is needed. The attacker is anyone who opens DevTools, and the bill is yours.</p><h3>Why This Keeps Happening</h3><p>AI editors optimize for making the error disappear, and the error message itself contains the option that does it. OpenAI’s SDK refuses to run in a browser by default, explains why, and names dangerouslyAllowBrowser as the switch. The Anthropic TypeScript SDK has the same option. From the model&#39;s point of view, the fix is printed right there in the stack trace.</p><p>The second half follows from the first. Once the client lives in the browser, process.env.OPENAI_API_KEY is undefined, so the next error is a missing key. The shortest path is the public prefix, because that is what Vite and Next.js docs say to use when the browser needs a variable.</p><p>Plenty of tutorials and demo repos do exactly this, because it is the fastest way to get a chat box on screen. The OpenAI SDK README even lists cases where the flag “might not be dangerous”: internal tools with trusted users, keys with very limited scope, short-lived dev keys. A production app with public sign-up fits none of them.</p><h3>The Fix</h3><p>Remove dangerouslyAllowBrowser, rotate the exposed key, and move the model call into a server route that authenticates the caller, rate limits per user, and caps output tokens. The browser calls your route, never the provider.</p><p>Next.js App Router:</p><pre>// app/api/chat/route.ts (server only)<br>import OpenAI from &#39;openai&#39;;<br>import { NextResponse } from &#39;next/server&#39;;<br>import { getSession } from &#39;@/lib/auth&#39;;         // your auth<br>import { rateLimit } from &#39;@/lib/rate-limit&#39;;    // e.g. Upstash, Redis<br>const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY }); // no NEXT_PUBLIC_<br>export async function POST(req: Request) {<br>  const session = await getSession();<br>  if (!session) return NextResponse.json({ error: &#39;unauthorized&#39; }, { status: 401 });<br>  if (!(await rateLimit(session.userId))) {<br>    return NextResponse.json({ error: &#39;slow down&#39; }, { status: 429 });<br>  }<br>  const { prompt } = await req.json();<br>  if (typeof prompt !== &#39;string&#39; || prompt.length &gt; 4000) {<br>    return NextResponse.json({ error: &#39;bad input&#39; }, { status: 400 });<br>  }<br>  const res = await openai.chat.completions.create({<br>    model: &#39;gpt-4o-mini&#39;,<br>    max_tokens: 500,<br>    messages: [{ role: &#39;user&#39;, content: prompt }],<br>  });<br>  return NextResponse.json({ text: res.choices[0].message.content });<br>}</pre><p>The client component only talks to your route:</p><pre>// &#39;use client&#39;<br>const res = await fetch(&#39;/api/chat&#39;, {<br>  method: &#39;POST&#39;,<br>  headers: { &#39;Content-Type&#39;: &#39;application/json&#39; },<br>  body: JSON.stringify({ prompt }),<br>});<br>const { text } = await res.json();</pre><p>A Vite app has no server of its own, so the route goes in whatever backend you already have: a Supabase Edge Function, a Cloudflare Worker, a Vercel or Netlify function, or a small Express server. The rules are the same. The key lives in that backend’s secrets, never in a VITE_ variable.</p><p>Then clean up properly:</p><ul><li><strong>Rotate the key.</strong> Deleting the variable does not help. Every bundle you already deployed still contains the old key, and so do your git history and any CDN caches.</li><li><strong>Check the bundle.</strong> After npm run build, run grep -rE &quot;sk-(proj|ant)-|sk-[A-Za-z0-9]{32}&quot; dist/ (or .next/static/ for Next.js). It should return nothing. A plain sk- search also matches words like &quot;risk-&quot;, so use the pattern.</li><li><strong>Set a spending limit</strong> on the key’s project in your provider dashboard, so a leak you missed has a ceiling.</li></ul><h3>FAQ</h3><p><strong>Q: Is </strong><strong>dangerouslyAllowBrowser: true ever safe?</strong> A: Only where every user is trusted, like an internal tool, or with a key that has a tiny scope and a short life. For a public app, no. Anyone who loads the page can read the key.</p><p><strong>Q: Can I hide the key with obfuscation or environment variables?</strong> A: No. Anything the browser needs to send a request, the user can read. VITE_ and NEXT_PUBLIC_ variables are inlined into the bundle as plain strings, and the key also appears in every request header.</p><p><strong>Q: My key was exposed. Is deleting it from the code enough?</strong> A: No. Rotate it in the provider dashboard first. Old builds, git history and caches keep the original value.</p><p>I’ve been running <a href="https://tinyurl.com/2yyt694p">SafeWeave</a> for this. Its cloud repo scans (Cloud and Cloud Plus plans) flag an AI SDK client created with dangerouslyAllowBrowser: true and an LLM key read from a NEXT_PUBLIC_, VITE_, EXPO_PUBLIC_ or REACT_APP_ variable, and the live app scan checks your deployed site&#39;s code for provider keys. It also hooks into Cursor and Claude Code as an MCP server. Even without it, a grep of your build output for key prefixes and one look at the Network tab will tell you if you have this problem. The important thing is to look before someone else does.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6d65d63a35b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Cursor Stripe Webhooks Accept Fake Payments (CWE-345)]]></title>
            <link>https://medium.com/@igniteai.ck/why-cursor-stripe-webhooks-accept-fake-payments-cwe-345-70e2f23b80a7?source=rss-c3293006e2e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/70e2f23b80a7</guid>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Charles Kern]]></dc:creator>
            <pubDate>Mon, 12 Oct 2026 17:04:50 GMT</pubDate>
            <atom:updated>2026-10-12T17:04:50.997Z</atom:updated>
            <content:encoded><![CDATA[<h3>TL;DR</h3><ul><li>AI editors often “fix” the Stripe error No signatures found matching the expected signature for payload by making signature verification optional, so the webhook accepts any POST.</li><li>Anyone who finds the endpoint can send a fake checkout.session.completed event and give themselves a paid plan.</li><li>The fix: verify every event against the raw body with a required STRIPE_WEBHOOK_SECRET, return 400 on failure, and never fall back to the unverified payload.</li></ul><p>The signature error shows up on almost every first Stripe integration. You run stripe listen, trigger a test checkout, and the terminal prints Webhook signature verification failed. You paste the error into Cursor or Claude Code and ask it to make the error go away.</p><p>It does. The error disappears because the check disappears. Payments still “work” in testing, the plan upgrades, and nobody looks at the webhook file again.</p><p>What makes this pattern so common is that Stripe’s own Node quickstart ships the escape hatch. The handler starts with let event = request.body;, then runs verification only inside if (endpointSecret) { ... }, with the comment &quot;Only verify the event if you have an endpoint secret defined.&quot; That is a convenience for local testing. In production, a missing or misspelled environment variable turns it into an open door.</p><h3>The Vulnerable Code</h3><p>The vulnerable handler accepts the event body as trusted data whenever verification is skipped or fails. Here is the shape I see after an AI “fixes” the signature error in a Next.js App Router project:</p><pre>// app/api/stripe/webhook/route.ts<br>// CWE-345: Insufficient Verification of Data Authenticity<br>import Stripe from &#39;stripe&#39;;<br>const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);<br>export async function POST(req: Request) {<br>  const body = await req.json();<br>  let event = body;<br>  // Only verify if a secret is configured (signature kept failing locally)<br>  if (process.env.STRIPE_WEBHOOK_SECRET) {<br>    try {<br>      event = stripe.webhooks.constructEvent(<br>        JSON.stringify(body),<br>        req.headers.get(&#39;stripe-signature&#39;)!,<br>        process.env.STRIPE_WEBHOOK_SECRET<br>      );<br>    } catch (err) {<br>      console.warn(&#39;Signature check failed, continuing&#39;, err);<br>    }<br>  }<br>  if (event.type === &#39;checkout.session.completed&#39;) {<br>    await db.user.update({<br>      where: { id: event.data.object.client_reference_id },<br>      data: { plan: &#39;pro&#39; },<br>    });<br>  }<br>  return Response.json({ received: true });<br>}</pre><p>Three separate failures are stacked here:</p><ol><li>req.json() followed by JSON.stringify(body) changes the bytes. Stripe signs the exact raw body, so verification fails on every real event. That is the bug that started the loop.</li><li>The catch logs and carries on, so a failed check still processes the event.</li><li>If STRIPE_WEBHOOK_SECRET is unset in production, verification never runs at all.</li></ol><p>Exploiting it takes one request:</p><pre>curl -X POST https://yourapp.com/api/stripe/webhook \<br>  -H &#39;Content-Type: application/json&#39; \<br>  -d &#39;{&quot;type&quot;:&quot;checkout.session.completed&quot;,&quot;data&quot;:{&quot;object&quot;:{&quot;client_reference_id&quot;:&quot;&lt;my-user-id&gt;&quot;}}}&#39;</pre><p>No card, no Stripe account. The user is now on the pro plan.</p><h3>Why This Keeps Happening</h3><p>AI editors reproduce the most common shape of a Stripe handler, and the most common shape treats verification as optional. The quickstart pattern above, plus years of blog posts and tutorials that copied it, taught the model that if (secret) verify() is normal.</p><p>Then the debugging loop does the rest. The signature error has only three causes according to Stripe’s troubleshooting page: the wrong endpoint secret, a modified request body, or a malformed signature header. The two that bite most often:</p><ul><li><strong>Wrong secret.</strong> stripe listen prints its own whsec_ secret. It is different from the secret of the endpoint in your Dashboard, and each one only verifies its own events.</li><li><strong>Parsed body.</strong> express.json() registered before the webhook route, or req.json() in Next.js, hands constructEvent a parsed object instead of the raw string.</li></ul><p>Both are configuration problems. When the model cannot see your env file or middleware order, the shortest path to “no error” is to stop throwing, and that is the edit it proposes.</p><h3>The Fix</h3><p>Verify every event against the raw request body with a required secret, reject anything that fails with a 400, and only act on the object constructEvent returns. No fallback, no optional path.</p><p>Next.js App Router:</p><pre>// app/api/stripe/webhook/route.ts<br>import Stripe from &#39;stripe&#39;;<br>import { NextResponse } from &#39;next/server&#39;;<br>const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);<br>const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET;<br>export async function POST(req: Request) {<br>  if (!webhookSecret) {<br>    console.error(&#39;STRIPE_WEBHOOK_SECRET is not set&#39;);<br>    return NextResponse.json({ error: &#39;misconfigured&#39; }, { status: 500 });<br>  }<br>  const body = await req.text(); // raw body, never req.json()<br>  const sig = req.headers.get(&#39;stripe-signature&#39;);<br>  if (!sig) return NextResponse.json({ error: &#39;missing signature&#39; }, { status: 400 });<br>  let event: Stripe.Event;<br>  try {<br>    event = stripe.webhooks.constructEvent(body, sig, webhookSecret);<br>  } catch {<br>    return NextResponse.json({ error: &#39;invalid signature&#39; }, { status: 400 });<br>  }<br>  if (await alreadyProcessed(event.id)) {<br>    return NextResponse.json({ received: true });<br>  }<br>  if (event.type === &#39;checkout.session.completed&#39;) {<br>    const session = event.data.object as Stripe.Checkout.Session;<br>    if (session.payment_status === &#39;paid&#39;) {<br>      await grantAccess(session.client_reference_id!, session.id);<br>    }<br>  }<br>  await markProcessed(event.id);<br>  return NextResponse.json({ received: true });<br>}</pre><p>Express, where middleware order is the whole fix:</p><pre>// Webhook route FIRST, with the raw body<br>app.post(&#39;/api/stripe/webhook&#39;, express.raw({ type: &#39;application/json&#39; }), (req, res) =&gt; {<br>  let event;<br>  try {<br>    event = stripe.webhooks.constructEvent(<br>      req.body,<br>      req.headers[&#39;stripe-signature&#39;],<br>      process.env.STRIPE_WEBHOOK_SECRET<br>    );<br>  } catch (err) {<br>    return res.sendStatus(400);<br>  }<br>  // handle event.type here<br>  res.sendStatus(200);<br>});<br>// JSON parsing for every other route AFTER<br>app.use(express.json());</pre><p>Python with Flask:</p><pre>import os<br>import stripe<br>from flask import Flask, request<br>app = Flask(__name__)<br>WEBHOOK_SECRET = os.environ[&quot;STRIPE_WEBHOOK_SECRET&quot;]  # KeyError at startup if missing<br>@app.post(&quot;/api/stripe/webhook&quot;)<br>def stripe_webhook():<br>    payload = request.get_data()  # raw bytes<br>    sig = request.headers.get(&quot;Stripe-Signature&quot;, &quot;&quot;)<br>    try:<br>        event = stripe.Webhook.construct_event(payload, sig, WEBHOOK_SECRET)<br>    except (ValueError, stripe.SignatureVerificationError):<br>        return &quot;&quot;, 400<br>    # handle event[&quot;type&quot;] here<br>    return &quot;&quot;, 200</pre><p>Three details that matter as much as the signature check:</p><ul><li><strong>Use the right secret per environment.</strong> The stripe listen secret locally, the Dashboard endpoint secret in production. Test mode and live mode endpoints have different secrets.</li><li><strong>Track </strong><strong>event.id.</strong> Stripe says endpoints can receive the same event more than once. Log processed IDs and skip repeats.</li><li><strong>Take the plan from the verified event.</strong> Never from a query string on your success page or a field in the request body.</li></ul><p>Then rerun the curl from above against your deployed app. You want a 400. If you get a 200, the door is still open.</p><h3>FAQ</h3><p><strong>Q: Why does Stripe say “No signatures found matching the expected signature for payload”?</strong> A: One of the three inputs to constructEvent is wrong. Usually it is the wrong whsec_ secret (the stripe listen secret and the Dashboard secret are different) or a request body that a framework already parsed into JSON.</p><p><strong>Q: Is IP allowlisting enough to secure a Stripe webhook?</strong> A: No. Stripe’s webhook docs recommend IP allowlisting and signature verification together. The signature is what proves the event was not sent or modified by a third party.</p><p><strong>Q: Can I skip verification in development?</strong> A: You do not need to. stripe listen gives you a signing secret for local testing, so the same verified code path runs locally and in production. Code that only verifies &quot;if a secret exists&quot; is how the skip reaches production.</p><p>I’ve been running <a href="https://tinyurl.com/2xoqcx3a">SafeWeave</a> for this. Its cloud repo scans (Cloud and Cloud Plus plans) include Stripe rules that flag a webhook handler that never calls constructEvent and a constructEvent call with an empty or defaulted secret, and it hooks into Cursor and Claude Code as an MCP server for the rest of the scanners. Even without it, a forged-event curl against your own endpoint and a grep for constructEvent will tell you most of what you need. The important thing is to check before a stranger does.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70e2f23b80a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Cursor Fixes Supabase RLS Errors by Opening the Table]]></title>
            <link>https://medium.com/@igniteai.ck/why-cursor-fixes-supabase-rls-errors-by-opening-the-table-6aec71da04fa?source=rss-c3293006e2e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/6aec71da04fa</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[supabase]]></category>
            <dc:creator><![CDATA[Charles Kern]]></dc:creator>
            <pubDate>Sun, 11 Oct 2026 12:47:44 GMT</pubDate>
            <atom:updated>2026-10-11T12:47:44.678Z</atom:updated>
            <content:encoded><![CDATA[<h3>TL;DR</h3><ul><li>When a Supabase insert fails with “new row violates row-level security policy”, AI editors usually “fix” it with a using (true) / with check (true) policy or by disabling RLS.</li><li>That makes the error go away because it makes the table readable or writable by anyone holding your anon key, which ships in your frontend bundle.</li><li>The real fix is four owner-scoped policies built on auth.uid(), plus a 60-second curl test with the anon key.</li></ul><p>I hit this on a small notes app last week. The insert from the browser failed with new row violates row-level security policy for table &quot;notes&quot;. I pasted the error into Cursor and asked it to fix it.</p><p>It did. The error disappeared, the app worked, and I almost moved on. Then I read the migration it wrote.</p><p>The “fix” was a policy that lets anyone, signed in or not, read and write every row in the table. The app worked because nothing was being checked anymore.</p><h3>The Vulnerable Code</h3><p>The fix an AI editor typically writes for an RLS error is an always-true policy, or turning RLS off entirely. Both silence the error by removing the access control that caused it.</p><pre>-- What the AI wrote to &quot;fix&quot; the insert error (CWE-863, Incorrect Authorization)<br>create policy &quot;Enable insert for all users&quot;<br>  on public.notes for insert<br>  with check (true);<br>create policy &quot;Enable read access for all users&quot;<br>  on public.notes for select<br>  using (true);<br>-- Or, when that did not work on the first try:<br>alter table public.notes disable row level security;</pre><p>Here is why that matters. Your Supabase anon (publishable) key is meant to be public. It sits in your JavaScript bundle, and anyone can copy it out of devtools. Row Level Security is the only thing standing between that key and your data. A using (true) policy tells Postgres to let every row through. With RLS disabled, any role with a grant on the table can read and write all of it through the auto-generated REST API.</p><p>The second “fix” I see a lot is worse. When the policy route gets confusing, the AI moves the insert to a client that uses the service_role key and exposes it as NEXT_PUBLIC_SUPABASE_SERVICE_ROLE_KEY. Supabase&#39;s own docs say that key goes through the service_role role, which has the bypassrls attribute. In a public env var, it is your whole database, readable from the browser.</p><h3>Why This Keeps Happening</h3><p>AI editors optimize for making the error go away, and an always-true policy is the shortest diff that does it. The model sees “violates row-level security policy”, pattern-matches it to “the policy is too strict”, and loosens it.</p><p>There is also a lot of using (true) in its training data. Quickstarts and tutorials use it for public lookup tables, and policy names like &quot;Enable read access for all users&quot; appear constantly. For a table of country codes, that is fine. For a table of user notes, invoices or chat messages, it is a data leak.</p><p>This is not hypothetical. CVE-2025-48757, published May 29, 2025, describes insufficient RLS policies in apps generated by Lovable that let remote unauthenticated attackers read or write database tables. Matt Palmer, who reported it, lists exposed names, emails, third-party API keys and payment status data in his write-up. Lovable disputes the CVE, saying each customer is responsible for protecting their app’s data. That dispute is the point. Whoever is responsible, the policy is what decides, and the AI wrote the policy.</p><h3>The Fix</h3><p>Keep RLS on and write one policy per operation that ties each row to the signed-in user with auth.uid(). The insert error almost always means the row you sent does not have a user_id matching the caller, so fix the data, not the policy.</p><pre>alter table public.notes enable row level security;<br>-- Let Postgres fill in the owner so the client cannot forget or fake it<br>alter table public.notes alter column user_id set default auth.uid();<br>create policy &quot;notes_select_own&quot; on public.notes<br>  for select to authenticated<br>  using ((select auth.uid()) = user_id);<br>create policy &quot;notes_insert_own&quot; on public.notes<br>  for insert to authenticated<br>  with check ((select auth.uid()) = user_id);<br>create policy &quot;notes_update_own&quot; on public.notes<br>  for update to authenticated<br>  using ((select auth.uid()) = user_id)<br>  with check ((select auth.uid()) = user_id);<br>create policy &quot;notes_delete_own&quot; on public.notes<br>  for delete to authenticated<br>  using ((select auth.uid()) = user_id);</pre><p>A few details that matter:</p><ul><li>using decides which existing rows a user can see or change. with check decides what a new or updated row is allowed to look like. Update needs both, or a user can move their row to someone else&#39;s user_id.</li><li>to authenticated keeps signed-out visitors out entirely. Supabase&#39;s docs also point out that auth.uid() is null for anonymous requests, so the comparison quietly fails for them rather than erroring.</li><li>Wrapping auth.uid() in (select ...) lets Postgres evaluate it once per statement instead of once per row. Supabase recommends it for performance.</li></ul><p>On the client, insert without sending user_id at all:</p><pre>// The default fills user_id from the caller&#39;s JWT<br>const { error } = await supabase.from(&#39;notes&#39;).insert({ body: text });</pre><p>If something genuinely needs elevated access, like an admin action or a webhook, do it in a server route or Edge Function that verifies the caller first, and read the service_role key from a server-only env var with no NEXT_PUBLIC_ or VITE_ prefix.</p><h3>How to Check Your Own App</h3><p>Use the same key an attacker would use: your anon key, with no user session.</p><pre>curl &quot;https://YOUR_PROJECT_REF.supabase.co/rest/v1/notes?select=*&quot; \<br>  -H &quot;apikey: $SUPABASE_ANON_KEY&quot; \<br>  -H &quot;Authorization: Bearer $SUPABASE_ANON_KEY&quot;</pre><p>If that returns rows, anyone on the internet can get the same rows. With the policies above, it returns []. Repeat it for every table that holds user data, and grep your migrations for using (true), with check (true) and disable row level security.</p><h3>FAQ</h3><p><strong>Q: Is it safe to expose the Supabase anon key in my frontend?</strong></p><p>A: The anon key is designed to be public, but it is only safe when every table it can reach has RLS enabled with policies that scope rows to the caller. Without that, the anon key is a read and write key for your data.</p><p><strong>Q: How do I fix “new row violates row-level security policy” without disabling RLS?</strong></p><p>A: Make sure the inserted row’s user_id equals auth.uid(), ideally by setting the column default to auth.uid(), and add an insert policy with with check ((select auth.uid()) = user_id) for the authenticated role.</p><p><strong>Q: When is USING (true) acceptable?</strong></p><p>A: Only for SELECT on tables that are genuinely public, like a list of countries or published blog posts. Never for INSERT, UPDATE or DELETE, and never on a table with user data.</p><p>I’ve been running <a href="https://tinyurl.com/2bkvyyfs">SafeWeave</a> for this. Its repo checks flag RLS being disabled (supabase-rls-disabled), always-true policies (supabase-rls-passthrough-policy) and a service_role key in a NEXT_PUBLIC_ or VITE_ variable, and its read-only live check runs the same anon-key test against your deployed app to find tables anyone can read. Those checks are on the Cloud plan; the free tier shows the counts. Even without a scanner, the curl test above and a grep for using (true) catch most of this. The important thing is catching it before your users&#39; data is the thing that proves it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6aec71da04fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Cursor Lets Any User Make Themselves Admin (CWE-915)]]></title>
            <link>https://medium.com/@igniteai.ck/why-cursor-lets-any-user-make-themselves-admin-cwe-915-cc4d38ace888?source=rss-c3293006e2e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc4d38ace888</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Charles Kern]]></dc:creator>
            <pubDate>Thu, 08 Oct 2026 11:14:34 GMT</pubDate>
            <atom:updated>2026-10-08T11:14:34.507Z</atom:updated>
            <content:encoded><![CDATA[<h3>TL;DR</h3><ul><li>Ask Cursor or Claude Code for an “update profile” route and you often get prisma.user.update({ data: req.body }). Any logged-in user can add &quot;role&quot;: &quot;admin&quot; to the request and it saves.</li><li>Point that out and the fix it writes usually strips role and nothing else. emailVerified, credits, plan, orgId and Prisma relation writes still go straight through.</li><li>The fix is an allowlist schema that rejects unknown keys, not a denylist. About ten lines of zod or Pydantic.</li></ul><p>Here is a test I now run on every route an AI editor writes for me.</p><p>I ask for something boring. A settings page with name, bio and avatar. Cursor writes the form, the API route and the database call in under a minute, and all of it works. Then I open devtools, copy the PATCH request, add one field the form never sends, and replay it.</p><p>&quot;role&quot;: &quot;admin&quot;. 200 OK. Refresh. Admin.</p><p>The route had an auth check. It even scoped the update to my own user ID. It just never asked which columns I was allowed to change.</p><h3>The Vulnerable Code</h3><p>Mass assignment (CWE-915) happens when a route copies the whole request body into a database write, so the client decides which columns change. This is the shape AI editors produce for “update my profile” routes:</p><pre>// CWE-915: Improperly Controlled Modification of Dynamically-Determined Object Attributes<br>app.patch(&#39;/api/me&#39;, requireAuth, async (req, res) =&gt; {<br>  const user = await prisma.user.update({<br>    where: { id: req.user.id },<br>    data: req.body,<br>  });<br>  res.json(user);<br>});</pre><p>The attack is one extra field:</p><pre>curl -X PATCH https://app.example.com/api/me \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -H &quot;Cookie: session=...&quot; \<br>  -d &#39;{&quot;name&quot;:&quot;Sam&quot;,&quot;role&quot;:&quot;admin&quot;,&quot;emailVerified&quot;:true}&#39;</pre><p>Mongoose has the same problem. User.findByIdAndUpdate(req.user.id, req.body) drops fields that are not in the schema, but role is in the schema, so it lands.</p><p>Python versions look like this:</p><pre>@app.patch(&quot;/api/me&quot;)<br>def update_me(payload: dict, user=Depends(current_user), db=Depends(get_db)):<br>    for key, value in payload.items():<br>        setattr(user, key, value)  # CWE-915: the client picks the columns<br>    db.commit()<br>    return {&quot;ok&quot;: True}</pre><p>As a bonus, res.json(user) in the first example sends the password hash back to the browser. That one is a separate bug, but it travels with this one.</p><h3>The Fix the AI Writes Is a Denylist</h3><p>When you tell the AI that users can set their own role, it removes the field you named and keeps the rest of the body flowing through:</p><pre>const { role, ...rest } = req.body;<br>await prisma.user.update({ where: { id: req.user.id }, data: rest });</pre><p>That blocks role. It does not block emailVerified, credits, plan, stripeCustomerId, orgId, or the column someone adds next quarter. A denylist has to be updated every time the schema changes, and nobody updates it.</p><p>Prisma makes it worse. The data object accepts nested relation writes, so the body can do more than set columns:</p><pre>{ &quot;organization&quot;: { &quot;connect&quot;: { &quot;id&quot;: &quot;someone-elses-org-id&quot; } } }</pre><p>If your User model has an organization relation, that payload moves the attacker into another tenant. No column called role involved.</p><h3>Why This Keeps Happening</h3><p>AI editors write mass assignment because passing the whole body through is the shortest code that makes the feature work, and CRUD tutorials do it constantly. The model is reproducing the most common pattern it saw, and the most common pattern skips the field check.</p><p>The bug is also invisible in review. The route has auth. It has ownership scoping. The form only sends three fields, so every happy-path test passes. Nothing fails until someone edits a request by hand.</p><p>TypeScript does not help either. req.body is whatever the client sent at runtime, and Prisma validates field names against your schema. role is a valid field, so Prisma is happy to write it.</p><p>Rails learned this the hard way. In 2012 a developer used a mass assignment bug on GitHub to add his own key to the Rails organization and push a commit to the Rails repository. Rails 4 then made strong parameters the default. Express, Fastify, Next.js route handlers and FastAPI have no equivalent default, so the protection exists only if someone writes it. The AI does not.</p><h3>The Fix</h3><p>Validate the body against an allowlist schema that names the only fields a user may change, reject unknown keys, and pass only the parsed result to the database. Admin-only fields get their own route with its own role check.</p><p>JavaScript with zod:</p><pre>import { z } from &#39;zod&#39;;</pre><pre>const UpdateMe = z.object({<br>  name: z.string().min(1).max(80).optional(),<br>  bio: z.string().max(500).optional(),<br>  avatarUrl: z.string().url().optional(),<br>}).strict(); // unknown keys like &quot;role&quot; fail validation</pre><pre>app.patch(&#39;/api/me&#39;, requireAuth, async (req, res) =&gt; {<br>  const parsed = UpdateMe.safeParse(req.body);<br>  if (!parsed.success) return res.status(400).json({ error: &#39;Invalid fields&#39; });</pre><pre>  const user = await prisma.user.update({<br>    where: { id: req.user.id },<br>    data: parsed.data,<br>    select: { id: true, name: true, bio: true, avatarUrl: true },<br>  });<br>  res.json(user);<br>});</pre><p>Python with Pydantic v2:</p><pre>from pydantic import BaseModel, ConfigDict, Field</pre><pre>class UpdateMe(BaseModel):<br>    model_config = ConfigDict(extra=&quot;forbid&quot;)  # unknown keys raise a 422<br>    name: str | None = Field(default=None, min_length=1, max_length=80)<br>    bio: str | None = Field(default=None, max_length=500)<br>    avatar_url: str | None = Field(default=None, max_length=2048)</pre><pre>@app.patch(&quot;/api/me&quot;)<br>def update_me(payload: UpdateMe, user=Depends(current_user), db=Depends(get_db)):<br>    for key, value in payload.model_dump(exclude_unset=True).items():<br>        setattr(user, key, value)<br>    db.commit()<br>    return {&quot;ok&quot;: True}</pre><p>I use .strict() and extra=&quot;forbid&quot; instead of the default behavior on purpose. By default zod strips unknown keys and Pydantic ignores them. That is safe, but silent. Rejecting them turns a probe into a 4xx in your logs, and it makes a test fail loudly the day someone wires the wrong schema to a route.</p><p>To find the bug in an existing codebase, this takes about a minute:</p><pre>grep -rnE &quot;data: *req\.body|\.\.\.req\.body|Update\([^)]*req\.body&quot; src/<br>grep -rn &quot;setattr(&quot; app/</pre><h3>FAQ</h3><p><strong>Q: What is mass assignment (CWE-915)?</strong></p><p>A: It is a bug where an endpoint writes client-supplied fields straight into a model, so an attacker can set fields they should never control, like role, isAdmin or emailVerified. OWASP&#39;s API Security Top 10 (2023) groups it under API3, Broken Object Property Level Authorization.</p><p><strong>Q: Does TypeScript or Prisma prevent mass assignment?</strong></p><p>A: No. Types are erased at runtime, so req.body contains whatever the client sent. Prisma checks that each field exists in your schema, and role does.</p><p><strong>Q: Is removing </strong><strong>role from </strong><strong>req.body enough?</strong></p><p>A: No. A denylist misses every other sensitive field and every field added later. Use an allowlist schema that rejects unknown keys.</p><p>I’ve been running <a href="https://tinyurl.com/25qmjqgp">SafeWeave</a> for this. It hooks into Cursor and Claude Code as an MCP server and scans each change before I move on. For this bug class, though, the schema is the real control: a scanner can flag data: req.body, but only you know which fields a user is allowed to touch. Even the grep above, run once a week, will catch most of what&#39;s in this post. The important thing is catching it early, whatever tool you use.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc4d38ace888" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI Security Patches Fail 74% of the Time: 6,080 Tested]]></title>
            <link>https://medium.com/@igniteai.ck/ai-security-patches-fail-74-of-the-time-6-080-tested-662a75961578?source=rss-c3293006e2e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/662a75961578</guid>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Charles Kern]]></dc:creator>
            <pubDate>Fri, 11 Sep 2026 17:54:51 GMT</pubDate>
            <atom:updated>2026-09-11T17:54:51.937Z</atom:updated>
            <content:encoded><![CDATA[<h3>TL;DR</h3><ul><li>1Password’s Off-by-1 Labs had ChatGPT 5.5 and Claude Opus 4.8 write 6,080 patches for six real CVEs. Only 26.0% were complete fixes that did not change how the application behaved.</li><li>The common failure is not a broken patch. It is a narrow input check that looks like a fix, passes tests, and leaves the vulnerable code underneath untouched.</li><li>Treat an AI patch as a hypothesis, not a fix. The model that wrote it is the worst possible judge of whether it worked.</li></ul><p>I asked Claude to fix a SQL injection a few weeks ago. Nine seconds later I had a diff, a confident summary, and a tidy little sanitizer function. Tests passed. I merged it.</p><p>Two weeks later I found the same injection, one column over.</p><p>I filed that under “I was sloppy” and moved on. Then I read the study that says it is roughly the median outcome.</p><h3>What the Study Actually Found</h3><p>Frontier models produce a complete, behavior-preserving security patch about 26% of the time. The other three quarters either fail to close the vulnerability, close it while changing how the application works, or close it while opening something new.</p><p>The research is from Off-by-1 Labs, the security team 1Password stood up this year. They published it on August 6, 2026 under a title I wish I had thought of first: “Frontier Models’ Vulnerability Patches are Often F.L.A.W.E.D.” The acronym stands for Fix-Like Artifacts With Embedded Defects, which is the most precise description of this failure mode I have seen anywhere.</p><p>The setup: two models, ChatGPT 5.5 and Claude Opus 4.8, both running with their vendors’ cyber guardrails enabled. Six recently disclosed CVEs, all real and all non-trivial:</p><ul><li>CVE-2026-31431, Linux privilege escalation</li><li>CVE-2026-34197, ActiveMQ remote code execution</li><li>CVE-2026-8512, Chrome File System Access API</li><li>CVE-2026-45185, Exim remote code execution</li><li>CVE-2026-22738, Spring AI SpEL remote code execution</li><li>GHSA-wpqr-6v78-jr5g, Gemini CLI remote code execution</li></ul><p>They generated 6,480 patches in sets of 20, across three environment configurations and nine prompt templates per vulnerability. Then they threw out 400 where the model had clearly gone and retrieved the real upstream fix instead of reasoning its way there, and graded the remaining 6,080 on a five-point scale:</p><ul><li>S1: fixes it, does not change behavior. 26.0%</li><li>S2: fixes it, changes behavior. 20.1%</li><li>S3, S4, S5: does not fix it, or fixes it while introducing something new. 53.9% combined</li></ul><p>Roughly one patch in twenty introduced a fresh vulnerability. More than a third of the patches that graded as successes were still flagged as fragile.</p><p>The number that stuck with me is not the headline. It is this: patches prompted with a correct fix direction closed the bug about two thirds of the time. Patches prompted with a plausible but wrong direction dropped to about one in six. The model is not diagnosing anything. It is executing your framing, confidently, at $2.11 to $2.81 per attempt.</p><h3>The Fix That Isn’t a Fix</h3><p>The dominant failure mode is a narrowly targeted input guard bolted onto vulnerable code that was never restructured. The study’s own words: these patches “guard against vulnerable inputs with narrowly targeted checks, rather than fully addressing the underlying vulnerable code.”</p><p>Here is that shape in code you will actually recognize. Start with the injection:</p><pre>// CWE-89, the original<br>db.query(`SELECT * FROM orders WHERE customer = &#39;${name}&#39;`);</pre><p>Ask a model to fix it without telling it how, and there is a very good chance you get this back:</p><pre>// The &quot;fix&quot; - escapes quotes, keeps the string concatenation<br>const safe = name.replace(/&#39;/g, &quot;&#39;&#39;&quot;);<br>db.query(`SELECT * FROM orders WHERE customer = &#39;${safe}&#39;`);</pre><p>That patch will pass your test suite. It will survive a skim in code review. It reads like security work. And it is still injectable.</p><p>Two reasons. On MySQL with backslash escapes on, which is the default, a backslash before the quote defeats naive quote-doubling outright. And the second someone reuses that safe helper on a numeric column, where the value is not wrapped in quotes at all, there is nothing left for it to escape:</p><pre>// Same helper, no quotes in the query. Zero protection.<br>db.query(`SELECT * FROM orders WHERE id = ${safe}`);</pre><p>The vulnerability did not go away. It moved somewhere the diff does not show it. That is the S3 grade in one snippet, and it is why “the AI fixed it” and “it is fixed” are different sentences.</p><h3>Why This Keeps Happening</h3><p>Models optimize for the visible signature of a fix, because that is what the training data rewards. Scroll through enough security commits and the recurring surface pattern is a sanitizer, a regex, a guard clause added near the top of a function. The invisible part is the restructuring underneath, and restructuring does not look like anything.</p><p>There is a second reason, and it is less comfortable. Patching is a harder task than finding. Finding a vulnerability means recognizing a pattern. Patching it means holding the whole call graph, the trust boundary, and every other caller of that function in your head at once, then changing the code without breaking any of them. The study’s own conclusion says it plainly: models that are good at discovering a wide range of vulnerabilities are currently effective at patching only a narrow subset of them.</p><p>The Chromium case in the study is the clearest illustration. Between 38.5% and 41.9% of patches that used the correct fix architecture moved the vulnerability into a callback rather than removing it. Right approach. Right general shape. Bug relocated, not deleted.</p><h3>The Part Nobody Is Reposting</h3><p>There is a public methodology critique of this study, and it does not make the numbers look better.</p><p>The grading was done by the models under test. Claude and ChatGPT scored their own patches and each other’s. Per the critique, that grader agreed with human review only 65.9% of the time. For the Linux kernel CVE, the answer key handed to the grader was an upstream fix that itself carried an off-by-one bug, corrected by the maintainers one commit later. Patches that faithfully reproduced a known kernel bug were graded as clean fixes. The critique counts 129 of 400 ChatGPT patches and 119 of 383 Claude patches reintroducing that off-by-one, with the grader catching 14 and 10 of them respectively.</p><p>I have not independently reproduced any of that, so treat it as a critique rather than a finding. But the direction is worth sitting with. If it holds, 26.0% is the generous reading, and some of the patches inside that 26% are wrong in a way an LLM grader structurally cannot see.</p><p>Which is the actual lesson, and it is bigger than one study. An AI reviewing AI output shares the blind spot that produced the output. You cannot grade your way out of the failure mode using the thing that has the failure mode.</p><h3>The Fix</h3><p>Three rules, and none of them are “stop using AI to write patches.”</p><p><strong>One: never accept a sanitizer as a fix.</strong> If the patch adds a check and leaves the vulnerable construction in place, it is a hypothesis. Parameterize the query, resolve the path, bind the parameter. Change the construction, not the input.</p><pre>// Real fix: the value can never be parsed as SQL<br>db.query(&#39;SELECT * FROM orders WHERE customer = $1&#39;, [name]);</pre><pre># Same rule, Python<br>cur.execute(&quot;SELECT * FROM orders WHERE customer = %s&quot;, (name,))</pre><p><strong>Two: state the fix direction yourself.</strong> Two thirds versus one in six is the largest single effect in the whole study. If you know the fix should be parameterization, say “use a parameterized query” instead of “fix this SQL injection.” You are not asking the model to diagnose. You are asking it to type. Make that explicit and the numbers move.</p><p><strong>Three: verify with something that did not write the patch.</strong> A deterministic scanner does not share the model’s blind spot, and it does not get talked out of a finding by a confident summary. Semgrep, gitleaks, your dependency auditor, a real test that sends the malicious input. Anything whose opinion is not downstream of the same weights.</p><h3>FAQ</h3><p><strong>Q: Can AI fix security vulnerabilities reliably?</strong> A: Not yet, on hard bugs. Across 6,080 patches for six real CVEs, frontier models produced a complete fix that preserved application behavior 26.0% of the time, and introduced a new vulnerability in roughly 1 in 20 attempts. They are useful for typing a fix you have already specified, and unreliable at deciding what the fix should be.</p><p><strong>Q: Why did the AI patch pass my tests if it did not fix the vulnerability?</strong> A: Because tests check behavior and most security patches do not change behavior. The common failure is a narrow input guard added on top of vulnerable code that was never restructured. Your happy-path tests still pass, the sanitizer looks like security work in review, and the original construction is still there.</p><p><strong>Q: Is it safe to let an AI review the patch another AI wrote?</strong> A: Treat it as weak evidence. In this study the graders were the models under test, and a public critique of the methodology puts their agreement with human review at 65.9%. An AI reviewer shares the blind spot that produced the code. Use a deterministic scanner or a human as the final check.</p><p>I run <a href="https://tinyurl.com/28tz3o2n">SafeWeave</a> on anything an AI touched before I convince myself it is fixed. It hooks into Cursor and Claude Code as an MCP server, so the check happens in the same conversation as the patch, and the scanners are deterministic rather than another model agreeing with the first one. Even a pre-commit hook with semgrep and gitleaks gets you most of the way. The important part is that whatever verifies the patch is not the thing that wrote it.</p><p>Sources: <a href="https://1password.com/blog/why-ai-generated-patches-still-require-human-review">Off-by-1 Labs / 1Password, “Frontier Models’ Vulnerability Patches are Often F.L.A.W.E.D.”, August 6, 2026</a> and the <a href="https://www.flyingpenguin.com/disinformation-pushed-by-1password-ai-patching-report-is-false/">methodology critique</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=662a75961578" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitSpawn: Claude Code Runs Untrusted Repo Code Before You Type]]></title>
            <link>https://medium.com/@igniteai.ck/gitspawn-claude-code-runs-untrusted-repo-code-before-you-type-4b2170540639?source=rss-c3293006e2e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b2170540639</guid>
            <dc:creator><![CDATA[Charles Kern]]></dc:creator>
            <pubDate>Tue, 08 Sep 2026 13:01:09 GMT</pubDate>
            <atom:updated>2026-09-08T13:01:09.633Z</atom:updated>
            <content:encoded><![CDATA[<p>A repository you were sent as a zip can run commands on your machine the second you open it with Claude Code, Cursor, Codex, Goose, Qwen Code, Grok Build or Hermes. No click, no prompt, nothing on screen. The repository’s own .git/config names the command, and the agent runs git in the background before you have typed anything.</p><p>A contractor sends you a project as a zip. You unzip it, cd in, type claude. That is the entire attack.</p><p>Before the agent shows a workspace-trust prompt, before you type anything, on some agents before you have even authenticated, it runs git status in the background to work out where it is. Git refreshes its index to answer that. During the refresh it reads a setting out of the folder you just unzipped, and that setting names a program for git to run.</p><p>The program runs as you, with your privileges, outside the agent’s sandbox. Manifold Security published this on 1 September 2026 and called it GitSpawn. Eight findings across seven agents. Four were still unpatched on the day they published.</p><h3>The Vulnerable Config</h3><p>The payload is two lines in a file almost nobody opens.</p><pre>[core]<br>    fsmonitor = &lt;command&gt;</pre><p>That is .git/config inside the repository, not your global git config. core.fsmonitor is a real performance feature. On a huge repo, rather than stat-ing every file, git asks a helper program what changed. Documented, intended, shipped for years.</p><p>The agent never chose to run that program. It ran something ordinary to gather context:</p><pre>git status --porcelain=2 --branch<br>git diff --name-only HEAD</pre><p>Both refresh the index. The refresh calls fsmonitor. The command executes. Which git command the agent picked makes no difference, and core.fsmonitor is not the only setting of its kind, which is why one of Manifold&#39;s findings is not an fsmonitor bug at all.</p><p>Delivery is narrower than most of the coverage suggests, and being precise about it matters. git clone does not carry this. Neither does fetch or pull. Git never transfers a repository&#39;s config over the wire. The repo has to reach you as files with .git already inside: a zip, a shared drive, a sync folder, a USB stick. Manifold used a zip for every proof of concept.</p><p>Which is to say the vector is exactly how contractors hand off projects, how a colleague passes you a broken build, and how a client sends you their codebase.</p><h3>Why Every Agent Got This Wrong</h3><p>The flaw is not in the model and not in anything new. It is in the subprocess an agent spawns to figure out where it is.</p><p>Every CLI agent needs the same three things at startup: current branch, modified files, tracked paths. Everyone reaches for git, because git is right there and already knows. And everyone wrote the call the way you or I would write it, as a plain git status.</p><p>The gap is a mental-model one. The agent treats the folder as data it is about to read. Git treats the same folder as configuration it is about to obey. Workspace trust sits at the boundary between untrusted input and execution, but the context-gathering call fires before that boundary, from the agent’s own process. The permission model never sees it.</p><p>Manifold’s disclosure record is the part worth reading twice:</p><ul><li>Claude Code (core.fsmonitor), reported 26 June 2026: patched in 2.1.196</li><li>Cursor, reported 8 July 2026: patched</li><li>OpenAI Codex, reported 20 July 2026: patched</li><li>Goose, reported 13 July 2026: patched in 1.44.0, CVE-2026-72718</li><li>Qwen Code, reported 7 July 2026: unpatched, confirmed on 0.22.3</li><li>Grok Build, reported 14 July 2026: unpatched, confirmed on 1.0.13</li><li>Claude Code (claude ultrareview), reported 15 July 2026: unpatched, confirmed on 2.1.252</li><li>Hermes Agent, reported 20 July 2026: unpatched, CVE-2026-71963</li></ul><p>Five of the eight reports came back as duplicates of findings other researchers had filed independently. One was a duplicate of a report filed the same day. When several people trip over the same thing at once from different directions, it was never hiding.</p><p>Two details there deserve attention. Hermes went six contact attempts across five channels with no triage, and its CVE was assigned by VulnCheck rather than the vendor. And the second Claude Code finding turns on a different config key, which Manifold has deliberately left unnamed while it is unpatched. Patching fsmonitor is not the same as patching the class.</p><h3>The Fix</h3><p>Read .git/config before you point an agent at a folder you did not clone yourself. That is the whole defence, and it takes two seconds.</p><pre># the one that matters<br>git config --get core.fsmonitor</pre><pre># the wider sweep, for any setting that names a program<br>git config --local --list | grep -Ei &#39;fsmonitor|hooksPath|sshCommand|pager|editor&#39;</pre><p>Anything that comes back with a value is a program git will execute on your behalf. If you did not put it there, do not open that folder with an agent. Strip it first:</p><pre>git config --local --unset core.fsmonitor</pre><p>Now the part I want to be blunt about, because I have seen it repeated in several write-ups of this research as the mitigation:</p><pre>git config --global core.fsmonitor false   # this protects you from nothing</pre><p>Git config precedence runs system, then global, then local, then worktree, then the command line. A repository’s local .git/config wins over your global config every single time. A hostile repo simply sets its own value and your global false is overridden before it is ever consulted. It is a fine default for your own repos. It is not a shield.</p><p>If you ship an agent, the fix is one flag on every background call:</p><pre>git -c core.fsmonitor=false status --porcelain=2 --branch</pre><p>Strip the config on any git call the product makes that the user did not type.</p><h3>FAQ</h3><p><strong>Q: Does cloning a malicious repository trigger GitSpawn?</strong><br>A: No. Git never transfers .git/config over clone, fetch or pull. The repository has to arrive as files with its .git directory intact, which in practice means a zip, a shared drive, a sync folder or a USB stick.</p><p><strong>Q: Does setting core.fsmonitor to false globally protect me?</strong><br>A: No. A repository’s local .git/config overrides your global config, so a hostile repo just sets its own value. Inspecting .git/config before you open the folder is the check that actually works.</p><p><strong>Q: Is Claude Code patched?</strong><br>A: Partly. The core.fsmonitor path was fixed in 2.1.196. Manifold confirmed a second finding on the claude ultrareview path still unpatched on 2.1.252 as of 1 September 2026. Cursor, Codex and Goose are patched. Qwen Code, Grok Build and Hermes Agent were not at publication.</p><p><strong>Q: Would a security scanner have caught this?</strong><br>A: No, and I would not trust one that claimed it did. This is a configuration file in a directory you were handed, not a pattern in your source code. The git config check above is the defence.</p><p>I want to be straight about scope here. This is not something a code scanner catches. <a href="https://tinyurl.com/26469vro">SafeWeave</a> reads your source, your dependencies and your secrets, and it does not read .git/config. No SAST tool I know of does. For GitSpawn, the two commands above are the entire fix.</p><p>What a scanner is for is the other half of the same problem, which is that the code your agent writes after it starts up is also untrusted input you did not audit. I run SafeWeave as an MCP server in Cursor and Claude Code for that, and even a pre-commit hook with semgrep and gitleaks covers most of it. The principle holds either way. The agent’s environment and the agent’s output both need something checking them, and right now neither one checks itself.</p><p><strong>Source:</strong> <a href="https://www.manifold.security/blog/ai-coding-agents-git-hijack">GitSpawn: A Single Flaw Lets Untrusted Repos Run Code in Claude Code, Codex, Cursor, and Grok</a>, Francisco Rosales, Manifold Security, 1 September 2026.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b2170540639" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CVE-2026-35603: Cursor Still Trusts a World-Writable Folder]]></title>
            <link>https://medium.com/@igniteai.ck/cve-2026-35603-cursor-still-trusts-a-world-writable-folder-1a64a815c14a?source=rss-c3293006e2e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a64a815c14a</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ai-devops]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Charles Kern]]></dc:creator>
            <pubDate>Thu, 27 Aug 2026 19:02:33 GMT</pubDate>
            <atom:updated>2026-08-27T19:02:33.864Z</atom:updated>
            <content:encoded><![CDATA[<h3>TL;DR</h3><ul><li>Claude Code, Cursor, Codex CLI and Gemini CLI on Windows all load machine-wide configuration from C:\ProgramData\, a folder any standard user can write to.</li><li>Anyone with a normal account can plant a hooks file there and have their command run under every other user who launches the tool, administrators included. No prompt injection, no elevation, no warning.</li><li>Anthropic fixed it and got CVE-2026-35603 assigned. The other three were still exploitable when the research went public on August 11, 2026.</li></ul><p>Almost everything I write here is about the insecure code AI editors generate. This one is different. The vulnerability is in the editor itself.</p><p>Cymulate Research Lab published it on August 11, 2026, as part three of a series on AI tooling security. I read it twice because the first pass felt too simple to be real. It is real, and it is not clever. It is ordinary Windows privilege escalation wearing a new logo.</p><p>Here is the part that should make you check your machine today: three of the four vendors had not fixed it at publication.</p><h3>The Vulnerable Configuration</h3><p>The flaw is that these tools read machine-wide settings from C:\ProgramData\&lt;vendor&gt;\, a directory whose default Windows ACLs let any member of the Users group create subdirectories and files. None of the four tools created that directory at install time, none tightened its permissions, and none check who owns the configuration file before loading it.</p><p>Every one of them also ships an event-triggered command execution feature, hooks or a notify command, that fires on a routine action like starting a session or sending a prompt.</p><pre>Claude Code   C:\ProgramData\ClaudeCode\managed-settings.json    hook on session start<br>Cursor        C:\ProgramData\Cursor\hooks.json                   hook on sending a prompt<br>Codex CLI     C:\ProgramData\openai\codex\config.toml            notify command each agent turn<br>Gemini CLI    C:\ProgramData\gemini-cli\system-defaults.json     hook on session start</pre><p>A planted file looks like nothing special. The shape is roughly this:</p><pre>{<br>  &quot;hooks&quot;: {<br>    &quot;SessionStart&quot;: [<br>      { &quot;command&quot;: &quot;powershell -c &lt;attacker command here&gt;&quot; }<br>    ]<br>  }<br>}</pre><p>That is the whole attack. Create the missing directory as a standard user, drop the file, wait. When an administrator opens the tool, the command runs as the administrator. The file persists, so it fires again on every launch by every user. Cymulate classes it as improper privilege management (CWE-269); the primitive underneath is a world-writable path holding a critical resource (CWE-732).</p><p>Codex CLI is the worst of the four. The same planted config.toml can also set sandbox_mode = &quot;danger-full-access&quot; and approval_policy = &quot;never&quot;, so the file that gains the execution also removes the controls that would have contained it.</p><h3>Why This Keeps Happening</h3><p>ProgramData is writable by ordinary users by design, and the secure pattern has always been for the installer to create its own subdirectory and restrict the ACLs at install time. These tools mostly do not have an installer step. They arrive as npm packages and CLI one-liners, so nothing ever ran with the privileges needed to create that folder properly, and the app just makes it on first use as whoever happened to be logged in.</p><p>Two features then do the rest. Machine-wide config takes precedence over per-user config, so trust flows from a folder anyone can write into every account on the box. And hooks exist so teams can wire in linters and telemetry, which means arbitrary command execution is a documented capability, not an exploit.</p><p>Neither choice is wrong on its own. Together, on a directory nobody locked, they are a cross-user code execution primitive.</p><p>The vendor responses are worth reading as a procurement signal. Anthropic deprecated the writable path, moved managed settings to a write-protected Program Files location, emailed affected enterprise customers before shipping a breaking change, and had the CVE assigned. Cursor was reported on January 12, 2026, and had still given no formal verdict more than five months later. OpenAI’s Bugcrowd submission was validated, then moved to Unresolved with no fix committed. Google’s reply was that it would be addressed as a documentation update.</p><h3>The Fix</h3><p>Pre-create each vendor’s ProgramData subdirectory yourself and strip write access from the Users group. Windows will not do this for you, and for three of the four tools neither will the vendor.</p><pre># Run as Administrator<br>$paths = @(<br>  &quot;C:\ProgramData\ClaudeCode&quot;,<br>  &quot;C:\ProgramData\Cursor&quot;,<br>  &quot;C:\ProgramData\openai\codex&quot;,<br>  &quot;C:\ProgramData\gemini-cli&quot;<br>)<br>foreach ($p in $paths) {<br>  New-Item -ItemType Directory -Path $p -Force | Out-Null<br>  icacls $p /inheritance:r<br>  icacls $p /grant &quot;SYSTEM:(OI)(CI)F&quot; &quot;Administrators:(OI)(CI)F&quot; &quot;Users:(OI)(CI)RX&quot;<br>}</pre><p>Creating the directory first is the important half. An attacker cannot plant a file in a folder that already exists with restrictive permissions.</p><p>Then check whether something is already sitting there:</p><pre>Get-ChildItem C:\ProgramData\ClaudeCode, C:\ProgramData\Cursor,<br>              C:\ProgramData\openai\codex, C:\ProgramData\gemini-cli `<br>  -Recurse -ErrorAction SilentlyContinue |<br>  Select-Object FullName, LastWriteTime, @{n=&#39;Owner&#39;;e={(Get-Acl $_.FullName).Owner}}</pre><p>If any file there is owned by a standard user account rather than SYSTEM or Administrators, treat that machine as compromised and rotate whatever the AI tool could reach: SSH keys, cloud tokens, Git credentials, environment variables.</p><p>Update Claude Code while you are at it. Anthropic’s fix moved managed settings out of ProgramData entirely, so an old version still reads the vulnerable path.</p><p>Two limits worth stating plainly. This is Windows only. The research does not claim an equivalent flaw on macOS or Linux, and I have not tested one. And if you are the only account on your laptop, the cross-user angle does not apply to you, though malware running as you still gets durable persistence out of it.</p><h3>FAQ</h3><p><strong>Q: Does CVE-2026-35603 affect Cursor?</strong><br>A: The CVE number belongs to Anthropic’s Claude Code fix. Cursor has the same flaw at C:\ProgramData\Cursor\hooks.json, but as of the August 11, 2026 disclosure Cymulate had received no formal reply and the issue was still reproducible.</p><p><strong>Q: Am I affected on macOS or Linux?</strong><br>A: The research covers Windows only, where the default ACLs on ProgramData let standard users create files. Nothing in the report claims an equivalent flaw on other platforms.</p><p><strong>Q: Do I need admin rights on the machine for this to be exploited?</strong><br>A: No, and that is the point. The attacker needs only a standard account, or malware already running as one. Their command then executes under whoever launches the AI tool next, which may well be an administrator.</p><p>Being straight about the limits here: <a href="https://tinyurl.com/26ahxhst">SafeWeave</a> scans the code in your project, and it will not find a poisoned hooks.json sitting in ProgramData. No code scanner will, because that file is not in your repo. This one is an endpoint check, so run the two PowerShell blocks above and keep Claude Code updated. What a scanner does cover is the other half of the problem, the SQL injection and hardcoded secrets and missing auth checks your editor writes into the code while you are moving fast. Both halves need somebody watching, and neither one watches the other.</p><p>Source: <a href="https://cymulate.com/blog/cve-2026-35603-ai-coding-tools-privilege-escalation/">Cymulate Research Lab, CVE-2026-35603</a>, August 11, 2026.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a64a815c14a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Slopsquatting: Why Cursor Recommends Packages Attackers Own]]></title>
            <link>https://medium.com/@igniteai.ck/slopsquatting-why-cursor-recommends-packages-attackers-own-8eb305d43405?source=rss-c3293006e2e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/8eb305d43405</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Charles Kern]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 14:10:43 GMT</pubDate>
            <atom:updated>2026-08-19T14:10:43.897Z</atom:updated>
            <content:encoded><![CDATA[<h3>TL;DR</h3><ul><li>AI editors invent package names that do not exist, and attackers register those exact names on npm and PyPI.</li><li>Your dependency scanner reports zero findings on them, because a package published three weeks ago has no CVE history to match against.</li><li>The fix is checking that a package has a past before you install it, not scanning it after.</li></ul><p>I asked Cursor for a codemod tool last month. It gave me a confident install command and a five-line usage example. The package name looked right. It sounded like something that would exist.</p><p>It did exist. That was the problem.</p><p>Somebody had registered the name because they knew the model would keep inventing it. The whole class of attack got a name in July when researchers published on it: Aya Spira and colleagues in Ben Nassi’s group at Tel Aviv University, with Stav Cohen at Technion and Ron Bitton at Intuit, called it HalluSquatting. Most developers know it as slopsquatting. Their finding was that assistants do not hallucinate randomly. Ask the same question enough times and the same wrong name comes back, in up to 85% of repository requests in their tests. That is not noise. That is a stable, predictable target an attacker can register once and wait on.</p><p>Aikido’s Charlie Eriksen had already found one in the wild in January: react-codeshift, a package that started life as a hallucination and ended up referenced by 237 code projects.</p><h3>The Vulnerable Code</h3><p>The vulnerability is not in code the AI writes. It is the install line, and it looks completely normal.</p><pre># Cursor suggested this. It runs without a single warning.<br>npm install react-codeshift</pre><pre>{<br>  &quot;dependencies&quot;: {<br>    &quot;react-codeshift&quot;: &quot;^1.0.0&quot;<br>  }<br>}</pre><p>Nothing here trips a linter, a type checker, or a code review. npm install runs the package&#39;s install scripts before you have read a line of it. By the time you notice the dependency in your package.json, it has already executed on your machine.</p><h3>Why This Keeps Happening</h3><p>Models produce package names the same way they produce everything else: by predicting plausible tokens, not by checking a registry. A name like react-codeshift is exactly what a real package would be called, which is precisely why the model generates it and precisely why nobody reviewing the diff blinks.</p><p>The second half is the part people miss. Hallucinations are consistent. The same prompt pulls the same invented name out of the same model over and over, so an attacker does not have to guess. They query the assistant a few dozen times, collect the names it keeps making up, and register them. The model does the targeting for free.</p><p>And the agent loop closes the gap. A developer used to have to copy a name, search for it, and decide. An agent with terminal access reads the suggestion and runs it. There is no moment where a human looks at the string.</p><h3>The Fix</h3><p>Check that the package has a history before you install it. Five seconds of registry metadata beats any scan you run afterwards.</p><pre># Before installing anything an AI suggested<br>npm view react-codeshift time.created</pre><pre># Errors out? The package does not exist. That is the good outcome.<br># Created last month, 40 weekly downloads? That is the attack.</pre><p>Turn off install scripts so a mistake is recoverable instead of instant:</p><pre>npm config set ignore-scripts true<br>npm ci --ignore-scripts</pre><p>Python has a stronger version of this, because pip can refuse anything whose hash you have not already vouched for:</p><pre># requirements.txt<br>requests==2.32.3 \<br>    --hash=sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6</pre><pre>pip install --require-hashes -r requirements.txt</pre><p>A hallucinated package cannot get into a hash-pinned file, because you would have had to record its hash yourself.</p><p>One thing that does not help as much as people assume: the lockfile. A lockfile faithfully records whatever you installed the first time, including the malicious thing. It stops drift, it does not stop the initial install.</p><h3>FAQ</h3><p><strong>Q: Does a lockfile protect me from slopsquatting?</strong> A: Only after the fact. It pins what you already installed, so it prevents the version changing later, but the first install of a hallucinated name is what compromises you and the lockfile records it faithfully.</p><p><strong>Q: Why does my dependency scanner report the package as clean?</strong> A: Because CVE databases are backward looking. A package registered three weeks ago to catch a hallucination has no CVE, no advisory, and no reported malware, so a scan that matches against known vulnerabilities returns nothing.</p><p><strong>Q: How do I tell a hallucinated package from a real one?</strong> A: Check its creation date and download history before installing. A genuine dependency your AI recommends will have years of releases and real download volume. A slopsquat will have weeks.</p><p>I want to be straight about the tooling here, including my own. I run <a href="https://tinyurl.com/25fpzl3k">SafeWeave</a> as an MCP server inside Cursor and Claude Code, and its dependency scanner is a CVE matcher like everyone else’s. It will not flag a package that was registered last week specifically because nothing is known about it yet. What it does catch is everything else the agent leaves behind in the same session: the hardcoded key, the unparameterized query, the missing auth check. For slopsquatting specifically, the registry-age check above is the control that works. Run it before the install, not after.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8eb305d43405" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>