Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into CWE-833-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
myteron authored May 15, 2024
2 parents 0b356b2 + e066c4c commit 48a7307
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CWE-664/CWE-681/compliant01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
""" Compliant Code Example """
from decimal import Decimal

t = Decimal(str(4 / 2))
print(f"t: {t}")
# t still prints "2.0", but now it's a Decimal
if Decimal("2").compare(t) == 0:
print("t equals 2")
# prints "t equals 2"
7 changes: 7 additions & 0 deletions CWE-664/CWE-681/noncompliant01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
""" Non-compliant Code Example """
s = str(4 / 2)
print(f"s: {s}")
# s is "2.0", a string
if s == "2":
print("s equals 2")
# <no output>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ It is **not production code** and requires code-style or python best practices t
|[CWE-410: Insufficient Resource Pool](CWE-664/CWE-410/.)||
|[CWE-502: Deserialization of Untrusted Data)](CWE-664/CWE-502/.)||
|[CWE-665: Improper Initialization](CWE-664/CWE-665/.)||
|[CWE-833: Deadlock](CWE-664/CWE-833/README.md)||
|[CWE-681: Improper Control of a Resource Through its Lifetime](CWE-664/CWE-681/.)||
|[CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')](CWE-664/CWE-843/.)||
|[XXX-005: Consider hash-based integrity verification of byte code files against their source code files](CWE-664/XXX-005/.)||
|<img width=680>|<img width=140>|
Expand Down

0 comments on commit 48a7307

Please sign in to comment.