Skip to content

fix: validate ciphertext length in aes128 decryptBufferCBC#21571

Draft
AztecBot wants to merge 1 commit intomerge-train/spartanfrom
claudebox/fix-aes128-decrypt-test
Draft

fix: validate ciphertext length in aes128 decryptBufferCBC#21571
AztecBot wants to merge 1 commit intomerge-train/spartanfrom
claudebox/fix-aes128-decrypt-test

Conversation

@AztecBot
Copy link
Collaborator

Summary

Adds input validation to Aes128.decryptBufferCBC to return an empty buffer when ciphertext is empty or not a multiple of 16 bytes (the AES block size).

PR #21192 added tests expecting this behavior but did not update the implementation, causing CI failure on merge-train/spartan.

Fix

Added early return guard in decryptBufferCBC:

if (data.length === 0 || data.length % 16 !== 0) {
  return Buffer.alloc(0);
}

Test plan

  • All 5 aes128 unit tests pass locally
  • The previously failing test should return empty buffer for ciphertext not a multiple of 16 now passes

ClaudeBox log: https://claudebox.work/s/60f97cca5a40e121?run=1

@AztecBot AztecBot force-pushed the claudebox/fix-aes128-decrypt-test branch from d5b1e06 to 66579c4 Compare March 15, 2026 05:30
@AztecBot AztecBot added the claudebox Owned by claudebox. it can push to this PR. label Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claudebox Owned by claudebox. it can push to this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant