Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Should CDN example on Download documentation page contain Subresource Integrity info? #13968

Open
@hakanson

Description

@hakanson

https://docs.angularjs.org/misc/downloading which is sourced from downloading.ngdoc contains a "Including angular scripts from the Google CDN" section with this example for downloading from the Google CDN server:

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>

With Subresource Integrity available in some browsers, should this example be updated to include an integrity attribute?

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"
        integrity="sha384-hXNI9Cb8OJC3+q10tEC7RUzaDEWKjIQiE1lg+tFIrttefIG+ScUCKqOlQVEqcmM0"
        crossorigin="anonymous"></script>

This value was determined by downloading the minified 1.4.5 file and computing the hash using:

wget https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js 
cat angular.min.js | openssl dgst -sha384 -binary | openssl enc -base64 -A

This is a good suggestion from a security perspective, but requires the documentation to be updated with a new integrity attribute along with every version change. It also would require the developer to understand the purpose of this attribute value, because if they copy that example and only change 1.4.5 to 1.4.6, the script will not load and the developer will get a potentially confusing error in the Console like:

Failed to find a valid digest in the 'integrity' attribute for resource 'https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.min.js' with computed SHA-256 integrity 'RIkiUZXLM0fYBgxgKBSCPnFxlu37oguHYe96c9t+HAg='. The resource has been blocked.

However, I would like to see the hashed for Subresource Integrity published somewhere, even if the Download documentation isn't the right place.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions