Skip to content

Commit 83d77fa

Browse files
committed
Add test setup (temp) for xss-input-dangerouslySetInnerHTML
1 parent c1fdac0 commit 83d77fa

File tree

5 files changed

+77
-0
lines changed

5 files changed

+77
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
edges
2+
| src/App.tsx:7:10:7:13 | todo | src/App.tsx:7:10:7:13 | todo | provenance | |
3+
| src/App.tsx:7:10:7:13 | todo | src/App.tsx:27:46:27:49 | todo | provenance | |
4+
| src/App.tsx:12:22:12:45 | todoInp ... ?.value | src/App.tsx:12:22:12:51 | todoInp ... e \|\| "" | provenance | |
5+
| src/App.tsx:12:22:12:51 | todoInp ... e \|\| "" | src/App.tsx:7:10:7:13 | todo | provenance | |
6+
nodes
7+
| src/App.tsx:7:10:7:13 | todo | semmle.label | todo |
8+
| src/App.tsx:7:10:7:13 | todo | semmle.label | todo |
9+
| src/App.tsx:12:22:12:45 | todoInp ... ?.value | semmle.label | todoInp ... ?.value |
10+
| src/App.tsx:12:22:12:51 | todoInp ... e \|\| "" | semmle.label | todoInp ... e \|\| "" |
11+
| src/App.tsx:27:46:27:49 | todo | semmle.label | todo |
12+
subpaths
13+
#select
14+
| src/App.tsx:27:46:27:49 | todo | src/App.tsx:12:22:12:45 | todoInp ... ?.value | src/App.tsx:27:46:27:49 | todo | $@ is reinterpreted as HTML without escaping meta-characters. | src/App.tsx:12:22:12:45 | todoInp ... ?.value | DOM text |
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* @name DOM text reinterpreted as HTML
3+
* @description Reinterpreting text from the DOM as HTML
4+
* can lead to a cross-site scripting vulnerability.
5+
* @kind path-problem
6+
* @problem.severity warning
7+
* @security-severity 6.1
8+
* @precision high
9+
* @id js/xss-through-dom
10+
* @tags security
11+
* external/cwe/cwe-079
12+
* external/cwe/cwe-116
13+
*/
14+
15+
//an exact copy of - https://github.com/github/codeql/blob/main/javascript/ql/src/Security/CWE-079/XssThroughDom.ql
16+
//included for testing purposes only
17+
18+
import javascript
19+
import semmle.javascript.security.dataflow.XssThroughDomQuery
20+
import XssThroughDomFlow::PathGraph
21+
22+
from XssThroughDomFlow::PathNode source, XssThroughDomFlow::PathNode sink
23+
where
24+
XssThroughDomFlow::flowPath(source, sink) and
25+
not isIgnoredSourceSinkPair(source.getNode(), sink.getNode())
26+
select sink.getNode(), source, sink,
27+
"$@ is reinterpreted as HTML without escaping meta-characters.", source.getNode(), "DOM text"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
XssThroughDom.ql
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
lockVersion: 1.0.0
3+
dependencies:
4+
codeql/concepts:
5+
version: 0.0.7
6+
codeql/controlflow:
7+
version: 2.0.17
8+
codeql/dataflow:
9+
version: 2.0.17
10+
codeql/javascript-all:
11+
version: 2.6.13
12+
codeql/mad:
13+
version: 1.0.33
14+
codeql/regex:
15+
version: 1.0.33
16+
codeql/ssa:
17+
version: 2.0.9
18+
codeql/threat-models:
19+
version: 1.0.33
20+
codeql/tutorial:
21+
version: 1.0.33
22+
codeql/typetracking:
23+
version: 2.0.17
24+
codeql/util:
25+
version: 2.0.20
26+
codeql/xml:
27+
version: 1.0.33
28+
codeql/yaml:
29+
version: 1.0.33
30+
compiled: false
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: advanced-security/javascript-sap-ui5-webcomponents-for-react-test
2+
version: 2.3.0
3+
extractor: javascript
4+
dependencies:
5+
codeql/javascript-all: "^2.4.0"

0 commit comments

Comments
 (0)