Skip to content

Optimize query for reference parser [RUN ALL RSPEC] [RUN AS-IF-FOSS]

What does this MR do?

It applies optimizations to MergeRequestParser for PostProcess pipeline.

Problem

We want to verify that links to merge requests are available for the current user. If they are not available, then we hide them.

Currently, we load all merge requests for each reference present on the page and check if the current user has access to their projects.

New approach

On the previous step, MergeRequestReferenceFilter converts references like !123 to HTML links. It additionally populates data attributes with meta information. The most important for us are merge request id and project id.

Instead of loading all merge request objects, we can fetch only their projects by ids defined in data attributes and verify if the user has access to them.

That significantly improves the performance.

Screenshots (strongly suggested)

Before After
Screenshot_2021-05-26_at_10.51.25 Screenshot_2021-05-26_at_10.48.47

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Vasilii Iakliushin

Merge request reports