Skip to content
Snippets Groups Projects
  1. Jan 23, 2018
    • Jan Provaznik's avatar
      Use limit for search count queries · 090ca9c3
      Jan Provaznik authored
      Search query is especially slow if a user searches a generic string
      which matches many records, in such case search can take tens of
      seconds or time out. To speed up the search query, we search only for
      first 1000 records, if there is >1000 matching records we just display
      "1000+" instead of precise total count supposing that with such amount
      the exact count is not so important for the user.
      
      Because for issues even limited search was not fast enough, 2-phase
      approach is used for issues: first we use simpler/faster query to get
      all public issues, if this exceeds the limit, we just return the limit.
      If the amount of matching results is lower than limit, we re-run more
      complex search query (which includes also confidential issues).
      Re-running the complex query should be fast enough in such case because the
      amount of matching issues is lower than limit.
      
      Because exact total_count is now limited, this patch also switches to
      to "prev/next" pagination.
      
      Related #40540
      090ca9c3
  2. Jan 16, 2018
    • Sean McGivern's avatar
      Fix project search results for digits surrounded by colons · 82f4564f
      Sean McGivern authored
      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.
      82f4564f
  3. Nov 30, 2017
  4. May 12, 2017
  5. May 10, 2017
  6. Apr 03, 2017
  7. Jan 24, 2017
  8. Dec 15, 2016
    • Douwe Maan's avatar
      Merge branch 'jej-note-search-uses-finder' into 'security' · 12db4cc0
      Douwe Maan authored
      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?
      
      :warning: - Potentially untested  
      :bomb: - No test coverage  
      :traffic_light: - Test coverage of some sort exists (a test failed when error raised)  
      :vertical_traffic_light: - Test coverage of return value (a test failed when nil used)  
      :white_check_mark: - Permissions check tested
      
      ### Note lookup without access check
      
      - [x] :white_check_mark: app/finders/notes_finder.rb:13 :download_code check
      - [x] :white_check_mark: app/finders/notes_finder.rb:19 `SnippetsFinder`
      - [x] :white_check_mark: app/models/note.rb:121 [`Issue#visible_to_user`]
      - [x] :white_check_mark: 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
      12db4cc0
  9. Nov 16, 2016
  10. Nov 08, 2016
  11. Oct 20, 2016
  12. Sep 06, 2016
  13. Jun 03, 2016
  14. May 31, 2016
  15. Mar 17, 2016
  16. Mar 11, 2016
    • Yorick Peterse's avatar
      Added ProjectSearchResults#project_ids_relation · 8c2868e8
      Yorick Peterse authored
      This ensures some other methods such as the "issues" method still work.
      8c2868e8
    • Yorick Peterse's avatar
      Refactor Gitlab::ProjectSearchResults · ec349dc1
      Yorick Peterse authored
      Previously this class would be given a project ID which was then used to
      retrieve the corresponding Project object. However, in all cases the
      Project object was already known as it was used to grab the ID to pass
      to ProjectSearchResults. By just passing a Project instead we remove the
      need for an extra query as well as the need for some other complexity
      in this class.
      ec349dc1
  17. Nov 03, 2015
  18. Nov 02, 2015
  19. Oct 29, 2015
  20. Oct 21, 2015
  21. Jun 09, 2015
  22. Jun 08, 2015
    • zenati's avatar
      No need to check if `repository_ref` is present · c418261b
      zenati authored
      There is no need to check if `repository_ref` is present as:
      ```
            @repository_ref = if repository_ref.present?
                                repository_ref
                              else
                                nil
                              end
      ```
      
      is as same as doing:
      
      ```
      @repository_ref = repository_ref
      ```
      c418261b
  23. Mar 23, 2015
  24. Sep 25, 2014
  25. Sep 09, 2014
  26. Sep 06, 2014
  27. Sep 05, 2014
  28. Aug 27, 2014
  29. Aug 26, 2014
Loading