dashboard icon indicating copy to clipboard operation
dashboard copied to clipboard

Unprivileged user can't see PSACT is set in cluster config

Open kourosh7 opened this issue 2 years ago • 0 comments

Setup

  • Rancher version: 2.7.6
  • Rancher UI Extensions:
  • Browser type & version: Tested on Firefox and Chrome

Describe the bug An unprivileged user can view the config of a cluster that has a PSA Configuration Template set on it, but in the Advanced Options > Pod Security Admission Configuration Template dropdown, it shows the value as None. If the same user views the YAML for the cluster, it shows the value under spec.defaultPodSecurityAdmissionConfigurationTemplateName

To Reproduce

  1. As an admin user, create a downstream RKE1 cluster with the Pod Security Admission Configuration Template set to rancher-restricted
  2. Once the cluster is active, the same user can go to Cluster Management, click the 3-dot menu for the cluster and select Edit Config and in the Advanced Options section see the Pod Security Admission Configuration Template value is set to rancher-restricted
  3. Create an unprivileged user with the attached GlobalRole and make that user a member of the same cluster
  4. As the unprivileged user, go to Cluster Management, click the 3-dot menu for the cluster and select View Config and check the Advanced Options section to see the Pod Security Admission Configuration Template value

Result The unprivileged user will see that the Pod Security Admission Configuration Template value shows as None. This is misleading because it is actually set to something. If the same user views the YAML for the cluster, they can see the value under spec.defaultPodSecurityAdmissionConfigurationTemplateName

Expected Result Show the actual value as it is seen in the YAML by the same user. Or, if this is a permissions issue, hide them from seeing this at all.

Screenshots

As seen by admin user: admin-user-sees-correct-PSACT-value

As seen by unprivileged user: unprivileged-user-sees-None-for-psact

Same unprivileged user can see the value set in the YAML unprivileged-user-sees-value-in-YAML

Additional context

global-reader-GlobalRole.txt

Workaround was to add the following to the GlobalRole

    resources:
      - podsecurityadmissionconfigurationtemplates
    verbs:
      - list

kourosh7 avatar Dec 14 '23 00:12 kourosh7