<?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: Khalid Attar</title>
    <description>The latest articles on DEV Community by Khalid Attar (@khalid_attar_f0b87efdc31d).</description>
    <link>https://dev.to/khalid_attar_f0b87efdc31d</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3859987%2F6954d509-890b-4f34-a3cd-5db55b40d123.png</url>
      <title>DEV Community: Khalid Attar</title>
      <link>https://dev.to/khalid_attar_f0b87efdc31d</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/khalid_attar_f0b87efdc31d"/>
    <language>en</language>
    <item>
      <title>I built a PR merge gate for NestJS backends — scanned a 137-star ecommerce repo and found 58 violations including a silent authorization bypass</title>
      <dc:creator>Khalid Attar</dc:creator>
      <pubDate>Fri, 03 Apr 2026 21:45:52 +0000</pubDate>
      <link>https://dev.to/khalid_attar_f0b87efdc31d/i-built-a-pr-merge-gate-for-nestjs-backends-scanned-a-137-star-ecommerce-repo-and-found-58-2dh8</link>
      <guid>https://dev.to/khalid_attar_f0b87efdc31d/i-built-a-pr-merge-gate-for-nestjs-backends-scanned-a-137-star-ecommerce-repo-and-found-58-2dh8</guid>
      <description>&lt;p&gt;🔗 &lt;a href="https://www.technicaldebtradar.com" rel="noopener noreferrer"&gt;technicaldebtradar.com&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;I built &lt;strong&gt;Technical Debt Radar&lt;/strong&gt; — a tool that blocks PR merges when it finds dangerous patterns in NestJS backends. Not a linter. Actual enforcement.&lt;/p&gt;

&lt;p&gt;To validate it, I scanned a real 137-star NestJS + Mongoose ecommerce project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results
&lt;/h2&gt;

&lt;p&gt;58 violations — 8 blocking the merge gate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Architecture: 9 (circular deps, cross-module violations)&lt;/li&gt;
&lt;li&gt;Reliability: 22 (missing error handling)&lt;/li&gt;
&lt;li&gt;Performance: 7 (unbounded queries, no pagination)&lt;/li&gt;
&lt;li&gt;Runtime Risk: 4 (fetch without timeout, ReDoS)&lt;/li&gt;
&lt;li&gt;Maintainability: 16 (dead code, unused exports)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Real Bug
&lt;/h2&gt;

&lt;p&gt;The code checked if a user purchased a product before allowing a review:&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="nx"&gt;hasPurchased&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;orderModel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findOne&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&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;orderItems.productId&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;delivered&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;// ← field doesn't exist in schema&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The correct field is &lt;code&gt;isDelivered: boolean&lt;/code&gt;. This query always returns null — anyone could review any product without purchasing it. Silent, no error thrown.&lt;/p&gt;

&lt;h2&gt;
  
  
  Auto-Fix
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;radar fix &lt;span class="nt"&gt;--auto&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;47 violations fixed automatically&lt;/li&gt;
&lt;li&gt;Debt score: 200 → 15&lt;/li&gt;
&lt;li&gt;Gate result: ✅ PASS&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx technical-debt-radar scan &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Free plan — 5 scans/month, no credit card required.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Happy to scan any public NestJS repo. What patterns do you wish your linter caught?&lt;/em&gt;&lt;/p&gt;

</description>
      <category>nestjs</category>
      <category>webdev</category>
      <category>typescript</category>
      <category>node</category>
    </item>
  </channel>
</rss>
