Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
eaffe45e
Commit
eaffe45e
authored
Nov 04, 2021
by
Piotr Skorupa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert insights page URL masking handler
parent
549c58be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
19 deletions
+4
-19
app/helpers/routing/pseudonymization_helper.rb
app/helpers/routing/pseudonymization_helper.rb
+2
-17
ee/spec/helpers/routing/pseudonymization_helper_spec.rb
ee/spec/helpers/routing/pseudonymization_helper_spec.rb
+2
-2
No files found.
app/helpers/routing/pseudonymization_helper.rb
View file @
eaffe45e
...
@@ -31,24 +31,11 @@ module Routing
...
@@ -31,24 +31,11 @@ module Routing
end
end
end
end
generate_url
(
masked_params
.
merge
(
params:
masked_query_params
))
Gitlab
::
Routing
.
url_helpers
.
url_for
(
masked_params
.
merge
(
params:
masked_query_params
))
end
end
private
private
def
generate_url
(
masked_params
)
# The below check is added since `project/insights` route does not
# work with Rails router `url_for` method.
# See https://gitlab.com/gitlab-org/gitlab/-/issues/343551
if
@request
.
path_parameters
[
:controller
]
==
'projects/insights'
default_root_url
+
"
#{
Gitlab
::
Routing
.
url_helpers
.
namespace_project_insights_path
(
masked_params
)
}
"
elsif
@request
.
path_parameters
[
:controller
]
==
'groups/insights'
default_root_url
+
"
#{
Gitlab
::
Routing
.
url_helpers
.
group_insights_path
(
masked_params
)
}
"
else
Gitlab
::
Routing
.
url_helpers
.
url_for
(
masked_params
)
end
end
def
mask_id
(
value
)
def
mask_id
(
value
)
if
@request
.
path_parameters
[
:controller
]
==
'projects/blob'
if
@request
.
path_parameters
[
:controller
]
==
'projects/blob'
':repository_path'
':repository_path'
...
@@ -93,9 +80,7 @@ module Routing
...
@@ -93,9 +80,7 @@ module Routing
mask_helper
=
MaskHelper
.
new
(
request
,
current_group
,
current_project
)
mask_helper
=
MaskHelper
.
new
(
request
,
current_group
,
current_project
)
mask_helper
.
mask_params
mask_helper
.
mask_params
# We rescue all exception for time being till we test this helper extensively.
rescue
ActionController
::
RoutingError
,
URI
::
InvalidURIError
=>
e
# Check https://gitlab.com/gitlab-org/gitlab/-/merge_requests/72864#note_711515501
rescue
=>
e
# rubocop:disable Style/RescueStandardError
Gitlab
::
ErrorTracking
.
track_exception
(
e
,
url:
request
.
original_fullpath
)
Gitlab
::
ErrorTracking
.
track_exception
(
e
,
url:
request
.
original_fullpath
)
nil
nil
end
end
...
...
ee/spec/helpers/routing/pseudonymization_helper_spec.rb
View file @
eaffe45e
...
@@ -20,7 +20,7 @@ RSpec.describe ::Routing::PseudonymizationHelper do
...
@@ -20,7 +20,7 @@ RSpec.describe ::Routing::PseudonymizationHelper do
describe
'when url has params to mask'
do
describe
'when url has params to mask'
do
context
'when project/insights page is loaded'
do
context
'when project/insights page is loaded'
do
let
(
:masked_url
)
{
"http://localhost/
/namespace
#{
group
.
id
}
/project
#{
project
.
id
}
/insights/
"
}
let
(
:masked_url
)
{
"http://localhost/
namespace
#{
group
.
id
}
/project
#{
project
.
id
}
/insights
"
}
let
(
:request
)
do
let
(
:request
)
do
double
(
:Request
,
double
(
:Request
,
path_parameters:
{
path_parameters:
{
...
@@ -42,7 +42,7 @@ RSpec.describe ::Routing::PseudonymizationHelper do
...
@@ -42,7 +42,7 @@ RSpec.describe ::Routing::PseudonymizationHelper do
end
end
context
'when groups/insights page is loaded'
do
context
'when groups/insights page is loaded'
do
let
(
:masked_url
)
{
"http://localhost/
/groups/namespace
#{
group
.
id
}
/-/insights/
"
}
let
(
:masked_url
)
{
"http://localhost/
groups/namespace
#{
group
.
id
}
/-/insights
"
}
let
(
:request
)
do
let
(
:request
)
do
double
(
:Request
,
double
(
:Request
,
path_parameters:
{
path_parameters:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment