impersonation

package
v0.34.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package impersonation deals with the impersonation headers a client may put on a request, from the point of view of something that forwards requests.

A virtual workspace commonly answers a request by forwarding it to a shard under an identity it established itself, either the caller's identity carried via impersonation, or a privileged identity of its own. The caller's request may itself carry impersonation headers, asking to act as someone else. Those were evaluated against the caller at the edge; if they travelled on to the shard, the shard would evaluate them again, this time against the forwarding identity, which is typically allowed far more than the caller is.

So anything that forwards a request must do one of two things: refuse the request when it asks to impersonate (HasHeaders), or strip the impersonation headers before forwarding (ScrubHeaders). Which one is right depends on whether the forwarder can honour the impersonation itself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasHeaders

func HasHeaders(header http.Header) bool

HasHeaders reports whether the request asks to impersonate someone, through any of the headers the apiserver's impersonation filter acts on. All of them must be considered: a request that only sets the UID header is still an impersonation request as far as that filter is concerned, so treating it as unimpersonated here would let it skip whatever checks the caller makes.

A header counts when it carries at least one non-empty value.

func ScrubHeaders

func ScrubHeaders(header http.Header)

ScrubHeaders removes every impersonation header from the request.

Anything that forwards a request onwards under an identity it established itself must do this, so that an impersonation the caller asked for is not replayed against the backend, where it would be evaluated against the forwarded identity instead of the original caller's.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL