-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use audience-scoped access token #715
Labels
Comments
Added to epic #586 |
5 tasks
Open
A positive side-effect of this would be that, in a dev environment, there'll be no need to provision a long-lived service account token for the operator. |
An example token: {
"aud": [
"random-yaml-workspace.default:50051"
],
"exp": 1739306657,
"iat": 1739303057,
"iss": "https://kubernetes.default.svc.cluster.local",
"jti": "190a47cf-8963-44b4-b77c-18ece58bc4af",
"kubernetes.io": {
"namespace": "pulumi-kubernetes-operator",
"serviceaccount": {
"name": "controller-manager",
"uid": "f48ad504-695a-4775-ba52-d66cd7ffdbb8"
}
},
"nbf": 1739303057,
"sub": "system:serviceaccount:pulumi-kubernetes-operator:controller-manager"
} The behavior when the audience is rejected by the agent:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The operator transmits its own service account token to the workspace pod for authentication purposes. There is a risk of privilege elevation if the workspace pod were to capture the token and use it to impersonate the operator for arbitrary API Server interactions.
Kubernetes has a feature to prevent this: audience-scoped tokens. Rather than using the default token, the operator should call the
TokenRequest
API to get a token with a workspace-specific audience (e.g. the service endpoint). The token then has a specific workspace as its audience, and is useless for any other purpose. TheTokenReview
API validates such tokens as normal. On the agent side, one attaches the expected audience to the context when calling AuthenticateToken:See also: https://adil.medium.com/how-to-use-tokenrequest-api-and-tokenvolume-projection-in-kubernetes-f007135b9994
The text was updated successfully, but these errors were encountered: