Securing payment pages for PCI DSS 4.0 requirements 6.4.3 and 11.6.1: a developer's practical guide
I build web apps with the MERN stack. I am not a PCI DSS assessor, and nothing here is a compliance opinion or a claim that a particular setup "passes." What I can do is read the public requirements the way I read an API
I build web apps with the MERN stack. I am not a PCI DSS assessor, and nothing here is a compliance opinion or a claim that a particular setup "passes." What I can do is read the public requirements the way I read an API contract, then show the engineering work they usually turn into on a checkout page.
PCI DSS requirements 6.4.3 and 11.6.1 arrived in v4.0, were carried into the current v4.0.1 revision, and became mandatory on 31 March 2025. The PCI Security Standards Council (PCI SSC) added them because e-commerce pages now assemble a lot of their behaviour from scripts in the shopper's browser, and those scripts are a common target for e-skimming Γ’β¬β attacks that steal card data as the shopper types. The official wording is in PCI DSS v4.0.1: Requirements and Testing Procedures (June 2024). In March 2025 the Council also published Payment Page Security and Preventing E-Skimming Γ’β¬β Guidance for PCI DSS Requirements 6.4.3 and 11.6.1. That supplement does not replace the standard; it is the document I keep open when I decide what to build.
What the two requirements actually ask for
6.4.3 covers payment-page scripts that load and run in the consumer browser. It has three parts: a method that confirms each script is authorized; a method that assures the integrity of each script; and an inventory of those scripts, with a written business or technical justification for why each one is necessary.
The standard does not name a single product. The guidance column, and the March 2025 supplement, mention Content Security Policy (CSP) and Subresource Integrity (SRI) as examples. Other methods are fine if they meet the same objective.
11.6.1 is the detection side. You deploy a change- and tamper-detection mechanism that alerts someone when security-impacting HTTP headers or the script contents of payment pages are modified Γ’β¬β including additions and deletions Γ’β¬β as received by the consumer browser. The check must run at least weekly, or at a frequency set in a targeted risk analysis under requirement 12.3.1.
That phrase, "as received by the consumer browser," is easy to under-read. Hashing the files on your origin is useful. It is not the same as seeing what a shopper's browser actually assembled, especially if a CDN, a tag manager or a third-party script changes after your deploy.
Start with an inventory, not a header
I used to reach for a CSP first. That is backwards. If you do not know which scripts belong on the payment page, you cannot authorize them, pin them or notice when a new one appears.
A payment page, here, is any page that can affect checkout security Γ’β¬β not only a form that posts a raw card number. If your React app mounts a hosted-fields iframe, the parent page still loads JavaScript that can touch the DOM around that iframe. The Council's guidance says a spreadsheet is enough in a simple environment. In a Node repo I keep JSON in version control, so a pull request that adds a script has an obvious file to update:
{
"page": "https://checkout.example.com/pay",
"reviewed": "2026-12-04",
"scripts": [
{
"id": "checkout-app",
"src": "https://checkout.example.com/assets/pay.js",
"sri": "sha384-REPLACE_WITH_THE_REAL_HASH",
"authorized_by": "eng-checkout",
"justification": "First-party bundle that mounts hosted payment fields and talks only to our checkout API."
},
{
"id": "psp-sdk",
"src": "https://js.psp.example/v1/checkout.js",
"sri": "sha384-REPLACE_WITH_THE_REAL_HASH",
"authorized_by": "eng-checkout",
"justification": "Provider SDK that creates the iframe for card collection. No analytics."
}
]
}
The justification line is not decoration: 6.4.3 wants a reason each script is necessary. Analytics, A/B tests and live-chat widgets are the leftovers I usually find on a first view-source; "marketing asked for it" is a prompt to move that script off the payment page. Authorization can be a named owner, a pull-request checklist, and a rule that a script does not ship until it is in the inventory. The guidance allows authorization after a change when you cannot do it in advance Γ’β¬β for example when a provider rotates a file Γ’β¬β but "as soon as possible after" is not the same as never.
Pin stable files with SRI
Subresource Integrity lets the browser refuse a file whose hash does not match the one on the <script> or <link> tag. It is defined in the W3C SRI specification. For a cross-origin file you also need crossorigin="anonymous", and the host must send CORS headers that allow the browser to read the body for hashing.
Generate the hash from the exact bytes you intend to serve:
# SHA-384 is a common choice; SHA-256 and SHA-512 are also valid.
openssl dgst -sha384 -binary ./public/assets/pay.js | openssl base64 -A
<script
src="https://js.psp.example/v1/checkout.js"
integrity="sha384-REPLACE_WITH_THE_REAL_HASH"
crossorigin="anonymous"
></script>
If the file on the CDN changes, the browser blocks it. That is the point, and it is why SRI is a poor fit for a tag-manager snippet that is supposed to change without a deploy. For those, use another integrity method, or stop loading them on the payment page. I treat a blocked script as an incident, not as a reason to delete the integrity attribute so checkout "works again."
Use CSP to describe who may run code
A Content Security Policy tells the browser which origins may run script. A tight policy on the payment page is one of the methods the PCI SSC guidance mentions for authorization and integrity. I ship it as an HTTP header, not a <meta> tag, so reporting works properly.
A cautious rollout starts with Content-Security-Policy-Report-Only, so violations are visible without breaking checkout. After you have reconciled every unexpected source against the inventory, switch to an enforcing Content-Security-Policy.
Content-Security-Policy: default-src 'self';
script-src 'self' https://js.psp.example 'sha384-REPLACE_WITH_THE_REAL_HASH';
style-src 'self';
img-src 'self' data:;
connect-src 'self' https://api.psp.example;
frame-src https://js.psp.example https://acs.example;
object-src 'none';
base-uri 'self';
report-uri https://checkout.example.com/csp-report
A few hard-won notes: 'unsafe-inline' in script-src undoes most of the value, so prefer hashes or nonces for inline script you cannot move into a file; 3-D Secure often opens an iframe on an issuer domain you cannot list in advance, so tightening frame-src without a plan will break authentication; and CSP is not a complete 11.6.1 mechanism on its own. A blocked-script report is a useful alert, but a policy that is later emptied out, or a header that disappears, is exactly the kind of security-impacting header change 11.6.1 wants you to notice.
In Express, the header can live next to the checkout route:
app.use("/pay", (req, res, next) => {
res.setHeader(
"Content-Security-Policy",
"default-src 'self'; script-src 'self' https://js.psp.example; object-src 'none'; base-uri 'self'"
);
next();
});
A simple Node.js change-detection check Γ’β¬β and what it is not
11.6.1 wants a mechanism, an alert path and a cadence. The snippet below is a starting point I would run on a schedule, not a finished control. It fetches the payment page, records security-impacting headers, extracts external script URLs, hashes each script body, and compares the result to the inventory. A missing script, a new script, a hash mismatch or a header drift fails the check.
import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";
const PAGE = "https://checkout.example.com/pay";
const HEADER_KEYS = [
"content-security-policy",
"content-security-policy-report-only",
"x-frame-options",
"strict-transport-security",
"referrer-policy",
];
function sha384(buf) {
return "sha384-" + createHash("sha384").update(buf).digest("base64");
}
function scriptSrcs(html) {
return [...html.matchAll(/<script[^>]+src=["']([^"']+)["']/gi)].map((m) =>
new URL(m[1], PAGE).href
);
}
const inventory = JSON.parse(await readFile("./script-inventory.json", "utf8"));
const expected = new Map(inventory.scripts.map((s) => [s.src, s.sri]));
const pageRes = await fetch(PAGE, { redirect: "error" });
if (!pageRes.ok) throw new Error(`page ${pageRes.status}`);
const headers = Object.fromEntries(
HEADER_KEYS.map((k) => [k, pageRes.headers.get(k)])
);
const html = await pageRes.text();
const srcs = scriptSrcs(html);
const problems = [];
for (const src of srcs) {
if (!expected.has(src)) problems.push(`unexpected script ${src}`);
}
for (const src of expected.keys()) {
if (!srcs.includes(src)) problems.push(`missing script ${src}`);
}
for (const src of srcs) {
const res = await fetch(src, { redirect: "error" });
const hash = sha384(Buffer.from(await res.arrayBuffer()));
if (expected.get(src) && expected.get(src) !== hash) {
problems.push(`hash mismatch ${src}`);
}
}
// Compare `headers` to a committed snapshot the same way.
if (problems.length) {
console.error(problems);
process.exit(1); // hook this into email, Slack or your pager
}
Hook the exit code to whatever already wakes a developer: a GitHub Action on a cron, a systemd timer, a job in your monitor. Weekly is the floor in the requirement, not a target to relax toward.
Treat this script as a lab check. A fetch from your CI runner may not see a skimmer that only injects for real shoppers, in certain countries, or after JavaScript has rewritten the DOM. A more faithful 11.6.1 design uses a real browser (I would reach for Playwright) from more than one network path, or a specialist tool, and looks at the scripts as they exist in the page after load. The Council's guidance is about the page the browser builds, not only the HTML your origin returned.
When an alert fires, the first questions are operational: was this an approved deploy that forgot to update the inventory? Did a vendor publish a new SDK? Did a header disappear? 11.6.1 is satisfied only if someone is alerted and the change is looked at. A log file that nobody reads does not do that job.
If I were adding these controls to a MERN checkout, the diff would include the inventory, SRI on every stable script, an enforcing CSP on the payment routes, a report endpoint, a scheduled check like the one above, a runbook for "script blocked" and "inventory mismatch," and the removal of non-payment third-party tags from the payment page. That last step often shrinks the problem more than any header tweak.
This is implementation practice, not an assessment. For the formal definitions, start with PCI DSS v4.0.1 and the Council's e-skimming guidance. If you need a wider map of how payment-page script controls sit inside a PCI DSS compliance audit, those Council documents are the source of truth; the code here is only a developer's sketch of the work they describe.
Sources
- PCI SSC, PCI DSS v4.0.1: Requirements and Testing Procedures, June 2024, requirements 6.4.3 and 11.6.1. https://www.pcisecuritystandards.org/standards/pci-dss/
- PCI SSC, "Just Published: PCI DSS v4.0.1," 11 June 2024. https://blog.pcisecuritystandards.org/just-published-pci-dss-v4-0-1
- PCI SSC, "New Information Supplement: Payment Page Security and Preventing E-Skimming," 10 March 2025. https://blog.pcisecuritystandards.org/new-information-supplement-payment-page-security-and-preventing-e-skimming
- PCI SSC, "Coffee with the Council: Guidance for PCI DSS E-commerce Requirements Effective After 31 March 2025," 26 March 2025. https://blog.pcisecuritystandards.org/coffee-with-the-council-podcast-guidance-for-pci-dss-e-commerce-requirements-effective-after-31-march-2025
- MDN, "Subresource Integrity." https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
- W3C, Subresource Integrity. https://www.w3.org/TR/SRI/
- MDN, "Content Security Policy (CSP)." https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.