Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
496c3612
Commit
496c3612
authored
Dec 02, 2020
by
Małgorzata Ksionek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add other method to handle strings middleware
parent
c3ebc8a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
lib/gitlab/middleware/handle_malformed_strings.rb
lib/gitlab/middleware/handle_malformed_strings.rb
+8
-1
spec/lib/gitlab/middleware/handle_malformed_strings_spec.rb
spec/lib/gitlab/middleware/handle_malformed_strings_spec.rb
+6
-1
No files found.
lib/gitlab/middleware/handle_malformed_strings.rb
View file @
496c3612
...
...
@@ -61,7 +61,7 @@ module Gitlab
return
false
unless
credentials
string_malformed?
(
credentials
)
credentials_
string_malformed?
(
credentials
)
end
def
param_has_null_byte?
(
value
,
depth
=
0
)
...
...
@@ -98,6 +98,13 @@ module Gitlab
# If we're here, we caught a malformed string. Return true
true
end
def
credentials_string_malformed?
(
string
)
string
.
force_encoding
(
'UTF-8'
).
match?
(
NULL_BYTE_REGEX
)
rescue
ArgumentError
,
Encoding
::
UndefinedConversionError
# If we're here, we caught a malformed string. Return true
true
end
end
end
end
spec/lib/gitlab/middleware/handle_malformed_strings_spec.rb
View file @
496c3612
# frozen_string_literal: true
require
'spec_helper'
require
"rack/test"
...
...
@@ -104,6 +103,12 @@ RSpec.describe Gitlab::Middleware::HandleMalformedStrings do
expect
(
subject
.
call
(
env
)).
not_to
eq
error_400
end
it
'does not reject correct encoded password with special characters'
do
env
=
env_for
.
merge
(
auth_env
(
"username"
,
"RçKszEwéC5kFnû∆f243fycGu§Gh9ftDj!U"
,
nil
))
expect
(
subject
.
call
(
env
)).
not_to
eq
error_400
end
end
context
'in params'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment