Skip to content

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

Merged
merged 12 commits into from
Jun 3, 2025
Merged

CWE-584 #897

merged 12 commits into from
Jun 3, 2025

Conversation

andrew-costello
Copy link
Contributor

No description provided.

Signed-off-by: Andrew Costello <andrew.costello@ericsson.com>
Copy link
Contributor

@BartKaras1128 BartKaras1128 left a 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

Comment on lines 1 to 22
# 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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 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()

andrew-costello and others added 7 commits May 28, 2025 08:49
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>
Copy link
Contributor

@BartKaras1128 BartKaras1128 left a 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

andrew-costello and others added 3 commits May 29, 2025 11:10
…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>
Copy link
Contributor

@s19110 s19110 left a 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>
@andrew-costello
Copy link
Contributor Author

Hello @s19110 , I believe that I have made a good solution for this, Thank you.

Copy link
Contributor

@gkunz gkunz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@gkunz gkunz merged commit 9995036 into ossf:main Jun 3, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants