Bypass 2FA setting not allowing dependency proxy pulls from users without 2FA in GitLab

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

We have received a ticket from a customer about 2FA validations when trying to pull images from the dependency proxy.

The customer has 2FA enforced on the instance, but also uses SAML SSO with the option to Bypass two-factor authentication. This is working fine instance wide, meaning that users who have signed in to the IDP and provided 2FA on the IDP, are not required to required to also go through 2FA in GitLab.

However, for the dependency proxy the behavior is not the same. When pulling images from the dependency proxy, GitLab is trying to check if the user has 2FA configured at the GitLab instance level, even though the customer is using  Bypass two-factor authentication feature. In summary:

Case 1

Case 2

Should Case 2 fail as well when Bypass two-factor authentication is configured and enabled? Since two factor is being bypassed at the instance level, it feels natural to also bypass and authorize requests to the dependency proxy.

Extra context: Case 2 fails with a CI job token. When using a PAT it succeeds.

Ideal Scenario:

Steps to reproduce

In a self-managed instance:

Example Project

N/A

What is the current bug behavior?

What is the expected correct behavior?

Relevant logs and/or screenshots

Screenshot 2025-06-12 at 07.21.27.png

Edited by 🤖 GitLab Bot 🤖