File tree Expand file tree Collapse file tree
javascript/frameworks/ui5
lib/advanced_security/javascript/frameworks/ui5/dataflow
test/queries/UI5Xss/xss-custom-control-api2/webapp/control Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,6 +61,19 @@ class LocalModelContentBoundBidirectionallyToHtmlISinkControl extends DomBasedXs
6161 UI5Control getControlDeclaration ( ) { result = controlDeclaration }
6262}
6363
64+ class LocalModelStringPropertySource extends DomBasedXss:: Source {
65+ LocalModelStringPropertySource ( ) {
66+ exists ( UI5BindingPath bindingPath |
67+ this =
68+ bindingPath
69+ .getControlDeclaration ( )
70+ .getDefinition ( )
71+ .getMetadata ( )
72+ .getProperty ( bindingPath .getPropertyName ( ) )
73+ )
74+ }
75+ }
76+
6477module UI5PathGraph< PathNodeSig ConfigPathNode, PathGraphSig< ConfigPathNode > ConfigPathGraph> {
6578 private newtype TNode =
6679 TUI5BindingPathNode ( UI5BindingPath path ) or
Original file line number Diff line number Diff line change 11sap . ui . define ( [
2- "sap/ui/core/Control"
3- ] , function ( Control ) {
2+ "sap/ui/core/Control" , 'sap/base/security/encodeXML'
3+ ] , function ( Control , EncodeXML ) {
44 return Control . extend ( "codeql-sap-js.control.xss" , {
55 metadata : {
66 properties : {
7- text : { type : "string" }
7+ text : { type : "string" } ,
8+ text2 : { type : "string" }
89 }
910 } ,
1011 renderer : {
@@ -13,6 +14,13 @@ sap.ui.define([
1314 oRm . openStart ( "div" , oControl ) ;
1415 oRm . unsafeHtml ( oControl . getText ( ) ) ; // XSS sink RenderManager.unsafeHtml
1516 oRm . close ( "div" ) ;
17+
18+ oRm . write ( `
19+ <div>
20+ <div>${ oControl . getText2 ( ) } </div>
21+ <div>${ EncodeXML ( oControl . getText2 ( ) ) } </div>
22+ </div>
23+ ` . trim ( ) ) ;
1624 }
1725 }
1826 } ) ;
You can’t perform that action at this time.
0 commit comments