<?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 Thanos Katsaounis on Medium]]></title>
        <description><![CDATA[Stories by Thanos Katsaounis on Medium]]></description>
        <link>https://medium.com/@katsathanasis2?source=rss-10010ac04eae------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*YV3Qah6bem4SC4VZoV9Llw.jpeg</url>
            <title>Stories by Thanos Katsaounis on Medium</title>
            <link>https://medium.com/@katsathanasis2?source=rss-10010ac04eae------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 23:02:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@katsathanasis2/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[The Database Nobody Dares Delete]]></title>
            <link>https://medium.com/@katsathanasis2/the-database-nobody-dares-delete-c793ac492db9?source=rss-10010ac04eae------2</link>
            <guid isPermaLink="false">https://medium.com/p/c793ac492db9</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Thanos Katsaounis]]></dc:creator>
            <pubDate>Sun, 23 Aug 2026 13:45:36 GMT</pubDate>
            <atom:updated>2026-08-23T15:03:53.956Z</atom:updated>
            <content:encoded><![CDATA[<p>Azure shows you every resource you own. It won’t tell you what breaks when one dies so I built the missing map.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8N-Ess6aohmpBStOwnWTfA.png" /></figure><p>Every Azure subscription has one. An expensive database that looks orphaned in the portal, no app sitting next to it, no owner in the tags, a few hundred euros a month going somewhere. Deleting it is the obvious call. Nobody makes it.</p><p>The reason nobody makes it is that “is anything using this?” is a genuinely annoying question to answer. Connection strings live in app settings. App settings live behind a different blade for every app. Role assignments are somewhere else entirely, and the Private Endpoint in front of the thing is its own resource with its own page. You can spend an afternoon on it and still end up saying “probably fine” out loud, which is not the same as knowing.</p><p>Azure will show you every object you own. It won’t answer the question you actually asked.</p><p>So I wrote a tool for it. cloudmap takes the name of one resource and gives you back its dependency graph, the blast radius, as an editable draw.io diagram with the real Azure icons, plus an HTML viewer, Mermaid, JSON and CSV. It runs on your machine with your own az login. The only traffic it makes is the CLI talking to Azure.</p><pre>pip install cloudmap<br>cloudmap trace contoso-web --from demo</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*oV6np_yb01gvkWZT5ly9Qw.png" /></figure><p>Two panels, because the question has two halves: what this thing needs, and what needs this thing. The demo estate is synthetic and ships inside the package, so that command works with no Azure account and nothing to clone.</p><p>I did look for something existing first. Hava and Lucidscale both do this, and do it well, but they want your cloud inventory uploaded to their service, which in a lot of places is where the conversation ends. The open-source ones stay in one layer, Terraform state or Kubernetes manifests. I wanted Azure’s own inventory, read on my laptop.</p><p>What follows is how it finds those edges, and what it does about the ones it can’t.</p><h3>There is no dependencies table</h3><p>Resource Graph is a good inventory API. One KQL query gets you every resource in the tenant with its whole properties blob. What it doesn&#39;t have is any notion of a relationship.</p><p>The relationships are in the blobs, and every service expresses them differently:</p><ul><li>what an App Service runs on is serverFarmId</li><li>the subnet it integrates with is virtualNetworkSubnetId</li><li>the Key Vault it reads is a @Microsoft.KeyVault(...) string inside an app setting</li><li>who can touch a storage account is a role assignment, in a different table</li><li>what a Private Endpoint fronts is down in privateLinkServiceConnections</li></ul><p>So the first layer of cloudmap is deliberately boring: per-type rules that turn properties into typed edges. hosted-on, reads-secret, private-link-to, routes-to, role: Key Vault Secrets User. Each edge also records the property path it came from.</p><p>That last bit looked like housekeeping when I added it. It ended up being the thing the whole tool rests on, because you can ask any edge on the map why it’s there and get a real answer.</p><p>For types nobody wrote a rule for, there’s a generic pass: any ARM id sitting anywhere in the properties, if it resolves to something in the scan, becomes a references edge with its property path attached. Which is how a type I&#39;ve never heard of still lands on the map.</p><p>I mean that literally. There’s a test that pushes all <strong>4,687 published Azure resource types</strong> through every one of those channels, because “it maps anything” is easy to say and I wanted it checked.</p><p>One category of edge can’t come out of Resource Graph at all, because ARG doesn’t return app configuration. A connection string to a Postgres server exists in exactly one place, which is the app’s settings. So cloudmap can deep-read workloads through the az CLI and pull edges out of those too. With --resolve-secrets it&#39;ll resolve Key Vault references in memory, so a KV-backed connection string still tells you which database is on the other end. Those values aren&#39;t printed and aren&#39;t written anywhere. They exist for as long as the extractor needs them.</p><h3>The rule that keeps a shared VNet from lying to you</h3><p>The obvious way to compute a blast radius is a breadth-first walk. Start at the seed, follow every edge in both directions, return everything you touched. That’s what I wrote first, and it produced garbage.</p><p>Here’s the failure. You trace a web app. It sits on an App Service Plan, so the walk steps down to the plan. Eleven other apps sit on that same plan and each of them points at it, so the walk cheerfully steps back up through the plan into all eleven, and then down into their databases and their vaults. One shared plan, or one shared VNet, and your “blast radius” is the whole subscription.</p><p>The rule that fixed it:</p><blockquote><em>From the seed the walk goes both ways, what it depends on and what depends on it. But once a path has stepped in one direction, it never turns around.</em></blockquote><p>Down means things my seed needs. Up means things that need my seed. A path that went down into the shared plan isn’t allowed to come back up into a sibling app, because that sibling is neither. The plan itself stays on the map. The eleven strangers don’t.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*IJhOYS_RrvTFL2VrBOg_pg.png" /></figure><p>What I like about it is what it replaced. The version before kept a hardcoded list of “hub types” the walk wasn’t allowed through, and every new shared-resource type meant editing the list. The direction rule deleted the list and handled cases the list never would have.</p><h3>What it tells you when it can’t see</h3><p>The way a dependency map fails badly is silently. You trace a Key Vault, almost nothing comes back, and you conclude nothing depends on it. But an empty map can also mean the scan got cut off at the pagination cap, or your account couldn’t read the app settings where the dependencies actually live, or the apps were never deep-read in the first place.</p><p>So the map carries its own caveats. If the scan hit the cap, it says truncated: true and complete: false. If a read failed on permissions, that becomes a named read gap on the artifact rather than a quietly missing edge. If workloads weren&#39;t enriched, that&#39;s a blind spot, with a note about which class of edges is therefore absent. And since you can query a saved map afterwards (cloudmap ask out.json &quot;what breaks if I touch contoso-kv&quot;), every answer that comes out of an incomplete map repeats the warning.</p><p>The permissions story is the same worry wearing a different hat. cloudmap has no credentials of its own, every read goes through your token, so it sees what you see. The part that catches people out is that Azure doesn’t error on resources you can’t read. They’re just not in the response. A thin map on a low-privilege account means “here’s what I was allowed to see”, and I’d rather the tool say that than let you read it as “here’s everything”.</p><p>One example of what that means in practice, which surprised me when I checked it: reading a web app’s settings needs Microsoft.Web/sites/config/list/Action, and that&#39;s a POST. The built-in Reader role is literally */read. So a Reader tracing a Key Vault will see almost none of what reads it, and the only decent thing the tool can do is say so.</p><h3>AI that proposes, code that decides</h3><p>There’s an optional AI layer, built under one constraint: a tool whose entire selling point is trust can’t contain a component that guesses.</p><p>With --llm a local model reads one resource&#39;s raw JSON and proposes candidate edges. It&#39;s told to output only targets that appear verbatim in the JSON. Then a deterministic verifier takes over, and every proposal has to resolve to a resource that was actually scanned. Anything that doesn&#39;t resolve gets dropped rather than shown. The ones that survive are drawn dashed and labelled as model-proposed, and any answer leaning on one is marked [GUESS].</p><p>The model doesn’t supply facts. It supplies suspicions, and the code either confirms them against your tenant or bins them. It all runs locally, ollama by default or any OpenAI-compatible server:</p><pre>export CLOUDMAP_LLM_URL=http://localhost:1234/v1/chat/completions<br>export CLOUDMAP_LLM_MODEL=&lt;model name&gt;</pre><p>I’ll be honest that this is the least exercised part of the tool. The design is right and the tests cover the boundary, but it’s had far less real use than the deterministic path.</p><h3>Back to that database</h3><p>Which brings me back to the database nobody could prove was safe to delete. A blast radius runs in both directions, and for this particular question you only want one of them:</p><pre>cloudmap trace sql-orders-dev --live --allow-live --direction up</pre><p>--direction up flips the question round: what needs this database. The connection string that answers it lives in some app&#39;s settings and nowhere else, so cloudmap deep-reads the apps in scope on the way through and comes back with whatever still points at the thing. Often the list is empty and you delete it and move on. Occasionally there&#39;s a production app on it nobody remembered. That&#39;s the case the whole exercise is for.</p><p>The project is MIT-licensed, on PyPI as <a href="https://pypi.org/project/cloudmap/">cloudmap</a>, and the repo is at <a href="https://github.com/KatsaounisThanasis/cloudmap">github.com/KatsaounisThanasis/cloudmap</a>. The synthetic estate ships with it, so it’s about a minute to try. If you point it at your own tenant and the map surprises you, that’s either a bug or the most useful thing it’ll ever tell you, and I’d like to hear about both.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c793ac492db9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a Policy Scanner That Fixes My Terraform and Proves the Fix Holds]]></title>
            <link>https://medium.com/@katsathanasis2/i-built-a-policy-scanner-that-fixes-my-terraform-and-proves-the-fix-holds-2cb12ac60637?source=rss-10010ac04eae------2</link>
            <guid isPermaLink="false">https://medium.com/p/2cb12ac60637</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Thanos Katsaounis]]></dc:creator>
            <pubDate>Fri, 24 Jul 2026 11:20:00 GMT</pubDate>
            <atom:updated>2026-07-24T11:20:00.054Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V5uI3g2MxmOVPzx89m0y7g.png" /></figure><p>Every IaC scanner I have used is great at one thing and useless at the next. It tells you what is wrong. Then it walks away.</p><p>You run it, 200 findings land in a report, a ticket gets filed, and three sprints later the same misconfiguration is still in production. Two gaps stay open the whole time. Nobody understands why finding number 147 actually matters, and even when the fix is obvious, somebody still has to write it and prove it closed the hole.</p><p>I wanted a tool that closes both gaps without sending my infrastructure code to anyone. So I built one, and last week I shipped v0.2.0.</p><h3>The loop</h3><p>policy-as-code-ai runs a closed loop over an Azure Terraform plan:</p><pre>terraform plan  -&gt;  OPA/Rego scan  -&gt;  local LLM explains each violation<br>                -&gt;  deterministic fix  -&gt;  re-scan proves 0 violations</pre><p>Every step is boring on its own. Put together, they turn a raw policy failure into a verified fix, and the last step is the one I care about most: the tool does not just claim it fixed things, it re-runs the same gate on the patched code and shows you the count drop to zero.</p><h3>Step one: find the problem, in plain Rego</h3><p>The detection is Open Policy Agent. Each rule is a small Rego policy that reads the plan and emits a structured violation. Here is the one for a storage account left open to the public internet:</p><pre># Rule AZ-STORAGE-003: deny public network access<br>deny contains {<br>	&quot;resource&quot;: resource.address,<br>	&quot;rule&quot;: &quot;AZ-STORAGE-003&quot;,<br>	&quot;severity&quot;: &quot;high&quot;,<br>	&quot;message&quot;: &quot;Storage account has public network access enabled. Set &#39;public_network_access_enabled&#39; to false.&quot;<br>} if {<br>	some resource in storage_accounts<br>	resource.change.after.public_network_access_enabled == true<br>}</pre><p>There are 21 of these across 10 Azure services: Storage, NSG, Key Vault, SQL, App Service, Managed Disk, Cosmos DB, AKS, Container Registry, Log Analytics.</p><h3>Step two: explain the risk, locally</h3><p>A finding like AZ-STORAGE-003 means nothing to someone shipping a feature under a deadline. So a language model turns each violation into two or three sentences of real-world risk plus a verification hint, and it runs on my machine through Ollama. Nothing about the plan leaves the box.</p><p>That last part is the whole point. Your Terraform encodes your network topology, your resource names, your security posture. I did not want any of that going to a third-party API just to get a sentence of explanation back. The backend is pluggable if you disagree (Azure OpenAI and Anthropic are one env var away), but the default keeps everything private, and there is no per-review token bill.</p><h3>Step three: fix it, without hallucinating</h3><p>Here is the line I hold firmly: the model explains, it never writes the fix. Remediation comes from a deterministic map, one attribute change per rule, applied only inside the resource that was actually flagged.</p><pre>{<br>  &quot;id&quot;: &quot;AZ-STORAGE-003&quot;,<br>  &quot;severity&quot;: &quot;high&quot;,<br>  &quot;fix&quot;: { &quot;attribute&quot;: &quot;public_network_access_enabled&quot;, &quot;value&quot;: &quot;false&quot; },<br>  &quot;doc&quot;: &quot;https://learn.microsoft.com/azure/storage/common/storage-network-security&quot;<br>}</pre><p>That is worth pausing on. If an LLM writes your HCL, you get plausible code that might be subtly wrong, and you have to review every line as if a junior did it at 3am. A lookup table cannot hallucinate a subnet. It covers the unambiguous cases (set TLS to 1.2, disable public access) and stays out of the ones that need judgment. An NSG rule that allows any inbound source has no single correct CIDR, so the fix there is fail-closed: set it to Deny and let a human scope it properly.</p><h3>Step four: prove it</h3><p>This is the part most tools skip. After the fix is written, the patched Terraform gets re-scanned against the same policies:</p><pre>$ make verify<br>Verifying remediated Terraform against the policy gate...<br>✓ Proof: remediated Terraform passes the policy gate with 0 violations.</pre><p>A clean re-scan is evidence, not a vibe. It is the difference between “the AI says it fixed it” and “the gate that failed a minute ago now passes.” If you read my last piece on a supply-chain pipeline that refuses to run code it can’t prove it built (https://github.com/KatsaounisThanasis/secure-supply-chain), you will recognize the pattern. I keep coming back to the same idea: do not trust the change, prove it.</p><h3>What v0.2.0 actually changed</h3><p>The first version proved the concept. This release is the unglamorous work that makes it usable.</p><p>One source of truth. A rule used to be defined in five places: the Rego policy, the remediation map, the SARIF exporter, the docs links, and the CI comment. They drifted. Now every rule lives once in rules.json, everything else derives from it, and a test fails CI the moment a policy and the catalog disagree. Adding a rule is two edits, not five.</p><p>Fixes that stay in their lane. The old remediation matched an attribute name anywhere in the file. If two storage accounts shared a setting, it could patch the wrong one. Now it parses the block and only touches the resource that was flagged.</p><p>Try it in 30 seconds, no cloud account. There is an offline mode that scans a bundled plan with just OPA:</p><pre>$ make scan-offline<br>Offline mode: scanning examples/insecure_plan.json (no terraform, no Azure).<br>Summary: 21 violation(s).</pre><p>No terraform, no az login, no Azure subscription. Clone and run.</p><h3>CI that keeps the promise</h3><p>The GitHub Action stays cloud-free and LLM-free on purpose. It scans a committed plan fixture, uploads the violations as SARIF so they show up in the repo’s Security tab with real line numbers, and posts a PR comment listing each violation and its deterministic fix. The AI explanations remain a local step, so the “your code never leaves your machine” guarantee holds even in CI.</p><h3>What I took away</h3><p>The satisfying part was not the AI. It was drawing a hard line around it. The model does the one thing it is genuinely good at, explaining, and a deterministic engine does the thing you cannot afford to get wrong, changing your infrastructure. The proof step ties it together and makes the whole thing something you can actually trust in a pipeline.</p><p>It is MIT. Clone it, run make scan-offline, and tell me where it breaks.</p><p>Repo: <a href="https://github.com/KatsaounisThanasis/policy-as-code-ai">https://github.com/KatsaounisThanasis/policy-as-code-ai</a></p><p>Originally published on dev.to: <a href="https://dev.to/thanasis_katsaounis_/i-built-a-policy-scanner-that-fixes-my-terraform-and-proves-the-fix-holds-28cf">https://dev.to/thanasis_katsaounis_/i-built-a-policy-scanner-that-fixes-my-terraform-and-proves-the-fix-holds-28cf</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cb12ac60637" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a CI/CD Pipeline That Refuses to Run Code It Can’t Prove It Built]]></title>
            <link>https://medium.com/@katsathanasis2/i-built-a-ci-cd-pipeline-that-refuses-to-run-code-it-cant-prove-it-built-e6cc30813524?source=rss-10010ac04eae------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6cc30813524</guid>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[supply-chain-security]]></category>
            <category><![CDATA[sigstore]]></category>
            <dc:creator><![CDATA[Thanos Katsaounis]]></dc:creator>
            <pubDate>Mon, 29 Jun 2026 18:22:37 GMT</pubDate>
            <atom:updated>2026-06-29T18:46:50.229Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ikKklley5WlnKzNCZbIcJg.png" /></figure><p>Your tests are green. The image is in the registry. It’s running in production. And almost nobody can answer one question with any confidence:</p><p><strong>Is the thing running in your cluster actually the thing your CI built?</strong></p><p>Think about everything between “my pipeline built an image” and “this pod is running.” A registry push. A tag anyone with write access can move. A latest that means whatever it pointed to five minutes ago. A base image that picked up a fresh CVE overnight. Most pipelines treat all of that as trusted. Supply-chain attacks like SolarWinds and Codecov, and the steady drip of typosquatted packages, live in exactly that gap.</p><p>So I tried to close it. Not with a policy doc. With a pipeline that proves integrity at every step and won’t run anything it can’t verify. Here’s how it works, plus the parts that actually gave me trouble.</p><h3>The trust gap, concretely</h3><p>A normal pipeline is build, push, deploy. Every arrow is an act of faith. The deploy step trusts the registry, the registry trusts whoever pushed, and the cluster trusts the tag.</p><p>The fix is to make trust checkable. Bind a cryptographic identity to the exact image bytes at build time, write that binding to a public log, and have the cluster verify it for itself before it schedules a single pod. Verification fails, the pod never runs.</p><p>That’s the whole idea. The implementation is eight stages, and each one leaves evidence behind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/1*lsnCyn95NYDZkT3YQjUzww.png" /></figure><h3>Stage 1: fail before you build</h3><p>The cheapest vulnerability to fix is the one you catch before the image even exists. Two checks run first. Hadolint on the Dockerfile, and Gitleaks across the full git history.</p><p>The fetch-depth: 0 is the important bit. Gitleaks scans history, not just the current tree. A secret you committed and &quot;removed&quot; three months ago is still sitting in the history, and it&#39;s still a leak.</p><pre>- name: Checkout code<br>  uses: actions/checkout@de0fac2e... # v6.0.2, SHA-pinned<br>  with:<br>    fetch-depth: 0<br><br>- name: Lint Dockerfile with Hadolint<br>  uses: hadolint/hadolint-action@2332a7b... # v3.3.0<br>  with:<br>    dockerfile: app/Dockerfile<br><br>- name: Scan for secrets with Gitleaks<br>  uses: gitleaks/gitleaks-action@ff98106... # v2.3.9</pre><p>Every action is pinned to a commit SHA, not a tag like @v3. Tags are mutable. Whoever controls the action&#39;s repo can repoint one whenever they like. Pin to a SHA and the build can&#39;t be tampered with through its own dependencies. It&#39;s the threat model turned back on the pipeline itself.</p><h3>Stage 2: build, scan, then decide</h3><p>This is the ordering call that took me a while to get right. Build the image locally, scan it, and push only if the scan passes. The naive version pushes first and scans the registry, which means a vulnerable image is already public by the time you find out it’s bad.</p><p>So Trivy runs three times, on purpose:</p><pre># 1) Report for humans + artifacts. Never fails the build.<br>- name: Run Trivy scan (JSON report)<br>  uses: aquasecurity/trivy-action@ed142fd... # v0.36.0<br>  with:<br>    image-ref: &#39;${{ env.IMAGE_REF }}&#39;<br>    format: &#39;json&#39;<br>    exit-code: &#39;0&#39;          # always upload, even when vulnerable<br>    ignore-unfixed: true<br>    severity: &#39;CRITICAL,HIGH&#39;<br><br># 2) SARIF -&gt; GitHub Security tab (same scan, machine format)<br><br># 3) The actual gate. This one is allowed to fail the build.<br>- name: Enforce CRITICAL/HIGH gate<br>  uses: aquasecurity/trivy-action@ed142fd...<br>  with:<br>    image-ref: &#39;${{ env.IMAGE_REF }}&#39;<br>    exit-code: &#39;1&#39;          # HIGH/CRITICAL -&gt; stop the pipeline<br>    ignore-unfixed: true<br>    severity: &#39;CRITICAL,HIGH&#39;</pre><p>Why split reporting from gating? Because you need triage data even when the build fails. If the gate and the report were one step, a failing build would hand you a red X and nothing to work with. Split them and you always get the SARIF in the Security tab and the JSON artifact, and the build still stops. ignore-unfixed: true is a pragmatic call. Don&#39;t block on CVEs that have no patch yet, or you&#39;ll never ship.</p><p>The SBOM (CycloneDX) is generated before the gate for the same reason. You want the component inventory of a failed build, not only a passing one.</p><h3>Stage 3: sign what you actually shipped</h3><p>The image passed the gate and got pushed to GHCR. Now we bind an identity to it, with no long-lived keys anywhere.</p><pre>- name: Sign image with Cosign (keyless) run: cosign sign --yes &quot;${IMAGE_REF}&quot; - name: Attest SBOM with Cosign run: cosign attest --yes --predicate sbom.json --type cyclonedx &quot;${IMAGE_REF}&quot;</pre><p>“Keyless” is the part worth slowing down on. There’s no private key sitting in a secret somewhere, waiting to get stolen. Cosign uses GitHub’s OIDC token to prove “this build ran from this workflow on this repo,” pulls a short-lived certificate from Sigstore’s CA (Fulcio), signs, and writes the signature to a public transparency log (Rekor). The signing key exists for a few seconds and then it’s gone.</p><p>What you end up with is an identity you can describe and check against. Not “signed by a key” but “signed by this workflow file on the main branch of this repo.” Anyone can verify it with zero setup:</p><pre>cosign verify \ --certificate-identity-regexp=&quot;https://github.com/KatsaounisThanasis/secure-supply-chain/.github/workflows/security.yml@refs/heads/main&quot; \ --certificate-oidc-issuer=&quot;https://token.actions.githubusercontent.com&quot; \ ghcr.io/katsaounisthanasis/secure-app:&lt;SHA&gt;</pre><h3>Stage 4: the cluster verifies for itself</h3><p>Signing is only half the value. A signature nobody checks is just decoration. The real enforcement happens at admission time in Kubernetes, with a Kyverno ClusterPolicy:</p><pre>verifyImages:<br>  - imageReferences:<br>      - ghcr.io/katsaounisthanasis/secure-app:*<br>    mutateDigest: true<br>    attestors:<br>      - entries:<br>          - keyless:<br>              issuer: https://token.actions.githubusercontent.com<br>              subject: https://github.com/KatsaounisThanasis/secure-supply-chain/.github/workflows/security.yml@refs/heads/main<br>              rekor:<br>                url: https://rekor.sigstore.dev</pre><p>When a pod gets created, Kyverno intercepts the request, looks the signature up in Rekor, and checks that the signing identity matches this exact workflow and issuer. Two things worth calling out:</p><ul><li>mutateDigest: true rewrites the image tag to its immutable digest on admission. So if someone repoints the tag later, the running pod stays pinned to the bytes that were verified. The tag-to-digest race is closed.</li><li>validationFailureAction: Enforce means this is not an audit log. A pod that fails verification gets rejected, not flagged.</li></ul><h3>The part I’m proudest of it proves itself on every push</h3><p>Anyone can write a README that makes these claims. What I wanted was a pipeline that demonstrates it, automatically, every time. So the final CI job spins up a real Kubernetes cluster ( kind) inside the runner, installs Kyverno, applies the policy, and runs two assertions:</p><pre>- name: Deploy SIGNED pod (expect ADMITTED)<br>  run: |<br>    sed &quot;s/__IMAGE_TAG__/${IMAGE_TAG}/g&quot; k8s/demos/pass-signed.yaml | kubectl apply -f -<br>    kubectl -n demo-secure wait --for=condition=Ready pod/secure-app-signed --timeout=3m<br><br>- name: Deploy UNSIGNED pod (expect REJECTED)<br>  run: |<br>    OUT=$(kubectl apply -f k8s/demos/fail-unsigned.yaml 2&gt;&amp;1) || true<br>    if echo &quot;$OUT&quot; | grep -q &quot;denied the request&quot;; then<br>      echo &quot;Unsigned image rejected, as expected.&quot;; exit 0<br>    fi<br>    echo &quot;::error::Unsigned image was NOT rejected. Admission control is broken.&quot;<br>    exit 1</pre><p>The signed pod has to reach Ready. The unsigned pod has to be denied at admission. If either expectation breaks, the build goes red. The security guarantee isn&#39;t a paragraph in a doc. It&#39;s a test that fails loudly the day it stops being true.</p><h3>The bug that taught me the most</h3><p>Everything signed cleanly. Everything verified from the CLI. And Kyverno still rejected my legitimately-signed image.</p><p>It was a format mismatch. Cosign v2.4+ defaults to the newer Sigstore bundle format, attached as OCI 1.1 referrers. Kyverno’s keyless verifyImages (v1.18 and earlier) couldn&#39;t read that format yet. As far as the verifier was concerned, a perfectly valid signature just wasn&#39;t there.</p><p>The fix was to pin Cosign to v2.2.4, so signatures land at the legacy &lt;digest&gt;.sig and &lt;digest&gt;.att tags that Kyverno understands:</p><pre>- name: Install Cosign<br>  uses: sigstore/cosign-installer@cad07c2... # v4.1.1<br>  with:<br>    cosign-release: &#39;v2.2.4&#39;</pre><p>The lesson goes well past this one repo. In a signing chain, the signer and the verifier have to agree on a format, and “latest” guarantees nothing about that. It’s also the kind of bug you only catch by running the verifier for real, which is exactly why the self-proving job earns its place.</p><h3>What this maps to</h3><p>If you’ve come across the SLSA framework or read about “shift-left security,” here’s what those phrases look like as working YAML:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*1K1zoj8MwAgW34u417UqIg.png" /></figure><h3>Takeaways</h3><ul><li>Order your gates so nothing unverified escapes. Build local, scan, gate, then push.</li><li>Keep reporting separate from enforcement, so failed builds still produce triage data.</li><li>Keyless signing gets rid of the key you’d otherwise have to protect. The attack surface you don’t have can’t be stolen.</li><li>A signature only matters if something verifies it. Push enforcement all the way to admission control.</li><li>Make your security claims self-proving. A green check that says “unsigned pods are rejected” beats any paragraph in a README.</li></ul><p>The full pipeline, the Kyverno policy, the kind demo, and the live Rekor transparency entry are all in the repo. Clone it, run make kyverno-demo, and watch your cluster reject an unsigned pod in real time:</p><p>👉 <a href="https://github.com/KatsaounisThanasis/secure-supply-chain"><strong>github.com/KatsaounisThanasis/secure-supply-chain</strong></a></p><p>If you’re building DevSecOps pipelines and you hit the Cosign/Kyverno format wall too, I’d genuinely like to hear how you got around it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6cc30813524" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>