File tree Expand file tree Collapse file tree 3 files changed +21
-4
lines changed
src/semmle/javascript/frameworks
test/library-tests/frameworks/Next Expand file tree Collapse file tree 3 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -67,12 +67,23 @@ private module NextJS {
67
67
68
68
NextJSStaticPropsStep ( ) {
69
69
pageModule = getAPagesModule ( ) and
70
- this = pageModule .getAnExportedValue ( "getStaticProps " ) .getAFunctionValue ( )
70
+ this = pageModule .getAnExportedValue ( "default " ) .getAFunctionValue ( )
71
71
}
72
72
73
73
override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
74
- pred = this .getAReturn ( ) .getALocalSource ( ) .getAPropertyWrite ( "props" ) .getRhs ( ) and
75
- succ = pageModule .getAnExportedValue ( "default" ) .getAFunctionValue ( ) .getParameter ( 0 )
74
+ (
75
+ pred =
76
+ pageModule
77
+ .getAnExportedValue ( "getStaticProps" )
78
+ .getAFunctionValue ( )
79
+ .getAReturn ( )
80
+ .getALocalSource ( )
81
+ .getAPropertyWrite ( "props" )
82
+ .getRhs ( )
83
+ or
84
+ pred = this .getAPropertyWrite ( "getInitialProps" ) .getRhs ( ) .getAFunctionValue ( ) .getAReturn ( )
85
+ ) and
86
+ succ = this .getParameter ( 0 )
76
87
}
77
88
}
78
89
}
Original file line number Diff line number Diff line change @@ -15,7 +15,12 @@ export async function getStaticProps({ params }) {
15
15
}
16
16
}
17
17
18
- export default function Post ( { taint } ) {
18
+ export default function Post ( { taint, stars } ) {
19
19
sink ( taint ) ;
20
+ sink ( stars ) ;
20
21
return < span /> ;
21
22
}
23
+
24
+ Post . getInitialProps = async ( ctx ) => {
25
+ return { stars : source ( 2 ) }
26
+ }
Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ remoteFlow
2
2
| pages/[my-fallback-id].jsx:9:40:9:45 | params |
3
3
dataFlow
4
4
| pages/[my-fallback-id].jsx:13:20:13:27 | source() | pages/[my-fallback-id].jsx:19:10:19:14 | taint |
5
+ | pages/[my-fallback-id].jsx:25:21:25:29 | source(2) | pages/[my-fallback-id].jsx:20:10:20:14 | stars |
You can’t perform that action at this time.
0 commit comments