Skip to content

Commit dc28bb5

Browse files
committed
JS: Fix alert location and use RelatedLocation in InsecureUrlWhitelist
1 parent a1c13f0 commit dc28bb5

File tree

1 file changed

+7
-7
lines changed
  • javascript/ql/test/query-tests/AngularJS/InsecureUrlWhitelist

1 file changed

+7
-7
lines changed
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
angular.module('myApp', [])
22
.config(function($sceDelegateProvider) {
33
$sceDelegateProvider.resourceUrlWhitelist([
4-
"**://example.com/*", // $ Alert - (exploit: http://evil.com/?ignore=://example.org/a or javascript:alert(1);://example.org/a)
5-
"*://example.org/*", // $ Alert - (exploit: javascript://example.org/a%0A%0Dalert(1) using a linebreak to end the comment starting with "//"!)
6-
"https://**.example.com/*", // $ Alert - exploit: https://evil.com/?ignore=://example.com/a
7-
"https://example.**", // $ Alert - exploit: https://example.evil.com or http://example.:[email protected]
8-
"https://example.*", // $ Alert - exploit: https://example.UnexpectedTLD
4+
"**://example.com/*", // $ RelatedLocation - (exploit: http://evil.com/?ignore=://example.org/a or javascript:alert(1);://example.org/a)
5+
"*://example.org/*", // $ RelatedLocation - (exploit: javascript://example.org/a%0A%0Dalert(1) using a linebreak to end the comment starting with "//"!)
6+
"https://**.example.com/*", // $ RelatedLocation - exploit: https://evil.com/?ignore=://example.com/a
7+
"https://example.**", // $ RelatedLocation - exploit: https://example.evil.com or http://example.:[email protected]
8+
"https://example.*", // $ RelatedLocation - exploit: https://example.UnexpectedTLD
99

1010
"https://example.com",
1111
"https://example.com/**",
@@ -19,6 +19,6 @@ angular.module('myApp', [])
1919
"https://*.example.com",
2020

2121
// not flagged:
22-
/http:\/\/www.example.org/g // $ Alert - (exploit http://wwwaexample.org (dots are not escaped))
23-
]);
22+
/http:\/\/www.example.org/g // $ MISSING: RelatedLocation - (exploit http://wwwaexample.org (dots are not escaped))
23+
]); // $ Alert
2424
});

0 commit comments

Comments
 (0)