Files
DodoSSH/tests/DodoSSH.Client.Sync.Tests
jaap-jan d10a38d8e6 Pin every cipher's AAD resource type from one table, not one test each
Mutation testing found that pointing CredentialCipher at
AadResourceType.Vault passed the entire suite. Every credential test compared
the cipher against itself — round trips, cross-type refusals, two-machine sync —
and all of those stay true when both halves of one cipher are wrong together,
because Seal and TryOpen share the constant. A password sealed under the resource
type for a vault encrypts cleanly, decrypts cleanly, syncs cleanly, and violates
docs/crypto.md in a way nothing surfaces until another implementation refuses the
item. By then the AAD is frozen into stored ciphertext and only clients can
re-encrypt it.

This is the third time that hole has appeared in this file, and the second time
mutation testing rather than review is what found it. So the fix is structural
rather than another hand-written test: one table of wire type to resource type,
a theory that seals a sample through each cipher and opens it with the resource
type the table names — never the one the cipher holds — and a guard asserting the
table covers ItemKinds.SyncedTypes. A fourth item type can no longer be added
without pinning its resource type: the coverage test fails, and the sample switch
throws with an explanation.

The two per-cipher tests it replaces said the same thing for hosts and keys, so
nothing is lost and the credential row is no longer something someone has to
remember.

Verified by re-running the mutation matrix. All seven sabotages are now detected:
the credential merge dropping its redaction, the key/credential exclusivity check
disabled, the schema version ladder flattened so a key-bound host claims the
credential version, a credential sending the server an empty fields record
instead of none, CredentialKind claiming to be a host, CredentialCipher sealing
under the wrong resource type, and the credential noun reading "host". Two of
those were unproven before this run — one because the earlier sabotage did not
compile, and one because it was genuinely undetected.

Sync.Tests 88/88, Domain.Tests 117/117. Zero warnings, dotnet format clean.
2026-07-29 21:17:36 +02:00
..