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
9440958f
Commit
9440958f
authored
Dec 06, 2021
by
Siddharth Dungarwal
Committed by
Peter Leitzen
Dec 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Urlencode the Elasticsearch Credentials
parent
a70428b3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
ee/app/models/ee/application_setting.rb
ee/app/models/ee/application_setting.rb
+2
-2
ee/spec/models/application_setting_spec.rb
ee/spec/models/application_setting_spec.rb
+11
-0
No files found.
ee/app/models/ee/application_setting.rb
View file @
9440958f
...
@@ -316,8 +316,8 @@ module EE
...
@@ -316,8 +316,8 @@ module EE
elasticsearch_url
.
map
do
|
url
|
elasticsearch_url
.
map
do
|
url
|
uri
=
URI
.
parse
(
url
)
uri
=
URI
.
parse
(
url
)
uri
.
user
=
elasticsearch_username
uri
.
user
=
URI
.
encode_www_form_component
(
elasticsearch_username
)
uri
.
password
=
elasticsearch_password
.
presence
||
''
uri
.
password
=
URI
.
encode_www_form_component
(
elasticsearch_password
)
uri
.
to_s
uri
.
to_s
end
end
end
end
...
...
ee/spec/models/application_setting_spec.rb
View file @
9440958f
...
@@ -374,6 +374,17 @@ RSpec.describe ApplicationSetting do
...
@@ -374,6 +374,17 @@ RSpec.describe ApplicationSetting do
expect
(
setting
.
elasticsearch_url_with_credentials
).
to
eq
(
%w[http://username:password@example.com https://test:test@example2.com:9200]
)
expect
(
setting
.
elasticsearch_url_with_credentials
).
to
eq
(
%w[http://username:password@example.com https://test:test@example2.com:9200]
)
end
end
it
'encodes the credentials'
do
setting
.
elasticsearch_url
=
'http://username:password@example.com,https://test:test@example2.com:9200'
setting
.
elasticsearch_username
=
'foo/admin'
setting
.
elasticsearch_password
=
'b@r'
expect
(
setting
.
elasticsearch_url_with_credentials
).
to
eq
(
%w[
http://foo%2Fadmin:b%40r@example.com
https://foo%2Fadmin:b%40r@example2.com:9200
]
)
end
end
end
describe
'#elasticsearch_password'
do
describe
'#elasticsearch_password'
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