Cluster 11 · PCI DSS 6.4.3 · Magento · csp_whitelist.xml + SRI

Magento 2 / Adobe Commerce PCI DSS 4.0.1 Req. 6.4.3 & 11.6.1: csp_whitelist.xml & Nonces

Satisfy Adobe Commerce / Magento 2 PCI DSS v4.0.1 payment-page rules: switch Magento_Csp out of report_only on checkout, configure csp_whitelist.xml + CspNonceProvider, and audit extension JS via SRI.

Zero Telemetry · Strict CSP (connect-src 'none') · WebCrypto

Checkout HTML & CSP Header Linter

PCI DSS v4.0.1 Req. 6.4.3 & 11.6.1
Compliance Note: Automated engineering & preparation guidance for PCI DSS v4.0.1 Req. 6.4.3 & 11.6.1 — verify final SAQ/ROC scope with your QSA or acquiring bank.
PCI DSS 6.4.3 & 11.6.1 Readiness Score
60 / 100 (D)
AUDIT RISK — FIX SCRIPT & CSP GAPS
External Scripts
2
Missing SRI/Pin
0
Evergreen PSPs
1
CSP Header
UNSAFE
Extracted Payment Page Script Inventory
Script / Block Category Status Required Control (SRI vs CSP/Nonce)
https://js.braintreegateway.com/web/3.106.0/js/client.min.js Evergreen PSP (Braintree Web / Drop-in) PASS
Evergreen PSP properly omits static SRI; enforce via strict CSP + Req. 11.6.1 header monitoring.
/static/frontend/Vendor/theme/en_US/requirejs/require.js First-Party Script ('self') PASS
Covered by first-party origin / nonce policy.
PCI-643-PSP-OK: 1 evergreen PSP loader(s) classified for CSP/nonce PASS
Detected Braintree Web / Drop-in — correctly distinguished from static CDN SRI.
PCI-CSP-INLINE: CSP script-src allows 'unsafe-inline' without a nonce ERROR
Remove 'unsafe-inline' (or pair with per-request 'nonce-...') to prevent injected inline skimmers from executing.
PCI-CSP-EVAL: CSP script-src permits 'unsafe-eval' ERROR
Remove 'unsafe-eval' from payment pages so string-to-code injection vectors (eval / new Function) stay blocked.
PCI-CSP-FRAME: Missing CSP frame-ancestors directive WARN
Add frame-ancestors 'none' (or 'self') to protect checkout UI against clickjacking overlays.
PCI-1161-REPORT: No CSP report-to / report-uri endpoint configured WARN
PCI DSS v4.0.1 Req. 11.6.1 requires alerting on unauthorized script or security-header changes at least every 7 days (or continuous telemetry).
Generated Strict Checkout CSP Template
default-src 'self'; script-src 'self' 'nonce-REPLACE_PER_REQUEST' https://js.braintreegateway.com; style-src 'self'; img-src 'self' data: https:; connect-src 'self' https://payments.braintree-api.com https://client-analytics.braintreegateway.com; frame-src 'self' https://assets.braintreegateway.com; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; form-action 'self'; report-uri https://commerce.example.com/__csp-report
PCI DSS v4.0.1 Req. 6.4.3 Script Justification Matrix (CSV)
"Merchant Origin","Script Location / Tag","Category","Authorization Status","Required Control (SRI vs CSP/Nonce)","Current Integrity / Nonce","Business Justification (PCI DSS v4.0.1 Req 6.4.3)","Req 11.6.1 Monitoring Cadence"
"commerce.example.com","https://js.braintreegateway.com/web/3.106.0/js/client.min.js","Evergreen PSP (Braintree Web / Drop-in)","Authorized","Strict CSP script-src host + 'nonce-...' + Req. 6.4.3 justification (Do NOT add static SRI)","MISSING","Braintree Hosted Fields / Drop-in loader. Use exact versioned path (when pinned with SRI) or CSP host + nonce if unpinned loader, and track in Req. 6.4.3 inventory.","Automated weekly or continuous HTTP header + script hash check via CheckoutShield PCI (https://pci.runglab.dev)"
"commerce.example.com","/static/frontend/Vendor/theme/en_US/requirejs/require.js","First-Party Script ('self')","Authorized","CSP 'self' / 'nonce-...' (add SRI if served via CDN)","MISSING","First-party application checkout bundle hosted on merchant origin.","Automated weekly or continuous HTTP header + script hash check via CheckoutShield PCI (https://pci.runglab.dev)"
CheckoutShield PCI · Live Audit $49 PCI Compliance Pack

Monitor Live Checkout Scripts & Ship QSA-Ready Req. 6.4.3 + 11.6.1 Evidence

Need automated HTTP header + script tampering alerts (PCI DSS v4.0.1 Req. 11.6.1) or a tailored CSP, nonce middleware & script justification bundle? Run a free live scan on CheckoutShield PCI (https://pci.runglab.dev), order the $49 CheckoutShield PCI Pack via Creem, or request a PayPal invoice via [email protected].

Platform PCI DSS v4.0.1 Specifications & Controls

Control / Origin Hardened Pattern Req. 6.4.3 & 11.6.1 Rationale
Magento_Csp Restrict Mode config.xml restrict_mode = 1 (checkout) Magento defaults to report_only=1 on many stores — must enforce restrict mode on checkout
Dynamic Inline Nonce $cspNonceProvider->generateNonce() Wrap required inline RequireJS/Hyvä configs with dynamic Magento CspNonceProvider
Extension Script Inventory etc/csp_whitelist.xml Audit every module's whitelist entries and prune legacy tracking/chat scripts
Adobe Commerce 2.4.7+ SRI Magento_Csp / SRI hash generation Protect static assets and external vendor scripts from Magecart modification

Magento 2 — Enforce Restrict Mode & Clean csp_whitelist.xml on Checkout

etc/config.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
  <default>
    <csp>
      <mode>
        <storefront_checkout_index_index>
          <report_only>0</report_only>
        </storefront_checkout_index_index>
      </mode>
      <policies>
        <storefront_checkout_index_index>
          <scripts>
            <inline>0</inline>
            <eval>0</eval>
          </scripts>
        </storefront_checkout_index_index>
      </policies>
    </csp>
  </default>
</config>

Magento Template — Nonce-Protected Inline Init ($secureRenderer)

checkout-init.phtml
<?php
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
$scriptString = 'window.checkoutConfig = window.checkoutConfig || {};';
?>
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>

Step-by-Step Hardening & Key Insights

  1. Flip csp/mode/storefront_checkout_index_index/report_only to 0 (enforcing restrict mode) on Magento 2.4.7+ checkout.
  2. Replace raw <script> tags in custom .phtml templates with $secureRenderer->renderTag() so Magento attaches per-request CSP nonces.
  3. Review every vendor module's etc/csp_whitelist.xml and remove unused analytics/marketing domains from checkout.
  4. Monitor live Magento checkout headers and scripts continuously via CheckoutShield PCI (https://pci.runglab.dev).
  • Adobe Commerce / Magento has historically been the #1 e-commerce target for Magecart skimmers; PCI DSS v4.0.1 explicitly tightened payment-page script rules with this risk in mind.
  • On Magento 2.4.7+, checkout CSP defaults shifted toward stricter enforcement, but custom themes and third-party modules still frequently inject inline <script> tags requiring $secureRenderer.
  • Do not forget /multishipping/checkout/ and custom one-step checkout routes when enabling CSP restrict mode.

Common Checkout Audit Pitfalls to Avoid

  • Leaving Magento_Csp in report_only = 1 in production while assuming CSP is protecting checkout.
  • Whitelisting *.googleapis.com, *.jsdelivr.net, or 'unsafe-eval' in csp_whitelist.xml.
  • Deploying unpatched third-party Magento extensions that load unpinned external CDN scripts.

More PCI DSS v4.0.1 & SRI Checkout Guides

← Back to PCI & SRI Checker Hub · Cluster 4: Security Headers & CSP → · Cluster 7B: Stripe/Creem Webhook HMAC → · CheckoutShield PCI Live Scan → · $49 PCI Compliance Pack →

Frequently Asked Questions

Does Magento 2.4.7+ enforce strict CSP on checkout out of the box?

Magento 2.4.7 introduced stricter checkout CSP support and SRI capabilities, but custom themes, third-party payment modules, and legacy extensions must be verified for report_only=0 and zero 'unsafe-inline'.

How do I replace inline scripts in Magento .phtml templates safely?

Use Magento's SecureHtmlRenderer ($secureRenderer->renderTag('script', ...)), which automatically binds the per-request CSP nonce.

How can I audit my rendered Magento checkout HTML right now?

Paste view-source HTML from /checkout into the linter above to extract every <script src>, spot unpinned external scripts, and export your Req. 6.4.3 CSV.