-
Notifications
You must be signed in to change notification settings - Fork 3
Extend bindings modeling #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 45 commits
d0f9ac1
7e34a50
8fc7310
276664f
149d64a
34c0093
b599ada
751981f
d7d23d4
e108f54
e521396
49e7d71
e37fb86
969f8a4
78f69fb
db28c78
f95dc01
ee0dcda
0813a1e
c8b05ed
1fa88f2
54945ae
d656503
979d14b
d7c5cfb
b1b7ced
b3b49bf
2e413a9
41714aa
d9da3cc
10fd422
b88fa58
b39c64a
9522319
a3856b2
8c90643
4271a25
3b90c42
26221fd
067f34c
d2e1c1b
a59d696
1c82a52
05e043e
22530c6
8248bfe
a52c867
70f105f
952d3c2
6d6eb47
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| | test.js:1:30:1:45 | {/foo/bar/baz} | | ||
| | test.js:2:30:2:44 | {foo/bar/baz} | | ||
| | test.js:4:41:4:62 | {model>/foo/bar/baz} | | ||
| | test.js:5:41:5:61 | {model>foo/bar/baz} | | ||
| | test.js:7:41:7:98 | {path : /foo/bar/baz, type : "sap.ui.model.type.String"} | | ||
| | test.js:8:41:8:97 | {path : foo/bar/baz, type : "sap.ui.model.type.String"} | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import javascript | ||
| import advanced_security.javascript.frameworks.ui5.Bindings | ||
| import advanced_security.javascript.frameworks.ui5.BindingStringParser as Make | ||
|
|
||
| class BindingStringReader extends StringLiteral { | ||
| BindingStringReader() { | ||
| this.getValue().matches("{%}") | ||
| } | ||
|
|
||
| string getBindingString() { | ||
| result = this.getValue() | ||
| } | ||
| } | ||
|
|
||
| module BindingStringParser = Make::BindingStringParser<BindingStringReader>; | ||
|
|
||
| from BindingStringParser::Binding binding | ||
| select binding | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| const simple_absolute_path = '{/foo/bar/baz}'; | ||
| const simple_relative_path = '{foo/bar/baz}'; | ||
|
|
||
| const simple_absolute_path_with_model = '{model>/foo/bar/baz}'; | ||
| const simple_relative_path_with_model = '{model>foo/bar/baz}'; | ||
|
|
||
| const simple_absolute_with_properties = "{path: '/foo/bar/baz', type: 'sap.ui.model.type.String'}"; | ||
| const simple_relative_with_properties = "{path: 'foo/bar/baz', type: 'sap.ui.model.type.String'}"; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| | test.html:5:11:5:31 | XML property binding: data-value to {/input} | | ||
| | test.html:8:11:8:33 | XML property binding: data-content to {/input} | | ||
| | test.js:10:20:10:33 | Early JavaScript property binding: {\\n ... } to "{/root/name}" | | ||
| | test.js:21:28:21:34 | JavaScript context binding: oInput to "/root" | | ||
| | test.js:23:38:23:43 | Late JavaScript property binding: value to "name" | | ||
| | test.js:26:60:34:9 | Early JavaScript property binding: {\\n ... } to {\\n ... } | | ||
| | test.js:38:48:44:9 | Late JavaScript property binding: value to {\\n ... } | | ||
| | test.js:48:19:48:42 | Early JavaScript property binding: {\\n ... } to "{/#foo ... label}" | | ||
| | test.json:9:21:9:29 | JSON property binding: items to {/Base} | | ||
| | test.json:15:30:15:38 | JSON property binding: value to {input} | | ||
| | test.json:19:32:19:78 | JSON property binding: content to {path : /input, formatter : ".valueFormatter"} | | ||
| | test.xml:2:5:2:28 | XML property binding: value to {foo} | | ||
| | test.xml:3:5:3:29 | XML property binding: value to {/foo} | | ||
| | test.xml:4:5:4:34 | XML property binding: value to {model>foo} | | ||
| | test.xml:5:5:5:35 | XML property binding: value to {model>/foo} | | ||
| | test.xml:6:5:8:29 | XML context binding: binding to {/root} | | ||
| | test.xml:6:5:8:29 | XML property binding: value to {foo} | | ||
| | test.xml:9:5:9:70 | XML property binding: value to {path : foo, type : "sap.ui.model.type.String"} | | ||
| | test.xml:10:5:10:71 | XML property binding: value to {path : /foo, type : "sap.ui.model.type.String"} | | ||
| | test.xml:11:5:11:77 | XML property binding: value to {path : model>/foo, type : "sap.ui.model.type.String"} | | ||
| | test.xml:12:5:12:76 | XML property binding: value to {path : model>foo, type : "sap.ui.model.type.String"} | | ||
| | test.xml:14:5:22:45 | XML property binding: value to {parts : [{path : foo}, {path : bar/baz}, {path : quux}], formatter : "some.formatter"} | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import javascript | ||
| import advanced_security.javascript.frameworks.ui5.Bindings | ||
|
|
||
| select any(Binding b) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <template data-controller-name="codeql-sap-js.controller.app"> | ||
| <div data-sap-ui-type="sap.m.Input" | ||
| data-placeholder="Enter Payload" | ||
| data-description="Try: <img src=x onerror=alert("XSS")>" | ||
| data-value="{/input}"> | ||
| </div> | ||
| <div data-sap-ui-type="sap.ui.core.HTML" | ||
| data-content="{/input}"> | ||
| </div> | ||
| </template> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| sap.ui.define([ | ||
| "sap/ui/core/mvc/Controller" | ||
| ], function(Controller) { | ||
| "use strict"; | ||
|
|
||
| return Controller.extend("foo", { | ||
| onInit: function() { | ||
| // Early property binding | ||
| var oInputWithEarlyPropertyBinding = new sap.m.Input({ | ||
Check noticeCode scanning / CodeQL Unused variable, import, function or class
Unused variable oInputWithEarlyPropertyBinding.
|
||
| value: "{/root/name}" | ||
| }); | ||
|
|
||
| // Early dynamic property binding | ||
| const model = "model"; | ||
| var oInputWithEarlyDynamicPropertyBinding = new sap.m.Input({ | ||
Check noticeCode scanning / CodeQL Unused variable, import, function or class
Unused variable oInputWithEarlyDynamicPropertyBinding.
|
||
| value: "{" + model + "</root/name}" | ||
| }); | ||
|
|
||
| var oInputWithLateBinding = this.byId("foo"); | ||
Check noticeCode scanning / CodeQL Unused variable, import, function or class
Unused variable oInputWithLateBinding.
|
||
| // Late context binding | ||
| oInput.bindElement("/root"); | ||
| // Late property binding | ||
| oInput.bindProperty("value", "name"); | ||
|
|
||
| // Early composite binding | ||
| var oInputWithEarlyContextBinding = new sap.m.Input({ | ||
Check noticeCode scanning / CodeQL Unused variable, import, function or class
Unused variable oInputWithEarlyContextBinding.
|
||
| value: { | ||
| parts: [ | ||
| { path: "/foo", type: new sap.ui.model.type.String() }, | ||
| { path: "/bar" }, | ||
| { path: "baz>/quux", type: new sap.ui.model.type.Float() } | ||
| ] | ||
| } | ||
| }); | ||
|
|
||
| // Late composite binding | ||
| var oInputWithLateContextBinding = this.byId("foo"); | ||
| oInputWithLateContextBinding.bindValue({ | ||
| parts: [ | ||
| { path: "/foo", type: new sap.ui.model.type.String() }, | ||
| { path: "/bar" }, | ||
| { path: "baz>/quux", type: new sap.ui.model.type.Float() } | ||
| ] | ||
| }); | ||
|
|
||
| // Early property metadata binding | ||
| var oLabel = new sap.m.Label({ | ||
Check noticeCode scanning / CodeQL Unused variable, import, function or class
Unused variable oLabel.
|
||
| text: "{/#foo/bar/@sap:label}" | ||
| }); | ||
| } | ||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "Type": "sap.ui.core.mvc.JSONView", | ||
| "controllerName": "codeql-sap-js.controller.app", | ||
| "content": [ | ||
| { | ||
| "Type": "sap.ui.commons.Carousel", | ||
| "width": "100%", | ||
| "orientation": "horizontal", | ||
| "items":"{/Base}", | ||
| "content": [ | ||
| { | ||
| "Type": "sap.m.Input", | ||
| "placeholder": "Enter Payload", | ||
| "description": "Try: <img src=x onerror=alert(\"XSS\")>", | ||
| "value": "{input}" | ||
| }, | ||
| { | ||
| "Type": "sap.ui.core.HTML", | ||
| "content": "{path:'/input', formatter: '.valueFormatter'}" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"> | ||
| <Input value="{foo}" /> | ||
| <Input value="{/foo}" /> | ||
| <Input value="{model>foo}" /> | ||
| <Input value="{model>/foo}" /> | ||
| <Input | ||
| value="{foo}" | ||
| binding="{/root}" /> | ||
| <Input value="{path: 'foo', type: 'sap.ui.model.type.String'}" /> | ||
| <Input value="{path: '/foo', type: 'sap.ui.model.type.String'}" /> | ||
| <Input value="{path: 'model>/foo', type: 'sap.ui.model.type.String'}" /> | ||
| <Input value="{path: 'model>foo', type: 'sap.ui.model.type.String'}" /> | ||
|
|
||
| <Input | ||
| value="{ | ||
| parts: | ||
| [ | ||
| {path: 'foo'}, | ||
| {path: 'bar/baz'}, | ||
| {path: 'quux'} | ||
| ], | ||
| formatter: 'some.formatter'}" /> | ||
| </mvc:View> |
Uh oh!
There was an error while loading. Please reload this page.