Skip to content

Conversation

@xiemaisi
Copy link

@xiemaisi xiemaisi commented Oct 3, 2018

This is a non-standard language feature for which we have parser support. Previously, however, the CFG extractor and the QL library still assumed that all imports appear at the toplevel, which gave us strange results for example on meteor.

This PR updates the QL library to remove the assumption about imports being top-level. Furthermore, we patch the missing CFG edges for non-toplevel imports in the library. I will open an internal PR that teaches the extractor to add these edges to begin with. The QL-level patch is compatible with the extractor changes, so having either or both of them works, and consequently we can deal with the PRs independently.

I have verified that this removes the false positives on meteor and doesn't otherwise affect results, at a very moderate cost to performance (<5%, so probably within the margin of error).

@xiemaisi xiemaisi requested a review from a team as a code owner October 3, 2018 12:15
Copy link
Contributor

@asger-semmle asger-semmle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xiemaisi xiemaisi added the JS label Oct 3, 2018
@semmle-qlci semmle-qlci merged commit bea86e5 into github:master Oct 4, 2018
@xiemaisi xiemaisi deleted the js/workaround-for-nested-imports branch October 4, 2018 09:35
aibaars pushed a commit that referenced this pull request Oct 14, 2021
API graphs: Fix bug for resolvable modules
smowton added a commit to smowton/codeql that referenced this pull request Apr 16, 2022
…-locations-and-syntactic-enclosure

Fix locations and enclosing statement/callable for assignments
MathiasVP pushed a commit to MathiasVP/ql that referenced this pull request Nov 20, 2025
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.

3 participants