-
Notifications
You must be signed in to change notification settings - Fork 172
CWE-476 #946
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?
CWE-476 #946
Conversation
Signed-off-by: Bartlomiej Karas <[email protected]>
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.
I left a couple small cosmetic suggestions. The rule looks good. Remember to also add the README link to the table in the main readme of the Secure Coding project.
|
||
## Compliant Code Example - Verify that the object is not None before accessing or modifying its fields | ||
|
||
The `compliant solution` includes the same implementation as the previous `non-compliant example` but now checks if the string is `None`. |
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.
I think some backticks are unnecessary here:
The `compliant solution` includes the same implementation as the previous `non-compliant example` but now checks if the string is `None`. | |
The `compliant solution` includes the same implementation as the previous non-compliant example but now checks if the string is `None`. |
The `compliant solution` includes the same implementation as the previous `non-compliant example` but now checks if the string is `None`. | |
The compliant solution includes the same implementation as the previous `non-compliant example` but now checks if the string is `None`. |
|
||
``` | ||
|
||
The code example attempts to directly calling `len()` on a non-array value, but rather on `None`, which will raise a `TypeError`. Such unchecked dereferencing of a `None` value could result in an application crash or denial of service, impacting system availability. |
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.
This sentence sounds a bit odd. How about something like that?
The code example attempts to directly calling `len()` on a non-array value, but rather on `None`, which will raise a `TypeError`. Such unchecked dereferencing of a `None` value could result in an application crash or denial of service, impacting system availability. | |
The code example attempts to directly call `len()` on a non-array value, in this case on `None`, which will raise a `TypeError`. Such unchecked dereferencing of a `None` value could result in an application crash or denial of service, impacting system availability. |
The rule looks good to me, I agree with @s19110 's rewording suggestion, I was going to put it in myself. When it is reworded, I will review again and give +1. |
No description provided.