Missing Error Message in Assert Statement
Description
The assert statement is missing an error message, which can make it difficult to diagnose issues when the assertion fails.
Examples
Insecure Code
cairo
assert(x > 0)Secure Code
cairo
assert(x > 0, 'x must be greater than 0')Remediation
Add a descriptive error message to the assert statement, e.g., assert condition, 'Error message'
Rule Details
| Field | Value |
|---|---|
| ID | CODE-0670 |
| Category | ErrorHandling |
| Severity | LOW |
| CWE | |
| Confidence | HIGH |
| Impact | LOW |
| Likelihood | LOW |
| Exploitability | COMPLEX |
| Tags | best-practice |
| OWASP | N/A |