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
Boxiang Sun
gitlab-ce
Commits
fa35ea13
Commit
fa35ea13
authored
Nov 27, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strip leading & trailing whitespaces in CI/CD secret variable keys
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
24fadd7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
0 deletions
+27
-0
app/models/concerns/has_variable.rb
app/models/concerns/has_variable.rb
+4
-0
changelogs/unreleased/40561-environment-scope-value-is-not-trimmed.yml
...released/40561-environment-scope-value-is-not-trimmed.yml
+5
-0
spec/models/concerns/has_variable_spec.rb
spec/models/concerns/has_variable_spec.rb
+18
-0
No files found.
app/models/concerns/has_variable.rb
View file @
fa35ea13
...
...
@@ -16,6 +16,10 @@ module HasVariable
key:
Gitlab
::
Application
.
secrets
.
db_key_base
,
algorithm:
'aes-256-cbc'
def
key
=
(
new_key
)
super
(
new_key
.
to_s
.
strip
)
end
def
to_runner_variable
{
key:
key
,
value:
value
,
public:
false
}
end
...
...
changelogs/unreleased/40561-environment-scope-value-is-not-trimmed.yml
0 → 100644
View file @
fa35ea13
---
title
:
Strip leading & trailing whitespaces in CI/CD secret variable keys
merge_request
:
15615
author
:
type
:
fixed
spec/models/concerns/has_variable_spec.rb
View file @
fa35ea13
...
...
@@ -9,6 +9,24 @@ describe HasVariable do
it
{
is_expected
.
not_to
allow_value
(
'foo bar'
).
for
(
:key
)
}
it
{
is_expected
.
not_to
allow_value
(
'foo/bar'
).
for
(
:key
)
}
describe
'#key='
do
context
'when the new key is nil'
do
it
'strips leading and trailing whitespaces'
do
subject
.
key
=
nil
expect
(
subject
.
key
).
to
eq
(
''
)
end
end
context
'when the new key has leadind and trailing whitespaces'
do
it
'strips leading and trailing whitespaces'
do
subject
.
key
=
' my key '
expect
(
subject
.
key
).
to
eq
(
'my key'
)
end
end
end
describe
'#value'
do
before
do
subject
.
value
=
'secret'
...
...
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