Skip to content

Latest commit

 

History

History
123 lines (92 loc) · 4.01 KB

README_TEMPLATE.md

File metadata and controls

123 lines (92 loc) · 4.01 KB

CWE-000: Title goes here

Introduction sentence, this will be displayed in search engines.

Introduction paragraph, expanding on the introduction sentence...

  • Use bullet points instead of commas.
  • Be brief.
  • Avoid duplicated content.

An example01.py code is optional and useful to demonstrate behaviour that does not work well in the compliant or noncompliant code.

example01.py:

"""Code Example"""

# Code goes here

Output of example01.py:

Console output...

Non-Compliant Code Example

Introduction to the code example...

noncompliant01.py:

"""Non-compliant Code Example"""

# Code goes here

#####################
# Trying to exploit above code example
#####################

# Code goes here

Short explanation of expected outcome of running the code example, e.g. "The code will ... throw an exception, print x..., loop forever..."

Compliant Solution

Introduction to the code example...

compliant01.py:

"""Compliant Code Example"""

# Code goes here

#####################
# Trying to exploit above code example
#####################

# Code goes here

Short explanation of expected outcome of running the code example, e.g. "The code will ... throw an exception, print x..., loop forever..."

Automated Detection

Tool Version Checker Description
Bandit 1.7.4 on Python 3.10.4 Not Available
Flake8 8-4.0.1 on Python 3.10.4 Not Available

Related Guidelines

MITRE CWE Pillar: [CWE-682: Incorrect Calculation]
MITRE CWE Base or Class (choose which one it is based on the abstraction on the CWE page): [CWE-1335: Incorrect Bitwise Shift of Integer (4.12)]
[SEI CERT Oracle Coding Standard for Java] [NUM14-J. Use shift operators correctly]
[CERT C Coding Standard] [INT34-C. Do not shift an expression by a negative number of bits or by greater than or equal to the number of bits that exist in the operand]

Bibliography

[SEI CERT JAVA 2024] NUM01-J. Do not perform bitwise and arithmetic operations on the same data [online]. Available from: https://wiki.sei.cmu.edu/confluence/display/java/NUM01-J.+Do+not+perform+bitwise+and+arithmetic+operations+on+the+same+data, [Accessed 6 May 2025]
[SEI CERT C 2025] CERT C Coding Standard [online]. Available from: https://www.securecoding.cert.org/confluence/display/seccode/CERT+C+Coding+Standard [Accessed 6 May 2025]
When writing bibliography, follow the [Harvard reference guide](https://dkit.ie.libguides.com/harvard/citing-referencing)