diff options
author | Joern Schneeweisz <jschneeweisz@gitlab.com> | 2019-10-08 09:53:36 +0300 |
---|---|---|
committer | Joern Schneeweisz <jschneeweisz@gitlab.com> | 2019-10-14 14:53:47 +0300 |
commit | 2ea5debad48b5c5b0e07d70f09c6439d1fa636b9 (patch) | |
tree | 1087f672d514f81275596c4c7087665cc84d47f9 /app | |
parent | 635e1578219d95ee683cd2901fa5d0f6965e7033 (diff) |
Use the '\A' and '\z' regex anchors in `InternalRedirect` to mitigate an Open Redirect issue.
Fixes https://dev.gitlab.org/gitlab/gitlabhq/issues/2934 and https://gitlab.com/gitlab-org/gitlab/issues/33569
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/concerns/internal_redirect.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/concerns/internal_redirect.rb b/app/controllers/concerns/internal_redirect.rb index fa3716502a0..e314953bb79 100644 --- a/app/controllers/concerns/internal_redirect.rb +++ b/app/controllers/concerns/internal_redirect.rb @@ -6,7 +6,7 @@ module InternalRedirect def safe_redirect_path(path) return unless path # Verify that the string starts with a `/` and a known route character. - return unless path =~ %r{^/[-\w].*$} + return unless path =~ %r{\A/[-\w].*\z} uri = URI(path) # Ignore anything path of the redirect except for the path, querystring and, |