<?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"><channel><title><![CDATA[Ops With Vibish]]></title><description><![CDATA[Ops With Vibish]]></description><link>https://vibishdevops.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 23:24:24 GMT</lastBuildDate><atom:link href="https://vibishdevops.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Zero-Trust Supply Chain Security on Bare-Metal K3s: Cosign, Syft, and Kyverno]]></title><description><![CDATA[Deploying containers by mutable tags (:latest) introduces blind spots into container execution. Compromised credentials or hijacked build runners can…]]></description><link>https://vibishdevops.hashnode.dev/zero-trust-supply-chain-k3s-cosign-kyverno</link><guid isPermaLink="true">https://vibishdevops.hashnode.dev/zero-trust-supply-chain-k3s-cosign-kyverno</guid><category><![CDATA[DevSecOps]]></category><category><![CDATA[Kubernetes]]></category><category><![CDATA[k3s]]></category><category><![CDATA[Security]]></category><category><![CDATA[gitops]]></category><dc:creator><![CDATA[Vibish]]></dc:creator><pubDate>Mon, 16 Nov 2026 15:58:44 GMT</pubDate><content:encoded><![CDATA[<p>Deploying containers by mutable tags (<code>:latest</code>) introduces blind spots into container execution. Compromised credentials or hijacked build runners can replace underlying images without triggering tag alerts.</p>
<p>This architecture enforces <strong>cryptographic image verification at admission time</strong> via Sigstore Cosign, Syft SBOM attestations, and Kyverno policy enforcement on bare-metal K3s.</p>
<hr />
<h3>End-to-End Cryptographic Trust Architecture</h3>
<p>The supply chain security architecture enforces strict separation of concerns across four key trust boundaries:</p>
<table>
<thead>
<tr>
<th align="left">Component</th>
<th align="left">Security Responsibility &amp; Output</th>
</tr>
</thead>
<tbody><tr>
<td align="left"><strong>1. CI Build Environment</strong></td>
<td align="left">• <strong>GitHub Actions</strong> build workflow<br />• Compute immutable digest: <code>sha256:7f83b...</code><br />• Generate <strong>SPDX SBOM</strong> via Syft<br />• Request <strong>OIDC JWT</strong> from Actions CA</td>
</tr>
<tr>
<td align="left"><strong>2. Sigstore PKI &amp; Rekor</strong></td>
<td align="left">• <strong>Fulcio CA:</strong> Validates OIDC JWT &amp; issues 10-minute ephemeral X.509 cert<br />• <strong>Rekor Log:</strong> Transparency ledger storing immutable signature hash (SET)</td>
</tr>
<tr>
<td align="left"><strong>3. OCI Registry (GHCR)</strong></td>
<td align="left">• <code>image@sha256:...</code> (Immutable Container)<br />• <code>sha256-....sig</code> (Cosign Signature)<br />• <code>sha256-....att</code> (SBOM Attestation)</td>
</tr>
<tr>
<td align="left"><strong>4. K3s Admission Gate</strong></td>
<td align="left">• <strong>API Server:</strong> Intercepts Pod admission via ValidatingAdmissionWebhook<br />• <strong>Kyverno:</strong> Verifies Sigstore signatures &amp; validates Rekor SET proof<br />• Mutates mutable tag to immutable <code>@sha256:...</code> digest<br />• <strong>Enforcement:</strong> ✅ <strong>Admit:</strong> Valid Signature | ❌ <strong>Drop:</strong> Unsigned / Untrusted</td>
</tr>
</tbody></table>
<hr />
<h3>Keyless Cryptographic Attestation Lifecycle</h3>
<p>Ephemeral certificates eliminate long-lived private keys in CI secrets. Trust is rooted in repository claims verified through GitHub's OIDC provider.</p>
<h4>Signing &amp; Admission Timeline</h4>
<ol>
<li><strong>Build &amp; Push Immutable Digest:</strong> GitHub Actions builds container and pushes immutable digest (<code>@sha256:...</code>) to GHCR.</li>
<li><strong>OIDC Token &amp; Ephemeral Certificate:</strong> Cosign requests OIDC JWT from GitHub, exchanging it with Fulcio CA for an ephemeral 10-minute X.509 certificate bound to repo identity.</li>
<li><strong>Rekor Transparency Log &amp; Attestation:</strong> Signature hash recorded in Rekor transparency ledger. Cosign uploads signature (<code>.sig</code>) and Syft SPDX SBOM (<code>.att</code>) to GHCR.</li>
<li><strong>K3s Admission Webhook Interception:</strong> Kubernetes API server fires <code>ValidatingAdmissionWebhook</code> to Kyverno. Kyverno pulls OCI signature and validates Rekor SET proof.</li>
</ol>
<h4>Admission Webhook Outcomes</h4>
<blockquote>
<p>✅ <strong>ADMITTED (Valid Signature &amp; Provenance):</strong><br />Kyverno mutates mutable tag to immutable <code>@sha256:...</code> digest and schedules Pod to node.</p>
</blockquote>
<blockquote>
<p>❌ <strong>REJECTED (Unsigned / Identity Mismatch):</strong><br />Kubernetes API server blocks admission request with <code>HTTP 403 Forbidden</code>. Pod execution is denied.</p>
</blockquote>
<hr />
<h3>Pipeline Specification: Build, Attest &amp; Keyless Sign</h3>
<p>Add this workflow to <code>.github/workflows/supply-chain.yml</code>:</p>
<pre><code class="language-yaml">name: Build, Attest &amp; Sign
on:
  push:
    branches: [ main ]

permissions:
  contents: read
  packages: write
  id-token: write # Required for Sigstore OIDC keyless signing

env:
  REGISTRY: ghcr.io
  IMAGE_NAME: ${{ github.repository }}

jobs:
  build-and-sign:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Cosign &amp; Syft
        uses: sigstore/cosign-installer@v3.7.0

      - name: Log in to GHCR
        uses: docker/login-action@v3
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Build and push image by digest
        id: build
        uses: docker/build-push-action@v6
        with:
          context: .
          push: true
          tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}

      - name: Sign container image (Keyless)
        env:
          COSIGN_EXPERIMENTAL: "1"
        run: |
          cosign sign --yes \
            ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}

      - name: Generate &amp; Attest SPDX SBOM
        uses: anchore/sbom-action@v0
        with:
          image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}
          format: spdx-json
          output-file: sbom.spdx.json

      - name: Attach SBOM Attestation
        run: |
          cosign attest --yes \
            --predicate sbom.spdx.json \
            --type spdxjson \
            ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}
</code></pre>
<hr />
<h3>Admission Policy State Engine (Kyverno)</h3>
<h4>Kyverno Admission Decision Pipeline</h4>
<pre><code>[ Incoming Pod Admission Request ]
               │
               ▼
┌─────────────────────────────────────────────────────────────┐
│ Stage 1: Intercept Pod Spec in `production` namespace       │ ──► [ PASSED ]
└─────────────────────────────────────────────────────────────┘
               │
               ▼
┌─────────────────────────────────────────────────────────────┐
│ Stage 2: Match Image Pattern `ghcr.io/vibishdevops/*`       │ ──► [ MATCHED ]
└─────────────────────────────────────────────────────────────┘
               │
               ▼
┌─────────────────────────────────────────────────────────────┐
│ Stage 3: Fetch Cosign Signature &amp; Validate Rekor SET Proof   │ ──► [ REKOR VERIFIED ]
└─────────────────────────────────────────────────────────────┘
               │
               ▼
┌─────────────────────────────────────────────────────────────┐
│ Stage 4: Verify OIDC Claims (Issuer &amp; Repo Subject)         │ ──► [ IDENTITY VALID ]
└─────────────────────────────────────────────────────────────┘
               │
               ▼
┌─────────────────────────────────────────────────────────────┐
│ Verdict: ADMISSION GRANTED (HTTP 200 OK)                     │
│ Action: Mutate image tag to immutable @sha256 digest        │
└─────────────────────────────────────────────────────────────┘
</code></pre>
<ul>
<li><strong>Stage 1:</strong> Intercept Pod Spec in <code>production</code> namespace <code>[PASSED]</code></li>
<li><strong>Stage 2:</strong> Match Image Pattern <code>ghcr.io/vibishdevops/*</code> <code>[MATCHED]</code></li>
<li><strong>Stage 3:</strong> Fetch Cosign Signature &amp; Validate Rekor Transparency Log <code>[REKOR VERIFIED]</code></li>
<li><strong>Stage 4:</strong> Verify OIDC Claims (Issuer: <code>token.actions.githubusercontent.com</code>, Subject: <code>https://github.com/vibishdevops/*</code>) <code>[IDENTITY VALID]</code></li>
<li><strong>Verdict: ✔ ADMISSION GRANTED (<code>200 OK</code>)</strong> — Image reference mutated to immutable <code>@sha256:...</code> digest &amp; dispatched to kubelet.</li>
</ul>
<hr />
<h3>Kyverno ClusterPolicy Implementation</h3>
<pre><code class="language-yaml">apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: enforce-signed-images
spec:
  validationFailureAction: Enforce
  background: false
  webhookTimeoutSeconds: 15
  rules:
    - name: verify-cosign-signature
      match:
        any:
          - resources:
              kinds:
                - Pod
              namespaces:
                - production
      verifyImages:
        - imageReferences:
            - "ghcr.io/vibishdevops/*"
          mutateDigest: true
          verifyDigest: true
          required: true
          attestors:
            - count: 1
              entries:
                - keyless:
                    subject: "https://github.com/vibishdevops/*"
                    issuer: "https://token.actions.githubusercontent.com"
                    rekor:
                      url: https://rekor.sigstore.dev
</code></pre>
<hr />
<h3>Threat Surface Mitigation Topology</h3>
<table>
<thead>
<tr>
<th align="left">Attack Vector</th>
<th align="left">Exploitation Mechanism</th>
<th align="left">Enforced Security Control</th>
</tr>
</thead>
<tbody><tr>
<td align="left"><strong>Tag Hijacking</strong></td>
<td align="left">Attacker overwrites mutable tag (<code>:latest</code>) in registry.</td>
<td align="left"><strong>Digest Pinning</strong> (<code>@sha256</code>)</td>
</tr>
<tr>
<td align="left"><strong>Compromised CI Secret</strong></td>
<td align="left">Long-lived private signing key leaked from runner secrets.</td>
<td align="left"><strong>Keyless OIDC Ephemeral Certs</strong></td>
</tr>
<tr>
<td align="left"><strong>Dependency Poisoning</strong></td>
<td align="left">Compromised base image or malicious third-party dependency.</td>
<td align="left"><strong>SPDX SBOM Attestation</strong> (Syft)</td>
</tr>
<tr>
<td align="left"><strong>Rogue Workload Ingestion</strong></td>
<td align="left">Deploying unapproved image directly via <code>kubectl</code> into cluster.</td>
<td align="left"><strong>Kyverno Admission Webhook</strong></td>
</tr>
</tbody></table>
<hr />
<h3>Verification &amp; Failure Mode Testing</h3>
<p>Test the admission webhook with an unsigned workload in <code>production</code>:</p>
<pre><code class="language-bash">kubectl run rogue-pod -n production --image=ghcr.io/vibishdevops/unsigned-app:latest
</code></pre>
<p>Admission rejection output:</p>
<pre><code class="language-text">Error from server: admission webhook "mutate.kyverno.svc-fail" denied the request:
resource Pod/production/rogue-pod was blocked due to the following policies
enforce-signed-images:
  verify-cosign-signature: 'failed to verify image ghcr.io/vibishdevops/unsigned-app:latest:
    .attestors[0].entries[0].keyless: no matching signatures: '
</code></pre>
<hr />
<h3>Operational Hardening Rules</h3>
<table>
<thead>
<tr>
<th align="left">Area</th>
<th align="left">Risk</th>
<th align="left">Mitigation</th>
</tr>
</thead>
<tbody><tr>
<td align="left"><strong>Webhook Deadlock</strong></td>
<td align="left">Kyverno restarts while validating its own image</td>
<td align="left">Exclude <code>kube-system</code> and <code>kyverno</code> namespaces from <code>ClusterPolicy</code>.</td>
</tr>
<tr>
<td align="left"><strong>Offline Verification</strong></td>
<td align="left">Rekor public log unreachable</td>
<td align="left">Mirror Rekor keys locally or configure private Rekor instance for air-gapped clusters.</td>
</tr>
<tr>
<td align="left"><strong>Registry Throttling</strong></td>
<td align="left">Admission webhook bursts exhausting rate limits</td>
<td align="left">Allocate <code>&gt;= 512Mi</code> RAM to Kyverno for in-memory signature caching.</td>
</tr>
</tbody></table>
]]></content:encoded></item></channel></rss>