Skip to content

API definition for scrubbing request headers sending from ext_proc filter to ext_proc server - #27333

Merged
htuch merged 8 commits into
envoyproxy:mainfrom
yanjunxiang-google:header_to_forward
May 18, 2023
Merged

htuch merged 8 commits into
envoyproxy:mainfrom
yanjunxiang-google:header_to_forward

Conversation

@yanjunxiang-google

Copy link
Copy Markdown
Contributor

API definition for scrubbing request headers sending from ext_proc filter to ext_proc server

Commit Message:
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

@repokitteh-read-only

Copy link
Copy Markdown

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

🐱

Caused by: #27333 was opened by yanjunxiang-google.

see: more, trace.

Signed-off-by: Yanjun Xiang <[email protected]>
bool disable_clear_route_cache = 11;

// Disallow headers to be forwarded to the ext_proc server based on this regular expression.
type.matcher.v3.RegexMatcher disallow_header_to_forward = 12;

@yanjunxiang-google yanjunxiang-google May 10, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@htuch @rshriram @tyxia
To have ext_proc filter support header scrubbing in the direction from envoy to ext_proc server, we need to add this regex expression configuration. Thus ext_proc filter can remove headers based on this config.

On the reverse direction, Envoy has this configure for this purpose:

type.matcher.v3.RegexMatcher disallow_expression = 6;

The question I have is that is it enough to just add this disallow_header_to_forward regex expression? Do we need to add something like:
config.common.mutation_rules.v3.HeaderMutationRules outbound_mutation_rules = 12;

similar to the reverse direction:

config.common.mutation_rules.v3.HeaderMutationRules mutation_rules = 9;

which has a lot of other capabilities. We don't use some of them for now, but may be needed in the future?

In my opinion, just have disallow_header_to_forward regular expression is simple and clear for now. But not sure whether this is all we need.

@tyxia tyxia May 10, 2023 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMHO, a wrapper seems to be better. it will be flexible and extensible with more feature/control and without compatibility concern (e.g., move this field into wrapper) or add more fields scatteredly

HeaderMutationRules in mutation_rules.proto is specific to mutation by external processing server as all the code comment suggests. Since we don't need all those sub fields there and our purpose here is different (i.e., forward not mutation), I think it will be clear that we introduce a new wrapper e.g., HeaderForwardingRules and this can be used for callout in general (not just ext_proc). It is fine that we just have single field (or two list pending on our internal discussion) for now.

WDYT?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We need an allowlist. Like headers_to_forward. Its a simple list of headers. This will be specified by the end user. Disallow may be too cumbersome.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1. It should be an allow list. My preference TBH is to make this a repeated Regex. I don't see a lot of value in forcing all users to form a compound regex to express the common case of a list of headers. Internally we can still turn it into one large regex if we want to for efficiency or the like.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good ideas for all the comments! Just updated the PR based on them.

@yanjunxiang-google

Copy link
Copy Markdown
Contributor Author

/assign @htuch @tyxia @rshriram

@tyxia tyxia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for working on it!

Started with a high-level comment. Also, do you want to include the implementation in this PR(along with doc and release note). Otherwise, you will need to have not_implemented_hide.

bool disable_clear_route_cache = 11;

// Disallow headers to be forwarded to the ext_proc server based on this regular expression.
type.matcher.v3.RegexMatcher disallow_header_to_forward = 12;

@tyxia tyxia May 10, 2023 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMHO, a wrapper seems to be better. it will be flexible and extensible with more feature/control and without compatibility concern (e.g., move this field into wrapper) or add more fields scatteredly

HeaderMutationRules in mutation_rules.proto is specific to mutation by external processing server as all the code comment suggests. Since we don't need all those sub fields there and our purpose here is different (i.e., forward not mutation), I think it will be clear that we introduce a new wrapper e.g., HeaderForwardingRules and this can be used for callout in general (not just ext_proc). It is fine that we just have single field (or two list pending on our internal discussion) for now.

WDYT?

Signed-off-by: Yanjun Xiang <[email protected]>

@tyxia tyxia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, modulo comment nits.

Thanks!

@htuch htuch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM modulo small comment.

@htuch htuch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM modulo small comment.

Signed-off-by: Yanjun Xiang <[email protected]>

@htuch htuch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks!

@htuch

htuch commented May 16, 2023

Copy link
Copy Markdown
Member

@adisuissa any last comments?

@adisuissa

Copy link
Copy Markdown
Contributor

@adisuissa any last comments?

May consider a small renaming s/forwarding/filtering/ but don't feel strongly about this.
/lgtm api

@yanjunxiang-google

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #27333 (comment) was created by @yanjunxiang-google.

see: more, trace.

@yanjunxiang-google

Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only

Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #27333 (comment) was created by @yanjunxiang-google.

see: more, trace.

@yanjunxiang-google

yanjunxiang-google commented May 16, 2023 •

Copy link
Copy Markdown
Contributor Author

@adisuissa any last comments?

May consider a small renaming s/forwarding/filtering/ but don't feel strongly about this. /lgtm api

I think the goal of the proto is to define what header to be forwarded, not what header to be filtered. Thus I would recommend stay with forwarding. But I don't have strong opinion either way.

@adisuissa

Copy link
Copy Markdown
Contributor

/docs

@repokitteh-read-only

Copy link
Copy Markdown

Docs for this Pull Request will be rendered here:

https://storage.googleapis.com/envoy-pr/27333/docs/index.html

The docs are (re-)rendered each time the CI envoy-presubmit (precheck docs) job completes.

🐱

Caused by: a #27333 (comment) was created by @adisuissa.

see: more, trace.

@adisuissa adisuissa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!
Small nit, and good to go.

tyxia

This comment was marked as duplicate.

tyxia

This comment was marked as duplicate.

@tyxia tyxia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@adisuissa adisuissa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm api

@yanjunxiang-google

Copy link
Copy Markdown
Contributor Author

Kind ping!

@htuch
htuch merged commit 7d1b1d0 into envoyproxy:main May 18, 2023
reskin89 pushed a commit to reskin89/envoy that referenced this pull request Jul 11, 2023
…lter to ext_proc server (envoyproxy#27333)

API definition for scrubbing request headers sending from ext_proc filter to ext_proc server

Signed-off-by: Yanjun Xiang <[email protected]>
Signed-off-by: Ryan Eskin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants