Part of the Commerce ecosystem · 506 projects
Commerce Payment Page Integrity inventories every script on Drupal Commerce payment pages, records a written justification and an authorization for each, sends a Content-Security-Policy built from what was authorized, and alerts when a script or a security header changes. These are the controls of PCI DSS 4.0.1 requirements 6.4.3 and 11.6.1, with records an assessor can export.
Status: Stable. 1.0.0 is the first release.
Why
E-skimming attacks add or change JavaScript on the page where a customer types card details. Since 31 March 2025, requirement 6.4.3 asks that every script on a payment page is authorized, has its integrity assured and is inventoried with a written justification, and 11.6.1 asks for alerts on unauthorized changes to those scripts and to security-impacting HTTP headers, as the browser receives them, at least weekly. Merchants assessed with SAQ A-EP, SAQ D or a Report on Compliance must meet both; SAQ A asks instead that a merchant confirm the site is not susceptible to attacks from scripts. Your acquirer decides which applies.
Features
Payment pages
- By default, the order information, review and payment steps of every checkout flow, any other step that holds a payment pane, and the page where customers add a stored payment method. Pages are found by checkout step and payment pane, never by payment gateway.
- Mark other routes as payment pages, such as a cart page with express checkout buttons, or exclude a page. Other modules can add pages of their own, including pages that are not Commerce pages, through a tagged service.
- On payment pages, JavaScript is served unaggregated, so each file is its own inventory item; every placeholder is rendered into the page instead of being streamed by BigPipe; and the page is kept out of the page caches, because each response carries its own nonce. Other pages keep all three.
Inventory and authorization (6.4.3)
- Every script on those pages: Drupal library files, external scripts and inline scripts, with its source, a SHA-384 hash of its content, the libraries that declare it, the pages it is on, and when it was first and last seen. Scripts are found in customer page views, in AJAX responses and by the scheduled check.
- A user with the dedicated permission authorizes, rejects or revokes each script with a written justification. Who decided and when are recorded, and for a script monitored by hash, the exact content version.
- Local files, which come from your own codebase, can be selected on the Scripts tab and authorized or rejected together, with the justification recorded for each; a file that changed after the list was shown is left for review. Inline and external scripts are decided one at a time.
- External scripts are monitored by content hash, or by source only for an SDK the vendor updates in place. A versioned one can be pinned with Subresource Integrity, a vendor URL with a per-request query string can be authorized for any query string, and origins a payment SDK loads at run time can be added by hand.
drush payment-page-integrity:reauthorizere-authorizes, as a deployment step, the authorized local files whose content changed, with the justification you give;--dry-runlists them without changing anything.
The payment page policy
- Three modes: inventory only (no policy, the default), report-only, and enforce.
- Only authorized script elements get the response's nonce, and authorized inline scripts are allowed by their hash.
'strict-dynamic', on by default, lets authorized scripts such as Drupal's AJAX or a payment SDK load what they need, and a companion report-only policy reports scripts loaded that way from sources the inventory does not list. - Local scripts carry Subresource Integrity (on by default) with the hash that was authorized, not the file's current one, so browsers refuse a modified file until it is re-authorized.
- In enforce mode, AJAX responses requested from a payment page leave out libraries that contain an unauthorized script, whichever route serves them (the checkout form, a view, a dialog).
object-src 'none'andbase-uri 'self', and other directives such asframe-src,connect-srcorform-actionif you add them; script directives cannot be added by hand. With the Content-Security-Policy module installed, the payment page policy is merged into its policy.- Browsers send violation reports to an endpoint whose address is signed per page, with caps on size, rate and new kinds of report, so a flood of made-up reports cannot crowd out real ones.
Change and tamper detection (11.6.1)
- A scheduled check from cron, daily by default and configurable from every hour to every 30 days (an interval longer than a week asks for a targeted risk analysis reference), from Drush, or from the admin pages.
- It requests each payment page over HTTP at the storefront address as a signed-in customer with a cart, once per payment gateway the cart can use, with that gateway selected. A gateway in live mode is selected only if you allow it, because building its form can create a payment at the provider.
- It downloads the scripts the page references, as a browser would, and compares their hashes with the inventory; local files as served are also compared with the files on disk.
- It compares the security headers received (CSP, HSTS, X-Frame-Options, Referrer-Policy, Permissions-Policy, the cross-origin headers, Set-Cookie attributes and others) with a baseline a person accepts, and checks that the payment page policy arrived with its script directives intact.
- A page whose payment form did not render, or whose live gateway was left out, is reported as checked only in part, never as passing. A failed check raises a critical alert and is retried after an hour, and when no check has succeeded for a day past the interval, the next cron run raises a critical alert.
Alerts, history and evidence
- Alerts by email and in the log. Critical alerts are emailed at once; warnings, and notices if you choose, are limited per hour, and the rest follow in a digest at cron. Each alert records who acknowledged or resolved it, when, and their note. When the condition goes away, the alert is marked as cleared and stays open until a person resolves it.
- A history of every discovery, change, decision, baseline change, settings change, alert response, export and check run. Each row is chained to the one before with an HMAC keyed by the site's hash salt; cron verifies the chain daily and raises a critical alert if it is broken.
- Every settings change is recorded with its values before and after, whether it came from the form, a configuration import or code, and a change that weakens the protection raises a critical alert.
- Evidence export from the Export tab or Drush: the inventory, history, alerts with their responses, violation reports and page baselines, each as CSV or JSON, or all of them as JSON with the settings in force and the result of verifying the history chain.
- Built not to store card data: URLs in violation reports lose their query string, and card-number-like digit runs and email addresses are removed from reports and script excerpts.
- Status report entries, and Drush commands to run the check, show the status and export the evidence. For other code: an event for each new alert, and services to read the inventory, run the check and raise alerts.
Requirements
- Drupal 11.3 or later, or Drupal 12. Drupal 12 needs a Drupal Commerce release that supports it; Commerce 3.3 supports Drupal 10.3 and 11.
- PHP 8.3 or later. The check downloads external scripts only when the curl extension is available.
- Drupal Commerce 3.3 or later, or Commerce 4, with its Checkout and Payment modules.
- Cron, and a server that can reach the storefront's own address, for the scheduled check.
- Optional: Content-Security-Policy 2.2 or later. Drush 13.7 or later is optional, for the commands.
- Any database Drupal supports (MySQL or MariaDB, PostgreSQL, SQLite).
Installation
Install with Composer, then enable the module:
composer require drupal/commerce_payment_page_integrity drush en commerce_payment_page_integrity
The module starts in inventory-only mode and sends no policy. Run the check, go through checkout with each payment method, authorize the scripts and accept the header baselines, then switch to report-only, and to enforce once the reports are clean.
Configuration and permissions
Everything is at Administration » Commerce » Configuration » Payment » Payment page integrity (/admin/commerce/config/payment/page-integrity), with tabs for scripts, pages, alerts, violation reports, history, export and settings (/admin/commerce/config/payment/page-integrity/settings). Alerts go to the site email address until you add recipients. The scheduled check is on from installation; when cron runs from the command line, set the storefront base URL, or the check cannot run. It signs in as a customer account it creates, with no roles, and deletes the carts it makes; choose an existing account and a product if your checkout needs a role or a particular product.
- View payment page integrity records (not restricted): see the script inventory, change history, alerts, violation reports and check results, and download the evidence export. Suitable for an assessor.
- Authorize payment page scripts (restricted): record the justification for a script and authorize, reject or revoke it, and add external script sources.
- Respond to payment page integrity alerts (restricted): acknowledge and resolve alerts, and run the check on demand.
- Administer payment page integrity (restricted): change the settings, including the policy mode, accept security header baselines, and run the check on demand.
What it does not cover
The module is a control that helps meet two requirements; it does not make a site compliant, which is for your assessor or acquirer to judge, and the policies, procedures and roles PCI DSS asks for are yours to write. Scripts inside a payment provider's iframe or hosted page are the provider's. The check requests pages as one customer, from the server's own address, and never requests the step that processes the payment, so content shown only to some customers, and a skimmer that hides from server addresses, are covered only by live page views and browser reports. Under 'strict-dynamic', a compromised authorized script that loads from an authorized source is caught only by the hash comparison, and only for scripts monitored by hash. Only payment pages Drupal renders are covered: a decoupled checkout needs its own policy and monitoring. Someone who can change the site's code or database can change the inventory too: the chained history shows edits made in the database, and forwarding the module's log channel elsewhere keeps a copy such a person cannot rewrite.
Similar projects
Checked on drupal.org in November 2026.
- Content-Security-Policy builds a site-wide policy, with hashes, nonces and violation reporting. Choose it for a site-wide CSP. It keeps no script inventory, justifications or authorizations; this module merges its payment page policy into it.
- Security Kit sets security headers site-wide, a Content-Security-Policy among them.
- SubResourceIntegrity let developers set
integrityattributes in library definitions. It has only a 2020 development release, for Drupal 8. - Script Manager places script snippets on pages under visibility conditions. It is a way to add scripts, not an inventory of them.
- Commercial client-side security services monitor payment pages from outside the site. Choose one if you want the monitoring run by a third party.
Support and maintenance
Report bugs and ask for features in the issue queue. Each release has notes describing what changed.
This project is not covered by Drupal's security advisory policy. Until it is, security issues are handled in the public issue queue and fixed in ordinary releases.
A read-only mirror is on GitHub at DanePete/drupal-commerce-payment-page-integrity; development and issues stay on drupal.org.
Maintainer
Created and maintained by deadnorth (Dead North).
Ask your assistant about Commerce Payment Page Integrity
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
- Commerce Core commerce_checkout
- Commerce Core commerce_payment
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
More in the Commerce ecosystem
Most installed first
Activity
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.0.0 | Stable | 11 | PHP >=8.3 | Dec 2, 2026 |