Skip to content

Step-up auth: Add REST API endpoint for group protection setting

What does this MR do and why?

Extends Groups REST API to expose and manage the step_up_auth_required_oauth_provider namespace setting, enabling programmatic configuration of step-up authentication requirements.

Adds conditional attribute exposure in GroupDetail entity with proper feature flag (omniauth_step_up_auth_for_namespace) and admin permission checks. The implementation follows existing namespace settings patterns and provides complete CRUD operations via GET/PUT endpoints.

This enables infrastructure-as-code security management and automation of step-up authentication policies across GitLab groups, addressing the gap between UI functionality and programmatic access.

🛠️ with ❤️ at Siemens

References

Screenshots or screen recordings

This MR adds REST API functionality without UI changes. The API responses can be tested via curl or API clients.

Before After
curl -H "PRIVATE-TOKEN: token" "http://localhost:3000/api/v4/groups/GROUP_ID" | jq '.step_up_auth_required_oauth_provider'
Response: Attribute not present
curl -H "PRIVATE-TOKEN: token" "http://localhost:3000/api/v4/groups/GROUP_ID" | jq '.step_up_auth_required_oauth_provider'
Response: null or "openid_connect"

How to set up and validate locally

Part 1: Prepare your local GitLab gdk instance

Follow the setup steps described in the previous MR.

Part 2: Test the REST API

  1. Create a test group and ensure that your personal access token can access this group (you need the api scope)
  2. Test GET request to retrieve current setting:
    curl --header "PRIVATE-TOKEN: your-token" \
      "http://localhost:3000/api/v4/groups/GROUP_ID"
  3. Test PUT request to update setting:
    curl --request PUT --header "PRIVATE-TOKEN: your-token" \
      --header "Content-Type: application/json" \
      --data '{"step_up_auth_required_oauth_provider":"openid_connect"}' \
      "http://localhost:3000/api/v4/groups/GROUP_ID"
  4. Test clearing the setting:
    curl --request PUT --header "PRIVATE-TOKEN: your-token" \
      --header "Content-Type: application/json" \
      --data '{"step_up_auth_required_oauth_provider":""}' \
      "http://localhost:3000/api/v4/groups/GROUP_ID"
  5. Verify attribute is only exposed with permissions and feature flag enabled
  6. Test validation with invalid provider names

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

MR Checklist (@gerardo-navarro)
Edited by Gerardo Navarro

Merge request reports

Loading