<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bedirhan Elibol</title>
    <description>The latest articles on DEV Community by Bedirhan Elibol (@bedirhandev).</description>
    <link>https://dev.to/bedirhandev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4185338%2F7ae60fba-27d0-4be8-8638-20ae9c54b512.jpg</url>
      <title>DEV Community: Bedirhan Elibol</title>
      <link>https://dev.to/bedirhandev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bedirhandev"/>
    <language>en</language>
    <item>
      <title>What a first visitor notices in 5 seconds (and what it costs you)</title>
      <dc:creator>Bedirhan Elibol</dc:creator>
      <pubDate>Thu, 26 Nov 2026 17:12:58 +0000</pubDate>
      <link>https://dev.to/bedirhandev/what-a-first-visitor-notices-in-5-seconds-and-what-it-costs-you-c48</link>
      <guid>https://dev.to/bedirhandev/what-a-first-visitor-notices-in-5-seconds-and-what-it-costs-you-c48</guid>
      <description>&lt;p&gt;You shipped. The feature works, the tests pass, the pull request is merged. Then a stranger opens the link, and they judge a different list.&lt;/p&gt;

&lt;p&gt;Here is what I see most on freshly launched apps, in the order a visitor notices it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The tab title.&lt;/strong&gt; Next.js, Vite and Create React App all ship a default title. If the tab says "Create Next App", "React App" or "Vite + React", the visitor reads it as "this was never finished". Fix it in one place:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app/layout.tsx&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;metadata&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Acme Invoices: send invoices that get paid'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Create, send and track invoices in minutes.'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Filler text.&lt;/strong&gt; "Lorem ipsum dolor" and "Your Company Name" survive in footers, empty states and pricing cards for longer than anyone admits. Search the repo for both before you launch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Numbers with nothing behind them.&lt;/strong&gt; "Trusted by 10,000+ users" and "99.9% uptime" typed straight into JSX are the classic case. A visitor who checks finds no source, and after that every other claim on the page gets read with suspicion. If the number is real, read it from your data or link your status page. If it isn't real yet, remove it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. A countdown that restarts.&lt;/strong&gt; A timer built from &lt;code&gt;Date.now() + 24 * 60 * 60 * 1000&lt;/code&gt; resets on every page load. People notice when they come back and the sale "ends in 24 hours" again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Social proof you cannot check.&lt;/strong&gt; A star rating with no review count, a "#1 Product of the Day" badge with no Product Hunt link, or a testimonial from "John Doe, Acme Corp". Each one costs more trust than having no proof at all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. The link preview.&lt;/strong&gt; Paste your URL into Slack or X. If the card is blank, there is no og:image. This is where most word of mouth happens, and it is the cheapest fix on this list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to check this without reading every file&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can go down the list by hand. Two tools help too. The free site check at &lt;a href="https://zelsis.com/site-check" rel="noopener noreferrer"&gt;https://zelsis.com/site-check&lt;/a&gt; takes a URL and looks at the page the way a first visitor does: template title, filler text, link preview, icon, phone layout. No account needed. For the code side, Zelsis runs on pull requests and flags the same patterns (starter titles, lorem ipsum, unsourced user counts, restarting countdowns, fake badges) as warnings on the diff, so they get caught before they ship. A warning never fails the check by itself.&lt;/p&gt;

&lt;p&gt;What is the oldest piece of placeholder you have found in a live product?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>nextjs</category>
      <category>startup</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How do you rename a column without breaking the deploy?</title>
      <dc:creator>Bedirhan Elibol</dc:creator>
      <pubDate>Tue, 24 Nov 2026 17:11:36 +0000</pubDate>
      <link>https://dev.to/bedirhandev/how-do-you-rename-a-column-without-breaking-the-deploy-34f8</link>
      <guid>https://dev.to/bedirhandev/how-do-you-rename-a-column-without-breaking-the-deploy-34f8</guid>
      <description>&lt;p&gt;A rename looks like the safest migration there is. It is instant in Postgres. It still broke a deploy for me, because the old version of the app kept running for a few minutes and kept querying the old name.&lt;/p&gt;

&lt;p&gt;The only approach I trust is expand and contract: add the new column, write to both, backfill in batches, switch reads, and drop the old column in a later release. It is slow, and it feels like a lot of ceremony for a name change.&lt;/p&gt;

&lt;p&gt;Do you do the full sequence, or ship the rename in a maintenance window? And what do you do about ORMs that generate the rename for you?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>postgres</category>
      <category>database</category>
      <category>devops</category>
    </item>
    <item>
      <title>A div with onClick is not a button</title>
      <dc:creator>Bedirhan Elibol</dc:creator>
      <pubDate>Mon, 23 Nov 2026 14:32:36 +0000</pubDate>
      <link>https://dev.to/bedirhandev/a-div-with-onclick-is-not-a-button-lka</link>
      <guid>https://dev.to/bedirhandev/a-div-with-onclick-is-not-a-button-lka</guid>
      <description>&lt;p&gt;The Pay button looks fine and works with a mouse. A customer who uses the keyboard presses Tab, and focus jumps straight past it. A screen reader reads the label as plain text. Neither of them can pay, and neither of them files a bug report. They leave.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it happens
&lt;/h2&gt;

&lt;p&gt;A &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; gets three things from the browser for free: it sits in the Tab order, Enter and Space press it, and assistive technology announces it as a button. A &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; gets none of them. Adding &lt;code&gt;onClick&lt;/code&gt; only handles the mouse.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Mouse only&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"pay-button"&lt;/span&gt; &lt;span class="n"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;handlePay&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;Pay&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The fix: use a real button
&lt;/h2&gt;

&lt;p&gt;Swap the element. Set &lt;code&gt;type="button"&lt;/code&gt; so it does not submit a surrounding form by accident, and keep a visible focus style so keyboard users can see where they are.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"button"&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"pay-button"&lt;/span&gt; &lt;span class="n"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;handlePay&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;Pay&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.pay-button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;all&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;unset&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.pay-button&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nt"&gt;focus-visible&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;outline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2px&lt;/span&gt; &lt;span class="n"&gt;solid&lt;/span&gt; &lt;span class="mh"&gt;#34d399&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;outline-offset&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the click goes to another page, use a link (&lt;code&gt;&amp;lt;a href&amp;gt;&lt;/code&gt; or your framework's &lt;code&gt;Link&lt;/code&gt;) instead. Links also work with the keyboard and open in a new tab.&lt;/p&gt;

&lt;h2&gt;
  
  
  When you cannot change the element
&lt;/h2&gt;

&lt;p&gt;Sometimes a library renders the wrapper for you. Then add what the browser would have given a button: a role, a place in the Tab order, and a key handler for Enter and Space.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;
  &lt;span class="n"&gt;role&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"button"&lt;/span&gt;
  &lt;span class="n"&gt;tabIndex&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;handlePay&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;onKeyDown&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'Enter'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// stop Space from scrolling the page&lt;/span&gt;
      &lt;span class="nf"&gt;handlePay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nc"&gt;Pay&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Check it before you ship
&lt;/h2&gt;

&lt;p&gt;Put the mouse away and go through your main flow (sign up, checkout, settings) with Tab, Shift+Tab, Enter and Space. Every action must be reachable, and you must always see where the focus is.&lt;/p&gt;

&lt;p&gt;In code, the &lt;code&gt;jsx-a11y&lt;/code&gt; ESLint rules &lt;code&gt;click-events-have-key-events&lt;/code&gt; and &lt;code&gt;no-static-element-interactions&lt;/code&gt; catch the same pattern. A release check can do the same on the pull request: Zelsis flags a &lt;code&gt;div&lt;/code&gt; or &lt;code&gt;span&lt;/code&gt; with &lt;code&gt;onClick&lt;/code&gt; and no role, tabIndex or key handler (rule 1029), and suggests the button fix.&lt;/p&gt;

&lt;p&gt;We wrote this up as a guide too: &lt;a href="https://zelsis.com/guides/clickable-div-keyboard" rel="noopener noreferrer"&gt;https://zelsis.com/guides/clickable-div-keyboard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Related: we ran this kind of check on our own UI last week and it flagged one thing that was wrong. How that went: &lt;a href="https://dev.to/bedirhandev/we-ran-our-own-form-label-check-on-our-own-ui-it-flagged-one-thing-and-it-was-wrong-pab"&gt;https://dev.to/bedirhandev/we-ran-our-own-form-label-check-on-our-own-ui-it-flagged-one-thing-and-it-was-wrong-pab&lt;/a&gt;&lt;/p&gt;

</description>
      <category>a11y</category>
      <category>react</category>
      <category>webdev</category>
      <category>frontend</category>
    </item>
    <item>
      <title>We ran our own form-label check on our own UI. It flagged one thing, and it was wrong.</title>
      <dc:creator>Bedirhan Elibol</dc:creator>
      <pubDate>Sat, 21 Nov 2026 15:22:06 +0000</pubDate>
      <link>https://dev.to/bedirhandev/we-ran-our-own-form-label-check-on-our-own-ui-it-flagged-one-thing-and-it-was-wrong-pab</link>
      <guid>https://dev.to/bedirhandev/we-ran-our-own-form-label-check-on-our-own-ui-it-flagged-one-thing-and-it-was-wrong-pab</guid>
      <description>&lt;p&gt;We check our own code with the same rules we sell. This week we ran the form-label and focus check (rule 1026) on our UI. It is the kind of check that catches an input with no label, or a focus outline removed without a replacement.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we ran
&lt;/h2&gt;

&lt;p&gt;We looked at every component file in our app that removes the browser focus outline (&lt;code&gt;outline-none&lt;/code&gt;). That is 53 files, scanned on 21 November 2026. The check looks at each element on its own. For a native input, textarea, select, button or link, it flags a removed outline with no replacement focus style. For an input, it flags a missing label unless one of these exists: a wrapping &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt;, &lt;code&gt;aria-label&lt;/code&gt;, &lt;code&gt;aria-labelledby&lt;/code&gt;, &lt;code&gt;title&lt;/code&gt;, or an &lt;code&gt;id&lt;/code&gt; that a label points to.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it found
&lt;/h2&gt;

&lt;p&gt;One hit. It was in &lt;code&gt;RuleKnowledgeBaseModal.tsx&lt;/code&gt;, which is the help text that explains each rule. The hit was an example of a form, written as text inside a string, not a live form on the page.&lt;/p&gt;

&lt;p&gt;So the finding was wrong. The check read a code sample inside a string as if it were real markup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it matters
&lt;/h2&gt;

&lt;p&gt;A check that reads example text as real code will send people to fix things that are not broken. That costs time, and it makes people stop trusting the next alert. We found this in our own product before any customer saw it, which is the reason to run the check on yourself first.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we are doing
&lt;/h2&gt;

&lt;p&gt;We are deciding whether to make the check skip text inside strings and documentation examples. We will report the result here either way, with the before and after on the same 53 files.&lt;/p&gt;

&lt;p&gt;If you run a similar check, ask one question about each hit: is this markup the browser will render, or text that only looks like markup? That question would have saved us this week.&lt;/p&gt;




&lt;p&gt;Update, 21 November 2026: we changed the check so it skips markup inside backtick strings, then ran it again on the same 53 files. Before the change it reported one hit, the false positive described above. After the change it reports none. A real unlabelled input in a component is still flagged.&lt;/p&gt;

</description>
      <category>a11y</category>
      <category>webdev</category>
      <category>security</category>
      <category>opensource</category>
    </item>
    <item>
      <title>How to catch secrets printed in CI logs before they leak</title>
      <dc:creator>Bedirhan Elibol</dc:creator>
      <pubDate>Sat, 21 Nov 2026 12:49:27 +0000</pubDate>
      <link>https://dev.to/bedirhandev/how-to-catch-secrets-printed-in-ci-logs-before-they-leak-4o0n</link>
      <guid>https://dev.to/bedirhandev/how-to-catch-secrets-printed-in-ci-logs-before-they-leak-4o0n</guid>
      <description>&lt;p&gt;A CI step that echoes a token is one line of YAML. It passes review because the build is green and nobody reads the console output.&lt;/p&gt;

&lt;p&gt;This is the pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Debug deploy&lt;/span&gt;
  &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;echo "${{ secrets.DEPLOY_KEY }}"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What to check in every workflow file:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Any echo or printenv line that references secrets.&lt;/li&gt;
&lt;li&gt;Debug steps that print the whole environment.&lt;/li&gt;
&lt;li&gt;Logging of request headers or config objects that hold a token.&lt;/li&gt;
&lt;li&gt;Passing a token on stdin where the tool supports it, like --password-stdin, so it never appears in the command line.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Zelsis flags the first pattern as CICD-SEC-05 (Exposed Secret Tokens in Build Log Outputs) on the exact line of the workflow file, during the pull request, before merge.&lt;/p&gt;

&lt;p&gt;A static check cannot know what a command prints at runtime. Treat it as the first filter. If a token has ever appeared in a log, rotate it, even if the log was private.&lt;/p&gt;

&lt;p&gt;How do you find these in CI today?&lt;/p&gt;

</description>
      <category>devops</category>
      <category>security</category>
      <category>githubactions</category>
    </item>
    <item>
      <title>How do you check keyboard access before a release?</title>
      <dc:creator>Bedirhan Elibol</dc:creator>
      <pubDate>Sat, 21 Nov 2026 12:35:22 +0000</pubDate>
      <link>https://dev.to/bedirhandev/how-do-you-check-keyboard-access-before-a-release-175j</link>
      <guid>https://dev.to/bedirhandev/how-do-you-check-keyboard-access-before-a-release-175j</guid>
      <description>&lt;p&gt;I keep finding forms where the focus ring was removed with &lt;code&gt;outline-none&lt;/code&gt; and nothing replaced it, and inputs that only have a placeholder. Both pass every visual review because a mouse user never notices.&lt;/p&gt;

&lt;p&gt;My current routine is to unplug the mouse and Tab through signup and checkout once per release. It takes about five minutes and usually finds something.&lt;/p&gt;

&lt;p&gt;What do you run? A linter rule, axe in CI, a manual pass, nothing yet? I'd like to hear what actually caught real bugs for you.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>a11y</category>
      <category>react</category>
    </item>
    <item>
      <title>A SQL rule that flagged constants, and how we taught it the difference</title>
      <dc:creator>Bedirhan Elibol</dc:creator>
      <pubDate>Wed, 11 Nov 2026 13:58:01 +0000</pubDate>
      <link>https://dev.to/bedirhandev/a-sql-rule-that-flagged-constants-and-how-we-taught-it-the-difference-1m1i</link>
      <guid>https://dev.to/bedirhandev/a-sql-rule-that-flagged-constants-and-how-we-taught-it-the-difference-1m1i</guid>
      <description>&lt;p&gt;A rule that says string interpolation in SQL is an injection is right most of the time. It is also wrong in a predictable way, and the wrong cases are common in real code. This week a SQL rule in our scanner flagged code that only ever ran with fixed values. Here is the code, what the rule saw, and what we changed.&lt;/p&gt;

&lt;h2&gt;
  
  
  The loop over a fixed list
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;table&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"messages"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"threads"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`DELETE FROM ${table} WHERE account_id = ?`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;accountId&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only &lt;code&gt;accountId&lt;/code&gt; comes from outside, and it is bound as a parameter. &lt;code&gt;table&lt;/code&gt; is one of two literals. The rule now follows a loop variable back to a literal array in the same file. If the array holds only string literals, the variable is a constant.&lt;/p&gt;

&lt;h2&gt;
  
  
  The helper that returns a fixed fragment
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;clearRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;table&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sb"&gt;`UPDATE ${table} SET in_inbox = 0 WHERE id = ?`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`${clearRole("messages")}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The helper is called only with literals. A typed parameter does not change that. The rule now checks the call sites: if every call passes a literal, the output is fixed.&lt;/p&gt;

&lt;h2&gt;
  
  
  The placeholder list
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`SELECT id FROM t WHERE id IN (${ids.map(() =&amp;gt; "?").join(",") || "NULL"})`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ids&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The interpolated part is only question marks, and the values are bound. The rule now recognises placeholder lists, including an empty-list fallback, and row tuples such as &lt;code&gt;(?, ?)&lt;/code&gt; for batched inserts.&lt;/p&gt;

&lt;h2&gt;
  
  
  The cursor clause
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;cursorSql&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cursor&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="sb"&gt;`WHERE latest &amp;lt; ? OR (latest = ? AND id &amp;gt; ?)`&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A fixed block of SQL is either added or left empty, and the values still go through bind parameters. The rule now treats that conditional as constant.&lt;/p&gt;

&lt;h2&gt;
  
  
  What did not change
&lt;/h2&gt;

&lt;p&gt;The rule still flags what it exists for: a query built from a request value, a variable taken from &lt;code&gt;req.query&lt;/code&gt;, or a table name passed in from outside. Each of those patterns has a vulnerable version that must keep firing and a fixed version that must stay quiet. A future edit that breaks either one fails the test suite.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this matters
&lt;/h2&gt;

&lt;p&gt;A scanner that flags constants trains people to ignore it. The next alert gets skipped, and then a real injection gets skipped with it. Reducing noise is part of catching the bug.&lt;/p&gt;

&lt;p&gt;If you want to see how a scanner handles your own repository, public repositories can be checked for free at &lt;a href="https://zelsis.com" rel="noopener noreferrer"&gt;zelsis.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>security</category>
      <category>sql</category>
      <category>javascript</category>
      <category>opensource</category>
    </item>
    <item>
      <title>A payment that never unlocked the plan: what our own webhook got wrong</title>
      <dc:creator>Bedirhan Elibol</dc:creator>
      <pubDate>Wed, 11 Nov 2026 10:04:59 +0000</pubDate>
      <link>https://dev.to/bedirhandev/a-payment-that-never-unlocked-the-plan-what-our-own-webhook-got-wrong-25lj</link>
      <guid>https://dev.to/bedirhandev/a-payment-that-never-unlocked-the-plan-what-our-own-webhook-got-wrong-25lj</guid>
      <description>&lt;p&gt;Someone paid for our product and got nothing. The payment went through, the provider sent us the event, and our handler answered with a success code. The customer was charged and their account stayed on the free plan. Nobody got an error, so nobody noticed.&lt;/p&gt;

&lt;p&gt;Here is what happened, and the three checks we added so it cannot happen silently again.&lt;/p&gt;

&lt;h2&gt;
  
  
  The payer had no account yet
&lt;/h2&gt;

&lt;p&gt;The customer paid before they created an account. Our webhook looked up the account by the payer's email, found nothing, and returned &lt;code&gt;200&lt;/code&gt;. From the provider's side the delivery succeeded, so it never retried.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;findUserByEmail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;warn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"no registered user, skipping"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;received&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That &lt;code&gt;200&lt;/code&gt; is the bug. It says "I handled this", and we did not.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we changed
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Keep the entitlement until it can be used.&lt;/strong&gt; When no account matches, we store the plan and the paid period in a small table keyed by the lowercased email. When the account is created, the signup step reads that row, writes the plan with the paid period, and removes the row. An expired row is ignored.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Return an error when a write fails.&lt;/strong&gt; If storing the entitlement fails, the handler returns &lt;code&gt;500&lt;/code&gt;, so the provider retries instead of dropping the event.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clear it on revoke and refund.&lt;/strong&gt; A cancellation or refund before signup removes the stored entitlement, so nobody keeps a plan they no longer paid for.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Checks for your own webhooks
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Ask what the handler does when the customer cannot be matched. If the answer is "return 200", fix that first.&lt;/li&gt;
&lt;li&gt;Match on the provider's customer or subscription id where you can. Email is a weak key: people pay with a different address than the one they signed up with.&lt;/li&gt;
&lt;li&gt;Test the path where the payment arrives before the account exists. Most billing bugs live in the order of events, not in the happy path.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These checks come from reading our own code and the events it received. If your webhook answers &lt;code&gt;200&lt;/code&gt; for things it did not do, it is worth a look this week.&lt;/p&gt;

&lt;p&gt;If you want a second pair of eyes on a public repo, the free check at &lt;a href="https://zelsis.com" rel="noopener noreferrer"&gt;zelsis.com&lt;/a&gt; covers the common webhook signature and access mistakes.&lt;/p&gt;

</description>
      <category>webhooks</category>
      <category>stripe</category>
      <category>saas</category>
      <category>backend</category>
    </item>
    <item>
      <title>We ran our security scanner on real SaaS code. Here is what it got wrong.</title>
      <dc:creator>Bedirhan Elibol</dc:creator>
      <pubDate>Tue, 10 Nov 2026 19:11:49 +0000</pubDate>
      <link>https://dev.to/bedirhandev/we-ran-our-security-scanner-on-real-saas-code-here-is-what-it-got-wrong-58k3</link>
      <guid>https://dev.to/bedirhandev/we-ran-our-security-scanner-on-real-saas-code-here-is-what-it-got-wrong-58k3</guid>
      <description>&lt;p&gt;A scanner that cries wolf gets switched off. So we pointed Zelsis at the code of several mature open-source SaaS products and read every high-severity finding by hand.&lt;/p&gt;

&lt;p&gt;Most of them were wrong. The code was protected, just in ways our rules did not understand. Below are the patterns, and the fix we made for each one. If you write a scanner, a linter or a review checklist, you will probably hit the same ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The guard is in a wrapper
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;GET&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;withCron&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;renewDomains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our cron rule looked for &lt;code&gt;CRON_SECRET&lt;/code&gt; inside the file. It was not there, because &lt;code&gt;withCron&lt;/code&gt; checks the signature before the handler runs. The rule now counts wrappers and auth helpers named for the job, such as &lt;code&gt;withCron&lt;/code&gt; or &lt;code&gt;isAuthorizedCronOrInternalRequest&lt;/code&gt;. It also flags only files that export a route, so helpers in a &lt;code&gt;cron/&lt;/code&gt; folder are no longer treated as endpoints.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The id comes from the session
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;getAccount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;actionClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;emailAccountId&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;prisma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;emailAccount&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findUnique&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;emailAccountId&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This looks like a record loaded by id with no owner check. It is not. The action client builds &lt;code&gt;ctx&lt;/code&gt; from the signed-in session, so the id belongs to the caller. The IDOR rule now treats values destructured from a server action's &lt;code&gt;ctx&lt;/code&gt; as the caller's own.&lt;/p&gt;

&lt;p&gt;The same rule also missed prefixed owner keys. &lt;code&gt;where: { id, emailAccountId }&lt;/code&gt; is scoped to the caller, but the rule only knew bare names like &lt;code&gt;userId&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The HTML was sanitized first
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;dangerouslySetInnerHTML&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;__html&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;DOMPurify&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sanitize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Flagging every &lt;code&gt;dangerouslySetInnerHTML&lt;/code&gt; is easy and mostly noise. The rule now skips values sanitized at the sink, names like &lt;code&gt;safeHtml&lt;/code&gt; in files that call a sanitizer, and translations looked up with a literal key such as &lt;code&gt;t("intro.paragraph")&lt;/code&gt;. That markup comes from the app's own locale files.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. The SQL is built from constants
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;table&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"messages"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"threads"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;tx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`DELETE FROM ${table} WHERE account_id = ?`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;accountId&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;String interpolation in SQL is a real risk, but here every interpolated value is a constant. The rule now follows loops over literal arrays, helpers that are only called with literals, placeholder lists such as &lt;code&gt;ids.map(() =&amp;gt; "?").join(",")&lt;/code&gt;, and cursor clauses that choose between fixed SQL and an empty string.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. The shell helper only gets literals
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;git&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;execSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`git ${command}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;git&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"status --porcelain"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A private helper that puts its parameter into a shell command is a real sink. But if it is not exported and every call in the file passes a literal, nothing outside the file can reach it. The rule checks the call sites before it flags.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. SHA-1, for a reason
&lt;/h2&gt;

&lt;p&gt;Checking passwords against the HaveIBeenPwned range API requires SHA-1, and only a five-character prefix leaves the process. The weak-hash rule now recognises that case.&lt;/p&gt;

&lt;h2&gt;
  
  
  How we keep fixes honest
&lt;/h2&gt;

&lt;p&gt;Every change above ships with two fixtures: the vulnerable version must still be caught, and the safe version must stay quiet. The projects are also in the clean set our benchmark runs on each release. A rule that starts firing on clean code gets marked experimental and stops failing builds until someone reviews it.&lt;/p&gt;

&lt;p&gt;The planted flaws in our test corpus are all still caught. We checked.&lt;/p&gt;

&lt;p&gt;If you want to see what the scanner says about your own code, public repositories are free at &lt;a href="https://zelsis.com" rel="noopener noreferrer"&gt;zelsis.com&lt;/a&gt;. If it flags something that is actually fine, tell us. That is how this list was written.&lt;/p&gt;

</description>
      <category>security</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Three privacy bugs a code review rarely catches (and how to find them before release)</title>
      <dc:creator>Bedirhan Elibol</dc:creator>
      <pubDate>Mon, 09 Nov 2026 09:27:07 +0000</pubDate>
      <link>https://dev.to/bedirhandev/three-privacy-bugs-a-code-review-rarely-catches-and-how-to-find-them-before-release-51lh</link>
      <guid>https://dev.to/bedirhandev/three-privacy-bugs-a-code-review-rarely-catches-and-how-to-find-them-before-release-51lh</guid>
      <description>&lt;p&gt;A visitor opens your landing page, sees a banner, and wants to say no. If the only button says "Accept all", you have a consent problem that no unit test will ever flag. Here are three of these that show up in real code, with the fix for each.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. A banner with accept and no refuse
&lt;/h2&gt;

&lt;p&gt;This is the common version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;CookieBanner&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"dialog"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;We use cookies to improve your experience.&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;acceptAll&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Accept all&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Regulators in the EU look at whether refusing is as easy as accepting. One button for yes and a settings link buried three clicks deep for no does not pass that bar. The fix is a second button with the same size and contrast, and one click:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;acceptAll&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Accept all&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;rejectNonEssential&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Necessary only&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure &lt;code&gt;rejectNonEssential&lt;/code&gt; really does not load analytics or ad scripts. A reject button that still fires the tag is worse than no button.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. A consent cookie that outlives the consent
&lt;/h2&gt;

&lt;p&gt;Consent is not permanent. Guidance in the EU points to asking again after about a year. Watch for this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cookie&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;consent&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;all&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;maxAge&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;365&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;3600&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Five years means a visitor who clicked "accept" once in 2026 is still treated as consenting in 2031. Cap it at 12 months and show the banner again after that.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. An embed that sets cookies before anyone clicks anything
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;iframe&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://www.youtube.com/embed/abc123"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The standard YouTube embed loads Google scripts and sets cookies when the page loads, before the visitor plays the video. Two ways out: use &lt;code&gt;https://www.youtube-nocookie.com/embed/abc123&lt;/code&gt;, which waits until the video is played, or render a placeholder image and only insert the iframe after a click.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to check this on every pull request
&lt;/h2&gt;

&lt;p&gt;You can grep for these by hand, and for a one-off audit that works. Over time it slips, because the banner gets rewritten and the embed gets copied from a blog post. I run Zelsis on pull requests for this. It flags a banner component with an accept control and no reject wording, a consent cookie lifetime above a year, and a &lt;code&gt;youtube.com/embed&lt;/code&gt; iframe. These are flagged as warnings, they do not fail the check, because whether a page needs consent depends on the product and the country. The embed check only looks at JavaScript and HTML-like files.&lt;/p&gt;

&lt;p&gt;Which of the three have you found in your own code? And does anyone have a banner pattern that makes refusing easy without hurting opt-in rates too much?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>privacy</category>
      <category>javascript</category>
      <category>security</category>
    </item>
    <item>
      <title>Why page 800 of your list is slow (and the one-line fix)</title>
      <dc:creator>Bedirhan Elibol</dc:creator>
      <pubDate>Thu, 05 Nov 2026 18:02:10 +0000</pubDate>
      <link>https://dev.to/bedirhandev/why-page-800-of-your-list-is-slow-and-the-one-line-fix-2dcd</link>
      <guid>https://dev.to/bedirhandev/why-page-800-of-your-list-is-slow-and-the-one-line-fix-2dcd</guid>
      <description>&lt;p&gt;A list endpoint with &lt;code&gt;LIMIT 20 OFFSET 20000&lt;/code&gt; looks harmless. On a table with a few hundred rows in development it is instant, so nobody notices.&lt;/p&gt;

&lt;p&gt;In production the database reads the first 20,000 rows in your sort order, discards them, and returns the next 20. Page 1 touches 20 rows. Page 1000 touches 20,000. If the table grows, the same URL gets slower every month, and the first complaint is usually an export or an admin screen that times out.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it looks like
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="k"&gt;OFFSET&lt;/span&gt; &lt;span class="mi"&gt;20000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run &lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt; on this and on the same query with &lt;code&gt;OFFSET 0&lt;/code&gt;. The plan shows the row count the scan produced, and the gap is the wasted work.&lt;/p&gt;

&lt;p&gt;In Prisma the same thing is &lt;code&gt;skip&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;prisma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findMany&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;orderBy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;createdAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;desc&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="na"&gt;skip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;take&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Keyset pagination
&lt;/h2&gt;

&lt;p&gt;Remember the last row of the previous page and ask for rows after it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;created_at&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;$&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With an index on &lt;code&gt;(created_at, id)&lt;/code&gt; the database jumps straight to the position and reads 20 rows, on page 1 and on page 1000. In Prisma:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;prisma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findMany&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;orderBy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;createdAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;desc&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;desc&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}],&lt;/span&gt;
  &lt;span class="na"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;lastId&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;skip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;take&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A second benefit
&lt;/h2&gt;

&lt;p&gt;With offsets, a row inserted while someone scrolls pushes everything down by one, so the next page repeats an item. A cursor does not shift.&lt;/p&gt;

&lt;h2&gt;
  
  
  The tradeoff
&lt;/h2&gt;

&lt;p&gt;You cannot jump to page 500, only go forward and back. For feeds, exports, admin lists and APIs that is usually fine. For a numbered pager over a small table, OFFSET is fine too. Small offsets are not the problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Catching it in review
&lt;/h2&gt;

&lt;p&gt;Zelsis flags a literal &lt;code&gt;OFFSET 1000&lt;/code&gt; or larger, and &lt;code&gt;.skip(1000)&lt;/code&gt; or larger, in a pull request as a low-severity warning. It does not catch an offset computed from &lt;code&gt;page * pageSize&lt;/code&gt;, so a human still has to look at those. Run &lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt; against production-sized data before you ship a list endpoint.&lt;/p&gt;

&lt;p&gt;How do you paginate big tables: cursors, or something else?&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>webdev</category>
      <category>performance</category>
      <category>database</category>
    </item>
    <item>
      <title>One using (true) policy makes your whole table public</title>
      <dc:creator>Bedirhan Elibol</dc:creator>
      <pubDate>Tue, 03 Nov 2026 09:23:15 +0000</pubDate>
      <link>https://dev.to/bedirhandev/one-using-true-policy-makes-your-whole-table-public-1dg7</link>
      <guid>https://dev.to/bedirhandev/one-using-true-policy-makes-your-whole-table-public-1dg7</guid>
      <description>&lt;p&gt;You hit a permission error. The quick fix is a policy with &lt;code&gt;using (true)&lt;/code&gt;, and the error goes away. So does the protection on that table.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why one loose policy wins
&lt;/h2&gt;

&lt;p&gt;Postgres policies are permissive by default. When a table has several permissive policies for the same command, a row is visible if any one of them returns true. They are combined with OR.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="n"&gt;policy&lt;/span&gt; &lt;span class="nv"&gt;"Org members read invoices"&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="n"&gt;invoices&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;select&lt;/span&gt;
  &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;org_id&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;org_id&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;members&lt;/span&gt; &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;()));&lt;/span&gt;

&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="n"&gt;policy&lt;/span&gt; &lt;span class="nv"&gt;"allow read"&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="n"&gt;invoices&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;select&lt;/span&gt;
  &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first policy is correct. The second makes it irrelevant: every row passes &lt;code&gt;true&lt;/code&gt;, so anyone holding the anon key can read every invoice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Find them
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;schemaname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tablename&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;policyname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;roles&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;qual&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;with_check&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;pg_policies&lt;/span&gt;
&lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;qual&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'true'&lt;/span&gt; &lt;span class="k"&gt;or&lt;/span&gt; &lt;span class="n"&gt;with_check&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'true'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each row is a policy that lets everything through for its command and roles. Some are on purpose, like a public &lt;code&gt;countries&lt;/code&gt; table. The rest are bugs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make it a test
&lt;/h2&gt;

&lt;p&gt;Run that query in CI after your migrations and fail when it returns a table that is not on an allow list. One test covers the whole class, including the policy nobody has written yet: the next one an agent adds to make an error go away.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you need a hard limit
&lt;/h2&gt;

&lt;p&gt;Restrictive policies are combined with AND. A row has to pass at least one permissive policy and every restrictive one, so a restrictive policy caps what any permissive policy can open:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="n"&gt;policy&lt;/span&gt; &lt;span class="nv"&gt;"org boundary"&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="n"&gt;invoices&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;restrictive&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;select&lt;/span&gt;
  &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;org_id&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;org_id&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;members&lt;/span&gt; &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;()));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With that in place, a later &lt;code&gt;using (true)&lt;/code&gt; cannot widen reads past the org boundary.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two more to check
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;with check (true)&lt;/code&gt; on insert or update: anyone allowed to write can write any row.&lt;/li&gt;
&lt;li&gt;A policy with no &lt;code&gt;to&lt;/code&gt; clause applies to every role, &lt;code&gt;anon&lt;/code&gt; included.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Zelsis flags &lt;code&gt;using (true)&lt;/code&gt; policies on pull requests. There is also a 14-second version of this post: &lt;a href="https://youtube.com/shorts/hHrIz9LJhD0" rel="noopener noreferrer"&gt;https://youtube.com/shorts/hHrIz9LJhD0&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have you found one of these in a real project? I'm curious what the "temporary" reason was.&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>supabase</category>
      <category>security</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
