-
Notifications
You must be signed in to change notification settings - Fork 1.9k
JS: Improve handling of React, lodash, function composition, and dynamic imports #4564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
erik-krogh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it.
It took a while to chew through, but it looks great.
I just got a few minor comments.
javascript/ql/test/library-tests/frameworks/ReactJS/higherOrderComponent.jsx
Show resolved
Hide resolved
Co-authored-by: Erik Krogh Kristensen <[email protected]>
Co-authored-by: Erik Krogh Kristensen <[email protected]>
|
Evaluation on nightly came back with a median slowdown of about 1%. Could have been worse, but could also be better. Will investigate. |
|
Double re-run of the 3 slowest slugs shows that the 1% was most likely a fluke. Looking at tuple counts I didn't see anything out of the ordinary either, although I did notice that |
esbena
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Two optional nits.
I have raised https://github.com/github/codeql-javascript-team/issues/248, which isn't a blocker for this PR.
|
|
||
| override predicate step(DataFlow::Node pred, DataFlow::Node succ) { | ||
| exists(int fnIndex, DataFlow::FunctionNode fn | fn = composed.getFunction(fnIndex) | | ||
| exists(int fnIndex, DataFlow::FunctionNode fn | fn = composed.getOperandFunction(fnIndex) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this would read more natural if the order of the three disjuncts was in between out, instead of the current out in between.
| } | ||
|
|
||
| override predicate step(DataFlow::Node pred, DataFlow::Node succ) { | ||
| // `memo(f)` returns a function behaves as `f` but caches results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // `memo(f)` returns a function behaves as `f` but caches results | |
| // `memo(f)` returns a function that behaves as `f` but caches results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, and also moved the comment closer to where it belongs
Adds models for React hooks and react-router (
react-router-dom), and tracks components through component transformers and lazy loading.Some drive-by fixes from testing on some React applications:
ValueNodeas this prevented it from propagating into a property pattern (object patterns are value nodes, but not property patterns).lodashtaint steps (almost the entire "string" category)lodash.template(experimental query). Added to justify not having it as a taint step.TaintStepsmetric now includesAdditionalFlowStepsteps. They also affect taint-tracking so this seemed easier than having a separate metric for it. (Both sides of the evaluations contain this commit)Evaluations: