From 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 18 Jun 2020 11:18:50 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-1-stable-ee --- spec/requests/api/admin/ci/variables_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'spec/requests/api/admin') diff --git a/spec/requests/api/admin/ci/variables_spec.rb b/spec/requests/api/admin/ci/variables_spec.rb index bc2f0ba50a2..185fde17e1b 100644 --- a/spec/requests/api/admin/ci/variables_spec.rb +++ b/spec/requests/api/admin/ci/variables_spec.rb @@ -109,6 +109,22 @@ describe ::API::Admin::Ci::Variables do expect(response).to have_gitlab_http_status(:bad_request) end + + it 'does not allow values above 700 characters' do + too_long_message = <<~MESSAGE.strip + The encrypted value of the provided variable exceeds 1024 bytes. \ + Variables over 700 characters risk exceeding the limit. + MESSAGE + + expect do + post api('/admin/ci/variables', admin), + params: { key: 'too_long', value: SecureRandom.hex(701) } + end.not_to change { ::Ci::InstanceVariable.count } + + expect(response).to have_gitlab_http_status(:bad_request) + expect(json_response).to match('message' => + a_hash_including('encrypted_value' => [too_long_message])) + end end context 'authorized user with invalid permissions' do -- cgit v1.2.3