Skip to content

JavaScript: Fix a bug in ServerSideUrlRedirect#259

Merged
semmle-qlci merged 1 commit intogithub:masterfrom
asger-semmle:open-redirect-expr
Oct 2, 2018
Merged

JavaScript: Fix a bug in ServerSideUrlRedirect#259
semmle-qlci merged 1 commit intogithub:masterfrom
asger-semmle:open-redirect-expr

Conversation

@asger-semmle
Copy link
Copy Markdown
Contributor

The server-side redirect query did not handle sinks in this case:

function f(res, nextUrl) {
  res.redirect(nextUrl);
}

because the logic in Sink.maybeNonLocal() required that a prefix of the sink must be an Expr. In this case, the prefix is found to be a ParameterNode whose asExpr() has no result.

I've refactored getAPrefix to return a DataFlow::Node and only coerce to Expr when doing getStringValue().

@asger-semmle asger-semmle requested a review from a team as a code owner October 1, 2018 11:39
Copy link
Copy Markdown

@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.

LGTM

@xiemaisi xiemaisi added the JS label Oct 2, 2018
@semmle-qlci semmle-qlci merged commit 829a5cc into github:master Oct 2, 2018
aibaars pushed a commit that referenced this pull request Oct 14, 2021
Don't include desugared nodes in the printed AST
smowton added a commit to smowton/codeql that referenced this pull request Apr 16, 2022
…ava-type-subs

Remove inapplicable TODO re: K<->J type substitution
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