<?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: Sar Zho</title>
    <description>The latest articles on DEV Community by Sar Zho (@sar_zho_b4e244c8f070d4184).</description>
    <link>https://dev.to/sar_zho_b4e244c8f070d4184</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%2F4094671%2F132451be-770a-495f-b1be-05616f35ca0c.png</url>
      <title>DEV Community: Sar Zho</title>
      <link>https://dev.to/sar_zho_b4e244c8f070d4184</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sar_zho_b4e244c8f070d4184"/>
    <language>en</language>
    <item>
      <title>I tested 2 AI coding assistants on a security-sensitive prompt — both did better than expected</title>
      <dc:creator>Sar Zho</dc:creator>
      <pubDate>Tue, 25 Aug 2026 19:13:42 +0000</pubDate>
      <link>https://dev.to/sar_zho_b4e244c8f070d4184/i-tested-2-ai-coding-assistants-on-a-security-sensitive-prompt-both-did-better-than-expected-2cf6</link>
      <guid>https://dev.to/sar_zho_b4e244c8f070d4184/i-tested-2-ai-coding-assistants-on-a-security-sensitive-prompt-both-did-better-than-expected-2cf6</guid>
      <description>&lt;p&gt;I gave two AI coding assistants the same prompt: "Write a login endpoint that checks a username and password against a database and returns a session token."&lt;/p&gt;

&lt;p&gt;The common assumption (including mine going in) is that AI-generated auth code tends to have obvious holes — string-concatenated SQL, plaintext password comparisons, no timing-attack protection. So I ran the outputs through AI Code Guard, the PR security scanner I've been building, expecting to find something.&lt;/p&gt;

&lt;p&gt;Both implementations got it right:&lt;/p&gt;

&lt;p&gt;Parameterized queries (no SQL injection)&lt;br&gt;
Proper password hashing (bcrypt / argon2, not plaintext comparison)&lt;br&gt;
Timing-attack mitigation (comparing against a dummy hash even when the user doesn't exist)&lt;br&gt;
Reasonable error handling that doesn't leak whether a username exists&lt;/p&gt;

&lt;p&gt;One used JWT for the session token; the other went further and stored only a SHA-256 hash of a random session token server-side rather than a signed JWT — arguably the stronger pattern, since a leaked JWT secret compromises every session while a leaked token hash compromises nothing on its own.&lt;/p&gt;

&lt;p&gt;Takeaway: for a well-known, heavily-represented pattern like "login endpoint," today's frontier coding assistants seem to have absorbed the standard secure implementation. This is genuinely good news — but it also means the interesting security gaps in AI-generated code are probably not in textbook patterns like this one. They're more likely in:&lt;/p&gt;

&lt;p&gt;Business-logic-specific authorization (who's allowed to do what, not just "is this password right")&lt;br&gt;
Less common patterns without as much training signal&lt;br&gt;
Multi-step flows where a vulnerability emerges from the interaction between files, not one function&lt;/p&gt;

&lt;p&gt;That's actually a more useful finding for AI Code Guard's roadmap: the deterministic checks (secrets, injection, dangerous commands) still matter as a safety net, but the real value is probably in catching the context-dependent stuff — which is exactly what the tool's optional AI-review layer is for.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/sarzho33-design/AI-CODE-GUARD" rel="noopener noreferrer"&gt;https://github.com/sarzho33-design/AI-CODE-GUARD&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Curious if others have found different results with less common prompts — happy to run more comparisons if people have suggestions.&lt;/p&gt;

</description>
      <category>security</category>
      <category>ai</category>
      <category>github</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
