Skip to content
Snippets Groups Projects
Verified Commit 212967ae authored by Rémy Coutable's avatar Rémy Coutable
Browse files

Reject blank environment vcariables in Gitlab::Git::RevList


Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent c1dbae90
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -22,7 +22,7 @@ module Gitlab
 
def valid?
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
 
Loading
Loading
@@ -35,7 +35,7 @@ module Gitlab
end
 
def environment_variables
@environment_variables ||= env.slice(*ALLOWED_VARIABLES)
@environment_variables ||= env.slice(*ALLOWED_VARIABLES).compact
end
end
end
Loading
Loading
Loading
Loading
@@ -26,6 +26,13 @@ describe Gitlab::Git::RevList, lib: true do
 
expect(rev_list).not_to be_valid
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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment