Overview
Within bounded collected PHTML files, supported direct dynamic output expressions call recognized context-matched escaping APIs on supported template receivers, use supported encoding forms or static values. This is an output syntax policy; custom implementations, unsupported contexts, dynamic markup and incomplete source coverage remain unavailable, and runtime XSS safety is not established.
Why it Matters
Context-matched encoding helps prevent dynamic data from changing the intended output syntax. Review supported receivers, APIs and embedding contexts together.
The check observes supported syntax only. A recognized call cannot establish safe custom implementations, all dynamic markup or complete runtime XSS protection.
Verification Steps
Manual Verification
- Review supported template receivers and context-matched escaping syntax only. Unsupported contexts or receiver/function identities remain unavailable; syntax is not proof of runtime XSS safety.
- Review custom templates and trace dynamic outputs.
- Match each sink with the appropriate Magento escaping method; justify intended trusted markup.
- Exercise representative output with inert special-character fixtures in a controlled environment.
Command / Review Sample
<!-- HTML text illustration -->
<?= $escaper->escapeHtml($label) ?>
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
- Use the recognized escaping helper for the actual output context and avoid assuming that an HTML helper is valid in JavaScript.
- Validate the exact named inputs and supported scope used by the finding; resolve unavailable data before interpreting a clean result.
- Rerun MB-0733 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
<?= $label ?>
Pass Example
<?= $escaper->escapeHtml($label) ?>
<!-- HTML text context only; review other sinks separately. -->
Scope and Evidence Limits
Rule revision: 2. Target modes: LOCAL.
Within bounded collected PHTML files, supported direct dynamic output expressions call recognized context-matched escaping APIs on supported template receivers, use supported encoding forms or static values. This is an output syntax policy; custom implementations, unsupported contexts, dynamic markup and incomplete source coverage remain unavailable, and runtime XSS safety is not established.
Within bounded collected PHTML files, supported direct dynamic output expressions call recognized context-matched escaping APIs on supported template receivers, use supported encoding forms or static values. This is an output syntax policy; custom implementations, unsupported contexts, dynamic markup and incomplete source coverage remain unavailable, and runtime XSS safety is not established.
Catalog coverage describes implementation capability, not a scan outcome. An incomplete manual review cannot establish that the criterion is satisfied.