An error occurred fetching the project authors.
  1. 18 Feb, 2020 1 commit
    • Oswaldo Ferreira's avatar
      Add cop to encourage idempotent Sidekiq workers · f78af0fc
      Oswaldo Ferreira authored
      This commit's goal is to add a cop (Scalability::IdempotentWorker)
      that will catch all workers that don't call idempotent! in its scope.
      
      Calling it will label the worker as idempotent, which will end up in
      our Sidekiq logs for further visibility.
      
      This also introduces a shared example and a perform_multiple helper
      method for executing jobs multiple times through unit tests.
      
      Also in this commit we set an example in an already idempotent worker
      ExpireJobCacheWorker. For this worker we call idempotent! in its
      scope and add tests with the new test helpers.
      f78af0fc
  2. 06 Feb, 2020 1 commit
  3. 05 Feb, 2020 2 commits
  4. 03 Feb, 2020 1 commit
    • Bob Van Landuyt's avatar
      Remove duplicated with_request_store spec-metadata · 87064f42
      Bob Van Landuyt authored
      The `with_request_store` metadata already lived inside `spec_helper`
      so we don't need another one.
      
      This also replaces the `before` and `after` blocks for handling the
      request store with a single around block. The advantage of that is
      that this `around` block would be wrapped around any `around` blocks
      defined inside the specs. Which I think is more predictable behaviour.
      87064f42
  5. 03 Jan, 2020 1 commit
    • Bob Van Landuyt's avatar
      Wrap requests in an ApplicationContext · 3c5be56e
      Bob Van Landuyt authored
      This provides context to all requests made to Rails controllers or
      grape endpoints.
      
      Doing this starts a new `Labkit::Context`, to which we can provide a
      namespace, project and user.
      
      We're currently setting the following values:
      
      - Web requests: In the ApplicationController we wrap the entire
        request in a `with_context`.
        - user: based on the `auth_user` if there is one
        - project: We try to read the @project instance variable of the
          controller.
        - namespace: We try to read the @group instance variable of the
          controller. If there was none, but the project was set, we'll use
          that path to set the namespace
      
      - API requests: The application context is pushed in a before block
        setting the following values:
        - user: to `current_user` if there is one
        - project: to `@project`
        - namespace: to `@group`
      
      - Internal API requests: the application context is pushed in a before
        block:
        - user: When to the user set in `Api::Support::GitAccessActor`
        - project: to @project if it was available
      
      The 3 supported attributes for a context are read lazily when
      required.
      
      This also replaces the existing correlation middlewares with the new
      Labkit::Context middlewares.
      
      The rack middleware wraps each rack request in an overarching context
      that adds the correlation id. The context is cleaned up after the
      request, so we're sure all child contexts are cleaned up as well.
      
      The sidekiq client middleware will write the context into the job that
       goes into redis when a job is scheduled.
      
      The sidekiq server middleware will then re-instantiate this context so
      the job gets executed with the same context that was alive when it was
      scheduled. This means that any new job scheduled from sidekiq would
      also have this context.
      3c5be56e
  6. 13 Dec, 2019 1 commit
  7. 19 Nov, 2019 1 commit
  8. 05 Nov, 2019 1 commit
  9. 21 Oct, 2019 1 commit
  10. 17 Oct, 2019 2 commits
  11. 15 Oct, 2019 1 commit
  12. 10 Oct, 2019 2 commits
  13. 06 Oct, 2019 1 commit
  14. 04 Oct, 2019 1 commit
  15. 02 Oct, 2019 1 commit
  16. 01 Oct, 2019 1 commit
  17. 26 Sep, 2019 1 commit
  18. 17 Sep, 2019 1 commit
  19. 05 Sep, 2019 2 commits
  20. 03 Sep, 2019 1 commit
  21. 02 Sep, 2019 1 commit
  22. 30 Aug, 2019 1 commit
  23. 11 Aug, 2019 1 commit
  24. 02 Aug, 2019 1 commit
  25. 25 Jul, 2019 3 commits
  26. 23 Jul, 2019 2 commits
  27. 18 Jul, 2019 1 commit
    • Markus Koller's avatar
      Add start_sha to commits API · f8cecafb
      Markus Koller authored
      When passing start_branch on committing from the WebIDE, it's possible
      that the branch has changed since editing started, which results in the
      change being applied on top of the latest commit in the branch and
      overwriting the new changes.
      
      By passing the start_sha instead we can make sure that the change is
      applied on top of the commit which the user started editing from.
      f8cecafb
  28. 16 Jul, 2019 1 commit
  29. 15 Jul, 2019 1 commit
    • Francisco Javier López's avatar
      Fix Server Side Request Forgery mitigation bypass · f5c1cd48
      Francisco Javier López authored
      When we can't resolve the hostname or it is invalid, we shouldn't
      even perform the request. This fix also fixes the problem the
      SSRF rebinding attack.
      
      We can't stub feature flags outside example blocks. Nevertheless,
      there are some actions that calls the UrlBlocker, that are performed
      outside example blocks, ie: `set` instruction.
      
      That's why we have to use some signalign mechanism outside the scope
      of the specs.
      f5c1cd48
  30. 12 Jul, 2019 4 commits