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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
2e552c6b
Commit
2e552c6b
authored
Jun 17, 2016
by
Paco Guzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter out sensitive parameters of metrics data
parent
7b944e01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
CHANGELOG
CHANGELOG
+1
-0
lib/gitlab/metrics/rack_middleware.rb
lib/gitlab/metrics/rack_middleware.rb
+5
-1
spec/lib/gitlab/metrics/rack_middleware_spec.rb
spec/lib/gitlab/metrics/rack_middleware_spec.rb
+16
-0
No files found.
CHANGELOG
View file @
2e552c6b
...
...
@@ -122,6 +122,7 @@ v 8.9.0 (unreleased)
- Set inverse_of for Project/Service association to reduce the number of queries
- Update tanuki logo highlight/loading colors
- Use Git cached counters for branches and tags on project page
- Filter parameters for request_uri value on instrumented transactions.
v 8.8.5
- Import GitHub repositories respecting the API rate limit !4166
...
...
lib/gitlab/metrics/rack_middleware.rb
View file @
2e552c6b
...
...
@@ -35,7 +35,7 @@ module Gitlab
def
transaction_from_env
(
env
)
trans
=
Transaction
.
new
trans
.
set
(
:request_uri
,
env
[
'REQUEST_URI'
]
)
trans
.
set
(
:request_uri
,
filtered_path
(
env
)
)
trans
.
set
(
:request_method
,
env
[
'REQUEST_METHOD'
])
trans
...
...
@@ -54,6 +54,10 @@ module Gitlab
private
def
filtered_path
(
env
)
ActionDispatch
::
Request
.
new
(
env
).
filtered_path
.
presence
||
env
[
'REQUEST_URI'
]
end
def
endpoint_paths_cache
@endpoint_paths_cache
||=
Hash
.
new
do
|
hash
,
http_method
|
hash
[
http_method
]
=
Hash
.
new
do
|
inner_hash
,
raw_path
|
...
...
spec/lib/gitlab/metrics/rack_middleware_spec.rb
View file @
2e552c6b
...
...
@@ -58,6 +58,22 @@ describe Gitlab::Metrics::RackMiddleware do
expect
(
transaction
.
values
[
:request_method
]).
to
eq
(
'GET'
)
expect
(
transaction
.
values
[
:request_uri
]).
to
eq
(
'/foo'
)
end
context
"when URI includes sensitive parameters"
do
let
(
:env
)
do
{
'REQUEST_METHOD'
=>
'GET'
,
'REQUEST_URI'
=>
'/foo?private_token=my-token'
,
'PATH_INFO'
=>
'/foo'
,
'QUERY_STRING'
=>
'private_token=my_token'
,
'action_dispatch.parameter_filter'
=>
[
:private_token
]
}
end
it
'stores the request URI with the sensitive parameters filtered'
do
expect
(
transaction
.
values
[
:request_uri
]).
to
eq
(
'/foo?private_token=[FILTERED]'
)
end
end
end
describe
'#tag_controller'
do
...
...
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