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

feat(security): explicitly whitelist URL schemes for bootstrap. #15427

Merged
merged 1 commit into from
Nov 23, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/Angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -1455,12 +1455,20 @@ function allowAutoBootstrap(document) {
link.href = src;
var scriptProtocol = link.protocol;
var docLoadProtocol = document.location.protocol;
if ((scriptProtocol === 'resource:' ||
scriptProtocol === 'chrome-extension:') &&
docLoadProtocol !== scriptProtocol) {
return false;
if (docLoadProtocol === scriptProtocol) {
return true;
}
switch(scriptProtocol) {
case 'http:':
case 'https:':
case 'ftp:':
case 'blob:':
case 'file:':
case 'data:':
return true;
default:
return false;
}
return true;
}

// Cached as it has to run during loading so that document.currentScript is available.
Expand Down