Bug 1972687 - Using bound SA tokens causes causes failures to /apis/authorization.openshift.io/v1/clusterrolebindings
Summary: Using bound SA tokens causes causes failures to /apis/authorization.openshift...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: apiserver-auth
Version: 4.8
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.8.0
Assignee: Sergiusz Urbaniak
QA Contact: liyao
URL:
Whiteboard:
: 1973258 (view as bug list)
Depends On: 1972383
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-16 12:19 UTC by Sergiusz Urbaniak
Modified: 2021-07-27 23:13 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1972383
Environment:
Last Closed: 2021-07-27 23:13:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift openshift-apiserver pull 219 0 None closed [release-4.8] Bug 1972687: openshift authorization proxy: escape header key values 2021-06-17 16:29:39 UTC
Red Hat Product Errata RHSA-2021:2438 0 None None None 2021-07-27 23:13:28 UTC

Comment 2 liyao 2021-06-18 10:26:18 UTC
Tested in fresh cluster 4.8.0-0.nightly-2021-06-18-055840

There are 2 ways to verify

Method 1
1. copy oc to ANY_POD
$ oc cp /usr/bin/oc ANY_POD:/tmp/oc
2. enter ANY_POD
$ oc rsh ANY_POD
3. get the resources in authorization.openshift.io group by oc CLI and check the result
when using old build, error is returned from the server.
sh-4.4$ /tmp/oc get rolebinding.v1.authorization.openshift.io
Error from server: Get "https://172.30.0.1:443/apis/rbac.authorization.k8s.io/v1/namespaces/xxia-proj/rolebindings?limit=500": net/http: invalid header field name "Impersonate-Extra-authentication.kubernetes.io/pod-uid"
sh-4.4$ /tmp/oc get role.v1.authorization.openshift.io
Error from server: Get "https://172.30.0.1:443/apis/rbac.authorization.k8s.io/v1/namespaces/xxia-proj/roles?limit=500": net/http: invalid header field name "Impersonate-Extra-authentication.kubernetes.io/pod-name" (edited) 

when using new build including the fix, expected result is returned.
sh-4.4# /tmp/oc get rolebinding.v1.authorization.openshift.io
NAME                    ROLE                                       USERS   GROUPS                                             SERVICE ACCOUNTS                      USERS
prometheus-k8s          openshift-oauth-apiserver/prometheus-k8s                                                              openshift-monitoring/prometheus-k8s   
...                                  
sh-4.4# /tmp/oc get role.v1.authorization.openshift.io
NAME
prometheus-k8s


Method 2
1) enter a different pod rather than KAS
$ oc get pods -n openshift-oauth-apiserver
$ oc rsh -n openshift-oauth-apiserver apiserver-64c8f57f9c-2djtw
2) curl the endpoint of the kube-apiserver from inside of the pod and check and result
$ token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
$ curl -k "https://${KUBERNETES_SERVICE_HOST}/apis/authorization.openshift.io/v1/clusterroles/view" -H "Authorization: Bearer ${token}"

when using old build, error is returned from the server.
{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {  },
  "status": "Failure",
  "message": "Get \"https://172.30.0.1:443/apis/rbac.authorization.k8s.io/v1/clusterroles/view\": net/http: invalid header field name \"Impersonate-Extra-authentication.kubernetes.io/pod-name\"",
  "code": 500
}

when using new build including the fix, expected result is returned.
{
  "kind": "ClusterRole",
  "apiVersion": "authorization.openshift.io/v1",
  "metadata": {
    "name": "view",
    ...
}

Comment 3 Osher De Paz 2021-06-21 12:13:56 UTC
*** Bug 1973258 has been marked as a duplicate of this bug. ***

Comment 6 errata-xmlrpc 2021-07-27 23:13:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.8.2 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:2438


Note You need to log in before you can comment on or make changes to this bug.