Skip to content

test: make encryption tamper check deterministic - #13

Merged
mohsinht merged 1 commit into
mainfrom
fix/deterministic-encryption-tamper-test
Aug 24, 2026
Merged

test: make encryption tamper check deterministic#13
mohsinht merged 1 commit into
mainfrom
fix/deterministic-encryption-tamper-test

Conversation

@mohsinht

Copy link
Copy Markdown
Owner

Summary

Fixes a flaky AES GCM tamper test exposed by CI after the Zaati branding merge.

The test previously replaced only the final Base64URL character of the ciphertext. Because Base64URL is unpadded, that character can sometimes change only unused padding bits, leaving the decoded ciphertext bytes unchanged. In that case authentication correctly succeeds and assert.throws fails.

This change decodes the ciphertext, flips one real bit in the first byte, and encodes it again. That guarantees the authenticated ciphertext bytes are actually modified and GCM rejection is deterministic.

Scope

  • test-only change
  • no encryption implementation or production behavior changes
  • preserves the existing authentication-failure assertion and coverage thresholds

Verification

CI should run the full quality gate, including npm run test:coverage.

@mohsinht
mohsinht merged commit ff4450c into main Aug 24, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant