Skip to content

Include extra attributes in SubjectAccessReview#13170

Closed
multimac wants to merge 1 commit intolinkerd:mainfrom
multimac:tap-subject-access-review-extra-attrs
Closed

Include extra attributes in SubjectAccessReview#13170
multimac wants to merge 1 commit intolinkerd:mainfrom
multimac:tap-subject-access-review-extra-attrs

Conversation

@multimac
Copy link
Contributor

Kubernetes authorization plugins can rely on extra attributes on a user, and these are provided via X-Remote-Extra- headers. Currently the Linkerd Viz tap API doesn't include these attributes when making the SubjectAccessReview request which means the Tap API cannot be used by end-users who's clusters use such authz plugins.

This change updates the tap controller to parse the X-Remote-Extra- headers and include them in the SubjectAccessReview request.

Fixed #13169

Kubernetes authorization plugins can rely on extra attributes on a user, and these are provided via `X-Remote-Extra-` headers. Currently the Linkerd Viz `tap` API doesn't include these attributes when making the `SubjectAccessReview` request which means the Tap API cannot be used by end-users who's clusters use such authz plugins.

This change updates the `tap` controller to parse the `X-Remote-Extra-` headers and include them in the SubjectAccessReview request.
Fixed linkerd#13169

Signed-off-by: David Symons <david.symons@onemodel.co>
@multimac multimac requested a review from a team as a code owner October 11, 2024 04:20
@kflynn
Copy link
Member

kflynn commented Oct 31, 2024

Hey @multimac, just a quick check-in -- we're heads-down to ship Linkerd 2.17 but will be coming back to this as soon as we can. Sorry for the delay!

@stale
Copy link

stale bot commented Jan 30, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 30, 2025
@wmorgan wmorgan removed the wontfix label Jan 30, 2025
@alex-kattathra-johnson
Copy link

@kflynn: Looks like 2.17 is out by now. Is there plan to revisit this?

@alex-kattathra-johnson
Copy link

Ping @adleong

@olix0r
Copy link
Member

olix0r commented Mar 27, 2025

Unassigning @adleong so that this bubbles back up for prioritization. Since this branch isn't passing CI, it will clearly need some more work before it can be merged.

@stale
Copy link

stale bot commented Jun 26, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 26, 2025
@stale stale bot closed this Jul 10, 2025
Tolsto added a commit to Tolsto/linkerd2 that referenced this pull request Nov 29, 2025
Problem

Kubernetes authorization plugins can rely on extra attributes on a user,
provided via X-Remote-Extra- headers, e.g. AWS EKS with AccessEntry authentication.
Currently, the Linkerd Viz tap API doesn't include these attributes when making
SubjectAccessReview requests, preventing tap from working in clusters that use
authorization plugins relying on these extra attributes.

Solution

Updated the tap API to extract X-Remote-Extra- headers from incoming requests
and include them in SubjectAccessReview calls. The header prefix is read from
the extension-apiserver-authentication ConfigMap to support custom configurations.

This implementation is based on the original work by David Symons in PR linkerd#13170.

Changes:
- Modified ResourceAuthzForUser in pkg/k8s/authz.go to accept extra attributes
  as map[string]authV1.ExtraValue
- Updated viz/tap/api/handlers.go to extract and URL-decode extra headers
- Modified viz/tap/api/server.go to read the configurable header prefix from
  the Kubernetes ConfigMap
- Added tests to verify extra attributes are correctly passed through

Validation

Ran go test ./viz/tap/api/... ./pkg/k8s/... and all tests pass. Added
TestHandleTap_ExtraHeaders to verify extra attributes are correctly extracted
and passed to the Kubernetes client.
Tested with an actual EKS cluster with AccessEntry authentication.

Fixes linkerd#13169

Signed-off-by: Nils Mueller <20240901+Tolsto@users.noreply.github.com>
Tolsto added a commit to Tolsto/linkerd2 that referenced this pull request Feb 12, 2026
Problem

Kubernetes authorization plugins can rely on extra attributes on a user,
provided via X-Remote-Extra- headers, e.g. AWS EKS with AccessEntry authentication.
Currently, the Linkerd Viz tap API doesn't include these attributes when making
SubjectAccessReview requests, preventing tap from working in clusters that use
authorization plugins relying on these extra attributes.

Solution

Updated the tap API to extract X-Remote-Extra- headers from incoming requests
and include them in SubjectAccessReview calls. The header prefix is read from
the extension-apiserver-authentication ConfigMap to support custom configurations.

This implementation is based on the original work by David Symons in PR linkerd#13170.

Changes:
- Modified ResourceAuthzForUser in pkg/k8s/authz.go to accept extra attributes
  as map[string]authV1.ExtraValue
- Updated viz/tap/api/handlers.go to extract and URL-decode extra headers
- Modified viz/tap/api/server.go to read the configurable header prefix from
  the Kubernetes ConfigMap
- Added tests to verify extra attributes are correctly passed through

Validation

Ran go test ./viz/tap/api/... ./pkg/k8s/... and all tests pass. Added
TestHandleTap_ExtraHeaders to verify extra attributes are correctly extracted
and passed to the Kubernetes client.
Tested with an actual EKS cluster with AccessEntry authentication.

Fixes linkerd#13169

Signed-off-by: Nils Mueller <20240901+Tolsto@users.noreply.github.com>
adleong added a commit that referenced this pull request Mar 2, 2026
* Include extra attributes in SubjectAccessReview

Problem

Kubernetes authorization plugins can rely on extra attributes on a user,
provided via X-Remote-Extra- headers, e.g. AWS EKS with AccessEntry authentication.
Currently, the Linkerd Viz tap API doesn't include these attributes when making
SubjectAccessReview requests, preventing tap from working in clusters that use
authorization plugins relying on these extra attributes.

Solution

Updated the tap API to extract X-Remote-Extra- headers from incoming requests
and include them in SubjectAccessReview calls. The header prefix is read from
the extension-apiserver-authentication ConfigMap to support custom configurations.

This implementation is based on the original work by David Symons in PR #13170.

Changes:
- Modified ResourceAuthzForUser in pkg/k8s/authz.go to accept extra attributes
  as map[string]authV1.ExtraValue
- Updated viz/tap/api/handlers.go to extract and URL-decode extra headers
- Modified viz/tap/api/server.go to read the configurable header prefix from
  the Kubernetes ConfigMap
- Added tests to verify extra attributes are correctly passed through

Validation

Ran go test ./viz/tap/api/... ./pkg/k8s/... and all tests pass. Added
TestHandleTap_ExtraHeaders to verify extra attributes are correctly extracted
and passed to the Kubernetes client.
Tested with an actual EKS cluster with AccessEntry authentication.

Fixes #13169

Signed-off-by: Nils Mueller <20240901+Tolsto@users.noreply.github.com>

* Handle extra auth headers safely

---------

Signed-off-by: Nils Mueller <20240901+Tolsto@users.noreply.github.com>
Co-authored-by: Alex Leong <alex@buoyant.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linkerd Tap doesn't seem to work with EKS Access Entries authentication

7 participants