formatter: add sha256 request header substitution formatter - #46891
Open
cooper-oai wants to merge 1 commit into
Open
formatter: add sha256 request header substitution formatter#46891cooper-oai wants to merge 1 commit into
cooper-oai wants to merge 1 commit into
Conversation
…les] Signed-off-by: Cooper Gamble <cooper@openai.com>
cooper-oai
requested a deployment
to
external-contributors
August 22, 2026 06:35 — with
GitHub Actions
Waiting
|
Hi @cooper-oai, welcome and thank you for your contribution. We will try to review your Pull Request as quickly as possible. In the meantime, please take a look at the contribution guidelines if you have not done so already. |
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.
Commit Message: formatter: add sha256 request header substitution formatter
Additional Description:
Add
%REQUEST_HEADER_SHA256(X?Y)%and%REQ_SHA256(X?Y)%as built-in HTTP substitution formatters. Both return the lowercase SHA-256 digest of request headerX, falling back toYwhenXis missing or empty. Missing and empty values produce no output rather than hashing an empty string.This supports request correlation and consistent hashing for internal gRPC calls such as ext_authz without copying plaintext sensitive header values into gRPC metadata. Header names are parsed at configuration time, and the implementation reuses Envoy's existing crypto utility.
Risk Level: Low. This is an optional, additive formatter and does not change existing formatters, routing, or xDS APIs.
Testing:
bazel test --config=clang --jobs=8 --local_ram_resources=12288 //test/common/formatter:substitution_formatter_test --test_output=errorstools/local_fix_format.shformatting and spelling checks on all changed files.Docs Changes: Document both operators, empty-header fallback, and the limits of unkeyed SHA-256 in the substitution formatter reference.
Release Notes: Added a new-feature release note for the SHA-256 request-header formatters.
Platform Specific Features: N/A
AI assistance: The implementation, tests, and documentation were prepared with AI assistance and reviewed by the submitter.
Related to #9652.
Fixes #46890