-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Design proposal: redacting sensitive user data from debug logs #27820
Comments
Hi @yanavlasov, as suggested in #27579 (comment) I'm submitting a design proposal issue. It includes some alternatives but I'm of course willing to adjust according to whatever is decided! |
Meant to cc @zuercher not assign. :) |
Given discussion here #27579 (comment), I interpret that it is discouraged to implement filtering around header logging code, which this design proposal is about. In case the situation would change, I'm willing work with this topic. |
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions. |
This issue is a design proposal for redacting sensitive user data that might be leaked via application logs when debug level logs are enabled in production.
Updates: #9652 and #27579
Goals
While doing troubleshooting it might be necessary to collect, distribute and store debug level application logs, even in production. Currently HTTP headers are printed to the debug log, when
--log-level debug
is enabled, which introduces a risk of unintended data leakage via revealing sensitive user information accidentally.This proposal is intended to discuss about a mechanism that user can (optionally) use to redact sensitive HTTP header information from application logs.
Design
The sensitive information shall be masked by adding
[redacted]
in place of potentially sensitive values.It shall be possible to redact values of common headers known to contain sensitive information, while preserving non-sensitive parts of header values. It shall also be possible to redact custom application specific headers that are used to pass sensitive information.
See "Example debug log entries" section for more details.
Alternative: Configurable list of headers to redact
In this alternative, it is assumed that redaction of the HTTP headers is configurable but new extension point to add custom "redactors" is NOT introduced. The reasoning is following:
Following predefined redactors shall be implemented:
/request-path?[redacted]
.cookie
header redactor leaves cookie names but redacts the values:key1=[redacted]; key2=[redacted]
set-cookie
header redactor leaves cookie names and attributes, but redacts the value:key=[redacted]; Path=/; Domain=example.com
Bootstrap config is used to select which headers are redacted:
Assuming that user wants to redact any sensitive information, the first three headers are highly likely candidates that are always present. User will also need to identify any application specific headers depending on the upstream applications, such as
x-vault-token
in the example above. The generic header value redactor (4) is used for headers that do not have a specific redactor logic associated with them.Alternative: Add new extension point for printing redacted headers into debug log
In this alternative, it is assumed that new redactors will be added over time. A new extension point shall be introduced to format header values (
HeaderEntry
instances inHeaderMap
), before printing them into the debug log.The
HeaderEntryFormatter
interface shall look like:The configuration shall look like:
Each entry in the list defines
header_names
and the corresponding formatter to apply for the headers. The formatter is passed configuration as typed config. The config messages in this example are empty. If entry is not found for header present in HTTP request or response, the header is printed as it is.Example debug log entries
Currently, headers are printed via
Http::HeaderMap::operator<<
stream insertion operator and implemented byHttp::HeaderMapImpl::dumpState()
.Following output is produced to debug log for HTTP request:
It includes request headers such as
cookie
andauthorization
and the query string.Similarly, sensitive information can be revealed in HTTP response headers when cookies are set:
Some applications use custom headers to pass sensitive information. Following example is from Vault:
Related information:
Here is a list of older issue where sensitive information was redacted from various printouts:
:PATH
in access logs without query string #7583, formatter: print request header without query string #15711The text was updated successfully, but these errors were encountered: