π 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
Stack Smashing Protection
Stack smashing protection is a security feature built into many modern computer programs and operating systems. It helps prevent attackers from exploiting buffer overflows, which occur when a program writes more data to a block of memory, or stack, than it can hold. By adding extra checks and safeguards, stack smashing protection makes it much harder for malicious code to take over a program through this type of attack.
Document Automation in Ops
Document automation in operations is the use of software tools to automatically create, manage, and process documents needed for daily business tasks. This can include generating contracts, invoices, reports, or compliance paperwork without manual input. By automating repetitive document tasks, organisations save time, reduce errors, and ensure consistency across their paperwork.
Rowhammer Attacks
Rowhammer attacks are a type of cyberattack that target the physical memory chips in computers, especially DRAM. By rapidly and repeatedly accessing specific rows of memory, attackers can cause tiny electrical disturbances that flip bits in nearby rows. This can lead to unauthorised changes in data, potentially allowing attackers to bypass security measures or gain higher privileges.
Adaptive Learning Rates
Adaptive learning rates are techniques used in training machine learning models where the rate at which the model learns changes automatically during the training process. Instead of using a fixed learning rate, the algorithm adjusts the rate depending on how well the model is improving. This helps the model learn more efficiently, making faster progress when possible and slowing down to avoid missing important details.
Sentiment Analysis Tool
A sentiment analysis tool is a type of software that examines text, such as social media posts or customer reviews, to determine whether the feelings expressed are positive, negative, or neutral. It uses algorithms to process language and assign a sentiment score to each piece of text. Businesses and researchers often use these tools to quickly understand public opinion or customer satisfaction without having to read each comment individually.