change remoteAddr to sourceIPs in Supervisor audit log for incoming http requests
#2174
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.
Previously the Supervisor audit logs logged the
http.Request'sremoteAddrvalue for all incoming http requests. However, this does not propagate the values of theX-Forwarded-FororX-Real-Ipheaders into the audit logs. This would lose some valuable information in the case where a proxy server is placed in front of the Supervisor.This PR removes the
remoteAddrfield from the Supervisor'sHTTP Request Receivedaudit log events, and replaces it with a newsourceIPsfield. The value of this field is filled using the same code that fills thesourceIPsfield in the Kubernetes audit logs, so it will have the exact same behavior. ThesourceIPsvalue will always be an array of strings, and each string will be an IP address. The request'sremoteAddrwill always be the last value in the list. Other values included in the list will be the IP addresses taken from the request'sX-Forwarded-Forand/orX-Real-Ipheaders.This is a breaking change for anyone who has built custom tooling to parse the Supervisor's audit logs. Please note the change in the field name, and note that the new
sourceIPsfield's value will always be an array of IP addresses instead of a single IP address. Since we just recently released the audit logging feature, hopefully this does not actually break anyone.Here is a real example from a Supervisor log after running the following command:
Log output includes the
X-Forwarded-Forvalues followed by theremoteAddrvalue:{ "level": "info", "timestamp": "2025-01-06T20:04:31.649240Z", "caller": "go.pinniped.dev/internal/federationdomain/requestlogger/request_logger.go:84$requestlogger.(*requestLogger).logRequestReceived", "message": "HTTP Request Received", "auditEvent": true, "auditID": "183bd147-0448-49dc-b042-1d6f706f4c76", "proto": "HTTP/2.0", "method": "GET", "host": "pinniped-supervisor-clusterip.supervisor.svc.cluster.local", "serverName": "pinniped-supervisor-clusterip.supervisor.svc.cluster.local", "path": "/some/path/.well-known/openid-configuration", "userAgent": "curl/8.7.1", "sourceIPs": [ "1.2.3.4", "5.6.7.8", "10.244.0.17" ] }Release note: