Subresource Integrity (SRI) provides a method to protect website delivery. It provides a mechanism to check the integrity of the resource hosted by third parties interface plug-ins. The plug-ins might include Content Delivery Networks (CDNs). This method verifies if the fetched resource has been delivered to the user without unexpected manipulation. This method ensures these assets have not been compromised for hostile purposes. SubResource Integrity cannot mitigate all risks in the application. A 3rd party javascript could access information from the end-users. Subresource integrity was introduced by scan and verify fetched files. An integrity value starts with at least one string. Each string contains a prefix that indicates hash algorithm. An integrity value may have multiple hashes, separated by whitespaces.
The below code is an example of integrity string with base64-encoded sha384 hash.
An attacker can gain access to Content Delivery Networks and cause huge damage to the application. If the attacker is one of the persons who had developed one of the CDN used by the application. He can gain access to your system by tweaking the content from CDN.
Beagle recommends the following:-