File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed
javascript/ql/test/query-tests/Security/CWE-079/DomBasedXssWithResponseThreat Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 92
92
| testReactRelay.tsx:136:16:136:39 | readFra ... y, key) | semmle.label | readFra ... y, key) |
93
93
| testReactRelay.tsx:137:50:137:53 | data | semmle.label | data |
94
94
subpaths
95
+ testFailures
96
+ | test.ts:8:82:8:92 | // $ Source | Missing result: Source |
97
+ | test.ts:21:79:21:88 | // $ Alert | Missing result: Alert |
98
+ | test.ts:24:94:24:103 | // $ Alert | Missing result: Alert |
Original file line number Diff line number Diff line change
1
+ import { QueryClient , injectQuery } from '@tanstack/angular-query-experimental'
2
+ import { HttpClient } from '@angular/common/http'
3
+
4
+ class ServiceOrComponent {
5
+ query = injectQuery ( ( ) => ( {
6
+ queryKey : [ 'repoData' ] ,
7
+ queryFn : ( ) =>
8
+ this . #http. get < Response > ( 'https://api.github.com/repos/tanstack/query' ) , // $ Source
9
+ } ) )
10
+
11
+ #http: {
12
+ get : < T > ( url : string ) => Promise < T >
13
+ } ;
14
+
15
+ constructor ( http : HttpClient ) {
16
+ this . #http = http ;
17
+ }
18
+
19
+ displayRepoDetails ( ) {
20
+ this . query . data . then ( response => {
21
+ document . getElementById ( 'repoInfo' ) . innerHTML = response . description ; // $ Alert
22
+
23
+ const detailsElement = document . createElement ( 'div' ) ;
24
+ detailsElement . innerHTML = `<h2>${ response . name } </h2><p>${ response . owner . bio } </p>` ; // $ Alert
25
+ document . body . appendChild ( detailsElement ) ;
26
+ } ) ;
27
+ }
28
+ }
29
+
30
+ interface Response {
31
+ name : string ;
32
+ description : string ;
33
+ stargazers_count : number ;
34
+ owner : {
35
+ bio : string ;
36
+ }
37
+ }
You can’t perform that action at this time.
0 commit comments