← Back to Baseline

MB-0014

Automated No direct PHP superglobal references in inspected application files

MB-C03 Secure Coding Practices High

Valid PHP files in the configured app subtree contain no T_VARIABLE references to $_GET, $_POST, $_REQUEST, $_COOKIE, $_FILES or $_SERVER. Comments and literal strings are ignored. This is a source coding policy, not proof of input validation.

Overview

Valid PHP files in the configured app subtree contain no T_VARIABLE references to $_GET, $_POST, $_REQUEST, $_COOKIE, $_FILES or $_SERVER. Comments and literal strings are ignored. This is a source coding policy, not proof of input validation.

Why it Matters

A consistent request abstraction makes input handling easier to test and review. Direct superglobal reads spread raw request access throughout modules.

Neither avoiding superglobals nor using a request API automatically sanitizes input: validation and output encoding still depend on how each value is used.

Verification Steps

Manual Verification

  1. Review PHP files in the configured app subtree with a PHP-aware parser.
  2. Locate real variable references to the listed superglobals, excluding comments and string literals.
  3. Trace replacements through the request abstraction and review validation separately.

Command / Review Sample

# Source example to locate with a PHP-aware review:
$value = $_GET['item'];

Use the assessed Magento project and the appropriate application or read-only review account. Replace example hosts, paths and identifiers with the assessment scope; configuration and source fragments are illustrative.

Remediation / Fix Guidance

  1. Inspect each named call and argument at the reported file/line. Trace input origin, receiver identity, authorization and output use before deciding whether to replace the API or document an approved exception to this explicit coding policy. Use Magento RequestInterface where the project policy requires it; changing the input-access API does not validate or authorize its values.
  2. Test the affected behavior and its real trust boundary. Replacing an API or wrapping a call does not by itself validate input or remove an exploit path.
  3. Rerun MB-0014 against the same release, profile and relevant file/key/package scope; compare the new evidence and inspect any independent collection gaps.

Examples

Illustrative examples only. Interpret them within the current revision criterion above; missing collection evidence is unresolved, never PASS.

Fail Example

A PHP expression reads $_GET['item'] directly.

Pass Example

Input comes through an injected request abstraction, with no prohibited superglobal variable reference in the reviewed PHP scope.

Scope and Evidence Limits

Rule revision: 3. Target modes: LOCAL.

Valid PHP files in the configured app subtree contain no T_VARIABLE references to $_GET, $_POST, $_REQUEST, $_COOKIE, $_FILES or $_SERVER. Comments and literal strings are ignored. This is a source coding policy, not proof of input validation.

This check covers only the collected observation. Missing collection scope, external controls and runtime behavior require separate evidence.

Catalog coverage describes implementation capability, not a scan outcome. An incomplete manual review cannot establish that the criterion is satisfied.

References