-
Notifications
You must be signed in to change notification settings - Fork 163
CWE-584 #897
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
CWE-584 #897
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.
Mostly just a few random empty spaces here and there that I suggest removing, everything else looks good
docs/Secure-Coding-Guide-for-Python/CWE-664/CWE-584/compliant01.py
Outdated
Show resolved
Hide resolved
docs/Secure-Coding-Guide-for-Python/CWE-664/CWE-584/compliant01.py
Outdated
Show resolved
Hide resolved
docs/Secure-Coding-Guide-for-Python/CWE-664/CWE-584/compliant02.py
Outdated
Show resolved
Hide resolved
docs/Secure-Coding-Guide-for-Python/CWE-664/CWE-584/noncompliant01.py
Outdated
Show resolved
Hide resolved
docs/Secure-Coding-Guide-for-Python/CWE-664/CWE-584/noncompliant01.py
Outdated
Show resolved
Hide resolved
# SPDX-FileCopyrightText: OpenSSF project contributors | ||
# SPDX-License-Identifier: MIT | ||
|
||
def do_logic(): | ||
try: | ||
raise Exception | ||
finally: | ||
c = 0 | ||
while c < 5: | ||
print(f"c is {c}") | ||
c += 1 | ||
if c == 3: | ||
break | ||
# return statement goes here | ||
# when exception is raised conditionally | ||
return True | ||
|
||
|
||
##################### | ||
# exploiting above code example | ||
##################### | ||
do_logic() |
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.
# SPDX-FileCopyrightText: OpenSSF project contributors | |
# SPDX-License-Identifier: MIT | |
def do_logic(): | |
try: | |
raise Exception | |
finally: | |
c = 0 | |
while c < 5: | |
print(f"c is {c}") | |
c += 1 | |
if c == 3: | |
break | |
# return statement goes here | |
# when exception is raised conditionally | |
return True | |
##################### | |
# exploiting above code example | |
##################### | |
do_logic() | |
# SPDX-FileCopyrightText: OpenSSF project contributors | |
# SPDX-License-Identifier: MIT | |
def do_logic(): | |
try: | |
raise Exception | |
finally: | |
c = 0 | |
while c < 5: | |
print(f"c is {c}") | |
c += 1 | |
if c == 3: | |
break | |
# return statement goes here | |
# when exception is raised conditionally | |
return True | |
##################### | |
# exploiting above code example | |
##################### | |
do_logic() |
Co-authored-by: Bartlomiej Karas <moezarts@gmail.com> Signed-off-by: andrew-costello <costelloandrew.work@gmail.com>
…1.py Co-authored-by: Bartlomiej Karas <moezarts@gmail.com> Signed-off-by: andrew-costello <costelloandrew.work@gmail.com>
…2.py Co-authored-by: Bartlomiej Karas <moezarts@gmail.com> Signed-off-by: andrew-costello <costelloandrew.work@gmail.com>
…nt01.py Co-authored-by: Bartlomiej Karas <moezarts@gmail.com> Signed-off-by: andrew-costello <costelloandrew.work@gmail.com>
…1.py Co-authored-by: Bartlomiej Karas <moezarts@gmail.com> Signed-off-by: andrew-costello <costelloandrew.work@gmail.com>
…nt01.py Co-authored-by: Bartlomiej Karas <moezarts@gmail.com> Signed-off-by: andrew-costello <costelloandrew.work@gmail.com>
Co-authored-by: Bartlomiej Karas <moezarts@gmail.com> Signed-off-by: andrew-costello <costelloandrew.work@gmail.com>
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.
One more really small change but we should have new lines at the end of our code examples:
Final newline missingPylintC0304:missing-final-newline
…1.py Co-authored-by: Bartlomiej Karas <moezarts@gmail.com> Signed-off-by: andrew-costello <costelloandrew.work@gmail.com>
…2.py Co-authored-by: Bartlomiej Karas <moezarts@gmail.com> Signed-off-by: andrew-costello <costelloandrew.work@gmail.com>
…nt01.py Co-authored-by: Bartlomiej Karas <moezarts@gmail.com> Signed-off-by: andrew-costello <costelloandrew.work@gmail.com>
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 have no other comments apart from @BartKaras1128, but I noticed CWE-584 has not been added to the table in https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Secure-Coding-Guide-for-Python/readme.md
Please add a link to your README for this rule to the readme.md for Python's secure coding before merging.
Signed-off-by: Andrew Costello <andrew.costello@ericsson.com>
Hello @s19110 , I believe that I have made a good solution for this, Thank you. |
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.
lgtm
No description provided.