This vulnerability occurs when code contains a conditional expression that will always evaluate to 'true', making the check ineffective and potentially bypassing critical security or logic gates.
An 'always true' expression often stems from logic errors where a developer compares a variable against itself, uses a constant instead of a variable, or creates a condition that can never be false due to prior operations. For example, checking `if (x > 5 || x >= 5)` is redundant because the second part is always true if the first is false. This dead code not only clutters the logic but can silently disable security validations, access controls, or error-handling routines, creating a false sense of security. From a security perspective, these flaws are particularly dangerous in authentication checks, input validation, or privilege escalation guards, as they may allow unauthorized actions to proceed. To prevent this, developers should audit conditional logic for tautologies, use static analysis tools to detect unreachable code, and carefully review comparisons involving constants or variables that may have been modified earlier in the function flow.
Impact: Quality DegradationVaries by Context
java
/* Warn customer about delay before order processing / ...}}