Download the PHP package falconmedia/magento2-csp-sri-lock without Composer

On this page you can find all versions of the php package falconmedia/magento2-csp-sri-lock. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package magento2-csp-sri-lock

Falcon Media -Magento 2 CSP SRI Lock

Package: falconmedia/magento2-csp-sri-lock\ Type: Magento 2 Module\ License: MIT\ Maintainer: Henk Valk [email protected]

Installation

Via Composer

composer require falconmedia/magento2-csp-sri-lock
php bin/magento module:enable FalconMedia_CspSriLock
php bin/magento setup:upgrade
php bin/magento cache:flush

Verification

After installation, verify that the correct storage class is active:

php bin/magento dev:di:info Magento\Csp\Model\SubresourceIntegrity\Storage\File

Expected output:

Preference: FalconMedia\CspSriLock\Model\SubresourceIntegrity\Storage\File

Issue

Magento 2.4.x stores Subresource Integrity (SRI) hashes in:

pub/static/frontend/sri-hashes.json
pub/static/adminhtml/sri-hashes.json

Under load, multiple PHP-FPM workers can write to the same file simultaneously.

Magento's default implementation writes using file mode 'w' without locking.

This can cause:

This often results in checkout becoming completely unavailable.


Root Cause

The core implementation:

If two requests write simultaneously:

Request A → truncates file
Request B → truncates file
Request A → writes partial JSON
Request B → overwrites partially

Result: corrupted JSON → checkout crash.


Solution

This module replaces Magento's default SRI file storage with a safer implementation that:

No database changes.\ No configuration required.\ Drop-in safe fix.

Testing

1. Remove existing SRI files

rm -f pub/static/frontend/sri-hashes.json
rm -f pub/static/adminhtml/sri-hashes.json
php bin/magento cache:flush

2. Generate concurrent requests

for i in {1..30}; do curl -s https://yourdomain.com/checkout/ > /dev/null & done; wait

3. Validate JSON

php -r 'json_decode(@file_get_contents("pub/static/frontend/sri-hashes.json")); echo json_last_error();'

Expected result:

0

Compatibility


Why This Matters

Checkout outages caused by corrupted SRI files can result in:

This module eliminates that class of failure entirely.


License

MIT License\ © 2026 Falcon Media


All versions of magento2-csp-sri-lock with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1 || ^8.2, ^8.3
magento/framework Version ^103.0
magento/module-csp Version ^100.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package falconmedia/magento2-csp-sri-lock contains the following files

Loading the files please wait ...