We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc5179a commit 1e3b862Copy full SHA for 1e3b862
javascript/ql/test/query-tests/Security/CWE-079/DomBasedXssWithResponseThreat/testReactRelay.tsx
@@ -0,0 +1,22 @@
1
+import React from 'react';
2
+import { useFragment } from 'react-relay';
3
+
4
+const CommentComponent = ({ commentRef }) => {
5
+ const commentData = useFragment(
6
+ graphql`
7
+ fragment CommentComponent_comment on Comment {
8
+ id
9
+ text
10
+ }
11
+ `,
12
+ commentRef
13
+ ); // $ MISSING: Source=[js/xss]
14
15
+ return (
16
+ <div>
17
+ <h3>Comment:</h3>
18
+ {/* Directly rendering user input without sanitation */}
19
+ <p dangerouslySetInnerHTML = {{ __html: commentData.text}}> {commentData.text}</p> // $ MISSING: Alert=[js/xss]
20
+ </div>
21
+ );
22
+};
0 commit comments