9 of 16: Why a Compliance Control Mapping Should Lead With Its Gaps
Eighth post from the compliance-ready backend kit, and the one the others hang from. Every earlier post in this series ended on a section called something like “what it does not do”. This is why.
The first version of the kit’s COMPLIANCE.md was a table. Thirteen rows, each a capability mapped to a HIPAA section, a PCI DSS requirement and a SOC 2 criterion. No status column.
Nobody wrote a false claim. I just listed the controls I was thinking about. But a controls table with no status column reads as a claim to every row, and several of those rows described things the code did not do.
The README was worse. It pitched “passkeys, Postgres-enforced tenant isolation, KMS envelope encryption, and append-only audit logs”. At the time, three of those four did not exist. Copy that states intentions as facts is how an overclaim happens by accident. Then it spreads: every later document and commit message inherits the sentence.
The table, as it stands today
Sixteen rows. Nine Implemented, three Partial, two Not implemented, two Not implemented here.
| Capability | Status | HIPAA (45 CFR) | PCI DSS v4.0.1 | SOC 2 |
|---|---|---|---|---|
| Multi-tenant isolation (database-per-tenant) | Implemented | 164.312(a)(1) | Req 7 | CC6.1 |
| RBAC / access control | Implemented | 164.312(a)(1); 164.312(a)(2)(i); 164.308(a)(4) | Req 7 | CC6.3 |
| Password storage (Argon2id) | Implemented | 164.308(a)(5)(ii)(D); 164.312(d) | 8.3.2 | CC6.1 |
| Access-token confidentiality (nested JWT) | Implemented | 164.308(a)(1)(ii)(B) | 6.2.4; 12.3.3 | CC6.1 |
| Input validation | Implemented | 164.312(c)(1) | 6.2.4 | CC8.1 |
| Vulnerability / dependency management | Partial | 164.308(a)(8); 164.308(a)(5)(ii)(B) | 6.3.1 to 6.3.3; 11.3 | CC7.1 |
| Structured logging and monitoring | Partial | 164.312(b); 164.308(a)(1)(ii)(D) | Req 10 | CC7.2 |
| Append-only audit logging (hash-chained) | Implemented | 164.312(b); 164.308(a)(1)(ii)(D) | 10.2; 10.3.2 | CC7.2 |
| Authentication (MFA, passkeys) | Not implemented | 164.312(d) | 8.4; 8.5 | CC6.1 |
| Key management (envelope, rotation, JWKS) | Partial | 164.312(a)(2)(iv) | 3.6; 3.7 (unverified) | CC6.1 |
| Encryption at rest | Not implemented | 164.312(a)(2)(iv) | 3.5; 3.5.1 | CC6.1 |
| Encryption in transit (TLS) | Not implemented here | 164.312(e)(1); 164.312(e)(2)(ii) | 4.2.1 | CC6.7 |
| Rate limiting and login throttling | Implemented | 164.308(a)(5)(ii)(C) | 8.3.4 (unverified) | CC6.6 |
| DoS / DDoS protection (network layer) | Not implemented here | (none) | 6.4.2 (unverified) | CC6.6 |
| Request-level DoS limits (timeouts, body size) | Implemented | (none) | (none) | CC6.6 |
| Control-plane authorization | Implemented | 164.312(a)(1); 164.308(a)(4) | Req 7 | CC6.3 |
Read the status column before anything else, because that is the column the first version did not have.
Four statuses, not two
“Done” and “not done” is not enough vocabulary.
| Status | Means |
|---|---|
| Implemented | realised in this repository and exercised by automated tests. You still own the organisational half |
| Partial | some of it exists, and the note says exactly which part does not |
| Not implemented | on the roadmap, not in the code. Do not cite it as evidence of anything |
| Not implemented here | a real, mandatory control that is satisfied outside this repository, or not at all |
Partial is the one that needs the most care, because most of a Partial row is real. Key management has envelope encryption, a key registry whose lifecycle is enforced by database constraints, rotation with an overlap, and a published JWKS. I wrote a whole post on rotating keys without downtime. What it does not have is a KMS or HSM adapter: the key-encrypting key still comes from configuration. So that row must not be cited against a requirement that calls for a secure cryptographic device, however much of the rest is true. The difference is exactly the one between a KMS and an HSM, and an assessor knows it.
Not implemented here exists for TLS. The service terminates plain HTTP and expects a load balancer or mesh in front. That is a legitimate architecture. It also means the TLS row is satisfied by something this repository cannot see, and the table should say so rather than quietly claim it or quietly drop it.
Do not invent a citation to fill a cell
The tempting move with a three-framework table is to make every cell say something. Resist it.
The DoS rows have no HIPAA mapping. The Security Rule’s technical safeguards in 164.312 cover access control, audit controls, integrity, authentication and transmission security. None of them is about availability under load. HIPAA handles that through the contingency-plan standard in 164.308(a)(7), an administrative safeguard about responding to emergencies and system failures. Stretching a technical citation over a rate limiter would look thorough and be wrong, and an empty cell that says “(none, see notes)” is more useful than a confident one that is not true.
The rule cuts the other way too. Login throttling is mapped to HIPAA, to 164.308(a)(5)(ii)(C), “Log-in monitoring (Addressable). Procedures for monitoring log-in attempts and reporting discrepancies.” Leaving out a real citation understates the kit in the same way an invented one overstates it.
Say when you have not checked
Several PCI cells say unverified. That is a deliberate admission that the mapping is my reading, not a QSA’s.
The reason is mundane. HIPAA is federal regulation, and the current text is on the eCFR for anyone to read, so every HIPAA citation in the table can be checked against the source. One of them was wrong in an earlier version, which said HIPAA names no password safeguard; 164.308(a)(5)(ii)(D) says otherwise, and the row was fixed. PCI DSS v4.0.1 sits behind the PCI Security Standards Council’s document library rather than on an open page. Where I could not confirm a clause number against the text, the cell says so.
One of those notes changed the code. PCI 8.3.4 is commonly read as requiring a lockout of at least 30 minutes after repeated failures. The kit implements a throttle, not a lockout, because an unauthenticated way to lock a named user out is a denial of service anyone can point at anyone. The note says that, and says to set the window to 30 minutes if your assessor reads it strictly. I explained the throttle in the rate limiting post.
A precise claim beats a strong one
The audit log is the clearest example. “Immutable audit log” is the phrase people expect. It is also false for any Postgres table, because a superuser can disable a trigger.
What the kit claims instead:
Append-only as enforced against the application role, and tamper-evident beyond that.
Every word is doing something. The triggers refuse UPDATE, DELETE and TRUNCATE. The revoked privileges only bind a role that is not the table owner, so they are a real boundary only when the service connects as the restricted role. Beyond that, the hash chain makes an edit detectable, not impossible, and only if the chain head is recorded somewhere the database cannot reach. That is three sentences longer than “immutable” and every one of them is true. The details are in the audit log post.
Make the claims checkable, then make overclaiming fail the build
A table you have to take on trust is only slightly better than no table. So the kit has two commands.
pnpm verify:claims runs the real test suites (the smoke test, the audit probes, the slowloris probe, the unit tests) and prints every result grouped under the row it supports, with that row’s citations beside it. Today that is 61 evidence items across the nine Implemented rows. It re-implements nothing. A copy of an assertion would be a second source of truth that could drift from the real one while still printing PASS.
pnpm verify:coverage is the same registry, run statically in CI on every pull request. It fails the build if a row marked Implemented has no registered evidence, or if the registry names a row the document no longer contains.
$ pnpm verify:coverage
PASS Control-plane authorization (tenant provisioning) (7 evidence item(s))
61 evidence item(s) across the 9 Implemented rows, 1 on rows with another status, 62 in total.
Every control marked Implemented has registered evidence.
That turns the rule “do not mark it Implemented without proof” from something remembered into something enforced. And the gate itself was tested the only way that counts: by flipping a row to Implemented with no evidence and watching the build go red. A check you have only ever seen pass has not been shown to check anything.
The same standard runs through the evidence. The rate limiter’s atomicity test implements the naive GET-then-SET limiter inside the test and asserts that it over-admits, because a passing test of the real limiter proves nothing if the naive one would pass too. The audit chain verifier is tested by planting an altered field, a removed event and a truncated start, and confirming each is detected and that restoring the original value makes the chain verify again. A test that cannot fail is worse than no test, because it looks like evidence.
What the kit does not claim
This goes at the top of the document, not the bottom.
- It does not make you compliant and it is not a certification. HIPAA, PCI DSS and SOC 2 each need organisational policies, workforce controls, risk assessments and assessment: a QSA and a Report on Compliance or an SAQ for PCI, a licensed CPA firm for a SOC 2 report. A repository satisfies none of that.
- Nobody has audited it except its author.
- “Addressable” does not mean optional. Under 45 CFR 164.306(d)(3), an addressable specification must be implemented if it is reasonable and appropriate, and if it is not, you must document why and implement an equivalent alternative where reasonable. Encryption at rest is addressable. It is not skippable.
- PCI DSS applies inside the cardholder data environment. A service that never touches card data does not inherit the PCI column. Scope is the first question a QSA asks.
- SOC 2 criteria are objectives, not a checklist. Whether a control meets one is judged in your environment, which a code repository cannot determine.
Why lead with the gaps
Because the reader of a controls document is looking for the gaps anyway.
An engineer evaluating a kit, a security reviewer at a customer, an assessor: each of them reads a capabilities table looking for the row that is overstated. The first one they find costs you every other row, because now nothing in the document can be taken at its word. A table that says “two Not implemented, here they are, here is what to do instead” has already answered the question they came with.
It also changes what you build. Once “Not implemented” is written down next to “Authentication (MFA, passkeys)”, it stops being a vague intention and becomes the most visible item on the roadmap.
The part worth taking with you
- A controls table with no status column is a claim to every row. Add the column first.
- Use four statuses, and write the note that says which half of a Partial row is missing.
- Leave a cell empty rather than invent a citation, and mark the ones you could not check as unverified.
- Prefer the precise claim to the strong one. “Append-only against the application role, tamper-evident beyond that” survives an assessor. “Immutable” does not.
- Gate it in CI. If marking a row Implemented without evidence does not break the build, it will happen.
COMPLIANCE.md, docs/compliance.md and scripts/verify-claims.mjs are in the kit repo. If you are starting from the frameworks rather than the code, COPPA vs HIPAA vs PCI DSS is the plain-language entry point to this series.