gitlab-org--gitlab-foss/app/controllers/projects
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
..
boards
cycle_analytics refactored updater and updated specs 2016-11-18 13:00:38 +01:00
application_controller.rb
artifacts_controller.rb
avatars_controller.rb Remove event caching code 2016-11-23 14:17:07 +01:00
badges_controller.rb
blame_controller.rb
blob_controller.rb Merge branch 'jej-22869' into 'security' 2016-11-28 21:25:18 -03:00
boards_controller.rb
branches_controller.rb Merge branch 'jej-fix-missing-access-check-on-issues' into 'security' 2016-11-28 21:25:46 -03:00
builds_controller.rb
commit_controller.rb Merge branch 'jej-23867-use-mr-finder-instead-of-access-check' into 'security' 2016-12-08 21:42:07 -03:00
commits_controller.rb Merge branch 'jej-23867-use-mr-finder-instead-of-access-check' into 'security' 2016-12-08 21:42:07 -03:00
compare_controller.rb Merge branch 'jej-23867-use-mr-finder-instead-of-access-check' into 'security' 2016-12-08 21:42:07 -03:00
container_registry_controller.rb
cycle_analytics_controller.rb Merge branch 'jej-fix-missing-access-check-on-issues' into 'security' 2016-11-28 21:25:46 -03:00
deploy_keys_controller.rb
discussions_controller.rb Merge branch 'jej-23867-use-mr-finder-instead-of-access-check' into 'security' 2016-12-08 21:42:07 -03:00
environments_controller.rb Add EnvironmentSerializer to EnvironmentsController 2016-11-16 11:58:06 +00:00
find_file_controller.rb
forks_controller.rb Add authentication for for create action. Add more tests for for new and create actions 2016-11-15 01:59:11 +03:00
git_http_client_controller.rb Move LfsHelper to a new LfsRequest concern 2016-11-23 17:28:11 +01:00
git_http_controller.rb Move LfsHelper to a new LfsRequest concern 2016-11-23 17:28:11 +01:00
graphs_controller.rb
group_links_controller.rb Only skip group when it's actually a group in the "Share with group" select 2016-11-04 12:42:19 +01:00
hooks_controller.rb
imports_controller.rb
issues_controller.rb Feature: delegate all open discussions to Issue 2016-12-05 20:55:45 +01:00
labels_controller.rb Use @project as default on ToggleSubscriptionAction concern 2016-11-17 15:10:13 -02:00
lfs_api_controller.rb Move LfsHelper to a new LfsRequest concern 2016-11-23 17:28:11 +01:00
lfs_storage_controller.rb Move LfsHelper to a new LfsRequest concern 2016-11-23 17:28:11 +01:00
merge_requests_controller.rb Merge branch 'fix/rename-mwbs-to-merge-when-pipeline-succeeds' into 'master' 2016-12-05 11:07:57 +00:00
milestones_controller.rb Add a starting date to milestones 2016-11-23 13:41:04 +02:00
network_controller.rb Refactor method name 2016-11-08 05:12:17 +09:00
notes_controller.rb Merge branch 'jej-note-search-uses-finder' into 'security' 2016-12-15 11:40:12 -03:00
pipelines_controller.rb Adds tests for tabs in the rspec for pipelines 2016-11-30 17:06:46 +00:00
pipelines_settings_controller.rb Fix wrong template rendered when CI/CD settings aren't update successfully 2016-11-22 16:18:05 +01:00
project_members_controller.rb Use a single query in Projects::ProjectMembersController to fetch members 2016-12-08 18:35:59 +01:00
protected_branches_controller.rb
raw_controller.rb
refs_controller.rb
releases_controller.rb Allow to delete tag release note 2016-12-12 15:31:14 -02:00
repositories_controller.rb
runner_projects_controller.rb
runners_controller.rb
services_controller.rb Make chat authorization to work [ci skip] 2016-11-17 21:34:23 +01:00
snippets_controller.rb add scope filters to project snippets page 2016-12-10 00:57:23 -06:00
tags_controller.rb Fix lightweight tags not processed correctly by GitTagPushService 2016-10-28 13:53:18 -03:00
templates_controller.rb
todos_controller.rb Merge branch 'jej-23867-use-mr-finder-instead-of-access-check' into 'security' 2016-12-08 21:42:07 -03:00
tree_controller.rb
triggers_controller.rb
uploads_controller.rb
variables_controller.rb
wikis_controller.rb use wiki pages index for sidebar overflow and limit sidebar list to 15 pages 2016-11-30 15:22:43 -06:00