-
Notifications
You must be signed in to change notification settings - Fork 2k
JS: recognize tagged template literals as DataFlow::CallNode
#14405
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 6 commits
951ed01
18e6a54
9b65017
7ca0996
56e9eda
d261cec
6377e92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| category: minorAnalysis | ||
| --- | ||
| * Tagged template literals have been added to `DataFlow::CallNode`. This allows the analysis to find flow into functions called with a tagged template literal, | ||
| and the arguments to a tagged template literal are part of the API-graph in `ApiGraphs.qll`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| import ApiGraphs.VerifyAssertions |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const tag = require("tag"); | ||
|
|
||
| tag.string`string1 | ||
| ${23}` // def=moduleImport("tag").getMember("exports").getMember("string").getParameter(1) | ||
|
|
||
| tag.highlight`string2 | ||
| ${23} | ||
| morestring | ||
| ${42}` // def=moduleImport("tag").getMember("exports").getMember("highlight").getParameter(2) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "name": "tagged-template" | ||
| } |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| function fooTag(strings, par1, par2) { | ||
|
|
||
| } | ||
|
|
||
| fooTag`hello ${arg1} world ${arg2}` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,37 @@ | ||
| import isUncertain | ||
| import getAFunctionValue | ||
| import getArgument | ||
| import getNumArgument | ||
| import isIncomplete | ||
| import getCalleeNode | ||
| import getLastArgument | ||
| import getAnArgument | ||
| import getACallee | ||
| import getCalleeName | ||
| import isImprecise | ||
| import javascript | ||
|
|
||
| query predicate test_isUncertain(DataFlow::InvokeNode invk) { invk.isUncertain() } | ||
|
|
||
| query predicate test_getAFunctionValue(DataFlow::Node node, DataFlow::FunctionNode res) { | ||
| res = node.getAFunctionValue() | ||
| } | ||
|
|
||
| query predicate test_getArgument(DataFlow::InvokeNode invk, int i, DataFlow::Node res) { | ||
| res = invk.getArgument(i) | ||
| } | ||
|
|
||
| query predicate test_getNumArgument(DataFlow::InvokeNode invk, int res) { | ||
| res = invk.getNumArgument() | ||
| } | ||
|
|
||
| query predicate test_isIncomplete(DataFlow::InvokeNode invk) { invk.isIncomplete() } | ||
|
|
||
| query predicate test_getCalleeNode(DataFlow::InvokeNode invk, DataFlow::Node res) { | ||
| res = invk.getCalleeNode() | ||
| } | ||
|
|
||
| query predicate test_getLastArgument(DataFlow::InvokeNode invk, DataFlow::Node res) { | ||
| res = invk.getLastArgument() | ||
| } | ||
|
|
||
| query predicate test_getAnArgument(DataFlow::InvokeNode invk, DataFlow::Node res) { | ||
| res = invk.getAnArgument() | ||
| } | ||
|
|
||
| query predicate test_getACallee(DataFlow::InvokeNode c, Function res) { res = c.getACallee() } | ||
|
|
||
| query predicate test_getCalleeName(DataFlow::InvokeNode invk, string res) { | ||
| res = invk.getCalleeName() | ||
| } | ||
|
|
||
| query predicate test_isImprecise(DataFlow::InvokeNode invk) { invk.isImprecise() } |
Uh oh!
There was an error while loading. Please reload this page.