Skip to content
Snippets Groups Projects
  1. Feb 25, 2020
  2. Feb 19, 2020
  3. Feb 14, 2020
  4. Feb 13, 2020
  5. Jan 29, 2020
  6. Jan 23, 2020
  7. Jan 20, 2020
  8. Jan 16, 2020
  9. Dec 10, 2019
  10. Dec 02, 2019
  11. Nov 19, 2019
  12. Oct 18, 2019
  13. Oct 17, 2019
  14. Sep 25, 2019
  15. Sep 18, 2019
  16. Sep 13, 2019
  17. Sep 10, 2019
  18. Jun 28, 2019
  19. Mar 28, 2019
  20. Jan 24, 2019
  21. Dec 20, 2018
  22. Nov 05, 2018
    • Yorick Peterse's avatar
      Rewrite SnippetsFinder to improve performance · d171ff60
      Yorick Peterse authored
      This completely rewrites the SnippetsFinder class from the ground up in
      order to improve its performance. The old code was beyond salvaging. It
      was complex, included various Rails 5 workarounds, comments that
      shouldn't be necessary, and most important of all: it produced a really
      poorly performing database query.
      
      As a result, I opted for rewriting the finder from scratch, instead of
      trying to patch the existing code. Instead of trying to reuse as many
      existing methods as possible, I opted for defining new methods
      specifically meant for the SnippetsFinder. This requires some extra code
      here and there, but allows us to have much more control over the
      resulting SQL queries. It is these changes that then allow us to produce
      a _much_ more efficient query.
      
      To illustrate how bad the old query was, we will use my own snippets as
      an example. Currently I have 52 snippets, most of which are global ones.
      To retrieve these, you would run the following Ruby code:
      
          user = User.find_by(username: 'yorickpeterse')
      
          SnippetsFinder.new(user, author: user).execute
      
      On GitLab.com the resulting query will take between 10 and 15 seconds to
      run, producing the query plan found at
      https://explain.depesz.com/s/Y5IX. Apart from the long execution time,
      the total number of buffers (the sum of all shared hits) is around 185
      GB, though the real number is probably (hopefully) much lower as I doubt
      simply summing these numbers produces the true total number of buffers
      used.
      
      The new query's plan can be found at https://explain.depesz.com/s/wHdN,
      and this query takes between 10 and 100-ish milliseconds to run. The
      total number of buffers used is only about 30 MB.
      
      Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/52639
      Unverified
      d171ff60
  23. Oct 23, 2018
    • Jan Provaznik's avatar
      Redact unsubscribe links in issuable texts · c1c14964
      Jan Provaznik authored
      It's possible that user pastes accidentally also unsubscribe link
      which is included in footer of notification emails. This unsubscribe
      link contains personal token which attacker then use to act as the
      original user (e.g. for sending comments under his/her identity).
      c1c14964
  24. Sep 17, 2018
    • Yorick Peterse's avatar
      Added FromUnion to easily select from a UNION · 8a72f5c4
      Yorick Peterse authored
      This commit adds the module `FromUnion`, which provides the class method
      `from_union`. This simplifies the process of selecting data from the
      result of a UNION, and reduces the likelihood of making mistakes. As a
      result, instead of this:
      
          union = Gitlab::SQL::Union.new([foo, bar])
      
          Foo.from("(#{union.to_sql}) #{Foo.table_name}")
      
      We can now write this instead:
      
          Foo.from_union([foo, bar])
      
      This commit also includes some changes to make this new setup work
      properly. For example, a bug in Rails 4
      (https://github.com/rails/rails/issues/24193) would break the use of
      `from("sub-query-here").includes(:relation)` in certain cases. There was
      also a CI query which appeared to repeat a lot of conditions from an
      outer query on an inner query, which isn't necessary.
      
      Finally, we include a RuboCop cop to ensure developers use this new
      module, instead of using Gitlab::SQL::Union directly.
      
      Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/51307
      Verified
      8a72f5c4
  25. Jul 30, 2018
    • Bob Van Landuyt's avatar
      Show the status of a user in interactions · f1d3ea63
      Bob Van Landuyt authored
      The status is shown for
      - The author of a commit when viewing a commit
      - Notes on a commit (regular/diff)
      - The user that triggered a pipeline when viewing a pipeline
      - The author of a merge request when viewing a merge request
      - The author of notes on a merge request (regular/diff)
      - The author of an issue when viewing an issue
      - The author of notes on an issue
      - The author of a snippet when viewing a snippet
      - The author of notes on a snippet
      - A user's profile page
      - The list of members of a group/user
      f1d3ea63
  26. Jul 26, 2018
  27. Mar 07, 2018
    • Jan Provaznik's avatar
      Add discussion API · dcdfa04b
      Jan Provaznik authored
      * adds basic discussions API for issues and snippets
      * reorganizes notes specs (so same tests can be used for all noteable types - issues, MRs, snippets)
      dcdfa04b
  28. Feb 09, 2018
    • Douwe Maan's avatar
      Merge branch... · 5e9e5692
      Douwe Maan authored
      Merge branch 'security-10-4-25223-snippets-finder-doesnt-obey-feature-visibility' into 'security-10-4'
      
      [Port for security-10-4]: Makes SnippetFinder ensure feature visibility
      5e9e5692
  29. Feb 02, 2018
  30. Nov 27, 2017
  31. Nov 24, 2017
  32. Nov 23, 2017
  33. Aug 31, 2017
    • Sean McGivern's avatar
      `current_application_settings` belongs on `Gitlab::CurrentSettings` · 5883ce95
      Sean McGivern authored
      The initializers including this were doing so at the top level, so every object
      loaded after them had a `current_application_settings` method. However, if
      someone had rack-attack enabled (which was loaded before these initializers), it
      would try to load the API, and fail, because `Gitlab::CurrentSettings` didn't
      have that method.
      
      To fix this:
      
      1. Don't include `Gitlab::CurrentSettings` at the top level. We do not need
         `Object.new.current_application_settings` to work.
      2. Make `Gitlab::CurrentSettings` explicitly `extend self`, as we already use it
         like that in several places.
      3. Change the initializers to use that new form.
      5883ce95
  34. Jul 06, 2017
    • Yorick Peterse's avatar
      Added Cop to blacklist the use of `dependent:` · 8fbbf41e
      Yorick Peterse authored
      This is allowed for existing instances so we don't end up 76 offenses
      right away, but for new code one should _only_ use this if they _have_
      to remove non database data. Even then it's usually better to do this in
      a service class as this gives you more control over how to remove the
      data (e.g. in bulk).
      Verified
      8fbbf41e
  35. Jul 05, 2017
  36. May 31, 2017
  37. May 10, 2017
  38. May 04, 2017
Loading