Skip to content

Fix request.reason.mode calcuation for glob and claims_to_roles expressions - #69629

Open
smallinsky wants to merge 3 commits into
masterfrom
smallinksy/request-reson-fix
Open

Fix request.reason.mode calcuation for glob and claims_to_roles expressions#69629
smallinsky wants to merge 3 commits into
masterfrom
smallinksy/request-reson-fix

Conversation

@smallinsky

@smallinsky smallinsky commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Closes #54397
Closes gravitational/customer-sensitive-requests#700

What

The request.reason.mode: required force a user to provide a Access Request Description. The option is configurable and make forces a JIT issuer to provided desc why he is requesting access.

The current functionality was only checking literal value equlity instead of regexp and claims_to_roles matching rules.

Why we match the mode: required agains regexp or claims_to_roles ?

This is needed because the the by default support regexp and claims_to_roles that and this cases where missing from intimal requested reason functionality:

https://goteleport.com/docs/identity-governance/access-requests/access-request-configuration/#requiring-request-reasons

changelog: Fixed access request reason requirement (request.reason.mode: required) being ignored when requestable roles were specified with a wildcard, regexp, or claims_to_roles instead of literal role names.

Manual Test Plan

Test Environment

local env

Test Cases

  • regexp match works:
  kind: role
  version: v7
  metadata:
    name: regexp-requester
  spec:
    allow:
      request:
        roles: ['^critical-.*$']
        reason:
          mode: required
  • Glob match works:
 kind: role
 version: v7
 metadata:
   name: wildcard-requester
 spec:
   allow:
     request:
       roles: ['critical-*']
       reason:
         mode: required
  • Claims to roles evaluation works:
  kind: role
  version: v7
  metadata:
    name: claims-requester
  spec:
    allow:
      request:
        claims_to_roles:
          - claim: 'logins'
            value: '*'
            roles: ['critical-access']
        reason:
          mode: required

TODO:

  • Update docs.

@smallinsky
smallinsky force-pushed the smallinksy/request-reson-fix branch from 3443159 to b8954bf Compare August 13, 2026 09:54
@smallinsky

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: b8954bf96d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@smallinsky

Copy link
Copy Markdown
Contributor Author

friendly ping @ryanclark @gabrielcorado

Comment thread lib/services/access_request.go Outdated
@smallinsky
smallinsky force-pushed the smallinksy/request-reson-fix branch from b8954bf to 58381f5 Compare August 14, 2026 09:29

@ryanclark ryanclark left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can merge today can we?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using wildcard for a role causes reason requirement to be ignored.

3 participants