-
Notifications
You must be signed in to change notification settings - Fork 1.9k
JS: type tracking for js/incomplete-hostname-regexp #1211
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
xiemaisi
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.
Nice! Glad to see this has finally come together. Have you tested this version of the query on a few of the projects we discussed earlier where the query used to take very long?
|
|
As discussed, I have added We should follow this up with a similar change for the forwards tracker soon. |
Could you make a JIRA issue for this? |
This query reformulates
js/incomplete-hostname-regexpto use backwards type tracking to avoid forwards taint tracking of irrelevant strings.To do this, the type tracking library is trivially generalized to support tracking of non-
SourceNodes.The expressivity of the reformulated query is not exactly the same, but I expect more results from the query since we now support additional sources, and no longer spuriously sanitize programmer-provided strings.
I suspect the idiom
(t.continue() = t2 or t = t2)should be encapsulated as ast.taint() = t2, but I would like to see another use case before moving it into the library.I have performed two evaluations: javscript-lgtm on big-apps.slugs, js/incomplete-hostname-regexp on default.slugs. There are no changes to the results (which I think is a good thing for this change), and the performance improves a bit.