Skip to content

Mark diff files if they're part of broken symlinks

Thomas Randolph requested to merge symlink-comments/process-symlink-files into master

What does this MR do?

For #223076 (closed)

In order to be able to turn off parts of the UI in certain symlink-related scenarios, we first need to be able to correctly identify those scenarios.

We can already identify current symlinks (file.b_mode === '120000') and past symlinks (file.a_mode === '120000').
Broken symlinks are a much different beast, though, so this MR adds the brokenSymlink property to diff_files.

brokenSymlink is false if we don't immediately have the information that would indicate that:

  • There is more than one file with the same file_hash in the full files list
  • Any of those duplicates at one point had or currently have the symlink file mode

If brokenSymlink is true, its value is an object whose structure (and internal logic) is available for review in the source code.

Notably, we need to do this work early - right when we receive the file list - because later processing both removes some of this information (because it's not used in the front-end) and does some deduplication. Because of this, this MR adds an early prepareRawDiffFile function that runs before the other basic preparation functions.

Screenshots

N/A, all ~"feature::maintenance"

Does this MR meet the acceptance criteria?

Conformity

Availability 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 Thomas Randolph

Merge request reports