-
Notifications
You must be signed in to change notification settings - Fork 1.8k
JS: Make DataFlow::SourceNode non-recursive #3196
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
JS: Make DataFlow::SourceNode non-recursive #3196
Conversation
@esbena do you remember why the AngularJS model needs string literals to be |
I think @max-schaefer is the author of this particular feature, perhaps he remembers some subtlety we are missing? Hisorically, I think the feature is a legacy thing from when we introduced |
Re-run of the slowest slugs without DPMs look good as well. |
@esbena could I ask you for a review? |
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. That is some nice detective work.
It seems easy to accidentally re-introduce these costly cycles again, AFAIU you are not breaking any negative cycles in these refactorings - or are you?
I have two proposals:
- document the places where it is tempting to undo your current improvements (see inline comments)
- construct a sneaky test that fails if we reintroduce a bad
SourceNode
/Import
dependency - if possible. (The test could either change analysis behaviour or cause a compilation error due to non-monotonic recursion.)
We are still waiting for Max' reply to "perhaps he remembers some subtlety we are missing?" btw.
result instanceof DataFlow::ValueNode | ||
} | ||
|
||
private | ||
DataFlow::Node getFactoryNodeInternal() { | ||
result = DataFlow::valueNode(getLastArgument()) or |
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.
Do we want to add a warning here as well?
I believe @esbena's answer is correct: this was done to make up for lacking string-literal tracking. Fine to remove it now. |
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
Excellent idea with the test case. I've added a test that fails if the domain of I'll look into removing the string literal source node from the Angular model, but given the good evaluations so far I think this is safe to land. |
DataFlow::SourceNode
was part of a weird recursive SCC involving AMD, Angular, lazy-cache, HTTP, and LodashUnderscore.this
is aSourceNode
. These have been removed.SourceNode
in a way that depended onangular()
whose return type isSourceNode
. Rewritten to useImport
instead.Import
in a way that depended onSourceNode
, and the above changes to Angular meansSourceNode
depends onImport
. Rewritten to rely on AST or the local data flow relation (which does not depend onSourceNode
).Full evaluation on smoke-test and security suite on nightly look good after finally giving up and using a
pragma[noopt]
in lazy-cache.