File tree Expand file tree Collapse file tree 4 files changed +27
-4
lines changed
lib/semmle/javascript/frameworks
test/library-tests/frameworks/ReactJS Expand file tree Collapse file tree 4 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -875,3 +875,22 @@ private class ReactPropAsViewComponentInput extends ViewComponentInput {
875875
876876 override string getSourceType ( ) { result = "React props" }
877877}
878+
879+ private predicate isServerFunction ( DataFlow:: FunctionNode func ) {
880+ exists ( Directive:: UseServerDirective useServer |
881+ useServer .getContainer ( ) = func .getFunction ( )
882+ or
883+ useServer .getContainer ( ) .( Module ) .getAnExportedValue ( _) .getAFunctionValue ( ) = func
884+ )
885+ }
886+
887+ private class ServerFunctionRemoteFlowSource extends RemoteFlowSource {
888+ ServerFunctionRemoteFlowSource ( ) {
889+ exists ( DataFlow:: FunctionNode func |
890+ isServerFunction ( func ) and
891+ this = func .getAParameter ( )
892+ )
893+ }
894+
895+ override string getSourceType ( ) { result = "React server function parameter" }
896+ }
Original file line number Diff line number Diff line change @@ -305,3 +305,7 @@ threatModelSource
305305| statePropertyWrites.js:38:24:38:33 | this.props | view-component-input |
306306| thisAccesses.js:31:12:31:16 | props | view-component-input |
307307| thisAccesses.js:48:18:48:18 | y | view-component-input |
308+ | use-server1.js:2:5:2:5 | x | remote |
309+ | use-server1.js:3:5:3:5 | y | remote |
310+ | use-server2.js:4:5:4:5 | x | remote |
311+ | use-server2.js:5:5:5:5 | y | remote |
Original file line number Diff line number Diff line change 11async function getData (
2- x , // $ MISSING: threatModelSource=remote
3- y ) { // $ MISSING: threatModelSource=remote
2+ x , // $ threatModelSource=remote
3+ y ) { // $ threatModelSource=remote
44 "use server" ;
55}
66
Original file line number Diff line number Diff line change 11"use server" ;
22
33export async function getData (
4- x , // $ MISSING: threatModelSource=remote
5- y ) { // $ MISSING: threatModelSource=remote
4+ x , // $ threatModelSource=remote
5+ y ) { // $ threatModelSource=remote
66}
77
88async function getData2 (
You can’t perform that action at this time.
0 commit comments