<?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: vorsken</title>
    <description>The latest articles on DEV Community by vorsken (@vorsken).</description>
    <link>https://dev.to/vorsken</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%2F3899625%2Ffe8ee2cb-f4f8-4b25-a31e-8817325fe91e.png</url>
      <title>DEV Community: vorsken</title>
      <link>https://dev.to/vorsken</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vorsken"/>
    <language>en</language>
    <item>
      <title>Stop merging vulnerable API code — automate PR security gates with Semgrep + Claude AI</title>
      <dc:creator>vorsken</dc:creator>
      <pubDate>Tue, 28 Apr 2026 00:53:20 +0000</pubDate>
      <link>https://dev.to/vorsken/stop-merging-vulnerable-api-code-automate-pr-security-gates-with-semgrep-claude-ai-22ik</link>
      <guid>https://dev.to/vorsken/stop-merging-vulnerable-api-code-automate-pr-security-gates-with-semgrep-claude-ai-22ik</guid>
      <description>&lt;p&gt;Stop merging vulnerable API code — automate PR security gates with Semgrep + Claude AI&lt;/p&gt;

&lt;p&gt;Every team says "we'll fix it after the merge."&lt;br&gt;
They rarely do.&lt;/p&gt;

&lt;p&gt;I built vorsken — a GitHub Action that blocks pull requests containing&lt;br&gt;
API vulnerabilities before they reach your main branch.&lt;/p&gt;

&lt;p&gt;It combines Semgrep static analysis with Claude AI to post a plain-English&lt;br&gt;
verdict directly in the PR comment: BLOCK / FLAG / PASS.&lt;/p&gt;

&lt;p&gt;Here's how to add it to any repo in under 5 minutes.&lt;/p&gt;


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

&lt;p&gt;When a PR is opened or updated:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Semgrep scans changed files using OWASP API Security Top 10 rules&lt;/li&gt;
&lt;li&gt;Claude AI analyzes the findings and generates a human-readable report&lt;/li&gt;
&lt;li&gt;A verdict is posted as a PR comment&lt;/li&gt;
&lt;li&gt;A BLOCK verdict fails the required check — the merge is prevented&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;PR opened&lt;br&gt;
└─▶ Semgrep scans with OWASP API Top10 rules&lt;br&gt;
└─▶ Claude AI explains each finding in plain English&lt;br&gt;
└─▶ BLOCK / FLAG / PASS posted as PR comment&lt;br&gt;
└─▶ BLOCK = merge prevented ✋&lt;/p&gt;

&lt;p&gt;text&lt;/p&gt;


&lt;h2&gt;
  
  
  Why not just use Semgrep alone?
&lt;/h2&gt;

&lt;p&gt;Semgrep gives you rule IDs and line numbers.&lt;br&gt;
vorsken adds the context developers actually need:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Semgrep alone&lt;/th&gt;
&lt;th&gt;vorsken&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Finding location&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OWASP category&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What the risk means&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅ (Claude explains)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Concrete fix suggestion&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅ (Claude suggests)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PR comment&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅ (auto-posted)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Merge blocked on BLOCK&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;h2&gt;
  
  
  Setup (5 minutes)
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1. Add your Anthropic API key
&lt;/h3&gt;

&lt;p&gt;In your repository: &lt;strong&gt;Settings → Secrets → Actions → New repository secret&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name: &lt;code&gt;ANTHROPIC_API_KEY&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Value: &lt;code&gt;sk-ant-...&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Don't have a key yet? Get one at &lt;a href="https://console.anthropic.com/" rel="noopener noreferrer"&gt;console.anthropic.com&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Create the workflow file
&lt;/h3&gt;

&lt;p&gt;Create &lt;code&gt;.github/workflows/policy-gate.yml&lt;/code&gt;:&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="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Policy Gate&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;types&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;opened&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;synchronize&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;reopened&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;gate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
      &lt;span class="na"&gt;pull-requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;

    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v4&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;fetch-depth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;zetide/vorsken@v0.2.6&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;anthropic-api-key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.ANTHROPIC_API_KEY }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Push this file and open a PR.&lt;/p&gt;




&lt;h2&gt;
  
  
  What the PR comment looks like
&lt;/h2&gt;

&lt;p&gt;When a vulnerability is detected, vorsken posts a comment like this:&lt;/p&gt;

&lt;p&gt;🚨 vorsken Policy Gate — BLOCK&lt;/p&gt;

&lt;p&gt;Summary: A hardcoded API key was detected in the changed files.&lt;/p&gt;

&lt;p&gt;Rule Severity OWASP Description&lt;br&gt;
hardcoded-api-key CRITICAL API8:2023 Hardcoded credential found in source.&lt;/p&gt;

&lt;p&gt;Risk:&lt;br&gt;
An attacker with read access to this repository can use the exposed&lt;br&gt;
credential to authenticate as your service and access protected resources.&lt;/p&gt;

&lt;p&gt;Fix:&lt;br&gt;
Remove the hardcoded key. Read it from the environment instead:&lt;/p&gt;

&lt;p&gt;api_key = os.environ["API_KEY"]&lt;/p&gt;

&lt;p&gt;text&lt;/p&gt;

&lt;p&gt;No need to look up the rule documentation — the context is right there in the PR.&lt;/p&gt;


&lt;h2&gt;
  
  
  OWASP API Security Top 10 coverage
&lt;/h2&gt;

&lt;p&gt;vorsken ships with Semgrep rules covering all 10 OWASP API Security risks (2023 edition):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API1 — Broken Object Level Authorization&lt;/li&gt;
&lt;li&gt;API2 — Broken Authentication&lt;/li&gt;
&lt;li&gt;API3 — Broken Object Property Level Authorization&lt;/li&gt;
&lt;li&gt;API4 — Unrestricted Resource Consumption&lt;/li&gt;
&lt;li&gt;API5 — Broken Function Level Authorization&lt;/li&gt;
&lt;li&gt;API6 — Unrestricted Access to Sensitive Business Flows&lt;/li&gt;
&lt;li&gt;API7 — Server Side Request Forgery (SSRF)&lt;/li&gt;
&lt;li&gt;API8 — Security Misconfiguration&lt;/li&gt;
&lt;li&gt;API9 — Improper Inventory Management&lt;/li&gt;
&lt;li&gt;API10 — Unsafe Consumption of APIs&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Optional: customize the policy
&lt;/h2&gt;

&lt;p&gt;Add a &lt;code&gt;.stacksecai.yml&lt;/code&gt; to your repo root to tune the behavior:&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="na"&gt;policy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;block_on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ERROR"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;flag_on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;WARNING"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;

&lt;span class="na"&gt;claude&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;claude-haiku-4-5"&lt;/span&gt;
  &lt;span class="na"&gt;severity_block&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CRITICAL"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;HIGH"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;severity_flag&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MEDIUM"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;

&lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;overrides&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hardcoded-password"&lt;/span&gt;
      &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;BLOCK"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Use your own Semgrep rules
&lt;/h3&gt;

&lt;p&gt;Point &lt;code&gt;semgrep-rules&lt;/code&gt; to your own rule directory:&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="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;zetide/vorsken@v0.2.6&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;anthropic-api-key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.ANTHROPIC_API_KEY }}&lt;/span&gt;
    &lt;span class="na"&gt;semgrep-rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./rules/my-custom-rules&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How it's built
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Semgrep&lt;/strong&gt; — static analysis engine&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude API (claude-haiku-4-5)&lt;/strong&gt; — AI analysis and plain-English output&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;tenacity&lt;/strong&gt; — exponential backoff retry on rate limits&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Actions&lt;/strong&gt; — zero-infrastructure deployment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The action is MIT licensed. Source: &lt;a href="https://github.com/zetide/vorsken" rel="noopener noreferrer"&gt;github.com/zetide/vorsken&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Try it now
&lt;/h2&gt;

&lt;p&gt;The easiest way to see it in action:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fork or clone any Python API project&lt;/li&gt;
&lt;li&gt;Add the workflow file above&lt;/li&gt;
&lt;li&gt;Open a PR that touches a file with a hardcoded credential or missing auth check&lt;/li&gt;
&lt;li&gt;Watch the BLOCK verdict appear in the PR comment&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Available on &lt;a href="https://github.com/marketplace/actions/vorsken-policy-gate" rel="noopener noreferrer"&gt;GitHub Marketplace&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Feedback and contributions welcome — if you try it out, let me know what you think in the comments.&lt;/p&gt;

&lt;p&gt;⭐ If this looks useful, a star on GitHub helps others find it:&lt;br&gt;
&lt;a href="https://github.com/zetide/vorsken" rel="noopener noreferrer"&gt;github.com/zetide/vorsken&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>automation</category>
      <category>security</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
