Skip to content

Fix LFS pointer checks only verifying first reference

Patrick Steinhardt requested to merge pks-lfs-pointers-batched-checks into master

What does this MR do?

Right now, all Git checks we have are implemented on top of the ChangeAccess class, which provides the infrastructure to check a single reference update. This is not a good fit for all checks though, given that some may be computed much more efficiently if all changes were batched together into a single call.

One of these examples are the LFS checks, which have been retrofitted to match that interface by only executing them for the first reference. This may lead to wrong results (e.g. the user may arrange ref updates such that only the second ref introduced new dangling LFS pointers) and make for code that is hard to understand.

To fix this issue, create new infrastructure for batched checks in the form of a new ChangesAccess class. In contrast to the ChangeAccess class, it hands over all changes at once to the respective checks instead of only passing over single references.

As a proof of concept, this MR also moves over the LFS checks to use the new infrastructure. This does indeed also fix a bug where only the first reference was ever checked for LFS pointers. With the new batched interface, we can efficiently compute new LFS pointers across all changed refs at once.

It's only the first user though: a second user is going to be the DiffCheck, which can also be converted to compute all newly introduced commits in a similar fashion.

Closes #330324 (closed)

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 Patrick Steinhardt

Merge request reports