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 ¶
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 ¶
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.