jetstack / kube-oidc-proxy

Reverse proxy to authenticate to managed Kubernetes API servers via OIDC.
https://jetstack.io
Apache License 2.0
477 stars 91 forks source link

Improve Unauthed response #141

Open JoshVanL opened 4 years ago

JoshVanL commented 4 years ago

Currently, when we fail a authentication on a request, we simply reply with a 403 with a "Unauthorized" response body. We may want to change this to instead return a k8s JSON object, similar to how the API server is doing it:

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {

  },
  "status": "Failure",
  "message": "pods is forbidden: User \"system:anonymous\" cannot list resource \"pods\" in API group \"\" in the namespace \"default\": No policy matched.",
  "reason": "Forbidden",
  "details": {
    "kind": "pods"
  },
  "code": 403
}

There is some discussion to have around this:

/cc @munnerz

jijiechen commented 3 years ago

The proxy keeps responding Unauthorized without any extra information when correct permission is added for the "in cluster" service account. It took me days to guess what happened and now I have to give up.