Skip to content

tests: add committed test vectors and load them into the harness - #1452

Closed
quexten wants to merge 1 commit into
km/integration-change-kdf-testfrom
km/integration-test-vectors
Closed

tests: add committed test vectors and load them into the harness#1452
quexten wants to merge 1 commit into
km/integration-change-kdf-testfrom
km/integration-test-vectors

Conversation

@quexten

@quexten quexten commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Objective

Ten users, one organization and two emergency-access grants as JSON under /test-vectors, each pairing the ciphertext a server would serve with the plaintext it must decrypt to — data that does not move when the code does.

Covers both crypto generations and every unlock method: V1/V2, PBKDF2/argon2id, master password, PIN, trusted device, key connector, one mid-upgrade account. Org and emergency-access vectors reference users by name rather than duplicating them. load.ts declares the shapes rather than inferring them, so a drifted vector fails to compile instead of loading as any.

unlock/happy-path.test.ts opens every vector through every method it declares and decrypts its whole vault with nothing ignored — nothing was written, so nothing may differ. It matters in TS rather than only in Rust because the models cross the FFI boundary both ways.

Finding

An AttachmentView carries decryptedKey — the attachment key in the clear — which vectors deliberately don't record, being in git. The validator drops it, scoped to attachments: decryptedKey is also the InitUserCryptoMethod variant tag, so an unscoped drop erases whole unlock methods.

Also

Change-kdf now seeds from v1-pbkdf2-min-iterations and v1-argon2id-tde, giving it a real vault to validate; tests/fixtures/accounts.ts goes away. .aikido excludes the directory (committed keys read as leaked secrets); .prettierignore stops reformatting bytes both suites read as fixed input.

Testing

17 vector tests, 104 passing overall. Confirmed to fail on demand: tampering a recorded plaintext, and bumping schemaVersion.

Key rotation is out of scope — needs the rotation routes and rotation-cases.ts first.

⚠️ Commits unsigned.

Breaking changes

None. Test-only, plus a new top-level test-vectors/.

Ten user accounts, one organization and two emergency-access grants,
recorded as JSON under /test-vectors. Each pairs the ciphertext a server
would serve with the plaintext it must decrypt to, so a test can assert
against data that does not move when the code does.

The set spans both crypto generations and every unlock method: V1 and V2
accounts, PBKDF2 and argon2id, master password, PIN, trusted device, key
connector, and one mid-upgrade account. Organization and emergency-access
vectors reference users by vector name rather than duplicating them.

unlock/happy-path.test.ts opens every vector through every method it
declares and decrypts its whole vault, with nothing ignored — nothing was
written, so nothing may differ. It is the baseline the rest of the suite
rests on, and it matters in TypeScript rather than only in Rust because the
models cross the FFI boundary both ways.

Landing them surfaced one real gap: an AttachmentView carries decryptedKey,
the attachment key in the clear, which a vector deliberately does not
record because a vector is committed to git. The validator now drops it,
scoped to attachments — decryptedKey is also the variant tag of
InitUserCryptoMethod, and dropping that would erase whole unlock methods.

The change-kdf tests now seed from v1-pbkdf2-min-iterations and
v1-argon2id-tde instead of hand-assembled fixtures, which also gives them a
real vault to validate rather than one the harness created for itself.

.aikido excludes the directory, whose committed private keys and passwords
would otherwise be reported as leaked secrets; .prettierignore stops
prettier reformatting bytes both suites read as fixed input.
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🔍 SDK Breaking Change Detection

SDK Version: km/integration-test-vectors (a3b94d7)

⚠️ If breaking changes are detected, a corresponding pull request addressing them must be ready for merge in the affected client repository.

Client Status Details
android ❌ Breaking changes detected Compilation failed with new SDK version. A corresponding pull request addressing the breaking changes must be ready for merge in bitwarden/android. - View Details
typescript ❌ Breaking changes detected Compilation failed with new SDK version. A corresponding pull request addressing the breaking changes must be ready for merge in bitwarden/clients. - View Details

Breaking change detection uses the build of the SDK from this branch, including any incompatibities pre-existing on or merged into this branch. Check the workflow logs to confirm.
Results update as workflows complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant