JS: Minor fixes to package export detection#3662
Merged
semmle-qlci merged 4 commits intogithub:js-team-sprintfrom Jun 12, 2020
Merged
JS: Minor fixes to package export detection#3662semmle-qlci merged 4 commits intogithub:js-team-sprintfrom
semmle-qlci merged 4 commits intogithub:js-team-sprintfrom
Conversation
esbena
reviewed
Jun 10, 2020
| result.analyze().getAValue() = mod.(NodeModule).getAModuleExportsValue() | ||
| or | ||
| exists(ASTNode export | result.getEnclosingExpr() = export | mod.exports(_, export)) | ||
| or |
Contributor
There was a problem hiding this comment.
I do not understand this change. Can you elaborate with a comment?
I would expect the above cases to handle the added case. If they didn't, why? And why not add yet another subclass of Module with a Module::experts that handles this case?
Contributor
Author
There was a problem hiding this comment.
The problem is that Module::exports just exposes an ASTNode and there is no reliable way to map that to the correct data-flow node. It would be great to modernize that abstraction but I don't think this PR is the right place to do that.
esbena
approved these changes
Jun 12, 2020
This was referenced Jun 22, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two minor fixes that were needed to detect the exported members of the package in https://github.com/github/codeql-javascript-CVE-coverage/issues/80.
The first commit removes an
ifand instead uses thepriorityto choose between the two alternatives. (I imagine this could eventually be unified with the entry-point guessing logic from the WIP monorepo support.)@max-schaefer the first commit might be relevant for you.