diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-664/CWE-501/README.md b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0040/README.md similarity index 98% rename from docs/Secure-Coding-Guide-for-Python/CWE-664/CWE-501/README.md rename to docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0040/README.md index aa1c5d29..40ca437c 100644 --- a/docs/Secure-Coding-Guide-for-Python/CWE-664/CWE-501/README.md +++ b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0040/README.md @@ -1,4 +1,4 @@ -# CWE-501: Trust Boundary Violation +# pyscg-0040: Respect Trust Boundaries Python's trust boundaries rely on explicit process isolation, rather than in-process access control within a single interpreter. diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-664/CWE-501/compliant01.png b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0040/compliant01.png similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-664/CWE-501/compliant01.png rename to docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0040/compliant01.png diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-664/CWE-501/noncompliant01.png b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0040/noncompliant01.png similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-664/CWE-501/noncompliant01.png rename to docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0040/noncompliant01.png diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-798/README.md b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0041/README.md similarity index 99% rename from docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-798/README.md rename to docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0041/README.md index 04e9a5f6..3da447ed 100644 --- a/docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-798/README.md +++ b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0041/README.md @@ -1,4 +1,4 @@ -# CWE-798: Use of hardcoded credentials +# pyscg-0041: Avoid Hardcoded Credentials Ensure that unique keys or secrets can be replaced or rejected at runtime and never hard-code sensitive information, such as passwords, and encryption keys in a component. diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-798/compliant01.py b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0041/compliant01.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-798/compliant01.py rename to docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0041/compliant01.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-798/noncompliant01.py b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0041/noncompliant01.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-798/noncompliant01.py rename to docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0041/noncompliant01.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-691/CWE-783/README.md b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0042/README.md similarity index 99% rename from docs/Secure-Coding-Guide-for-Python/CWE-691/CWE-783/README.md rename to docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0042/README.md index 0e6b0bc4..b30fea1c 100644 --- a/docs/Secure-Coding-Guide-for-Python/CWE-691/CWE-783/README.md +++ b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0042/README.md @@ -1,4 +1,4 @@ -# CWE-783: Operator Precedence Logic Error +# pyscg-0042: Mind Operator Precedence Failing to understand the order of precedence in expressions that read and write to the same object can lead to unintended side effects. diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-691/CWE-783/compliant01.py b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0042/compliant01.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-691/CWE-783/compliant01.py rename to docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0042/compliant01.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-691/CWE-783/example01.py b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0042/example01.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-691/CWE-783/example01.py rename to docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0042/example01.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-691/CWE-783/example02.py b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0042/example02.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-691/CWE-783/example02.py rename to docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0042/example02.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-691/CWE-783/noncompliant01.py b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0042/noncompliant01.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-691/CWE-783/noncompliant01.py rename to docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0042/noncompliant01.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-472/README.md b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0055/README.md similarity index 98% rename from docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-472/README.md rename to docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0055/README.md index 1d834e55..97da527e 100644 --- a/docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-472/README.md +++ b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0055/README.md @@ -1,4 +1,4 @@ -# CWE-472: External Control of Assumed-Immutable Web Parameter +# pyscg-0055: Validate Web Parameters Ensuring user roles are determined on the server side prevents attackers from manipulating permissions through client-side data. diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-472/example01.py b/docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0055/example01.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-472/example01.py rename to docs/Secure-Coding-Guide-for-Python/01_introduction/pyscg-0055/example01.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/README.md b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/README.md similarity index 99% rename from docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/README.md rename to docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/README.md index 72efefb7..830aba97 100644 --- a/docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/README.md +++ b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/README.md @@ -1,4 +1,4 @@ -# CWE-175: Improper Handling of Mixed Encoding +# pyscg-0043: Handle Mixed Character Encoding Locale-dependent programs may produce unexpected behavior or security bypasses in an environment whose locale is unset, or not set to an appropriate value. diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/compliant01.py b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/compliant01.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/compliant01.py rename to docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/compliant01.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/compliant02.py b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/compliant02.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/compliant02.py rename to docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/compliant02.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/example01.py b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/example01.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/example01.py rename to docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/example01.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/example02.py b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/example02.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/example02.py rename to docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/example02.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/example03.py b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/example03.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/example03.py rename to docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/example03.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/noncompliant01.py b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/noncompliant01.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/noncompliant01.py rename to docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/noncompliant01.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/noncompliant02.py b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/noncompliant02.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-175/noncompliant02.py rename to docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0043/noncompliant02.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-180/README.md b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0044/README.md similarity index 98% rename from docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-180/README.md rename to docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0044/README.md index 9e62ed0f..d941ef64 100644 --- a/docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-180/README.md +++ b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0044/README.md @@ -1,4 +1,4 @@ -# CWE-180: Incorrect Behavior Order: Validate Before Canonicalize +# pyscg-0044: Validate Before Canonicalize Normalize/canonicalize strings before validating them to prevent risky strings such as `../../../../passwd` allowing directory traversal attacks, and to reduce `XSS` attacks. @@ -7,7 +7,7 @@ The need for supporting multiple languages requires the use of an extended list Character Encoding systems such as `ASCII`, `Windows-1252`, or `UTF-8` consist of an agreed mapping between byte values and a human-readable character known as code points. Each code point represents a single relation between characters such as a fixed number "`\u002e`", its graphical representation "`.`", and name "`FULL STOP`" [[Batchelder 2022]](https://www.youtube.com/watch?v=sgHbC6udIqc). Using the same encoding assures that equivalent strings have a unique binary representation Unicode Standard _annex #15, Unicode Normalization Forms_ [[Davis 2008]](https://wiki.sei.cmu.edu/confluence/display/java/Rule+AA.+References#RuleAA.References-Davis08). Different or unexpected changes in encoding can allow attackers to workaround validation or input sanitation affords. > [!WARNING] -> Ensure to use allow lists to avoid having to maintain an deny list on a continuous basis (as exclusion lists are a moving target) as per [CWE-184: Incomplete List of Disallowed Input - Development Environment](../../CWE-693/CWE-184/README.md). +> Ensure to use allow lists to avoid having to maintain an deny list on a continuous basis (as exclusion lists are a moving target) as per [pyscg-0047: Use Allow Lists Over Deny Lists](../../04_neutralization/pyscg-0047/README.md). diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-180/compliant01.py b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0044/compliant01.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-180/compliant01.py rename to docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0044/compliant01.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-180/example01.py b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0044/example01.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-180/example01.py rename to docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0044/example01.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-180/noncompliant01.py b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0044/noncompliant01.py similarity index 100% rename from docs/Secure-Coding-Guide-for-Python/CWE-707/CWE-180/noncompliant01.py rename to docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0044/noncompliant01.py diff --git a/docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-182/README.md b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0045/README.md similarity index 74% rename from docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-182/README.md rename to docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0045/README.md index c729c4c2..9bf17842 100644 --- a/docs/Secure-Coding-Guide-for-Python/CWE-693/CWE-182/README.md +++ b/docs/Secure-Coding-Guide-for-Python/02_encoding_and_strings/pyscg-0045/README.md @@ -1,8 +1,8 @@ -# CWE-182: Collapse of Data into Unsafe Value +# pyscg-0045: Enforce Consistent Encoding Handling data between different encodings or while filtering out untrusted characters and strings can cause malicious content to slip through input sanitation. -Encoding changes, such as changing from `UTF-8` to pure `ASCII`, can result in turning non-functional payloads, such as ``, into functional `