Cluster 11 · PCI DSS 6.4.3 · WordPress · wp_enqueue_script SRI

WooCommerce PCI DSS v4.0.1 Req. 6.4.3 & 11.6.1: script_loader_tag SRI & Checkout CSP

Harden WordPress & WooCommerce /checkout routes against Magecart e-skimmers: inject SRI hashes via script_loader_tag, dequeue unnecessary plugin JS on checkout, and lock down Stripe/PayPal CSP.

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
75 / 100 (C)
AUDIT RISK — FIX SCRIPT & CSP GAPS
External Scripts
3
Missing SRI/Pin
1
Evergreen PSPs
1
CSP Header
STRICT
Extracted Payment Page Script Inventory
Script / Block Category Status Required Control (SRI vs CSP/Nonce)
https://js.stripe.com/v3/ Evergreen PSP (Stripe.js v3) PASS
Evergreen PSP properly omits static SRI; enforce via strict CSP + Req. 11.6.1 header monitoring.
https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js Static External Script ERROR
Needs missing SRI integrity="sha384-...", missing crossorigin="anonymous".
/wp-content/plugins/woocommerce/assets/js/frontend/checkout.min.js?ver=9.4.1 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 Stripe.js v3 — correctly distinguished from static CDN SRI.
PCI-643-SRI: 1 static external script(s) missing SRI or crossorigin="anonymous" ERROR
Static third-party scripts on payment pages MUST pin an exact version and carry integrity="sha384-..." + crossorigin="anonymous" under PCI DSS v4.0.1 Req. 6.4.3.
PCI-CSP-BASE: Add base-uri 'self' WARN
Prevents <base href> hijacking of relative checkout script URLs.
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).
PCI-CSP-ALLOW-OK: All extracted HTML <script> origins match strict CSP script-src PASS
Zero unauthorized or unallowlisted script hosts.
Generated Strict Checkout CSP Template
default-src 'self'; script-src 'self' 'nonce-REPLACE_PER_REQUEST' https://js.stripe.com https://cdn.jsdelivr.net; style-src 'self'; img-src 'self' data: https:; connect-src 'self' https://api.stripe.com https://r.stripe.com; frame-src 'self' https://js.stripe.com https://hooks.stripe.com; object-src 'none'; base-uri 'self'; frame-ancestors 'none'; form-action 'self'; report-uri https://woo-shop.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"
"woo-shop.example.com","https://js.stripe.com/v3/","Evergreen PSP (Stripe.js v3)","Authorized","Strict CSP script-src host + 'nonce-...' + Req. 6.4.3 justification (Do NOT add static SRI)","MISSING","Core card tokenization and 3DS2 iframe loader (Stripe.js v3). Evergreen endpoint; SRI unsupported by Stripe — authorize via strict CSP script-src + nonce and monitor via Req. 11.6.1.","Automated weekly or continuous HTTP header + script hash check via CheckoutShield PCI (https://pci.runglab.dev)"
"woo-shop.example.com","https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js","Static External Script","Action Required","SRI (sha384) + crossorigin=""anonymous""","MISSING","Pinned external script verified via Subresource Integrity (Req. 6.4.3).","Automated weekly or continuous HTTP header + script hash check via CheckoutShield PCI (https://pci.runglab.dev)"
"woo-shop.example.com","/wp-content/plugins/woocommerce/assets/js/frontend/checkout.min.js?ver=9.4.1","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
WordPress Hook for SRI add_filter('script_loader_tag', ...) Injects integrity="sha384-..." crossorigin="anonymous" on static external handles
Checkout Script Minimization wp_dequeue_script() on is_checkout() Strip sliders, popups, and chat widgets from /checkout to shrink Req. 6.4.3 surface
PSP Loaders js.stripe.com/v3/ or paypal.com/sdk/js Keep evergreen PSP loaders free of static SRI; govern via strict CSP
Tamper Alerting (11.6.1) Header + DOM baseline monitoring Alert within 7 days on any unauthorized plugin script injection on /checkout

WordPress mu-plugin — Enforce SRI & Dequeue Non-Payment Scripts on Checkout

pci-checkout-hardening.php
<?php
/**
 * PCI DSS v4.0.1 Req. 6.4.3 — Attach SHA-384 SRI to static external scripts
 * and dequeue non-essential frontend plugins on WooCommerce /checkout.
 */
add_filter('script_loader_tag', function ($tag, $handle, $src) {
    $sri_map = [
        'select2-cdn' => 'sha384-REPLACE_WITH_REAL_SHA384_HASH',
    ];
    if (isset($sri_map[$handle]) && strpos($tag, 'integrity=') === false) {
        $hash = esc_attr($sri_map[$handle]);
        return str_replace(' src=', ' integrity="' . $hash . '" crossorigin="anonymous" src=', $tag);
    }
    return $tag;
}, 10, 3);

add_action('wp_enqueue_scripts', function () {
    if (function_exists('is_checkout') && is_checkout()) {
        wp_dequeue_script('marketing-popup-js');
        wp_dequeue_script('gtm-datalayer-js');
    }
}, 99);

Nginx / Cloudflare Strict Checkout CSP for WooCommerce + Stripe

woo-checkout-csp.conf
location = /checkout/ {
  add_header Content-Security-Policy "default-src 'self'; script-src 'self' https://js.stripe.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self' https://api.stripe.com https://r.stripe.com; frame-src 'self' https://js.stripe.com https://hooks.stripe.com; object-src 'none'; base-uri 'self'; frame-ancestors 'self'; report-uri https://woo-shop.example.com/__csp-report" always;
}

Step-by-Step Hardening & Key Insights

  1. Audit all handles enqueued on /checkout using browser DevTools or paste your rendered <head> HTML into our linter.
  2. Dequeue every non-payment marketing/UI plugin script when is_checkout() is true.
  3. Compute SHA-384 hashes for any remaining static CDN handles and inject them via script_loader_tag.
  4. Deploy a scoped CSP header on /checkout/ and verify weekly with CheckoutShield PCI (https://pci.runglab.dev).
  • WordPress/WooCommerce stores are prime Magecart targets because dozens of plugins enqueue unmonitored JS onto /checkout unless explicitly dequeued.
  • Adding ?ver=9.4.1 to local plugin assets helps cache busting, but does NOT prevent server-side or CDN tampering without SRI or Req. 11.6.1 monitoring.
  • Start with Content-Security-Policy-Report-Only on /checkout/ for 48 hours to discover legitimate WooCommerce inline/nonce needs before enforcing.

Common Checkout Audit Pitfalls to Avoid

  • Attaching SRI to WooCommerce payment gateway evergreen loaders (js.stripe.com/v3/ or paypal.com/sdk/js).
  • Forgetting to wrap /order-pay/ and /my-account/add-payment-method/ with the same Req. 6.4.3 CSP controls as /checkout/.
  • Leaving plugin caching/minification plugins active that rewrite script URLs and break static SRI hashes.

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

Can WP Rocket or Autoptimize break SRI hashes on WooCommerce?

Yes. If an optimization plugin concatenates or re-minifies an external script, its bytes change and SRI will block execution. Exclude checkout routes from asset rewriting.

Do I need CSP on /checkout/ if I use WooCommerce Stripe Payment Element?

Yes. Even when Stripe renders card inputs in an iframe, PCI DSS v4.0.1 Req. 6.4.3 and 11.6.1 apply to the parent checkout page.

How do I generate the Req. 6.4.3 script inventory for my WooCommerce store?

Paste your /checkout/ page HTML source into the linter above and export the CSV Justification Matrix in one click.