BigW Consortium Gitlab

Commit deb74f73 by Sean McGivern

Merge branch '25848-fix-git-rev-list-env-parsing' into 'master'

Reject blank environment variables in Gitlab::Git::RevList Closes #25848 See merge request !8189
parents 52278412 212967ae
...@@ -22,7 +22,7 @@ module Gitlab ...@@ -22,7 +22,7 @@ module Gitlab
def valid? def valid?
environment_variables.all? do |(name, value)| environment_variables.all? do |(name, value)|
value.start_with?(project.repository.path_to_repo) value.to_s.start_with?(project.repository.path_to_repo)
end end
end end
...@@ -35,7 +35,7 @@ module Gitlab ...@@ -35,7 +35,7 @@ module Gitlab
end end
def environment_variables def environment_variables
@environment_variables ||= env.slice(*ALLOWED_VARIABLES) @environment_variables ||= env.slice(*ALLOWED_VARIABLES).compact
end end
end end
end end
......
...@@ -26,6 +26,13 @@ describe Gitlab::Git::RevList, lib: true do ...@@ -26,6 +26,13 @@ describe Gitlab::Git::RevList, lib: true do
expect(rev_list).not_to be_valid expect(rev_list).not_to be_valid
end end
it "ignores nil values" do
env = { var => nil }
rev_list = described_class.new('oldrev', 'newrev', project: project, env: env)
expect(rev_list).to be_valid
end
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