Skip to content

Improve UI handling of custom RBAC config #2287

Description

@AlanGreene

Is your feature request related to a problem ?

Follow up to #1420

The Dashboard API (provided by the Kubernetes API server) respects the configured RBAC, whether using the Dashboard ServiceAccount (default) or via user impersonation. This means that a user accessing the Dashboard can only access and act on the resources to which they (or the Dashboard ServiceAccount) are granted the relevant permissions. In case of forbidden access the Dashboard will display corresponding errors to the user.

The Dashboard also provides a 'read-only' mode with restricted RBAC. This mode is reflected in the UI by hiding any navigation items or other controls that require write access, e.g. Import resources, Create PipelineRun, delete, rerun, etc.

However, if a user/admin customises the RBAC, or enables user impersonation, the UI does not reflect this. All navigation items / controls are available in the UI and the user is presented with corresponding errors for any actions they not have permission to perform. It would be a much better user experience to only show the navigation items and controls the user has permission to use, thus avoiding these errors.

Describe the solution you'd like

The Kubernetes API server provides a number of mechanisms for checking API access

The most appropriate of these seems to be:

  • SelfSubjectRulesReview - A review which returns the set of actions a user can perform within a namespace. Useful for users to quickly summarize their own access, or for UIs to hide/show actions.

The Dashboard client should use this to determine which elements to make available in the UI.

Describe alternatives you've considered

SelfSubjectAccessReview allows a user to query whether or not they have permission to perform a given action, e.g. create a deployment in the dev namespace.

This may be useful in specific targeted cases but is unlikely to work well as a more general solution as it would require many requests on page load / navigation.

Additional context

Note: SelfSubjectRulesReview is scoped to a single namespace so additional work is required to handle the 'All namespaces' option in the global namespaces filter.

Consideration should also be given to caching responses for some period to avoid the need to query access on every navigation. This would be purely a client optimisation to avoid unnecessary network traffic, the actual RBAC configured on the cluster would still apply to the API calls.

How would we handle cases where a user doesn't have permission to list namespaces? One option is to prompt them to enter a namespace and then we could persist that in browser storage and use it to populate the namespaces dropdown / selected global namespace filter. For these users we should probably remove/disable the 'All namespaces' option.

Activity

  1. self-assigned this
    on Jan 15, 2022
  2. tekton-robot commented on Apr 17, 2022

    @tekton-robot
    Contributor

    Issues go stale after 90d of inactivity.
    Mark the issue as fresh with /remove-lifecycle stale with a justification.
    Stale issues rot after an additional 30d of inactivity and eventually close.
    If this issue is safe to close now please do so with /close with a justification.
    If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

    /lifecycle stale

    Send feedback to tektoncd/plumbing.

  3. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Apr 17, 2022
  4. AlanGreene commented on Apr 17, 2022

    @AlanGreene
    MemberAuthor

    This is still something we want to do .
    /lifecycle frozen

  5. added
    lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.
    and removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Apr 17, 2022
  6. DrissiReda commented on Apr 17, 2022

    @DrissiReda

    @AlanGreene is it a priority? If not, when do you think it’s going to be handled.

  7. AlanGreene commented on Feb 10, 2023

    @AlanGreene
    MemberAuthor

    Apologies for not replying sooner, I must have missed the notification. It's not currently a high priority but is something we would like to get to eventually. The highest priority items at the moment are currency (supporting latest Pipeline features) and consistency (common actions / presentation of resources, ensuring all *Run resources have similar support for creation etc.).

    This issue will become more important to provide clean support for #1388 and also opens up some other interesting possibilities in future so it is still something we'd love to add.

  8. removed their assignment
    on Aug 26, 2024
  9. removed
    lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.
    on May 19, 2026
  10. solidDoWant commented on Nov 14, 2026

    @solidDoWant

    I'm hitting a similar issue. I'm currently only giving the dashboard access to specific project namespaces via k8s RBAC, along with namespace list+watch. Right now, I need to update the --namespaces flag every time I add/remove a project. Without this, the dashboard namespace dropdown lists every namespace, and errors when selecting namespaces that it doesn't have permission to read.

    I'd be willing to contribute PR(s) for either of the following fixes:

    • Add support for a label selector flag along the lines of --namespace-selector=example.com/tekton-dashboard=true. This would decouple namespace additions/removals from my dashboard config. I think client-go provides a helper for this that should make implementation very straightforward.
    • Add support for deriving the namespace list via SelfSubjectRulesReview on every namespace. This would be a more complex solution, but more automatic for users.

    Would PRs for either of these features be accepted?

  11. AlanGreene commented on Nov 16, 2026

    @AlanGreene
    MemberAuthor

    Hi @solidDoWant, thanks for your interest.

    I'd like to understand your setup and use case a bit better:

    along with namespace list+watch

    If you're restricting the Dashboard to a subset of namespaces using --namespaces as you've mentioned, then you shouldn't need to give it namespace list+watch permission and can remove namespaces from the default tekton-dashboard-tenant-view ClusterRole or whatever config you have in place.

    every time I add/remove a project

    How many projects are you working with and how frequently does the list change? What does the process of adding or removing a project currently look like in a broader sense? Have you considered automation around this process that could also update the Dashboard config at the same time?


    As for your specific proposals:

    Add support for a label selector flag

    See #2172 (comment) for details of why this is not an approach we'll be pursuing.

    Add support for deriving the namespace list

    Deriving the list would require the Dashboard service account to always have permission to list all namespaces, which goes against our current minimal RBAC approach. The Dashboard service account (or user when using impersonation) must either be granted permission to list namespaces, or the desired subset of namespaces to display must be provided via config. These are the only supported scenarios and this stance is unlikely to change in the near term.

    The use of SelfSubjectRulesReview as proposed in the issue description is still the preferred approach but requires careful design before beginning implementation.

    Some things to consider:

    • prefer client-only changes using existing back-end (we'll be completely replacing the current back-end in the near future)
    • avoid disruptive API changes where possible
    • minimise any additional API surface area
    • efficient retrieval and caching of permissions
      • find good balance between currency and additional load on API server. Can probably get away with page load / namespace change to start with and go from there based on user feedback.
    • compatibility with planned Tekton Results integration (avoid multiple rounds of disruptive changes or rework)
    • etc.
  12. solidDoWant commented on Nov 16, 2026

    @solidDoWant

    If you're restricting the Dashboard to a subset of namespaces using --namespaces as you've mentioned, then you shouldn't need to give it namespace list+watch permission

    Thanks! Didn't realize that.

    How many projects are you working with and how frequently does the list change?

    Right now, about a dozen. Right now with how cheap and generally useful LLMs are, I'm "writing" (and maintaining) a project every week or so. Today my project setup process is entirely contained in a Helm chart, so adding or removing a project is as simple as adding/removing a Helm release file (I use FluxCD/GitOps), and updating any "coupled" config sites like the dashboard --namespaces flag.

    I certainly could setup my own automation for this. I'll probably go this route if there isn't a clear solution here - I just thought that this might benefit other users, so figured I'd see if the project was interested in this.

    Maybe another solution here would be to add this to the Tekton Operator TektonDashboard resource. The downside would be that the application would need to restart every time the list changed. This doesn't bother me, but other folks that change their list more frequently may take issue with this.

    See #2172 (comment)
    Deriving the list would require the Dashboard service account to always have permission to list all namespaces

    Thanks, hadn't seen that comment before. It does look like the dashboard has this permission by default. I completely get and respect that the goal here is to minimize permissions required. Maybe a solution here would be to only require namespace list+watch if a namespace selector flag is used? This wouldn't raise the RBAC permissions required for the current --namespaces path, nor the default install, while still addressing the issue. The flags would be "xor", matching the currently supported scenarios from a security perspective. How does this sound?

    Regarding the SelfSubjectRulesReview, I think this requires specifying a namespace so even with this approach namespace list+watch would be required.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions