Verify Subresource Integrity for Versioned Website Assets
Subresource Integrity lets a browser check a fetched script or stylesheet against a digest. A mismatch blocks the resource. Pinning the file and its integrity metadata to the same release is important.
Choose a stable file
On staging identify a versioned asset with known bytes. Compute the supported integrity value using an approved build process. A hexadecimal checksum is not the Base64 digest notation expected by HTML integrity metadata. Record the filename and digest format.
Test the expected response
For another origin, confirm CORS and the appropriate crossorigin attribute. Inspect the browser network and console. On your own staging fixture, check failure behavior with an intentionally mismatched digest and restore the approved metadata before continuing.
Keep URLs and hashes together
Deploy the new versioned URL and matching digest as one reviewed change. Recheck critical flows and keep the previous matching pair for rollback. If a supplier changes an unversioned asset unexpectedly, inspect the changed file before approving its bytes.
Related Ferkesh Knowledge Base guides
- How Content Security Policy Affects Website Resources
- How to Verify a Backup Archive Checksum Before Restoring
Ferkesh Tools
Official references
Last reviewed .
Zpětná vazba byla odeslána!