gitlab-org--gitlab-foss/app/controllers
Douwe Maan 12db4cc0e7 Merge branch 'jej-note-search-uses-finder' into 'security'
Fix missing Note access checks in by moving Note#search to updated NoteFinder

Split from !2024 to partially solve https://gitlab.com/gitlab-org/gitlab-ce/issues/23867

## Which fixes are in this MR?

⚠️ - Potentially untested  
💣 - No test coverage  
🚥 - Test coverage of some sort exists (a test failed when error raised)  
🚦 - Test coverage of return value (a test failed when nil used)  
 - Permissions check tested

### Note lookup without access check

- [x]  app/finders/notes_finder.rb:13 :download_code check
- [x]  app/finders/notes_finder.rb:19 `SnippetsFinder`
- [x]  app/models/note.rb:121 [`Issue#visible_to_user`]
- [x]  lib/gitlab/project_search_results.rb:113
  - This is the only use of `app/models/note.rb:121` above, but importantly has no access checks at all. This means it leaks MR comments and snippets when those features are `team-only` in addition to the issue comments which would be fixed by `app/models/note.rb:121`.
  - It is only called from SearchController where `can?(current_user, :download_code, @project)` is checked, so commit comments are not leaked.

### Previous discussions
- [x] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#b915c5267a63628b0bafd23d37792ae73ceae272_13_13 `: download_code` check on commit
- [x] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#b915c5267a63628b0bafd23d37792ae73ceae272_19_19 `SnippetsFinder` should be used
  - `SnippetsFinder` should check if the snippets feature is enabled -> https://gitlab.com/gitlab-org/gitlab-ce/issues/25223

###  Acceptance criteria met?
- [x] Tests added for new code
- [x] TODO comments removed
- [x] Squashed and removed skipped tests
- [x] Changelog entry
- [ ] State Gitlab versions affected and issue severity in description
- [ ] Create technical debt issue for NotesFinder.
  - Either split into `NotesFinder::ForTarget` and `NotesFinder::Search` or consider object per notable type such as `NotesFinder::OnIssue`. For the first option could create `NotesFinder::Base` which is either inherited from or which can be included in the other two.
  - Avoid case statement anti-pattern in this finder with use of `NotesFinder::OnCommit` etc. Consider something on the finder for this? `Model.finder(user, project)`
  - Move `inc_author` to the controller, and implement `related_notes` to replace `non_diff_notes`/`mr_and_commit_notes`

See merge request !2035
2016-12-15 11:40:12 -03:00
..
admin Add nested groups support on data level 2016-12-08 11:47:16 +02:00
ci Remove Ci::ApplicationController 2016-10-10 16:47:27 +02:00
concerns Introduce deployment services, starting with a KubernetesService 2016-12-14 21:06:26 +00:00
dashboard Limit what label fields we expose on Dashboard::LabelsController#index 2016-10-19 14:58:26 -02:00
explore Precalculate trending projects 2016-10-10 12:27:08 +02:00
groups Add nested groups support on data level 2016-12-08 11:47:16 +02:00
import Merge branch 'security-fix-leaking-namespace-name' into 'security' 2016-10-24 15:49:05 +02:00
oauth
profiles Remove event caching code 2016-11-23 14:17:07 +01:00
projects Merge branch 'jej-note-search-uses-finder' into 'security' 2016-12-15 11:40:12 -03:00
sherlock
abuse_reports_controller.rb
application_controller.rb Merge branch 'dz-allow-nested-group-routing' into 'master' 2016-11-24 04:31:54 +00:00
autocomplete_controller.rb Do not raise error in AutocompleteController#users when not authorized 2016-11-30 10:09:14 +05:00
confirmations_controller.rb
dashboard_controller.rb
emojis_controller.rb
groups_controller.rb Syntax fixes and better tests for helper methods. Updated docs. 2016-09-15 14:10:49 -05:00
health_check_controller.rb
help_controller.rb Fix URL rewritting in the Help section 2016-12-01 16:40:48 +01:00
invites_controller.rb
jwt_controller.rb Merge branch 'unauthenticated-container-registry-access' into 'security' 2016-11-09 12:28:29 +01:00
koding_controller.rb Split Koding admin/user docs 2016-08-22 17:09:15 +03:00
notification_settings_controller.rb
omniauth_callbacks_controller.rb
passwords_controller.rb
profiles_controller.rb implements reset incoming email token on issues modal and account page, 2016-11-07 15:56:18 +00:00
projects_controller.rb Revert "Merge branch '22680-unlabel-limit-autocomplete-to-selected-items' into 'master'" 2016-11-17 09:39:23 +00:00
registrations_controller.rb Merge branch 'destroy-session' into 'security' 2016-12-08 21:21:06 -03:00
root_controller.rb
search_controller.rb Fix broken commits search 2016-11-08 12:03:23 +02:00
sent_notifications_controller.rb Remove default value for project argument on subscribable concern 2016-11-17 15:10:13 -02:00
sessions_controller.rb fix: removed signed_out notification 2016-12-12 15:04:48 +05:30
snippets_controller.rb Added 'Download' button to snippet view 2016-10-11 15:36:59 -04:00
uploads_controller.rb
users_controller.rb Check all namespaces on validation of new username. 2016-11-17 19:59:03 +01:00