11import javascript
22import advanced_security.javascript.frameworks.ui5.dataflow.DataFlow as UI5DataFlow
33import advanced_security.javascript.frameworks.ui5.UI5View
4- import semmle.javascript.security.dataflow.DomBasedXssQuery as DomBasedXss
4+ private import semmle.javascript.security.dataflow.DomBasedXssQuery as DomBasedXss
55
6- class Configuration extends DomBasedXss :: Configuration {
7- override predicate isSource ( DataFlow:: Node start ) {
8- super . isSource ( start )
6+ module UI5Xss implements DataFlow :: ConfigSig {
7+ predicate isSource ( DataFlow:: Node start ) {
8+ DomBasedXss :: DomBasedXssConfig :: isSource ( start , _ )
99 or
1010 start instanceof RemoteFlowSource
1111 }
1212
13- override predicate isAdditionalFlowStep (
14- DataFlow:: Node start , DataFlow:: Node end , DataFlow:: FlowLabel inLabel ,
15- DataFlow:: FlowLabel outLabel
16- ) {
17- /* Already an additional flow step defined in `DomBasedXssQuery::Configuration` */
18- super .isAdditionalFlowStep ( start , end , inLabel , outLabel )
19- or
20- /* TODO: Legacy code */
21- /* Handler argument node to handler parameter */
22- exists ( UI5Handler h |
23- start = h .getBindingPath ( ) .getNode ( ) and
24- /*
25- * Ideally we would like to show an intermediate node where
26- * the handler is bound to a control, but there is no sourceNode there
27- * `end = h.getBindingPath() or start = h.getBindingPath()`
28- */
29-
30- end = h .getParameter ( 0 )
31- )
32- }
33-
34- override predicate isBarrier ( DataFlow:: Node node ) {
13+ predicate isBarrier ( DataFlow:: Node node ) {
3514 /* 1. Already a sanitizer defined in `DomBasedXssQuery::Configuration` */
36- super . isSanitizer ( node )
15+ DomBasedXss :: DomBasedXssConfig :: isBarrier ( node )
3716 or
3817 /* 2. Value read from a non-string control property */
3918 exists ( PropertyMetadata m | not m .isUnrestrictedStringType ( ) | node = m )
@@ -53,10 +32,28 @@ class Configuration extends DomBasedXss::Configuration {
5332 [ "encodeCSS" , "encodeJS" , "encodeURL" , "encodeURLParameters" , "encodeXML" , "encodeHTML" ]
5433 }
5534
56- override predicate isSink ( DataFlow:: Node node ) {
35+ predicate isSink ( DataFlow:: Node node ) {
5736 node instanceof UI5ExtHtmlISink or
5837 node instanceof UI5ModelHtmlISink
5938 }
39+
40+ predicate isAdditionalFlowStep ( DataFlow:: Node start , DataFlow:: Node end ) {
41+ /* Already an additional flow step defined in `DomBasedXssQuery::Configuration` */
42+ DomBasedXss:: DomBasedXssConfig:: isAdditionalFlowStep ( start , _, end , _)
43+ or
44+ /* TODO: Legacy code */
45+ /* Handler argument node to handler parameter */
46+ exists ( UI5Handler h |
47+ start = h .getBindingPath ( ) .getNode ( ) and
48+ /*
49+ * Ideally we would like to show an intermediate node where
50+ * the handler is bound to a control, but there is no sourceNode there
51+ * `end = h.getBindingPath() or start = h.getBindingPath()`
52+ */
53+
54+ end = h .getParameter ( 0 )
55+ )
56+ }
6057}
6158
6259/**
0 commit comments