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
fed1dac9
Commit
fed1dac9
authored
Oct 04, 2019
by
Dylan Griffith
Committed by
Bob Van Landuyt
Oct 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix search by IID reveals private data
parent
3860a49b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
1 deletion
+53
-1
changelogs/unreleased/security-search-by-iid-leaks-data.yml
changelogs/unreleased/security-search-by-iid-leaks-data.yml
+6
-0
ee/lib/elastic/latest/application_class_proxy.rb
ee/lib/elastic/latest/application_class_proxy.rb
+4
-1
ee/spec/models/concerns/elastic/issue_spec.rb
ee/spec/models/concerns/elastic/issue_spec.rb
+22
-0
ee/spec/models/concerns/elastic/merge_request_spec.rb
ee/spec/models/concerns/elastic/merge_request_spec.rb
+21
-0
No files found.
changelogs/unreleased/security-search-by-iid-leaks-data.yml
0 → 100644
View file @
fed1dac9
---
title
:
Limit search for IID to a type to avoid leaking records with the same IID that
the user does not have access to
merge_request
:
author
:
type
:
security
ee/lib/elastic/latest/application_class_proxy.rb
View file @
fed1dac9
...
...
@@ -82,7 +82,10 @@ module Elastic
{
query:
{
bool:
{
filter:
[{
term:
{
iid:
iid
}
}]
filter:
[
{
term:
{
iid:
iid
}
},
{
term:
{
type:
self
.
es_type
}
}
]
}
}
}
...
...
ee/spec/models/concerns/elastic/issue_spec.rb
View file @
fed1dac9
...
...
@@ -75,6 +75,28 @@ describe Issue, :elastic do
expect
(
described_class
.
elastic_search
(
'bla-bla'
,
options:
{
project_ids: :any
,
public_and_internal_projects:
true
}).
total_count
).
to
eq
(
3
)
end
it
"searches by iid and scopes to type: issue only"
do
issue
=
nil
Sidekiq
::
Testing
.
inline!
do
issue
=
create
:issue
,
title:
'bla-bla issue'
,
project:
project
create
:issue
,
description:
'term2 in description'
,
project:
project
# MergeRequest with the same iid should not be found in Issue search
create
:merge_request
,
title:
'bla-bla'
,
source_project:
project
,
iid:
issue
.
iid
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
# User needs to be admin or the MergeRequest would just be filtered by
# confidential: false
options
=
{
project_ids:
[
project
.
id
],
current_user:
admin
}
results
=
described_class
.
elastic_search
(
"#
#{
issue
.
iid
}
"
,
options:
options
)
expect
(
results
.
total_count
).
to
eq
(
1
)
expect
(
results
.
first
.
title
).
to
eq
(
'bla-bla issue'
)
end
it
"returns json with all needed elements"
do
assignee
=
create
(
:user
)
issue
=
create
:issue
,
project:
project
,
assignees:
[
assignee
]
...
...
ee/spec/models/concerns/elastic/merge_request_spec.rb
View file @
fed1dac9
...
...
@@ -40,6 +40,27 @@ describe MergeRequest, :elastic do
expect
(
described_class
.
elastic_search
(
'term3'
,
options:
{
project_ids: :any
,
public_and_internal_projects:
true
}).
total_count
).
to
eq
(
1
)
end
it
"searches by iid and scopes to type: merge_request only"
do
project
=
create
:project
,
:public
,
:repository
merge_request
=
nil
Sidekiq
::
Testing
.
inline!
do
merge_request
=
create
:merge_request
,
title:
'bla-bla merge request'
,
source_project:
project
create
:merge_request
,
description:
'term2 in description'
,
source_project:
project
,
target_branch:
"feature2"
# Issue with the same iid should not be found in MergeRequest search
create
:issue
,
project:
project
,
iid:
merge_request
.
iid
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
options
=
{
project_ids:
[
project
.
id
]
}
results
=
described_class
.
elastic_search
(
"!
#{
merge_request
.
iid
}
"
,
options:
options
)
expect
(
results
.
total_count
).
to
eq
(
1
)
expect
(
results
.
first
.
title
).
to
eq
(
'bla-bla merge request'
)
end
it
"returns json with all needed elements"
do
merge_request
=
create
:merge_request
...
...
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