Subresource Integrity (SRI)

Subresource Integrity (SRI)

πŸ“Œ Subresource Integrity (SRI) Summary

Subresource Integrity (SRI) is a security feature that helps ensure files loaded from third-party sources, such as JavaScript libraries or stylesheets, have not been tampered with. It works by allowing website developers to provide a cryptographic hash of the file they expect to load. When the browser fetches the file, it checks the hash. If the file does not match, the browser refuses to use it. This helps protect users from malicious code being injected into trusted libraries or resources.

πŸ™‹πŸ»β€β™‚οΈ Explain Subresource Integrity (SRI) Simply

Imagine you order a new phone online and the shop tells you the exact weight it should be. When it arrives, you weigh it. If the weight is wrong, you know something is off and do not use it. SRI works the same way for website files, checking that what you get is exactly what you expected.

πŸ“… How Can it be used?

Subresource Integrity can be used to secure third-party scripts on your website, preventing compromised files from running.

πŸ—ΊοΈ Real World Examples

A web developer links to a popular JavaScript library like jQuery from a CDN. They add an SRI hash to the script tag. If an attacker tries to alter the library on the CDN, the browser detects the change and blocks the script, keeping the website safe.

A company embeds a CSS framework from an external source in its customer portal. By including an SRI attribute with the correct hash, the browser ensures the stylesheet has not been modified before applying it, protecting the site’s appearance and user experience.

βœ… FAQ

What is Subresource Integrity and why is it important for websites?

Subresource Integrity, or SRI, is a way to make sure that files like scripts and stylesheets loaded from other websites have not been changed by anyone with bad intentions. It helps protect both the website and its visitors from harmful code by checking if the file matches a known signature. If something is not right, the browser will block the file, keeping the site safer.

How does Subresource Integrity work when loading third-party scripts?

When you use SRI, you add a special code called a hash to your script or link tag. This hash is like a fingerprint for the file. The browser checks the downloaded file against this fingerprint. If everything matches, the file loads as normal. If it does not, the browser will stop the file from running, so only safe files are used.

Do I need to update the SRI hash if the third-party file changes?

Yes, you do. If the file you are linking to is updated or changed, its fingerprint will also change. You will need to update the SRI hash in your website code so that the browser knows what to expect. If you forget, the browser will block the file because it thinks something might be wrong.

πŸ“š Categories

πŸ”— External Reference Links

Subresource Integrity (SRI) link

πŸ‘ Was This Helpful?

If this page helped you, please consider giving us a linkback or share on social media! πŸ“Ž https://www.efficiencyai.co.uk/knowledge_card/subresource-integrity-sri

Ready to Transform, and Optimise?

At EfficiencyAI, we don’t just understand technology β€” we understand how it impacts real business operations. Our consultants have delivered global transformation programmes, run strategic workshops, and helped organisations improve processes, automate workflows, and drive measurable results.

Whether you're exploring AI, automation, or data strategy, we bring the experience to guide you from challenge to solution.

Let’s talk about what’s next for your organisation.


πŸ’‘Other Useful Knowledge Cards

Data Quality Checks

Data quality checks are processes that help ensure the information in a dataset is accurate, complete, and reliable. They involve looking for errors such as missing values, duplicate records, or values that do not make sense. By performing these checks, organisations can trust that their decisions based on the data are sound. These checks can be done automatically using software or manually by reviewing the data.

Cloud-Native Observability

Cloud-native observability is a way to monitor, understand and troubleshoot applications that run in cloud environments. It uses tools and techniques to collect data like logs, metrics and traces from different parts of an application, no matter where it is deployed. This helps teams quickly spot issues, measure performance and maintain reliability as their systems grow and change.

Architecture Scalability Planning

Architecture scalability planning is the process of designing technology systems so they can handle increased demand without major changes or disruptions. It involves anticipating growth in users, data, or workload and making sure the system can expand smoothly. This planning helps prevent performance issues and costly redesigns in the future.

Metadata Management Systems

Metadata Management Systems are tools or platforms that help organisations organise, store, and maintain information about their data, such as where it comes from, how it is used, and its meaning. These systems make it easier to track data sources, understand data quality, and ensure that everyone uses the same definitions. By providing a central place for metadata, they help people find and use data more efficiently and confidently.

API Security Strategy

An API security strategy is a plan to protect application programming interfaces (APIs) from unauthorised access and misuse. It includes steps to control who can access the API, how data is protected during transmission, and how to monitor for unusual activity. A good strategy helps prevent data leaks, fraud, and service outages by using security tools and best practices.