Repository navigation
Read only the target argument of redirect sinks - #83
Merged
Merged
Conversation
10 tasks done
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fourth item of #71: redirect sinks read their target only.
test: define redirect sinks as reading their target only), implementation follows.redirect("url-name", arg)andredirect("url-name", pk=arg)resolve a URL pattern with the extra arguments as route parameters;HttpResponseRedirect(to),HttpResponsePermanentRedirect(to)and Flask'sredirect(location, code)take the target first too. The five sinks now restrictREDIRECTto argument 0 throughSink.positions, the mechanism SQL statements already use, so attacker-controlled data in the other arguments is not an open redirect while a tainted target still is.open-redirectfindings; DjangoGoat loses its threeredirect('profile', pk=user.pk)findings and keeps its real ones. What remains on healthchecks isredirect(request.GET.get("next"))behind the project's own_allow_redirectcheck, reported as a hotspot, plusredirect(request.path)andreverse(...)paths with a query string taken from the request, which are same-origin by construction and a candidate for a later refinement.Part of #71.