JavaScript: Improve query help for js/server-side-unvalidated-url-redirection.
#13771
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.
I'm not really sure about this, so opening as a draft pull request first to get some input from the JavaScript team.
Basically, our query help currently suggests an allowlist approach to preventing redirections. That's great advice in general, but in practice may be difficult and invasive to implement, so I was wondering whether we also want to suggest a more local fix.
The one I added to the query help is to check whether the URL is "local" in the sense that it doesn't redirect to a different host. Working back from the query, one way of doing that is to ensure it starts with a single, but not a double, slash. However, I've seen the slides from this BlackHat talk, and while they are a bit hard to understand I think the upshot is that this sort of thing is extremely tricky to check reliably, so perhaps this is actually dangerous advice?