fix(audit): log user for filtered requests - #1090
Merged
oliverbaehler merged 2 commits intoAug 19, 2026
Merged
Conversation
anisimov-es
force-pushed
the
fix/audit-filtered-request-username
branch
from
August 11, 2026 09:27
3ca150e to
d1512fa
Compare
Signed-off-by: Anisimov Evgeniy <anisimov.evgeniy.s@gmail.com>
anisimov-es
force-pushed
the
fix/audit-filtered-request-username
branch
from
August 11, 2026 13:54
d1512fa to
8046ea9
Compare
oliverbaehler
requested changes
Aug 18, 2026
oliverbaehler
approved these changes
Aug 19, 2026
Contributor
Author
|
@oliverbaehler thank you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Capsule Proxy forwards filtered cross-namespace requests using its own ServiceAccount. As a result, the Kubernetes API server audit event cannot include the original caller in
impersonatedUser.This change adds a structured V(4) Proxy log before the caller token is replaced:
{ "msg": "proxying filtered request", "username": "system:serviceaccount:<namespace>:<name>", "method": "GET", "uri": "/api/v1/secrets" }The log makes the authenticated caller observable for requests handled through the selector/filter path, without logging bearer tokens or groups. It gives security teams a reliable way to attribute filtered API requests to the originating user or ServiceAccount, instead of inferring the caller from a proxy IP address or treating successful requests as unattributed.
Changes
handleRequest.Validation
make golintgo test $(go list ./... | grep -v /e2e/)Created a Tenant owned by a dedicated ServiceAccount.
Created three Tenant namespaces, a BusyBox workload, and one Secret per namespace.
Requested
GET /api/v1/secrets?limit=500through Capsule Proxy using the ServiceAccount token.The response contained only the three Tenant secrets.
Capsule Proxy emitted:
{ "msg": "proxying filtered request", "username": "system:serviceaccount:capsule-audit-client:audit-user", "method": "GET", "uri": "/api/v1/secrets" }