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 {
875
875
876
876
override string getSourceType ( ) { result = "React props" }
877
877
}
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
305
305
| statePropertyWrites.js:38:24:38:33 | this.props | view-component-input |
306
306
| thisAccesses.js:31:12:31:16 | props | view-component-input |
307
307
| 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 1
1
async function getData (
2
- x , // $ MISSING: threatModelSource=remote
3
- y ) { // $ MISSING: threatModelSource=remote
2
+ x , // $ threatModelSource=remote
3
+ y ) { // $ threatModelSource=remote
4
4
"use server" ;
5
5
}
6
6
Original file line number Diff line number Diff line change 1
1
"use server" ;
2
2
3
3
export async function getData (
4
- x , // $ MISSING: threatModelSource=remote
5
- y ) { // $ MISSING: threatModelSource=remote
4
+ x , // $ threatModelSource=remote
5
+ y ) { // $ threatModelSource=remote
6
6
}
7
7
8
8
async function getData2 (
You can’t perform that action at this time.
0 commit comments