File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed
test/query-tests/Security/CWE-830 Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -69,16 +69,17 @@ module StaticCreation {
69
69
}
70
70
71
71
override string getProblem ( ) {
72
- result =
73
- "Script loaded from content delivery network with no integrity check."
72
+ result = "Script loaded from content delivery network with no integrity check."
74
73
}
75
74
}
76
75
77
76
/** An iframe element that includes untrusted content. */
78
77
class IframeElementWithUntrustedContent extends AddsUntrustedUrl instanceof HTML:: IframeElement {
79
78
IframeElementWithUntrustedContent ( ) { isUntrustedSourceUrl ( super .getSourcePath ( ) ) }
80
79
81
- override string getProblem ( ) { result = "HTML iframe element loaded using unencrypted connection." }
80
+ override string getProblem ( ) {
81
+ result = "HTML iframe element loaded using unencrypted connection."
82
+ }
82
83
}
83
84
}
84
85
Original file line number Diff line number Diff line change 13
13
scrpt2 . src = 'http://www.cdn.local/ga.js' ;
14
14
scrpt2 . integrity = 'sha256-h0UuK3mE9taiYlB5u9vT9A0s/XDgkfVd+F4VhN/sky=' ;
15
15
16
+ // NOT OK (http + ternary)
17
+ var scrpt3 = document . createElement ( 'script' ) ;
18
+ scrpt3 . type = 'text/javascript' ;
19
+ scrpt3 . src = ( 'https:' == document . location . protocol ? 'http://unsafe' : 'http://also-unsafe' ) + '.cdn.local/ga.js' ;
20
+
16
21
// NOT OK (http URL)
17
22
var ifrm = document . createElement ( 'iframe' ) ;
18
23
ifrm . src = 'http://www.example.com/' ;
27
32
}
28
33
var ifrm3 = document . createElement ( 'iframe' ) ;
29
34
ifrm3 . src = getUrl ( 'v123' ) ;
35
+
30
36
} ) ( ) ;
31
37
</ script >
32
38
</ head >
Original file line number Diff line number Diff line change 1
- | DynamicCreationOfUntrustedSourceUse.html:18:26:18:50 | 'http:/ ... e.com/' | HTML iframe element loaded using unencrypted connection. |
2
- | DynamicCreationOfUntrustedSourceUse.html:29:27:29:40 | getUrl('v123') | HTML iframe element loaded using unencrypted connection. |
1
+ | DynamicCreationOfUntrustedSourceUse.html:19:28:19:129 | ('https ... /ga.js' | HTML script element loaded using unencrypted connection. |
2
+ | DynamicCreationOfUntrustedSourceUse.html:23:26:23:50 | 'http:/ ... e.com/' | HTML iframe element loaded using unencrypted connection. |
3
+ | DynamicCreationOfUntrustedSourceUse.html:34:27:34:40 | getUrl('v123') | HTML iframe element loaded using unencrypted connection. |
3
4
| StaticCreationOfUntrustedSourceUse.html:6:9:6:56 | <script>...</> | HTML script element loaded using unencrypted connection. |
4
5
| StaticCreationOfUntrustedSourceUse.html:9:9:9:58 | <iframe>...</> | HTML iframe element loaded using unencrypted connection. |
5
6
| StaticCreationOfUntrustedSourceUse.html:21:9:21:155 | <script>...</> | Script loaded from content delivery network with no integrity check. |
You can’t perform that action at this time.
0 commit comments