oauth2-proxy: [Bug]: Using google groups in Auth endpoint with allowed_groups parameter not working.

Oauth2 Proxy is not handling allowed_groups parameter correctly at Auth endpoint. I got 403 error in my application even if I am a member of google group.

Current Behavior

I was able to configure in Oauth2 Proxy google adminEmail, groups and serviceAccountJson. I used very wide group which includes all employees at my company so when SSO is enabled everyone has an access. This is working correctly and I checked that groups configured at this level of Oauth2 Proxy are correctly verifying if user is member of a google group.

For some applications I would like to narrow access to smaller groups, for example a single team. I am trying to use auth endpoint like this: oauth2/auth?allowed_groups=my-group@company.com. At this point it doesn’t work, it works when I am using parameter allowed_emails with single user e-mails, but when I am trying to use allowed_groups i got 403 error no matter if I am member of defined group or not.

Expected Behavior

I would like to be able to use Google groups like my-group@company.com in Auth endpoint in Ingress annotation. So Oauth2 Proxy expands Google group in to members, compare list of members with user which tries to access application and let in if user is a member of allowed_groups as it works on global configuration level of Oauth2 Proxy.

Possible Solution

It’s possible that I am doing something wrong so wanted clarify some topics:

  1. Are Google groups handled by allowed_groups of auth enpoint?
  2. If yes how I should define such group? I tried by e-mail address and by name and nothing seems to be working. On global configuration level I am using e-mail address of the group and it’s working fine.
  3. Are there any additional configuration / flags needed in order to make it work? I assumed that if oauth2 proxy is able to handle google groups on global configuration level it will be able to handle it also on auth endpoint.

Steps to Reproduce (for bugs)

In my case:

  • setup Oauth2-proxy
  • setup Google Auth Provider with “Restrict auth to specific Google groups on your domain” as explained in link: docs
  • try to use wide google group on global level
  • try to restrict access to smaller group (be member of both wide and small group) on Auth endpoint with allowed_groups parameter
  • you probably should receive 403 error, even though you should have access.

Your Environment

It’s setup in kubernetes. I am having problem only with mentioned feature so I don’t think there is need to analyse my environment.

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 7
  • Comments: 22 (9 by maintainers)

Most upvoted comments

unstale

still very broken