Repository navigation
JS: add taint-step for URL construction in js/request-forgery #5630
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand this test and the new QL step. Can you elaborate?
My thoughts:
I agree that
request.urlis user-controlled, but it will only reach this line if there is a route handler that listens atrequest.url. So I would treat as "mostly sanitized" if the route handler does not listen on*(it does that in his test though).I can see that this may be vulnerable after all since the
new URL(request.url, base)also changes the host of the URL, causing the "mostly sanitized" url to mean something different to a different host. But that subtlety is not reflected in the QL change that do not check for a second argument.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mostly answered your own question.
Yes, it does sound reasonable to treat such urls as mostly sanitized.
But I think it would take some effort to do, as we would need to match handlers with which urls they listen on.
And I think the url can be tainted even if the handler doesn't listen on
*, as long as the handler listens on some "blob".(E.g.
"/foo/bar/*"or"/foo/:bar").I could add a requirement that the second argument is present (we would still flag the CVE).
In the scenario I looked at the problem was that a certain
/privfolder on the target server was supposed to be private (all requests were supposed to go to a/pubfolder).But I also think we should keep the one argument
var succ = new URL(pred)step, because it is essentially an identity function (that sometimes throws an exception).I think we might need some advanced flow-label use if we want to keep track of "how unsafe" a given url is.
(Maybe we could do something similar to the
js/tainted-pathquery).Yes, we risk that the results might become slightly noisy, but I think it seems safe enough to land.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I am inclined to accept the risk of the FPs, @asgerf do you have any additional thoughts on these URL subtleties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could get FPs from accessing safe parts of the URL, like
new URL(taint).port, but since it only affects the request forgery query I'm fine with it.