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
1bdeed0e
Commit
1bdeed0e
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
af687aa1
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 @
1bdeed0e
...
@@ -16,6 +16,10 @@ module HasVariable
...
@@ -16,6 +16,10 @@ module HasVariable
key:
Gitlab
::
Application
.
secrets
.
db_key_base
,
key:
Gitlab
::
Application
.
secrets
.
db_key_base
,
algorithm:
'aes-256-cbc'
algorithm:
'aes-256-cbc'
def
key
=
(
new_key
)
super
(
new_key
.
to_s
.
strip
)
end
def
to_runner_variable
def
to_runner_variable
{
key:
key
,
value:
value
,
public:
false
}
{
key:
key
,
value:
value
,
public:
false
}
end
end
...
...
changelogs/unreleased/40561-environment-scope-value-is-not-trimmed.yml
0 → 100644
View file @
1bdeed0e
---
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 @
1bdeed0e
...
@@ -9,6 +9,24 @@ describe HasVariable do
...
@@ -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
)
}
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
describe
'#value'
do
before
do
before
do
subject
.
value
=
'secret'
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