Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Apr 5, 2019

This query reformulates js/incomplete-hostname-regexp to 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 as t.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.

@ghost ghost added the JS label Apr 5, 2019
@ghost ghost self-requested a review as a code owner April 5, 2019 06:41
@ghost ghost mentioned this pull request Apr 5, 2019
Copy link

@xiemaisi xiemaisi left a 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?

@ghost ghost added the WIP This is a work-in-progress, do not merge yet! label Apr 5, 2019
@ghost
Copy link
Author

ghost commented Apr 8, 2019

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?

~10% time reduction

@ghost
Copy link
Author

ghost commented Apr 10, 2019

As discussed, I have added TypeBackTracker::step and TypeBackTracker::smallstep.
The change has no negative performance impact on big-apps.slugs/security.

We should follow this up with a similar change for the forwards tracker soon.

@xiemaisi
Copy link

We should follow this up with a similar change for the forwards tracker soon.

Could you make a JIRA issue for this?

@ghost ghost removed the WIP This is a work-in-progress, do not merge yet! label Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants