Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

JS: support that the base is not a method-call in getAChainedMethodCall #8380

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

Merged
merged 2 commits into from
Mar 10, 2022

Conversation

erik-krogh
Copy link
Contributor

@erik-krogh erik-krogh commented Mar 9, 2022

Gets a TP for CVE-2021-46704

Evaluation was uneventful.


Consider the below.

result = DataFlow::moduleImport("foo").getAnInstantiation().getAMethodCall*().getAMethodCall("bar");

This will not flag the below:

const Foo = require("foo");
const inst = new Foo();
const result = inst.bar();

Because DataFlow::moduleImport("foo").getAnInstantiation().getAMethodCall*() is restricted to the type DataFlow::CallNode, even if we take 0 steps through the transitive closure.

@github-actions github-actions bot added the JS label Mar 9, 2022
@erik-krogh erik-krogh marked this pull request as ready for review March 9, 2022 19:46
@erik-krogh erik-krogh requested a review from a team as a code owner March 9, 2022 19:46
@kaeluka kaeluka self-requested a review March 10, 2022 12:28
kaeluka
kaeluka previously approved these changes Mar 10, 2022
Copy link
Contributor

@kaeluka kaeluka left a comment

Choose a reason for hiding this comment

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

So, I'm understanding this correctly — the problem in your example is that in the third line below, inst is not a CallNode and therefore the bar call is not found? That's quite an easy mistake to make. As you're on a roll, this might be worth doing a ql-for-ql query for?

const Foo = require("foo");
const inst = new Foo();
const result = inst.bar();

Also, the check asks for a change note, but I think you can disable that.

javascript/ql/lib/semmle/javascript/dataflow/Sources.qll Outdated Show resolved Hide resolved
@erik-krogh erik-krogh added the no-change-note-required This PR does not need a change note label Mar 10, 2022
Co-authored-by: Stephan Brandauer <kaeluka@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JS no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.