Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-27 00:08:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-27 00:08:22 +0300
commitcaafd2e49984d98cbe9f565674611c3194948492 (patch)
tree4d2d9f51d1a01dc3e9da5403325853434447c243 /spec/requests/user_sends_malformed_strings_spec.rb
parenta683d38a36aadac5c244299d37325424d85fa9e5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/user_sends_malformed_strings_spec.rb')
-rw-r--r--spec/requests/user_sends_malformed_strings_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/requests/user_sends_malformed_strings_spec.rb b/spec/requests/user_sends_malformed_strings_spec.rb
new file mode 100644
index 00000000000..b6eda9159bc
--- /dev/null
+++ b/spec/requests/user_sends_malformed_strings_spec.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'User sends malformed strings as params' do
+ let(:null_byte) { "\u0000" }
+ let(:invalid_string) { "mal\xC0formed" }
+
+ it 'raises a 400 error with a null byte' do
+ post '/nonexistent', params: { a: "A #{null_byte} nasty string" }
+
+ expect(response).to have_gitlab_http_status(:bad_request)
+ end
+
+ it 'raises a 400 error with an invalid string' do
+ post '/nonexistent', params: { a: "A #{invalid_string} nasty string" }
+
+ expect(response).to have_gitlab_http_status(:bad_request)
+ end
+end