Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 8 min read

A security-clean Kubernetes patch can still break the workload

A security scanner can go quiet after an automatic YAML patch, and the workload can still have stopped doing its job. "Findings: 0" is not the same as "still works". That gap is what BlastGuard AI is built to catch. Bla

A security-clean Kubernetes patch can still break the workload

A security scanner can go quiet after an automatic YAML patch, and the workload can still have stopped doing its job. "Findings: 0" is not the same as "still works". That gap is what BlastGuard AI is built to catch.

BlastGuard AI is a public entry for the Nebius x NVIDIA hackathon on Devpost, submitted 30 October 2026. It finds misconfigurations in a Kubernetes manifest with deterministic rules and external validators, asks NVIDIA Nemotron (through Nebius Token Factory) for a patched YAML, re-verifies that patch from scratch, and then runs an Intent Preservation Gate. The release decision is SAFE_TO_PROPOSE or REVIEW_REQUIRED. The model only proposes. Deterministic checks decide.

The recorded runtime proof is the clearest picture of why the second decision exists.

The collector that had nothing left to collect

The proof ran in a kind cluster on GitHub Actions. A synthetic collector mounts a node hostPath at /var/bg-demo and looks for a marker file. When the marker is present, the pod prints COLLECTED.

The original manifest is intentionally rough. The container runs as user 0, and the hostPath volume is the whole point of the job:

          command:
            - sh
            - -c
            - |
              while true; do
                if grep -q BG_SENTINEL /data/app.log 2>/dev/null; then echo COLLECTED; else echo NOTHING_TO_COLLECT; fi
                sleep 2
              done
          securityContext:
            runAsUser: 0
          volumeMounts:
            - name: hostlogs
              mountPath: /data
              readOnly: true
      volumes:
        - name: hostlogs
          hostPath:
            path: /var/bg-demo
            type: DirectoryOrCreate

hostPath is also a security finding (rule BG002). A fixer that only chases findings has a cheap way out: replace the volume with emptyDir. The scanner goes green. The collector no longer sees the host files.

That is what happened. Nemotron proposed a patch. Attempt 1 still kept the hostPath, so verification failed on BG002. Attempt 2 passed every security check. In the accepted patch the volume is gone:

      volumes:
        - name: hostlogs
          emptyDir: {}

In the cluster, the same container then printed NOTHING_TO_COLLECT. The Intent Preservation Gate returned REVIEW_REQUIRED. In the recorded evidence the high-severity drift is HOSTPATH_REPLACED: the hostlogs volume at /var/bg-demo was replaced by emptyDir, so the workload no longer sees the host files it was mounted to read or write. The same evidence names the model as nvidia/nemotron-3-super-120b-a12b. The gate code that fires here is a structural comparison, not a second security scan:

        elif "hostPath" not in new:
            out.append(_drift("HOSTPATH_REPLACED", HIGH, obj,
                              f"hostPath volume '{name}' ({path}) was replaced by {_source(new)}: the workload no "
                              "longer sees the host files it was mounted to read or write"))

A security-only tool would have accepted that patch.

Hand-drawn pipeline: find, patch, re-verify, then the intent gate, with the kind proof underneath

Find, patch, re-verify, then the gate

The published pipeline has four stages.

  1. Find. Thirteen deterministic rules, BG001 through BG013, plus kubeconform for schema validation and kube-linter as an external validator.
  2. Patch. Nemotron proposes a full YAML patch. The model does not get to decide the outcome.
  3. Re-verify. The candidate is checked from scratch, up to 3 attempts. Verifier feedback goes back to the model.
  4. Gate. An intent check on the accepted patch. The release is SAFE_TO_PROPOSE or REVIEW_REQUIRED.

YAML parsing is fail-closed. The loader is yaml.safe_load_all. Manifests are never executed. Size and document caps apply; in the repo those are 64 KB and 20 documents. A malformed or oversized input is rejected before any model call.

The built-in rules are ordinary Kubernetes security checks, independent of the LLM. BG001 flags a privileged container. BG002 flags a hostPath volume. BG003 flags hostNetwork. Other rules cover running as root, privilege escalation, missing CPU and memory limits, unpinned images, a writable root filesystem, dangerous capabilities, an automounted service account token, a LoadBalancer Service, and a missing NetworkPolicy (BG013, info only). Blocking findings are everything except info.

That is why a security-only gate is the wrong last step for this class of workload. BG002 is correct to flag hostPath. A log collector that exists to read a node path will also go dark if that volume is removed. The same tension appears in the gate for hostNetwork, and for a Service that stops being a LoadBalancer. The change may be the right hardening, or it may be the thing the workload was for. The gate does not try to guess which. It sends the patch to review.

The patch is applied in a sandbox, not in a cluster. An identity guard runs during verification and blocks deletes or swaps of the workload. If the "fix" removes the object, drops replicas to 0, removes a container, or changes a container's image repository, the candidate is rejected and that result goes back to the model as feedback:

    for r, od in orig.items():
        nd = new.get(r)
        if nd is None:
            errs.append(f"{r} was removed or renamed")
            continue
        if pod_spec(od) is not None and pod_spec(nd) is None:
            errs.append(f"{r} lost its pod spec")
            continue
        o_shape, n_shape = _shape(od), _shape(nd)
        for cname, repo in o_shape.items():
            if cname not in n_shape:
                errs.append(f"{r}: container '{cname}' was removed")
            elif n_shape[cname] != repo:
                errs.append(f"{r}: container '{cname}' image repo changed {repo} -> {n_shape[cname]}")
        o_rep = (od.get("spec") or {}).get("replicas")
        n_rep = (nd.get("spec") or {}).get("replicas")
        if n_rep == 0 and o_rep != 0:
            errs.append(f"{r}: replicas scaled to 0")

Parse problems, API errors, a wall-time budget that runs out, or a validator that did not run or did not pass, all fail closed. In those cases the release cannot be SAFE_TO_PROPOSE. Completeness is strict. validators_complete is true only if every external validator actually ran and passed on the accepted patch. A missing kubeconform or kube-linter result is treated like a failure to decide, not like a pass.

Security verification and the intent gate are separate decisions. The loop can mark a run VERIFIED (no blocking findings, identity guard quiet, validators did not fail) and still release it as REVIEW_REQUIRED. That is what happened in the collector proof: final status VERIFIED, release REVIEW_REQUIRED. On the published page, VERIFIED means "passed these checks", not "works in your cluster".

The gate itself compares the original and the accepted patch structurally and lists drifts. A high-severity drift forces review. If the gate errors, it also fails closed:

    try:
        drifts = intent_drifts(original, patched)
    except Exception as exc:  # fail closed on any malformed structure
        return {"verdict": REVIEW_REQUIRED, "drifts": [],
                "error": f"intent gate error: {exc.__class__.__name__}",
                "note": "The gate could not analyse this patch, so review is required."}
    high = [x for x in drifts if x["severity"] == HIGH]
    return {"verdict": REVIEW_REQUIRED if high else NO_HIGH_IMPACT_DRIFT, "drifts": drifts, "error": None,
            "note": ("A security-clean patch changed what the workload does. Review before proposing."
                     if high else "No high-impact static drift detected. Behaviour in a cluster is still not proven.")}

The public release value SAFE_TO_PROPOSE is produced only after that verdict, and only if verification is complete:

        if self.status != VERIFIED:
            return "NOT_PROPOSED" if self.status == UNRESOLVED else "BLOCKED"
        if not self.attempts:
            # Already clean on input: nothing was patched, so there is nothing to propose.
            ok = bool(self.validators_initial) and all(v.get("status") == "pass" for v in self.validators_initial)
            return "NO_CHANGE_NEEDED" if ok else "REVIEW_REQUIRED"
        if self.intent is None or self.intent["verdict"] == REVIEW_REQUIRED:
            return "REVIEW_REQUIRED"
        if not self.validators_complete:
            return "REVIEW_REQUIRED"
        return "SAFE_TO_PROPOSE"

HOSTPATH_REPLACED is a high drift. So is turning off hostNetwork on a workload that used the node network, changing a Service from LoadBalancer to another type, removing a volume mount, or setting a read-only root filesystem when no writable volume is left. Those are the kinds of "fixes" that clear a scanner and stop the job from doing what it was mounted, exposed, or scheduled to do.

The Streamlit app that hosts the demo never touches a cluster. The kind run lives in GitHub Actions, as a separate proof of the same loop.

What the small corpus showed

The figures below come from the project's own small corpus: 16 cases, 48 real runs, hand-written oracles, published as is.

35 patches passed security. 14 of those broke the workload function. A security-only tool would accept all 35. BlastGuard sent those 14 to review, and accepted 0 of them as safe. It also sent 0 function-preserving patches to review.

The rest of that corpus is about inputs that should be left alone, or rejected early:

  • 6/6 already-clean manifests needed no change
  • 6/6 invalid inputs were rejected before any model call
  • 3/3 prompt injections inside a manifest were ignored

Those three rows follow the same fail-closed paths already in the loop. An already-clean manifest that also passes the external validators never reaches the model; the release is NO_CHANGE_NEEDED. Invalid YAML, or input that fails the size and document caps, is rejected in parse_manifest and no model call is made. The prompt-injection figure is on the published page; this article does not add a private walkthrough of those three runs.

There is also a blind challenge: 6 unseen cases, 18 runs, 0 false SAFE. The gate sent 13 of those 18 to review. The page does not break down the other 5 of those 18, so that split is not invented here.

Hand-drawn summary of the published corpus figures, including the 14 patches sent to review

What this does not claim

The published limits belong with the result.

The oracles are small and overlap the gate conceptually, so the 14/14 figure is not an independent audit of the same idea by a second method. The runtime proof is one synthetic case. Reasons from the gate are generic. Corpora were hand-written by one author.

VERIFIED is not a promise that the patch works in a cluster you care about. The app never talks to one. The kind proof shows that this particular collector printed NOTHING_TO_COLLECT after a security-clean patch, and that the gate sent that patch to review. It does not show behaviour under some other workload.

The public demo at blastguard.justrunme.com is capped at 10 runs per session and 1500 runs process-wide.

One more distinction, because the name is easy to mix up. The original BlastGuard, a Go CVE blast-radius engine, existed before the submission period and is not integrated here. blastguard-ai was built during the period.

The stack on this setup is Python, Streamlit, Nemotron, Nebius Token Factory, kubeconform, kube-linter, and kind. The repository and the Devpost entry, plus a short demo video, are linked from the write-up at justrunme.com/hackathons.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.