GitLab organization Severitymedium builtIn

Description

When a top-level group enforces 2FA, the grace period for newly invited members to enrol should be short (less than 8 days). Long grace periods let invited accounts accumulate write access without 2FA enrolment, undermining the protection. The lessThan operator works on the int field two_factor_grace_period.

Recommendation

1. Go to your top-level Group Settings > General. 
2. Expand the Permissions and group features section. 
3. With Require all users in this group to setup two-factor authentication enabled, set Two-factor authentication grace period to 7 days or fewer. 
4. Save changes.

Policy Rule

{
  "target": "GLGroup",
  "if": {
    "allOf": [
      {
        "resource": "GLGroup",
        "property": "TwoFactorGracePeriod",
        "operator": "lessThan",
        "value": 8
      }
    ]
  },
  "then": {
    "effect": "Audit"
  }
}