759 words
4 minutes

06 from Mutation Testing for Infrastructure Code — 153 Planted Bugs, Four Tests That Could Not Fail

Mutation testing for infrastructure code, one planted violation per promise

By Docker Captain · CNCF Ambassador · IBM Champion
Cyan-lit steel lattice with a red fault inside, mutation testing Blueprint 06

Mutation tools exist for Java, JavaScript and Python, but none knows what a Terraform default or a PowerShell guard promises. Written by hand, one plant per promise, the same idea fits infrastructure code.

Its job is to test the tests: a check that has never been seen to fail has not been shown to work.

  1. 1

    Write the promises

    One sentence each, in the terms a reader would use: “the database is not reachable from the internet”, not the name of the setting. Start with the promises whose failure is an audit finding: who can reach the data, what gets deleted, what a dry run records, which host a job logs into.

  2. 2

    Plant one violation per promise

    The smallest edit that breaks it, one line in a tab-separated plants.tsv beside the tests: the file, the text to replace, its replacement, and what the plant breaks. The fields are JSON strings, so a plant can span lines and carry quotes.

  3. 3

    Run the untouched copy first

    The suite has to pass on a clean copy. Otherwise every plant fails for a reason that has nothing to do with the plant, and the run reports a perfect score over a broken suite.

  4. 4

    One plant, one fresh copy

    Apply each plant to its own copy and run the suite; it counts as caught only if the suite goes red. Two violations at once can mask each other.

  5. 5

    Fail on a stale plant

    A plant whose text is gone fails the run. A plant that silently stops applying is a test that silently stops being tested.

  6. 6

    Run the plants on every push, and fix the test first

    A surviving plant is information about the test. For a security control, plant the attacker's move, not the removal of the control's neighbour.

One line per promise

PromiseThe plantWhat catches itOwner
A dry run deletes nothing and says soThe script's own ShouldProcess check always answers yesThe count the script reports, “Deleted 0 file(s)”Maintainer
The job logs in only to the host whose key it scannedStrict host key checking turned offAn impostor with fresh host keys under the target's nameSecurity
The database is not reachable from the internetThe default of publicly_accessible flipped to trueterraform test with a mock provider, no cloud accountPlatform engineer

The neighbour Remove the guard that refuses an empty key scan. Strict checking refuses the unknown host anyway, the test stays green, and it proves nothing.

The attacker's move Turn strict checking off and put an impostor under the target's name. The job logs in and upgrades it, and the test goes red.

What shows it works

Each is a public commit, run or file.

  • Commit fd18b15c, released in v1.1.0 on 26 September 2026: the impostor test and the plant runner, run on every push, and the host-key plants that first proved nothing.
  • Verification run 42893910994, 10 November 2026: 5 plants, 5 caught, 0 missed, 0 stale.
  • The plant runner, 78 lines of Python: the clean copy, one copy per plant, stale fails.
  • The first pass, in the post on 27 September 2026: 153 plants across fifteen repositories, and four tests that could not fail.

Plants are not free. A repository with eighteen plants runs its suite nineteen times, and in September the slowest here spent about three minutes a push on its test and plants together. A private monorepo would run them on a schedule, or when the tested files change.

A security control is tested when an attacker's move is shown to fail against it.

The long version is the post Mutation Testing for Infrastructure Code. Inozemtseva and Holmes, Coverage is not strongly correlated with test suite effectiveness, ICSE 2014; OpenSSH, ssh_config (StrictHostKeyChecking); PIT, Stryker and mutmut.


Vladimir Mikhalev

Docker CaptainCNCF AmbassadorIBM Champion

The Verdict — production-tested analysis on YouTube.

The Verdict

Inconvenient truths about shipping in the AI era

Container security, platform engineering, and the agentic shift — tested in production, argued without the hype. The verdict reaches your inbox the moment there's one worth sending.

Related Posts

Same category
  1. 1
    Mutation Testing for Infrastructure Code — 153 Planted Bugs, Four Tests That Could Not Fail
    DevOps & Cloud · Mutation testing for infrastructure code, done by hand across fifteen repositories. 153 planted bugs, and four green tests that could never have failed.
  2. 2
    DNS Exfiltration From an Air-Gapped VPC: No Route Out Is Not No Way Out
    DevOps & Cloud · DNS exfiltration needs no route. In a VPC with no internet gateway and no NAT, a pod and its node still resolved example.com, until a DNS Firewall refused it.
  3. 3
    Scheduled Workflows Fail Silently: A GitHub Actions Heartbeat for 122 Repositories
    DevOps & Cloud · GitHub Actions switches off a scheduled workflow after 60 quiet days, with no failed run and no red badge. What watches every schedule, and the watcher.
  4. 4
    Completed Is Not Restored: Kyverno Fail-Open, a Velero Restore and an HTTP 200 That Meant 500
    DevOps & Cloud · Scale Kyverno to zero and its webhooks vanish. A Velero restore said Completed over an empty disk. A 200 carried a 500. Three statuses that reported success.

More Blueprints

All 20
  1. 07
    The red-case audit
    Signal, 5 September 2026 · Run each health check against a case it must fail, name the binary that serves, keep errors apart from empty answers, and make something act on the label.
  2. 08
    The restore proof
    Signal, 23 September 2026 · Read the archive back, run the shipped restore script against a marker, prove the prune, and measure recovery time weekly on a machine that never ran the stack.
  3. 09
    The bounded cloud run
    Signal, 13 November 2026 · Run the real cloud test in an account of its own, tag and tear down every resource, sweep and cap what escapes, and report the cost from the bill, not the estimate.
  4. 10
    The read receipt
    Signal, 20 September 2026 · Prove the source before the prompt, open the response before trusting it, and let a verdict slow a change but never wave one through.
Mutation testing for infrastructure code, one planted violation per promise
https://heyvaldemar.com/blueprints/planted-violations/
Author
Vladimir Mikhalev
Published
2026-11-13
License
CC BY-NC-SA 4.0