File tree Expand file tree Collapse file tree
src/semmle/javascript/frameworks
test/library-tests/frameworks/Redux Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1134,9 +1134,11 @@ module Redux {
11341134 }
11351135
11361136 /**
1137- * An entry point in the API graphs corresponding to functions named `mapDispatchToProps`,
1138- * used to catch cases where the call to `connect` was not found (usually because of it being
1139- * wrapped in another function, which API graphs won't look through).
1137+ * An API entry point corresponding to a `connect` function which we couldn't recognize exactly.
1138+ *
1139+ * The `connect` call is recognized based on an argument being named either `mapStateToProps` or `mapDispatchToProps`.
1140+ * Used to catch cases where the `connect` function was not recognized by API graphs (usually because of it being
1141+ * wrapped in another function, which API graphs won't look through).
11401142 */
11411143 private class HeuristicConnectEntryPoint extends API:: EntryPoint {
11421144 HeuristicConnectEntryPoint ( ) { this = "react-redux-connect" }
Original file line number Diff line number Diff line change @@ -92,3 +92,8 @@ function mapStateToProps(state) {
9292const mapDispatchToProps = { toolkitAction, manualAction } ;
9393
9494const ConnectedComponent = connect ( mapStateToProps , mapDispatchToProps ) ( MyComponent ) ;
95+
96+ function connectLike ( f , g ) {
97+ return c => somethingWeirdAndComplicated ( f , g ) ( c ) ;
98+ }
99+ const ConnectedComponent2 = connectLike ( mapStateToProps , mapDispatchToProps ) ( MyComponent ) ;
Original file line number Diff line number Diff line change @@ -112,6 +112,10 @@ taintFlow
112112| react-redux.jsx:69:31:69:38 | source() | react-redux.jsx:75:10:75:36 | props.p ... Action2 |
113113| react-redux.jsx:69:31:69:38 | source() | react-redux.jsx:76:10:76:36 | props.p ... Action3 |
114114| react-redux.jsx:70:30:70:37 | source() | react-redux.jsx:77:10:77:28 | props.propFromAsync |
115+ reactComponentRef
116+ | react-redux.jsx:64:1:80:1 | functio ... r}}/>\\n} | react-redux.jsx:64:1:80:1 | functio ... r}}/>\\n} |
117+ | react-redux.jsx:64:1:80:1 | functio ... r}}/>\\n} | react-redux.jsx:94:28:94:84 | connect ... ponent) |
118+ | react-redux.jsx:64:1:80:1 | functio ... r}}/>\\n} | react-redux.jsx:97:12:97:12 | c |
115119getAffectedStateAccessPath
116120| react-redux.jsx:12:33:17:9 | (state, ... } | toolkit |
117121| react-redux.jsx:18:41:23:9 | (state, ... } | toolkit |
Original file line number Diff line number Diff line change @@ -59,3 +59,5 @@ class BasicTaint extends TaintTracking::Configuration {
5959query predicate taintFlow ( DataFlow:: Node source , DataFlow:: Node sink ) {
6060 any ( BasicTaint cfg ) .hasFlow ( source , sink )
6161}
62+
63+ query DataFlow:: SourceNode reactComponentRef ( ReactComponent component ) { result = component .getAComponentCreatorReference ( ) }
You can’t perform that action at this time.
0 commit comments