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
3a8ad2ed
Commit
3a8ad2ed
authored
Dec 15, 2020
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that secrets masking does not change bytesize
parent
51ba77d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
lib/gitlab/ci/mask_secret.rb
lib/gitlab/ci/mask_secret.rb
+1
-5
spec/lib/gitlab/ci/mask_secret_spec.rb
spec/lib/gitlab/ci/mask_secret_spec.rb
+4
-0
No files found.
lib/gitlab/ci/mask_secret.rb
View file @
3a8ad2ed
...
@@ -9,11 +9,7 @@ module Gitlab
...
@@ -9,11 +9,7 @@ module Gitlab
# We assume 'value' must be mutable, given
# We assume 'value' must be mutable, given
# that frozen string is enabled.
# that frozen string is enabled.
##
value
.
gsub!
(
token
,
'x'
*
token
.
bytesize
)
# TODO We need to remove this because it is going to change checksum of
# a trace.
#
value
.
gsub!
(
token
,
'x'
*
token
.
length
)
value
value
end
end
end
end
...
...
spec/lib/gitlab/ci/mask_secret_spec.rb
View file @
3a8ad2ed
...
@@ -22,6 +22,10 @@ RSpec.describe Gitlab::Ci::MaskSecret do
...
@@ -22,6 +22,10 @@ RSpec.describe Gitlab::Ci::MaskSecret do
expect
(
mask
(
'token'
,
nil
)).
to
eq
(
'token'
)
expect
(
mask
(
'token'
,
nil
)).
to
eq
(
'token'
)
end
end
it
'does not change a bytesize of a value'
do
expect
(
mask
(
'token-ü/unicode'
,
'token-ü'
).
bytesize
).
to
eq
16
end
def
mask
(
value
,
token
)
def
mask
(
value
,
token
)
subject
.
mask!
(
value
.
dup
,
token
)
subject
.
mask!
(
value
.
dup
,
token
)
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