Skip to content

Default owners for CODEOWNERS sections can't parse "." period symbols in usernames

Summary

Introduced in GitLab 15.11, Set a Default Owner for a section allows to specify a group, or user, as the default owner for an applicable section, such as:

[Documentation] @benjaminking 
docs/

A customer has reported that this does not work if a username contains a period symbol, .. Due to parsing, any users mentioned after a user with the period symbol are not considered as Code Owners. For example:

[awesome-group] @tmike @nabeel.bilgrami @mlockhart
folder/

This will only show @tmike as a Code Owner, as @nabeel.bilgrami and @mlockhart are not parsed:

image

I have been able to reproduce this in this publicly accessible project.

Steps to reproduce

  1. Create a project.
  2. Enable CodeOwner approval requirements for the protected branch, main.
  3. Create a CODEOWNERS file, similar to the above. Ensure that several project members have either been invited, or have inheritance. One of these project members will need to have a period symbol in the username.
  4. On a new branch, make a change and open a merge request, attempting to change something covered by the CODEOWNERS file.
  5. Note that any users mentione before the period symbol user are considered, but the period symbol user and any user after them are not considered.

Example Project

Publicly accessible project

What is the current bug behavior?

Some form of parsing seems to cut the username list short.

A user with a period symbol, and any users after them, are not considered as Code Owner approvers.

What is the expected correct behavior?

All users specified in the default owners list next to the section name should be added as Code Owners.

Output of checks

This bug happens on GitLab.com

Possible fixes

It looks like the regex used here doesn't consider the period symbol (\s+[@\w_\-\/\s+]*)?:

image

If we update the expression to include a period symbol in the character set, it works as expected (\s+[@\w_.\-\/\s+]*)?:

image