Commit Graph

55 Commits

Author SHA1 Message Date
GitLab Bot e6bcd6e738 Add latest changes from gitlab-org/gitlab@master 2020-09-25 09:09:40 +00:00
GitLab Bot a66475b6be Add latest changes from gitlab-org/gitlab@master 2020-09-11 21:08:44 +00:00
GitLab Bot 692f4b734f Add latest changes from gitlab-org/gitlab@master 2020-09-03 21:08:18 +00:00
GitLab Bot f2eb66fef8 Add latest changes from gitlab-org/gitlab@master 2020-08-21 03:10:16 +00:00
GitLab Bot bdca097916 Add latest changes from gitlab-org/gitlab@master 2020-08-11 03:11:00 +00:00
GitLab Bot c59765a50a Add latest changes from gitlab-org/gitlab@master 2020-06-24 18:09:03 +00:00
GitLab Bot 018431c70e Add latest changes from gitlab-org/gitlab@master 2020-06-11 15:08:36 +00:00
GitLab Bot c4844aea3f Add latest changes from gitlab-org/gitlab@master 2020-06-03 00:08:38 +00:00
GitLab Bot 6c577c9ada Add latest changes from gitlab-org/gitlab@master 2020-05-25 03:08:11 +00:00
GitLab Bot 2e4dcef627 Add latest changes from gitlab-org/gitlab@master 2020-05-08 15:09:28 +00:00
GitLab Bot 17c8111494 Add latest changes from gitlab-org/gitlab@master 2020-05-07 21:09:26 +00:00
GitLab Bot cfaf1cca44 Add latest changes from gitlab-org/gitlab@master 2020-02-16 21:08:53 +00:00
GitLab Bot 4247e67be1 Add latest changes from gitlab-org/gitlab@master 2020-01-03 12:07:59 +00:00
GitLab Bot 784fae4b9d Add latest changes from gitlab-org/gitlab@master 2019-12-12 12:07:33 +00:00
GitLab Bot c77dd0995c Add latest changes from gitlab-org/gitlab@master 2019-10-24 00:07:18 +00:00
GitLab Bot bd860c22f6 Add latest changes from gitlab-org/gitlab@master 2019-09-17 12:06:48 +00:00
Francisco Javier López 107ebb8251 Lower searches count limit
Lowering the limit when performing search from 1001 to 101.
This will allow us to speed this process.
2019-09-09 13:46:24 +00:00
Thong Kuah 8c42a0eac0 Add frozen_string_literal to lib part 2
Using the sed script from
https://gitlab.com/gitlab-org/gitlab-ce/issues/59758
2019-08-23 00:15:24 +12:00
Markus Koller 49c83155cc
Load search result counts asynchronously
Querying all counts for the different search results in the same request
led to timeouts, so we now only calculate the count for the *current*
search results, and request the others in separate asynchronous calls.
2019-08-12 22:01:15 +02:00
Alexis Reigel 241f38b01d
project's user search includes group members too 2019-03-14 18:21:02 +01:00
Alexis Reigel 22f44b50d8
add users search results to project scoped search 2019-03-14 18:16:03 +01:00
Jan Provaznik 58bfd73331 Optimized file search to work without limits
* removed 100 limit on file search results because we
  load all results anyway
* expensive processing (parsing match content, utf encoding)
  is done only for selected page in paginated output
2018-12-06 09:25:09 +01:00
Francisco Javier López 6354d55470 Fixing bug with wiki ref in ProjectSearchResults 2018-07-20 13:49:30 +00:00
Mark Chao a63bce1a4b Resolve "Rename the `Master` role to `Maintainer`" Backend 2018-07-11 14:36:08 +00:00
Francisco Javier López 7350eb1fa8 Add ability to search wiki titles 2018-06-04 11:41:37 +00:00
Jan Provaznik 91f8656c2c Disable greedy mode when matching filename 2018-05-15 10:20:18 +00:00
Zeger-Jan van de Weg 92482e01b4
Bump Gitaly to 0.98.0
Hooks were run for wikis, but given the internal API wasn't responding
failures happended, as seen on:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18693
2018-05-07 14:10:04 +02:00
Jasper Maes d17d3ec7f7 Split repository search result on \n instead of $ to prevent the items of the array to start with a newline. Remove the strip from parsing the search result to keep result endlines. 2018-03-19 19:09:31 +01:00
Sean McGivern 06a226a1c0 Fix code and wiki search results when filename is non-ASCII
Previously, we only handled non-ASCII file contents, but the name itself can be
non-ASCII.
2018-03-12 10:43:13 +00:00
Jan Provaznik 741caf93e1 Use limited count queries also for scoped searches 2018-03-05 13:25:56 +00:00
Sean McGivern b3c096cddc Fix code search results with non-ASCII data
Gitlab::Git::Popen#popen now returns ASCII-8BIT (binary) data always, so we need
to handle that explicitly.
2018-02-28 10:22:04 +00:00
Sean McGivern 82f4564fb7 Fix project search results for digits surrounded by colons
A file containing /:\d+:/ in its contents would break the search results if
those contents were part of the results, because we were splitting on colons,
which can't work with untrusted input.

Changing to use the null byte as a separator is much safer.
2018-01-16 11:56:07 +00:00
blackst0ne 27c95364b5 Replace '.team << [user, role]' with 'add_role(user)' in specs 2017-12-22 19:18:28 +11:00
haseeb 869877ab26 fix for special charecter in file names 2017-11-30 09:57:58 +00:00
Robert Speicher 72a7b30c9f Change all `:empty_project` to `:project` 2017-08-02 17:47:31 -04:00
Robert Speicher 9513bd18c4 Ensure all project factories use `:repository` trait or `:empty_project` 2017-08-01 14:51:52 -04:00
Rémy Coutable ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Valery Sizov 1a424a9bc9 Explicitly test that guest is able to search through the wiki 2017-05-29 16:20:25 +03:00
Valery Sizov f6c4ccd1f2 Backport FileFinder from EE 2017-05-12 13:21:30 +03:00
Douwe Maan 61a81a3ac2 Merge branch '31157-respect-project-features-in-wiki-search' into 'security'
Respect project features in wiki and blob search

See merge request !2089
2017-05-10 16:44:20 +02:00
Valery Sizov 387c4b2c21 Backport of multiple_assignees_feature [ci skip] 2017-05-04 17:11:53 +03:00
Nick Thomas 7f32ad7097 Fix blob highlighting in search 2017-04-03 18:51:44 +01:00
Semyon Pupkov 3deb66ea56 Add traits for ProjectFeatures to Project factory
https://gitlab.com/gitlab-org/gitlab-ce/issues/24007
2017-02-05 13:11:45 +05:00
Robert Speicher 80a6d2fda2 Use `:empty_project` where possible throughout spec/lib 2017-01-25 12:25:42 -05:00
YarNayar dd3ddcd72b Allows to search within project by commit's hash
Was proposed in #24833
2017-01-24 14:56:00 +03:00
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
Douwe Maan 3bf34face4 Merge branch 'jej-use-issuable-finder-instead-of-access-check' into 'security'
Replace issue access checks with use of IssuableFinder

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

### Issue lookup with access check

Using `visible_to_user` likely makes these security issues too. See [Code smells](#code-smells).

- [x] 🚦 app/finders/notes_finder.rb:15 [`visible_to_user`]
- [x] 🚥 app/views/layouts/nav/_project.html.haml:73 [`visible_to_user`] [`.count`]
- [x]  app/services/merge_requests/build_service.rb:84 [`issue.try(:confidential?)`]
- [x]  lib/api/issues.rb:112 [`visible_to_user`]
  - CHANGELOG: Prevented API returning issues set to 'Only team members' to everyone
- [x]  lib/api/helpers.rb:126 [`can?(current_user, :read_issue, issue)`] Maybe here too?
- [x]  lib/gitlab/search_results.rb:53 [`visible_to_user`]

### Previous discussions
- [ ] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#b2ff264eddf9819d7693c14ae213d941494fe2b3_128_126
- [ ] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#7b6375270d22f880bdcb085e47b519b426a5c6c7_87_87

See merge request !2031
2016-11-28 21:26:23 -03:00
Valery Sizov a5632e802b Search for a filename in a project 2016-11-16 14:25:54 +02:00
tiagonbotelho 1d268a89de adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
Douglas Barbosa Alexandre b56c456750 Project members with guest role can't access confidential issues 2016-06-13 19:32:00 -03:00