Development tools and frameworks usually have options to make debugging easier for developers, but these features should never be enabled for applications deployed in production.

Why is this an issue?

Debug instructions or error messages can leak detailed information about the system, such as the application’s path, file names, or stack traces. The rule flags configurations and API calls that enable debug features, including stack trace printing, verbose logging, debug mode flags, and remote debugging endpoints.

What is the potential impact?

Information disclosure

Attackers can exploit debug output to learn internal application details, file paths, stack traces, and configuration data that can be leveraged to craft further attacks.

Increased attack surface

Debug features may expose remote debugging endpoints, profiling APIs, or detailed error pages that significantly increase the attack surface of the application.

How to fix it

Code examples

Debug features should be disabled or guarded by environment checks before deploying to production.

Noncompliant code example

if (unexpectedCondition)
{
  Alert.show("Unexpected Condition"); // Noncompliant
}

The trace() function outputs debug statements, which can be read by anyone with a debug version of the Flash player:

var val:Number = doCalculation();
trace("Calculation result: " + val);  // Noncompliant

Compliant solution

if (unexpectedCondition)
{
  // Do not expose debug information in production
}
var val:Number = doCalculation();

Resources

Standards