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
c9b4dc67
Commit
c9b4dc67
authored
Aug 09, 2019
by
Patrick Derichs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filter out old system notes for epics
parent
20920f80
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
7 deletions
+16
-7
app/controllers/concerns/issuable_actions.rb
app/controllers/concerns/issuable_actions.rb
+1
-1
app/controllers/concerns/notes_actions.rb
app/controllers/concerns/notes_actions.rb
+1
-1
app/models/note.rb
app/models/note.rb
+4
-0
changelogs/unreleased/security-epic-notes-api-reveals-historical-info-ce-master.yml
...rity-epic-notes-api-reveals-historical-info-ce-master.yml
+5
-0
lib/api/discussions.rb
lib/api/discussions.rb
+1
-1
lib/api/helpers/notes_helpers.rb
lib/api/helpers/notes_helpers.rb
+3
-3
lib/api/notes.rb
lib/api/notes.rb
+1
-1
No files found.
app/controllers/concerns/issuable_actions.rb
View file @
c9b4dc67
...
@@ -110,7 +110,7 @@ module IssuableActions
...
@@ -110,7 +110,7 @@ module IssuableActions
end
end
notes
=
prepare_notes_for_rendering
(
notes
)
notes
=
prepare_notes_for_rendering
(
notes
)
notes
=
notes
.
reject
{
|
n
|
n
.
cross_reference_not_
visible_for?
(
current_user
)
}
notes
=
notes
.
select
{
|
n
|
n
.
visible_for?
(
current_user
)
}
discussions
=
Discussion
.
build_collection
(
notes
,
issuable
)
discussions
=
Discussion
.
build_collection
(
notes
,
issuable
)
...
...
app/controllers/concerns/notes_actions.rb
View file @
c9b4dc67
...
@@ -29,7 +29,7 @@ module NotesActions
...
@@ -29,7 +29,7 @@ module NotesActions
end
end
notes
=
prepare_notes_for_rendering
(
notes
)
notes
=
prepare_notes_for_rendering
(
notes
)
notes
=
notes
.
reject
{
|
n
|
n
.
cross_reference_not_
visible_for?
(
current_user
)
}
notes
=
notes
.
select
{
|
n
|
n
.
visible_for?
(
current_user
)
}
notes_json
[
:notes
]
=
notes_json
[
:notes
]
=
if
use_note_serializer?
if
use_note_serializer?
...
...
app/models/note.rb
View file @
c9b4dc67
...
@@ -331,6 +331,10 @@ class Note < ApplicationRecord
...
@@ -331,6 +331,10 @@ class Note < ApplicationRecord
cross_reference?
&&
!
all_referenced_mentionables_allowed?
(
user
)
cross_reference?
&&
!
all_referenced_mentionables_allowed?
(
user
)
end
end
def
visible_for?
(
user
)
!
cross_reference_not_visible_for?
(
user
)
end
def
award_emoji?
def
award_emoji?
can_be_award_emoji?
&&
contains_emoji_only?
can_be_award_emoji?
&&
contains_emoji_only?
end
end
...
...
changelogs/unreleased/security-epic-notes-api-reveals-historical-info-ce-master.yml
0 → 100644
View file @
c9b4dc67
---
title
:
Filter out old system notes for epics in notes api endpoint response
merge_request
:
author
:
type
:
security
lib/api/discussions.rb
View file @
c9b4dc67
...
@@ -239,7 +239,7 @@ module API
...
@@ -239,7 +239,7 @@ module API
# because notes are redacted if they point to projects that
# because notes are redacted if they point to projects that
# cannot be accessed by the user.
# cannot be accessed by the user.
notes
=
prepare_notes_for_rendering
(
notes
)
notes
=
prepare_notes_for_rendering
(
notes
)
notes
.
reject
{
|
n
|
n
.
cross_reference_not_
visible_for?
(
current_user
)
}
notes
.
select
{
|
n
|
n
.
visible_for?
(
current_user
)
}
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
end
end
...
...
lib/api/helpers/notes_helpers.rb
View file @
c9b4dc67
...
@@ -12,7 +12,7 @@ module API
...
@@ -12,7 +12,7 @@ module API
end
end
def
update_note
(
noteable
,
note_id
)
def
update_note
(
noteable
,
note_id
)
note
=
noteable
.
notes
.
find
(
params
[
:note_id
]
)
note
=
noteable
.
notes
.
find
(
note_id
)
authorize!
:admin_note
,
note
authorize!
:admin_note
,
note
...
@@ -61,8 +61,8 @@ module API
...
@@ -61,8 +61,8 @@ module API
end
end
def
get_note
(
noteable
,
note_id
)
def
get_note
(
noteable
,
note_id
)
note
=
noteable
.
notes
.
with_metadata
.
find
(
params
[
:note_id
]
)
note
=
noteable
.
notes
.
with_metadata
.
find
(
note_id
)
can_read_note
=
!
note
.
cross_reference_not_
visible_for?
(
current_user
)
can_read_note
=
note
.
visible_for?
(
current_user
)
if
can_read_note
if
can_read_note
present
note
,
with:
Entities
::
Note
present
note
,
with:
Entities
::
Note
...
...
lib/api/notes.rb
View file @
c9b4dc67
...
@@ -42,7 +42,7 @@ module API
...
@@ -42,7 +42,7 @@ module API
# array returned, but this is really a edge-case.
# array returned, but this is really a edge-case.
notes
=
paginate
(
raw_notes
)
notes
=
paginate
(
raw_notes
)
notes
=
prepare_notes_for_rendering
(
notes
)
notes
=
prepare_notes_for_rendering
(
notes
)
notes
=
notes
.
reject
{
|
n
|
n
.
cross_reference_not_
visible_for?
(
current_user
)
}
notes
=
notes
.
select
{
|
note
|
note
.
visible_for?
(
current_user
)
}
present
notes
,
with:
Entities
::
Note
present
notes
,
with:
Entities
::
Note
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
...
...
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