Add Subresource Integrity hashes to enqueued scripts and styles, approve changed files before they are trusted, and scan pages for missing SRI.
SRI Shield records a cryptographic hash (an SRI hash) for each enqueued script and stylesheet the first time it is served, and adds the integrity and crossorigin attributes to its tag. A visitorβs browser compares each file it downloads with that hash and refuses to use a file whose content does not match.
Changed files wait for your approval. When a protected fileβs content changes β after a theme, plugin, or WordPress update, or because the file was modified β SRI Shield keeps serving the previously trusted hash and flags the change for review. Browsers refuse the changed file until an administrator compares the trusted and proposed hashes and either approves the new hash or keeps the trusted one. SRI Shield never re-trusts a changed file on its own.
What SRI does and does not do. SRI confirms that a fileβs content matches a hash; it does not judge whether a file is safe. The first hash for each file is taken from the content the file has at that moment, so a file that was already compromised when it was first hashed is not detected. Generating hashes automatically is not, by itself, protection against malicious changes β that is why changes require review.
integrity and crossorigin attributes are added to the fileβs tag.Hash Records > Changes Awaiting Review with the trusted and proposed hashes side by side. Approve the new hash once you have confirmed the change is expected, or keep the trusted hash.Automatic SRI Enrollment β Generates SRI hashes for enqueued CSS and JavaScript the first time they are served and injects the integrity and crossorigin attributes through WordPress loader hooks.
Change Review β When a protected fileβs content changes, the trusted hash stays in place and the change waits for an administrator. Approving re-fetches the file and succeeds only if it still produces the exact hash you reviewed. Every approval and dismissal is recorded in the Logs.
Local, CDN & Remote File Support β Covers assets hosted on your own site and assets hosted on CDNs and other remote services, when they are accessible from your server.
Three Hash Algorithms β Choose SHA-256, SHA-384, or SHA-512. SHA-384 is the default and is recommended for almost all sites. Changing the algorithm re-encodes a stored hash only after the fileβs content is confirmed unchanged.
Change Detection β Optionally checks local files for changes (modification time and size) as pages load, so changed files are flagged without waiting for a scan.
Stored Hashes β Hashes are stored in a database table (with a short-lived cache for remote files) and reused, so files are not re-hashed on every visit.
Website Scanner β Fetches your home page and recent posts and pages and analyzes the HTML your server returns. Every script and stylesheet tag on every page is checked on its own, so a file that is protected on one page and unprotected on another is reported on the page where it is unprotected. Results: Valid, Missing, Invalid attribute, Hash mismatch, Crossorigin missing, or Unreachable. Scan depth is adjustable from 1 to 200 pages per run (default 25).
Email Alerts β Sends a responsive HTML email when a scan finds a problem, to the address you choose (your site admin email by default).
Hash Records β Every enrolled file with its URL, type, algorithm, trusted integrity hash, status, and last-updated time, plus a Copy button for the hash and the list of changes awaiting review.
Hash an External URL β Enter the address of an external file to hash it on demand. If the URL is already stored, it is re-checked instead and any change waits for review.
Exclusions β Skip specific assets by handle, or exclude and re-include individual files from Hash Records.
Activity Logs β A record of plugin activity, including every hash approval and dismissal, with export, plus optional structured debug logging.
Maintenance Tools β Reset Cache (clears cached lookups and failed-asset records; trusted hashes and pending reviews are kept) and Re-check Hashes (hashes every registered asset again; changes are flagged for review).
Optional Admin Coverage β Extend integrity attributes to the WordPress admin area as well as the public site.
Multisite Ready β Multisite-compatible activation, and it cleans up after itself on uninstall.
Developer Hooks β Filters and actions to override the algorithm per handle, exclude handles dynamically, change the crossorigin attribute, add scan URLs, customize alert emails, and react to scan, change, and approval events.
Run a scan and every script and stylesheet on your checked pages, plus every stored hash record, gets a result:
crossorigin attribute, so browsers cannot verify it and refuse to load it.Scanner scope: the scanner analyzes the HTML your server returns. It does not run JavaScript, so scripts and stylesheets added at runtime β for example by tag managers, consent tools, or lazy loaders β are not detected. It also cannot check whether a remote host sends the CORS headers that cross-origin SRI requires.
The Scanner keeps a short history of recent scans, and stored results can be cleared whenever you like.
Alert emails are fully brandable from the Notifications screen:
SRI Shield is an administrative tool. Every screen, setting, and review action is restricted to users who can manage site options β the Administrator role on a standard WordPress site. Editors, Authors, Contributors, Subscribers, and visitors never see the pluginβs controls and cannot approve hash changes.
SRI Shield runs inside your own WordPress site. To do its job, it makes the following requests from your server:
Below are commonly used extension points.
add_filter( 'sri_shield_enabled', function ( $enabled ) {
return $enabled;
} );
add_filter( 'sri_shield_excluded_handles', function ( $handles ) {
$handles[] = 'my-dynamic-handle';
return $handles;
} );
add_filter( 'sri_shield_hash_algorithm', function ( $algorithm, $handle, $url, $type ) {
if ( 'critical-script' === $handle ) {
return 'sha512';
}
return $algorithm;
}, 10, 4 );
add_filter( 'sri_shield_crossorigin_attribute', function ( $crossorigin, $handle ) {
if ( 'local-only-asset' === $handle ) {
return '';
}
return $crossorigin;
}, 10, 2 );
Applied when an asset is first enrolled and when an administrator approves a change.
add_filter( 'sri_shield_generated_hash', function ( $integrity, $handle ) {
return $integrity;
}, 10, 2 );
add_action( 'sri_shield_hash_generated', function ( $handle, $record ) {
// An asset was enrolled.
}, 10, 2 );
add_action( 'sri_shield_hash_failed', function ( $handle, $record ) {
// Alerting.
}, 10, 2 );
add_action( 'sri_shield_asset_changed', function ( $record, $context ) {
// Content no longer matches the trusted hash; $record['pending_integrity'] holds the proposed hash.
}, 10, 2 );
add_action( 'sri_shield_hash_approved', function ( $record, $previous_integrity, $user_id ) {
// An administrator approved a change.
}, 10, 3 );
add_action( 'sri_shield_hash_change_dismissed', function ( $record, $user_id ) {
// An administrator kept the trusted hash.
}, 10, 2 );
add_action( 'sri_shield_cache_cleared', function () {
// External cache sync.
} );
add_action( 'sri_shield_tamper_detected', function ( $finding ) {
// Fired for each hash mismatch. $finding includes page_url, asset_url, declared_integrity, expected_integrity, etc.
} );
add_action( 'sri_shield_scan_completed', function ( $summary, $findings ) {
// Fired once per scan with the run summary and problem findings.
}, 10, 2 );
add_filter( 'sri_shield_scan_urls', function ( $urls ) {
$urls[] = home_url( '/checkout/' );
return $urls;
} );
add_filter( 'sri_shield_email_subject', function ( $subject, $summary, $findings ) {
return $subject;
}, 10, 3 );
add_filter( 'sri_shield_email_recipient', function ( $recipient ) {
return $recipient;
} );