-
Notifications
You must be signed in to change notification settings - Fork 0
[Security] Fix CodeQL alert #20: Use of a broken or weak cryptographic algorithm #94
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,8 +15,10 @@ def encrypt_data_des(data, key): | |
| return encrypted | ||
|
|
||
| def encrypt_with_arc2(plaintext, key): | ||
| cipher = ARC2.new(key, ARC2.MODE_ECB) | ||
| return cipher.encrypt(plaintext) | ||
| from Crypto.Cipher import AES | ||
| cipher = AES.new(key, AES.MODE_GCM) | ||
| ciphertext, tag = cipher.encrypt_and_digest(plaintext) | ||
| return cipher.nonce + tag + ciphertext | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function name falsely implies ARC2 but uses AES-GCMMedium Severity The function |
||
|
|
||
| def generate_token(): | ||
| token = "" | ||
|
|
||


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.
ARC2 import now unused after removing its only usage
Low Severity
The
ARC2import on line 3 (from Crypto.Cipher import DES, ARC2, Blowfish) is now unused becauseencrypt_with_arc2was the only consumer and this change replaced its internals withAES. The stale import of a weak cryptographic module partially undermines the intent of removing weak crypto usage from this function.