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
1965f02e
Commit
1965f02e
authored
Jul 09, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
2084bda2
6d3fede0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
lib/peek/views/redis.rb
lib/peek/views/redis.rb
+6
-2
spec/lib/peek/views/redis_detailed_spec.rb
spec/lib/peek/views/redis_detailed_spec.rb
+36
-0
No files found.
lib/peek/views/redis.rb
View file @
1965f02e
...
...
@@ -37,6 +37,8 @@ end
module
Peek
module
Views
module
RedisDetailed
REDACTED_MARKER
=
"<redacted>"
def
results
super
.
merge
(
details:
details
)
end
...
...
@@ -57,10 +59,12 @@ module Peek
end
def
format_command
(
cmd
)
if
cmd
.
length
>=
2
&&
cmd
.
first
=~
/^auth$/i
cmd
[
-
1
]
=
REDACTED_MARKER
# Scrub out the value of the SET calls to avoid binary
# data or large data from spilling into the view
if
cmd
.
length
>=
2
&&
cmd
.
first
=~
/set/i
cmd
[
-
1
]
=
"<redacted>"
elsif
cmd
.
length
>=
3
&&
cmd
.
first
=~
/set/i
cmd
[
2
..-
1
]
=
REDACTED_MARKER
end
cmd
.
join
(
' '
)
...
...
spec/lib/peek/views/redis_detailed_spec.rb
0 → 100644
View file @
1965f02e
# frozen_string_literal: true
require
'spec_helper'
describe
Peek
::
Views
::
RedisDetailed
do
let
(
:redis_detailed_class
)
do
Class
.
new
do
include
Peek
::
Views
::
RedisDetailed
end
end
subject
{
redis_detailed_class
.
new
}
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:cmd
,
:expected
)
do
[
:auth
,
'test'
]
|
'auth <redacted>'
[
:set
,
'key'
,
'value'
]
|
'set key <redacted>'
[
:set
,
'bad'
]
|
'set bad'
[
:hmset
,
'key1'
,
'value1'
,
'key2'
,
'value2'
]
|
'hmset key1 <redacted>'
[
:get
,
'key'
]
|
'get key'
end
with_them
do
it
'scrubs Redis commands'
,
:request_store
do
subject
.
detail_store
<<
{
cmd:
cmd
,
duration:
1
.
second
}
expect
(
subject
.
details
.
count
).
to
eq
(
1
)
expect
(
subject
.
details
.
first
)
.
to
eq
({
cmd:
expected
,
duration:
1000
})
end
end
end
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