test(crypto): fix 1/256 flaky tampered-ciphertext test - #199
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Flaky-Test-Fix:
crypto.test.js„throws on tampered ciphertext"Symptom: Build & Release #197 (Merge
feature/pihole-followups) schlug an genau diesem Test fehl (Missing expected exception, 1 von 1913) →release-Job übersprungen.Ursache (NICHT die PR-Logik): Der Test „tampert" den Ciphertext, indem er das erste Byte mit
'ff'überschreibt:Das Ciphertext-Format ist
iv:tag:encrypted(Hex, AES-256-GCM, zufälliger IV pro Aufruf). Beginnt die zufällige Nutzlast bereits mit0xff(≈1/256 pro Lauf), ist das „Tampern" ein No-Op → der GCM-Auth-Tag bleibt gültig →decrypt()wirft NICHT →assert.throwsschlägt fehl. Reiner ~0,39 %-Flake.Fix: Deterministisch tampern via XOR-Flip (matcht die bestehende Konvention in
guac_token.test.js,buf[...] ^= 0xff):Evidenz:
crypto.test.js200/200 grün (deterministisch).Nur die Test-Datei geändert, keine Produktionslogik. Geschwister-Tamper-Tests (
guac_token.test.js,e2ee.test.js) nutzen bereits sichere Muster — kein weiterer Handlungsbedarf.🤖 Generated with Claude Code