Skip to content

Authentication via Gitlab doesn't match with allowed-roles #4529

Closed
@eanikindfi

Description

@eanikindfi

Issue submitter TODO list

  • I've looked up my issue in FAQ
  • I've searched for an already existing issues here
  • I've tried running master-labeled docker image and the issue still persists there
  • I'm running a supported version of the application which is listed here

Describe the bug (actual behavior)

We deploy Kafka UI with helm-chart (0.7.6) and try to make Gitlab (self-hosted) integration for oauth.
We've managed to make it, but authorization doesn't work exactly how we want to.
We are trying to use allowed-roles option in Kafka Ui config, but it does nothing pretty much — any user who has access to valid gitlab account can actually access Kafka UI now.

Note: probably not a bug but misconfigured Kafka UI <> Gitlab integration.

Expected behavior

We have some groups in our Gitlab and when we use allowed-roles option we expect it to filter some of them and reject accesses. For example:
We have gitlab group — my-org/acl/kafka-ui/my-app/dev
In Kafka UI we have parameter:

allowed-roles:
  - my-org/acl/kafka-ui/my-app/dev

If a user has membership in this gitlab group they will have an access to Kafka UI. Otherwise they will not.
But now every gitlab user has an access — membership has no control over it.

Your installation details

helm-chart version = 0.7.6
image version = docker.io/provectuslabs/kafka-ui:v0.7.2

In values we use this block:

yamlApplicationConfig:
  auth:
    type: OAUTH2
    oauth2:
      client:
        gitlab:
          clientId: my_id
          clientSecret: my_secret
          client-name: GitLab
          client-authentication-method: client_secret_post
          authorization-grant-type: authorization_code
          authorization-uri: https://my-gitlab.com/oauth/authorize
          issuer-uri: https://my-gitlab.com
          jwk-set-uri: https://my-gitlab.com/oauth/discovery/keys
          user-name-attribute: name
          provider: oauth
          redirect-uri: https://my-kafka.net/login/oauth2/code/gitlab
          scope: openid
          token-uri: https://my-gitlab.com/oauth/token
          custom-params:
            type: oauth
            roles-field: groups
            allowed-roles:
              - my-org/acl/kafka-ui/my-app/dev

Steps to reproduce

For clientId we create a gitlab application with this scope:

  • openid
  • profile
  • email

Screenshots

No response

Logs

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/triageIssues pending maintainers triagetype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions