Skip to content

JS: Recognize Express headers as RequestInputAccess - #231

Merged
semmle-qlci merged 4 commits into
github:masterfrom
asger-semmle:express-headers
Sep 26, 2018
Merged

semmle-qlci merged 4 commits into
github:masterfrom
asger-semmle:express-headers

Conversation

@asger-semmle

Copy link
Copy Markdown
Contributor

req.headers.x was missing from the Express model. I've also thrown in req.host and req.hostname as they are derived from headers.

Evaluation looks good. It gives rise to a false positive due to the Reflected XSS query treating headers as sources, which it really shouldn't. I'll put up a separate PR for that separately.

@asger-semmle
asger-semmle requested a review from a team as a code owner September 26, 2018 07:03

@xiemaisi xiemaisi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM, modulo one minor suggestion. Is this covered by an existing change note?

// `req.headers.name`
kind = "header" and
headers.accesses(request, "headers") and
this = headers.getAPropertyRead(_))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps use getAPropertyRead() instead (without the don't-care argument) so it also considers dynamic property reads?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍 Thanks for spotting that.

@xiemaisi xiemaisi added the JS label Sep 26, 2018
@semmle-qlci
semmle-qlci merged commit c36e7f0 into github:master Sep 26, 2018
aibaars added a commit that referenced this pull request Oct 14, 2021
smowton pushed a commit to smowton/codeql that referenced this pull request Feb 7, 2022
Introduce cast for `<unsafe-coerce>` calls
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