BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ed5f17cc
Commit
ed5f17cc
authored
Jun 17, 2016
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'secure-request-uris' into 'master'
Filter out sensitive parameters of metrics data See merge request !4748
parents
8dccfb4a
2e552c6b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
CHANGELOG
CHANGELOG
+1
-0
rack_middleware.rb
lib/gitlab/metrics/rack_middleware.rb
+5
-1
rack_middleware_spec.rb
spec/lib/gitlab/metrics/rack_middleware_spec.rb
+16
-0
No files found.
CHANGELOG
View file @
ed5f17cc
...
...
@@ -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 @
ed5f17cc
...
...
@@ -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 @
ed5f17cc
...
...
@@ -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