mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
JS: Add parameters of server functions as remote flow sources
This commit is contained in:
@@ -875,3 +875,22 @@ private class ReactPropAsViewComponentInput extends ViewComponentInput {
|
||||
|
||||
override string getSourceType() { result = "React props" }
|
||||
}
|
||||
|
||||
private predicate isServerFunction(DataFlow::FunctionNode func) {
|
||||
exists(Directive::UseServerDirective useServer |
|
||||
useServer.getContainer() = func.getFunction()
|
||||
or
|
||||
useServer.getContainer().(Module).getAnExportedValue(_).getAFunctionValue() = func
|
||||
)
|
||||
}
|
||||
|
||||
private class ServerFunctionRemoteFlowSource extends RemoteFlowSource {
|
||||
ServerFunctionRemoteFlowSource() {
|
||||
exists(DataFlow::FunctionNode func |
|
||||
isServerFunction(func) and
|
||||
this = func.getAParameter()
|
||||
)
|
||||
}
|
||||
|
||||
override string getSourceType() { result = "React server function parameter" }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user