Cybersecurity · 2026-07-28

Detection is the hard part: what building a compliance engine taught me

Security compliance work gets described as if the difficulty is in the fixing. Run the scan, read the report, close the gaps. In my experience the fixing is the easy half.

The hard half is the engine that produces the report — and specifically, the act of reading a written control and deciding, in code, what "compliant" means on a real system.

A hardening guide is prose. It was written by people describing intent, and intent does not compile. Take a rule that says a service must not run with elevated privileges. On paper that is one sentence. In an engine you have to answer: which services, discovered how, on which of several supported platforms, in what state, and what do you do about the three legitimate exceptions the platform itself ships with. Get it wrong in one direction and you flood the team with false positives until they stop reading the output. Get it wrong in the other and you have quietly declared a system safe that is not.

Two things I would tell anyone starting this work.

**Encode the exception with the rule.** The temptation is to write the clean check first and handle reality later, in a suppression list somewhere else. That list becomes the least-reviewed and most load-bearing file in the codebase. If a rule has a legitimate exception, the exception belongs next to the rule, with the reason written down.

**Validate on real systems, early and repeatedly.** A check that passes in a unit test and fails on a live cluster has taught you nothing. The gap between "the code is right" and "the check is right" only closes against real machines in real configurations.

The reason this matters beyond compliance: a detection engine is the clearest example I know of a system whose output is trusted precisely as much as its false-positive rate allows. That is true of alerting, of static analysis, of test suites, and increasingly of AI-generated review. Build the thing people can afford to believe.

← All posts

I love to make complex looking systems easy to understand — whether it is life or software!