Skip to content
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

filter: add capability to selectively dump request/response state on crash #37816

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

agrawroh
Copy link
Contributor

Description

Added a new configuration option in the Bootstrap to control whether headers and trailers should be included in the state dump during crashes. This feature allows more secure debugging by redacting sensitive information from logs.

Fixes #37793


Commit Message: filter: add capability to selectively dump request/response state on crash
Additional Description: Add new config in Bootstrap to control whether the headers/trailers should be dumped during the crash.
Risk Level: Low
Testing: Added Unit tests
Docs Changes: Added
Release Notes: Added

Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @wbpcode
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #37816 was opened by agrawroh.

see: more, trace.

@agrawroh
Copy link
Contributor Author

/assign @phlax

@agrawroh agrawroh force-pushed the selective_dump_state branch 2 times, most recently from 95f7ed7 to 44c74e9 Compare December 26, 2024 14:20
@agrawroh agrawroh force-pushed the selective_dump_state branch from 44c74e9 to 2c23dfd Compare December 26, 2024 14:26
Comment on lines +433 to +477
message DumpStateConfig {
// Configuration for controlling what state gets dumped when the ``dumpState()`` function is called. This allows
// selectively enabling/disabling certain types of information from being included in state dumps, which can be useful
// for security or performance reasons.
message DumpConfig {
// Configures how this type of state should be dumped.
oneof config {
option (validate.required) = true;

// When set to ``true``, completely disables dumping of this type of state information. This provides a simple way
// to completely exclude certain data from dumps.
bool disabled = 1;

// Provides an allow-list of specific headers that should be included in dumps. Only headers in this list will be
// dumped and the remaining will be excluded. This provides granular control over exactly which headers appear in
// the dumps.
HeaderList allowed_headers = 2;
}

// List of specific headers that should be included in dumps when using an allow-list.
message HeaderList {
// The list of header names that should be included in the dumps. Any headers not in this list will be excluded
// from dumps. Header names should match the exact header key.
repeated string headers = 1;
}
}

// Controls dumping of HTTP request headers. When not specified, all request headers will be dumped.
// Can be disabled entirely or limited to specific headers via allow-list.
DumpConfig request_headers = 1;

// Controls dumping of HTTP request trailers. When not specified, all request trailers will be dumped.
// Can be disabled entirely or limited to specific trailers via allow-list.
DumpConfig request_trailers = 2;

// Controls dumping of HTTP response headers. When not specified, all response headers will be dumped.
// Can be disabled entirely or limited to specific headers via allow-list.
DumpConfig response_headers = 3;

// Controls dumping of HTTP response trailers. When not specified, all response trailers will be dumped.
// Can be disabled entirely or limited to specific trailers via allow-list.
DumpConfig response_trailers = 4;

// Controls dumping of stream info state. When not specified, all stream info will be dumped.
DumpConfig stream_info = 5;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather then to do this with a big change, I will prefer do this gradually. (like only handle request headers first).

And considering the acutal scenario and back compatibility, what we want is an ability to hide some state if user explicitly set the configuration, not a reverse way.

Comment on lines +439 to +450
oneof config {
option (validate.required) = true;

// When set to ``true``, completely disables dumping of this type of state information. This provides a simple way
// to completely exclude certain data from dumps.
bool disabled = 1;

// Provides an allow-list of specific headers that should be included in dumps. Only headers in this list will be
// dumped and the remaining will be excluded. This provides granular control over exactly which headers appear in
// the dumps.
HeaderList allowed_headers = 2;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We not recomment oneof now. And I think what we want may only a repeated string sanitize_request_headers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Permit excluding sensitive headers from dump on fatal error
3 participants