-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add ECB and CBC block mode test cases for BrokenCryptoAlgorithm query #20887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: geoffw0 <[email protected]>
…e the focus of these new tests should be the block mode not the encryption algorithm.
|
Ready for review. We're not going to actually address these test cases for a while, because we need to investigate and fix an issue in call resolution first - so lets merge the new tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive test coverage for ECB (Electronic Codebook) block mode, which is cryptographically weak, alongside the existing CBC (Cipher Block Chaining) tests. The tests demonstrate that ECB mode should trigger security alerts regardless of the underlying cipher algorithm.
- Added
test_ecb()function with test cases covering AES, DES, and RC2 ciphers using ECB mode - Tests use various initialization patterns (turbo-fish syntax, type aliases,
new(),new_from_slice()) - Added
ecbcrate dependency (version 0.1.2) to support the new tests
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test_cipher.rs | Adds new test_ecb() function with test cases for ECB mode encryption using AES128, DES, and RC2, along with a type alias MyAesEcbEncryptor following the pattern established in test_cbc() |
| options.yml | Adds ecb = { version = "0.1.2" } dependency to support ECB mode testing |
| Cargo.lock | Updates lock file with ecb crate (v0.1.2) and its dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add test coverage for cryptographic block modes (ECB vs CBC) across multiple cipher types. ECB is cryptographically weak; CBC is acceptable.
Changes
test_ecb()function exercising ECB mode with AES, DES, and RC2ecb::Encryptor::<aes::Aes128>::new()type MyDesEcbEncryptor = ecb::Encryptor<des::Des>new(),new_from_slice()ecb = { version = "0.1.2" }to test optionsExample
Test cases marked with
$ MISSING:as block mode detection is not yet implemented inRustCrypto.qll.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.