Commit 6246979a authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '60945-masked-variable-still-printed-in-log-output-on-gitlab-com' into 'master'

Resolve "Masked Variable still printed in log output on gitlab.com"

Closes #60945

See merge request gitlab-org/gitlab-ce!27768
parents 536d96a3 07b5c503
...@@ -27,13 +27,9 @@ module Gitlab ...@@ -27,13 +27,9 @@ module Gitlab
# don't expose `file` attribute at all (stems from what the runner # don't expose `file` attribute at all (stems from what the runner
# expects). # expects).
# #
# If the `variable_masking` feature is enabled we expose the `masked`
# attribute, otherwise it's not exposed.
#
def to_runner_variable def to_runner_variable
@variable.reject do |hash_key, hash_value| @variable.reject do |hash_key, hash_value|
(hash_key == :file && hash_value == false) || hash_key == :file && hash_value == false
(hash_key == :masked && !Feature.enabled?(:variable_masking))
end end
end end
......
...@@ -137,19 +137,5 @@ describe Gitlab::Ci::Variables::Collection::Item do ...@@ -137,19 +137,5 @@ describe Gitlab::Ci::Variables::Collection::Item do
.to eq(key: 'VAR', value: 'value', public: true, file: true, masked: false) .to eq(key: 'VAR', value: 'value', public: true, file: true, masked: false)
end end
end end
context 'when variable masking is disabled' do
before do
stub_feature_flags(variable_masking: false)
end
it 'does not expose the masked field to the runner' do
runner_variable = described_class
.new(key: 'VAR', value: 'value', masked: true)
.to_runner_variable
expect(runner_variable).to eq(key: 'VAR', value: 'value', public: true)
end
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment