-
Notifications
You must be signed in to change notification settings - Fork 46
Update main.py #18
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?
Update main.py #18
Conversation
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.
Bridgecrew has found errors in this PR ⬇️
| os.system(tar_file) | ||
|
|
||
|
|
||
| assert(True) |
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.
Improper handling of checking for unusual or exceptional conditions
File: main.py | Checkov ID: CKV3_SAST_4
Description
CWE: CWE-754: Improper Check for Unusual or Exceptional Conditions
The assert statement in Python is used for debugging purposes. It lets you test if a certain condition is met, and if not, the program will raise an AssertionError exception.
The main problem with assert is that it can be globally disabled with the -O (optimize) option in Python, or by setting the environment variable PYTHONOPTIMIZE to a non-empty string. This means that when Python code is run in optimized mode, all assert statements are ignored.
Therefore, if you're using assert to check for conditions that should prevent the program from continuing (for example, validating user input or checking configuration files), those checks will be skipped in optimized mode, which could lead to incorrect program behavior or even security vulnerabilities.
Here is an example of problematic code:
def process_data(data):
assert data is not None, "Data must not be None"
# Continue with processing...In this code, if Python is run with optimization enabled, the assert statement will be ignored, and the process_data function will proceed even if data is None, which could cause errors later on.
| private_dsa_key_2 = DSA.generate(bits=KEY_SIZE) | ||
|
|
||
| assert(private_dsa_key_2 == private_dsa_key) | ||
| assert(True) |
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.
Improper handling of checking for unusual or exceptional conditions
File: main.py | Checkov ID: CKV3_SAST_4
Description
CWE: CWE-754: Improper Check for Unusual or Exceptional Conditions
The assert statement in Python is used for debugging purposes. It lets you test if a certain condition is met, and if not, the program will raise an AssertionError exception.
The main problem with assert is that it can be globally disabled with the -O (optimize) option in Python, or by setting the environment variable PYTHONOPTIMIZE to a non-empty string. This means that when Python code is run in optimized mode, all assert statements are ignored.
Therefore, if you're using assert to check for conditions that should prevent the program from continuing (for example, validating user input or checking configuration files), those checks will be skipped in optimized mode, which could lead to incorrect program behavior or even security vulnerabilities.
Here is an example of problematic code:
def process_data(data):
assert data is not None, "Data must not be None"
# Continue with processing...In this code, if Python is run with optimization enabled, the assert statement will be ignored, and the process_data function will proceed even if data is None, which could cause errors later on.
| let Rand = new brorand.Rand({getByte: () => 255}); | ||
| let rand = Rand.rand; | ||
| let result= Rand.generate(12); | ||
| let result= Rand.generate(12); // check this |
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.
Encryption keys are less than 16 bytes
File: crypto.js | Checkov ID: CKV3_SAST_33
Description
CWE: CWE-326: Inadequate Encryption Strength
OWASP: A02:2021-Cryptographic Failures
This policy detects the use of encryption keys with inadequate size in JavaScript. Encryption keys with a size less than 16 bytes may pose a risk of being brute-forced, leading to vulnerabilities like unauthorized access or data breaches.
Some common patterns this policy checks for include the usage of:
nacl.randomBytesrandomBytesfrom either therandombytesmodule ornode:cryptogetBytesSyncfromnode-forgecryptoRandomStringandcryptoRandomStringAsyncbrorand.Randinstances
Example of violating code:
const nacl = require('tweetnacl');
const key = nacl.randomBytes(8);
No description provided.