gitlab-org--gitlab-foss/spec/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 Allow admins to stop impersonating users without e-mail addresses 2016-11-17 23:28:39 -05:00
ci
groups Add toggle_subscription action to Groups::LabelsController 2016-11-17 15:10:13 -02:00
import modify github import JS and controller so we can now specify a namespace and/or name for a project. 2016-09-20 10:14:39 +02:00
oauth Use HTTP matchers if possible 2016-06-27 20:10:42 +02:00
profiles fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
projects Merge branch 'issue_13270' into 'master' 2016-12-13 11:43:15 +00:00
abuse_reports_controller_spec.rb
application_controller_spec.rb Add nested groups support to the routing 2016-11-23 14:08:36 +02:00
autocomplete_controller_spec.rb Do not raise error in AutocompleteController#users when not authorized 2016-11-30 10:09:14 +05:00
blob_controller_spec.rb Fix Error 500 when viewing a blob with binary characters after the 1024-byte mark 2016-06-12 07:36:25 -07:00
groups_controller_spec.rb This fixes a long running tests due to changed Sidekiq state 2016-08-15 23:26:40 +02:00
health_check_controller_spec.rb Use HTTP matchers if possible 2016-06-27 20:10:42 +02:00
help_controller_spec.rb Fix URL rewritting in the Help section 2016-12-01 16:40:48 +01:00
invites_controller_spec.rb Use HTTP matchers if possible 2016-06-27 20:10:42 +02:00
notification_settings_controller_spec.rb Merge branch 'master' into issue_3359_3 2016-06-29 11:32:38 -03:00
projects_controller_spec.rb Merge branch 'use-separate-token-for-incoming-email' into 'master' 2016-11-08 10:47:45 +00:00
registrations_controller_spec.rb Assert against ActionMailer::Base.deliveries relatively. 2016-07-05 10:20:32 +05:30
root_controller_spec.rb
search_controller_spec.rb Merge branch 'jej-note-search-uses-finder' into 'security' 2016-12-15 11:40:12 -03:00
sent_notifications_controller_spec.rb Remove default value for project argument on subscribable concern 2016-11-17 15:10:13 -02:00
sessions_controller_spec.rb fix: 24982- Remove'Signed in successfully' message 2016-12-07 20:30:28 +05:30
snippets_controller_spec.rb Ensure user is authenticated to create a new snippet 2016-11-28 16:57:49 +01:00
uploads_controller_spec.rb Use HTTP matchers if possible 2016-06-27 20:10:42 +02:00
users_controller_spec.rb Enforce the fork_project permission in Projects::CreateService 2016-09-27 13:17:56 +01:00