This repository has been archived by the owner on Sep 14, 2020. It is now read-only.
[305] Hide authorisation headers of exceptions' reprs #306
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What do these changes do?
Prevent leaking
Authorisation:
and maybe other sensitive headers of the K8s API requests and responses when failing to post an event.Description
Previously, Kopf was logging the whole repr of an error in case of failures. With
aiohttp.ClientResponseError
, this seems to be a problem, as its repr includes all the request headers, includingAuthorization: …
.When this header is logged, then those who have access to the logs can also get access to the K8s API (especially if the K8s API tokens are not expired, which is the case on its own).
With this change, it will only show string forms of any errors. For
aiohttp.ClientResponseError
, this means only the HTTP status, message, and an URL. And, as a special case, in K8s-event posting, only the HTTP status and message.Issues/PRs
Type of changes
Checklist
CONTRIBUTORS.txt