-
Notifications
You must be signed in to change notification settings - Fork 3
Port UI5PathGraph to use the newer data flow API
#216
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a97afee
Parameterize UI5PathGraph on `PathNodeSig` and `PathGraphSig`
jeongsoolee09 17f2897
Port over `UI5Xss`
jeongsoolee09 c62ef21
Update expected results of UI5Xss
jeongsoolee09 7a9f335
Rename the second parameter to `ConfigPathGraph`
jeongsoolee09 781ae31
Port over UI5PathInjection
jeongsoolee09 54a8654
Merge branch 'main' into jeongsoolee09/port-UI5PathGraph
jeongsoolee09 5634682
Port over `UI5LogInjection`
jeongsoolee09 4c5b7f6
Remove commented out code
jeongsoolee09 32aba1c
Port over `UI5LogsToHttp`
jeongsoolee09 dbcdcbf
Port over `UI5UnsafeLogAccess`
jeongsoolee09 fbc03f5
Port over `UI5FormulaInjection`
jeongsoolee09 eae4c93
Update expected results of `UI5UnsafeLogAccess`
jeongsoolee09 9b09c02
Update expected results
jeongsoolee09 6df3a9e
Update expected results
jeongsoolee09 f7c00b7
Merge branch 'main' into jeongsoolee09/port-UI5PathGraph
jeongsoolee09 638a1cc
Port over `formulaSinkTest` and expected results
jeongsoolee09 803f57e
Merge branch 'jeongsoolee09/port-UI5PathGraph' of github.com:advanced…
jeongsoolee09 615c1b9
Update expected results of `formulaSinkTest`
jeongsoolee09 ab4bc8a
Replace `AmdModuleDefinition.getDependency/1`
jeongsoolee09 d748abf
Merge branch 'main' into jeongsoolee09/port-UI5PathGraph
jeongsoolee09 807e6fb
Merge branch 'main' into jeongsoolee09/port-UI5PathGraph
jeongsoolee09 1f93e3b
Merge branch 'main' into jeongsoolee09/port-UI5PathGraph
jeongsoolee09 8d7c49c
Merge branch 'jeongsoolee09/port-UI5PathGraph' of github.com:advanced…
jeongsoolee09 f541012
Demote `LogArgumentToListener` to a query-dependent flow step
jeongsoolee09 909ce39
Put back `LogArgumentToListener` to `FlowSteps.qll` and reference it …
jeongsoolee09 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
...t/frameworks/ui5/lib/advanced_security/javascript/frameworks/ui5/UI5LogInjectionQuery.qll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,13 @@ | ||
| import javascript | ||
| import advanced_security.javascript.frameworks.ui5.dataflow.DataFlow | ||
| private import advanced_security.javascript.frameworks.ui5.dataflow.DataFlow::UI5PathGraph | ||
| import semmle.javascript.security.dataflow.LogInjectionQuery as LogInjection | ||
| import semmle.javascript.security.dataflow.LogInjectionQuery | ||
|
|
||
| class UI5LogInjectionConfiguration extends LogInjection::LogInjectionConfiguration { | ||
| override predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource } | ||
| module UI5LogInjection implements DataFlow::ConfigSig { | ||
| predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource } | ||
|
|
||
| override predicate isSink(DataFlow::Node node) { | ||
| predicate isBarrier(DataFlow::Node node) { LogInjectionConfig::isBarrier(node) } | ||
|
|
||
| predicate isSink(DataFlow::Node node) { | ||
| node = ModelOutput::getASinkNode("ui5-log-injection").asSink() | ||
| } | ||
| } |
43 changes: 43 additions & 0 deletions
43
...ipt/frameworks/ui5/lib/advanced_security/javascript/frameworks/ui5/UI5LogsToHttpQuery.qll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import javascript | ||
| import advanced_security.javascript.frameworks.ui5.dataflow.DataFlow | ||
| import advanced_security.javascript.frameworks.ui5.UI5LogInjectionQuery | ||
|
|
||
| class ClientRequestInjectionVector extends DataFlow::Node { | ||
| ClientRequestInjectionVector() { | ||
| exists(ClientRequest req | | ||
| this = req.getUrl() or | ||
| this = req.getADataNode() | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| class UI5LogEntryFlowState extends string { | ||
| UI5LogEntryFlowState() { this = ["not-logged-not-accessed", "logged-and-accessed"] } | ||
| } | ||
|
|
||
| module UI5LogEntryToHttp implements DataFlow::StateConfigSig { | ||
| class FlowState = UI5LogEntryFlowState; | ||
|
|
||
| predicate isSource(DataFlow::Node node, FlowState state) { | ||
| node instanceof RemoteFlowSource and | ||
| state = "not-logged-not-accessed" | ||
| } | ||
|
|
||
| predicate isAdditionalFlowStep( | ||
| DataFlow::Node start, FlowState preState, DataFlow::Node end, FlowState postState | ||
| ) { | ||
| UI5LogInjection::isAdditionalFlowStep(start, end) and | ||
| preState = postState | ||
| or | ||
| exists(LogArgumentToListener logArgumentToListener | | ||
| logArgumentToListener.step(start, end) and | ||
| preState = "not-logged-not-accessed" and | ||
| postState = "logged-and-accessed" | ||
| ) | ||
| } | ||
|
|
||
| predicate isSink(DataFlow::Node node, FlowState state) { | ||
| node instanceof ClientRequestInjectionVector and | ||
| state = "logged-and-accessed" | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
.../frameworks/ui5/lib/advanced_security/javascript/frameworks/ui5/UI5PathInjectionQuery.qll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import javascript | ||
|
|
||
| module UI5PathInjection implements DataFlow::ConfigSig { | ||
| predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource } | ||
|
|
||
| predicate isSink(DataFlow::Node node) { | ||
| node = ModelOutput::getASinkNode("ui5-path-injection").asSink() | ||
| } | ||
| } |
45 changes: 45 additions & 0 deletions
45
...rameworks/ui5/lib/advanced_security/javascript/frameworks/ui5/UI5UnsafeLogAccessQuery.qll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import javascript | ||
| import advanced_security.javascript.frameworks.ui5.dataflow.DataFlow | ||
| import semmle.javascript.security.dataflow.LogInjectionQuery | ||
|
|
||
| module UI5UnsafeLogAccess implements DataFlow::ConfigSig { | ||
| predicate isSource(DataFlow::Node node) { node instanceof RemoteFlowSource } | ||
|
|
||
| predicate isBarrier(DataFlow::Node node) { LogInjectionConfig::isBarrier(node) } | ||
|
|
||
| predicate isSink(DataFlow::Node node) { | ||
| node = ModelOutput::getASinkNode("ui5-log-injection").asSink() | ||
| } | ||
| } | ||
|
|
||
| private newtype TLogEntriesNode = | ||
| TDataFlowNode(DataFlow::Node node) { | ||
| node = ModelOutput::getATypeNode("SapLogEntries").getInducingNode() | ||
| } or | ||
| TUI5ControlNode(UI5Control control) { control.getImportPath() = "sap/ui/vk/Notifications" } | ||
|
|
||
| class LogEntriesNode extends TLogEntriesNode { | ||
| DataFlow::Node asDataFlowNode() { this = TDataFlowNode(result) } | ||
|
|
||
| UI5Control asUI5ControlNode() { this = TUI5ControlNode(result) } | ||
|
|
||
| File getFile() { | ||
| result = this.asDataFlowNode().getFile() | ||
| or | ||
| result = this.asUI5ControlNode().getView() | ||
| } | ||
|
|
||
| string toString() { | ||
| result = this.asDataFlowNode().toString() | ||
| or | ||
| result = this.asUI5ControlNode().toString() | ||
| } | ||
|
|
||
| predicate hasLocationInfo( | ||
| string filepath, int startline, int startcolumn, int endline, int endcolumn | ||
| ) { | ||
| this.asDataFlowNode().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) | ||
| or | ||
| this.asUI5ControlNode().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.