Skip to content
Snippets Groups Projects
Commit 61e8ca8c authored by Douwe Maan's avatar Douwe Maan
Browse files

Don't leak private group existence by redirecting from namespace controller to group controller.

parent 2953e0d1
No related branches found
No related tags found
1 merge request!440Don't leak private group existence by redirecting from namespace controller to group controller.
Pipeline #
Loading
@@ -31,6 +31,7 @@ v 7.10.0 (unreleased)
Loading
@@ -31,6 +31,7 @@ v 7.10.0 (unreleased)
- Replace commits calendar with faster contribution calendar that includes issues and merge requests - Replace commits calendar with faster contribution calendar that includes issues and merge requests
- Add inifinite scroll to user page activity - Add inifinite scroll to user page activity
- Don't show commit comment button when user is not signed in. - Don't show commit comment button when user is not signed in.
- Don't leak private group existence by redirecting from namespace controller to group controller.
   
v 7.9.0 v 7.9.0
- Send EmailsOnPush email when branch or tag is created or deleted. - Send EmailsOnPush email when branch or tag is created or deleted.
Loading
Loading
Loading
@@ -4,14 +4,22 @@ class NamespacesController < ApplicationController
Loading
@@ -4,14 +4,22 @@ class NamespacesController < ApplicationController
def show def show
namespace = Namespace.find_by(path: params[:id]) namespace = Namespace.find_by(path: params[:id])
   
unless namespace if namespace
return render_404 if namespace.is_a?(Group)
group = namespace
else
user = namespace.owner
end
end end
   
if namespace.type == "Group" if user
redirect_to group_path(namespace) redirect_to user_path(user)
elsif group && can?(current_user, :read_group, group)
redirect_to group_path(group)
elsif current_user.nil?
authenticate_user!
else else
redirect_to user_path(namespace.owner) render_404
end end
end end
end end
Loading
@@ -52,7 +52,7 @@ module Mentionable
Loading
@@ -52,7 +52,7 @@ module Mentionable
if identifier == "all" if identifier == "all"
users.push(*project.team.members.flatten) users.push(*project.team.members.flatten)
elsif namespace = Namespace.find_by(path: identifier) elsif namespace = Namespace.find_by(path: identifier)
if namespace.type == "Group" if namespace.is_a?(Group)
users.push(*namespace.users) users.push(*namespace.users)
else else
users << namespace.owner users << namespace.owner
Loading
Loading
Loading
@@ -221,7 +221,7 @@ module Gitlab
Loading
@@ -221,7 +221,7 @@ module Gitlab
link_to("@all", namespace_project_url(project.namespace, project), options) link_to("@all", namespace_project_url(project.namespace, project), options)
elsif namespace = Namespace.find_by(path: identifier) elsif namespace = Namespace.find_by(path: identifier)
url = url =
if namespace.type == "Group" if namespace.is_a?(Group)
group_url(identifier) group_url(identifier)
else else
user_url(identifier) user_url(identifier)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment