Skip to content

WIP: Fix pages access control settings on gitlab.com

What does this MR do?

https://gitlab.com/gitlab-org/gitlab-ce/issues/59286

This MR adds rake task which updates settings of all projects created after adding pages_access_level column to project_features unless project is public. We don't need to update public projects since for them current default ProjectFeature::ENABLED is actually equivalent to being public(and ProjectFeature::PUBLIC is even invalid value in UI now: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18589/diffs#85026f91fe12e413b4dd838ae761885adfa6812f_93_111)

We have about 3M projects to update

Aggregate  (cost=548314.70..548314.71 rows=1 width=8) (actual time=2568.773..2568.774 rows=1 loops=1)
  Buffers: shared hit=104695
  ->  Seq Scan on project_features  (cost=0.00..540090.35 rows=3289742 width=0) (actual time=0.041..2304.487 rows=3179099 loops=1)
        Filter: (pages_access_level = 20)
        Rows Removed by Filter: 6195464
        Buffers: shared hit=104695
Planning time: 0.499 ms
Execution time: 2568.845 ms

So we use background migration for that purpose.

I also considered starting background migration from usual migration not rake task and check if access_control is disabled there. But that can make things wrong in case if used enabled and then disabled access control.

Does this MR meet the acceptance criteria?

Conformity

Performance and testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • 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 Vladimir Shushlin

Merge request reports