Skip to content

fix(aes): validate key generation lengths - #404

Open
harrshita123 wants to merge 1 commit into
google:masterfrom
harrshita123:fix/aes-key-length-validation
Open

harrshita123 wants to merge 1 commit into
google:masterfrom
harrshita123:fix/aes-key-length-validation

Conversation

@harrshita123

@harrshita123 harrshita123 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #403.

Validate AES key-generation lengths at the shared Dart API boundary before dispatching to native or browser implementations.

This ensures that AES-CBC, AES-CTR, and AES-GCM consistently reject invalid lengths with FormatException, without exposing raw JavaScript TypeError objects on browser backends. The existing UnsupportedError behavior for 192-bit AES keys is preserved.

Regression coverage includes all three AES APIs on the VM, Chrome Dart2JS, and Chrome Dart2Wasm.

Tests

  • dart analyze --fatal-warnings .
  • dart test test/webcrypto_test.dart -p vm
  • dart test test/webcrypto_test.dart -p chrome --compiler dart2js
  • dart test test/webcrypto_test.dart -p chrome --compiler dart2wasm

This branch has not been deployed

No deployments
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.

bug: browser AES key generation exposes raw JavaScript errors for out-of-range lengths

1 participant