Skip to content

xds/bootstrap: add trusted_xds_server server feature#8692

Merged
Pranjali-2501 merged 5 commits intogrpc:masterfrom
Pranjali-2501:bootstrap-changes
Nov 25, 2025
Merged

xds/bootstrap: add trusted_xds_server server feature#8692
Pranjali-2501 merged 5 commits intogrpc:masterfrom
Pranjali-2501:bootstrap-changes

Conversation

@Pranjali-2501
Copy link
Copy Markdown
Contributor

@Pranjali-2501 Pranjali-2501 commented Nov 3, 2025

This PR implements the Bootstrap config changes for gRFC A81.

Authority rewriting is a security-sensitive feature that should only be enabled when the xDS server is explicitly trusted to provide such configuration. gRFC A81 specifies that this trust is indicated by adding trusted_xds_server to the server_features list for a given server in the bootstrap file.

RELEASE NOTES: None

@Pranjali-2501 Pranjali-2501 added this to the 1.78 Release milestone Nov 3, 2025
@Pranjali-2501 Pranjali-2501 added the Area: xDS Includes everything xDS related, including LB policies used with xDS. label Nov 3, 2025
@Pranjali-2501 Pranjali-2501 added the Type: Feature New features or improvements in behavior label Nov 3, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 82.85714% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.34%. Comparing base (c45d8e6) to head (680ebd3).
⚠️ Report is 16 commits behind head on master.

Files with missing lines Patch % Lines
internal/xds/xdsclient/clientimpl.go 76.92% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8692      +/-   ##
==========================================
- Coverage   83.42%   83.34%   -0.08%     
==========================================
  Files         416      419       +3     
  Lines       32303    32443     +140     
==========================================
+ Hits        26948    27040      +92     
- Misses       3993     4031      +38     
- Partials     1362     1372      +10     
Files with missing lines Coverage Δ
internal/xds/bootstrap/bootstrap.go 66.66% <100.00%> (+0.51%) ⬆️
internal/xds/clients/xdsclient/authority.go 79.51% <100.00%> (+0.26%) ⬆️
internal/xds/clients/xdsclient/xdsconfig.go 100.00% <100.00%> (ø)
internal/xds/xdsclient/clientimpl.go 85.45% <76.92%> (-0.96%) ⬇️

... and 32 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@easwars easwars changed the title xds/bootstrap: adding server_feature in bootstrap config xds/bootstrap: add trusted_xds_server server feature Nov 4, 2025
@easwars
Copy link
Copy Markdown
Contributor

easwars commented Nov 4, 2025

The generic xDS client's configuration can be found here:

type ServerConfig struct {

We need to propagate this newly added server feature to the generic xDS client as well. In order to do that, we need to do the following:

  • Either of the following:
    • Add a new field named TrustedXDSServer in the above mentioned ServerConfig struct, or
    • Add a new field named ServerFeatures which is of type []ServerFeature and remove the existing IgnoreResourceDeletion, or
    • Add a new field named ServerFeatures which is of type map[ServerFeature]bool which is the idiomatic way of representing a Set in Go. Again, remove the existing IgnoreResourceDeletion field.
    • I would prefer going with the second or the third approach since there is already a comment there saying IgnoreResourceDeletion will be removed in favor of two new fields when A88 is implemented. Instead of adding one field per server feature, we could instead have a container to store the server features.
  • Add a method in the ServerConfig struct of the generic xDS client to check if a server feature exists. This could be something like:
func (s *ServerConfig) SupportsServerFeature(feature ServerFeature) bool { ... }
  • Introduce exported constants for the supported server features in the generic xDS client. This could be internal/xds/clients/xdsclient/xdsconfig.go. Something like:
type ServerFeature int
const (
	ServerFeatureIgnoreResourceDeletion ServerFeature = iota
	ServerFeatureTrustedXDSServer
)
  • Remove the existing direct reference to IgnoreResourceDeletion here:
    if serverConfig.IgnoreResourceDeletion {
    and replace it with a call to serverConfig.SupportsServerFeature(ServerFeatureIgnoreResourceDeletion)
  • Add logic to populate the server features in the generic xDS client config here:
    func buildXDSClientConfig(config *bootstrap.Config, metricsRecorder estats.MetricsRecorder, target string, watchExpiryTimeout time.Duration) (xdsclient.Config, error) {
    • While you are here, you could also refactor the code a little to pull out the common logic to from an internal server config to an external (or generic) server config. That code is currently repeated twice. If you could pull it out into a separate function, that would be nicer
  • Update tests

@easwars easwars assigned Pranjali-2501 and unassigned easwars and arjan-bal Nov 4, 2025
@easwars
Copy link
Copy Markdown
Contributor

easwars commented Nov 18, 2025

@Pranjali-2501 : Please assign it back to me once you've handled the comment. Thanks.

Copy link
Copy Markdown
Contributor

@easwars easwars left a comment

Choose a reason for hiding this comment

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

LGTM, modulo minor nits

Comment on lines +77 to +92

// IgnoreResourceDeletion is a server feature which if set to true,
// indicates that resource deletion errors from xDS management servers can
// be ignored and cached resource data can be used.
//
// This will be removed in the future once we implement gRFC A88
// and two new fields FailOnDataErrors and
// ResourceTimerIsTransientError will be introduced.
IgnoreResourceDeletion bool

// TODO: Link to gRFC A88
ServerFeature ServerFeature
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.

Nit: You could get rid of the newline and add a trailing comment to this line saying this field stores a bitmap of supported features.

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.

Done.

Comment thread internal/xds/xdsclient/clientimpl.go Outdated
serverFeatures = serverFeatures | xdsclient.ServerFeatureTrustedXDSServer
}
gsc := xdsclient.ServerConfig{
ServerIdentifier: clients.ServerIdentifier{ServerURI: sc.ServerURI(), Extensions: grpctransport.ServerIdentifierExtension{ConfigName: sc.SelectedChannelCreds().Type}},
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.

Nit: Please use a separate line for individual fields (in sub-struct fields as well). I understand this is continuing to do what the existing code was doing. But that happened to be a part of a giant refactor, and it was often easy to miss things during the review. See: go/go-style/decisions#literal-formatting

Thanks.

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.

Done.

@easwars easwars assigned Pranjali-2501 and unassigned easwars Nov 25, 2025
@Pranjali-2501 Pranjali-2501 merged commit a764d3f into grpc:master Nov 25, 2025
14 checks passed
Pranjali-2501 added a commit that referenced this pull request Jan 5, 2026
…icy (gRFC A81) (#8779)

This PR implements the xDS :authority header rewriting feature as
specified in [gRFC
A81](https://github.com/grpc/proposal/blob/master/A81-xds-authority-rewriting.md)

### Key Changes:

* xds_cluster_impl LB Policy:
* Updated the Picker to check for the auto_host_rewrite flag (passed via
ConfigSelector).
* If enabled, the picker retrieves the hostname attribute from the
subchannel .
* The picker populates the Metadata field in PickResult with the new
:authority value.

* changes in  stream.go:
* Updated stream.go to inspect the PickResult metadata. If an :authority
override is present and the user has not explicitly set an authority via
CallOption, the `callHdr.Authority` is updated with hostname.
   
* PR relies on the following changes already merged:
* Bootstrap config change (#8692): Added the trusted_xds_server server
feature to the bootstrap configuration.
* xDS resource validation (#8728): Implemented validation and extraction
of the auto_host_rewrite field from RDS resources and the hostname field
from EDS resources.
* Endpoint Structure (#8750): Refactored xdsresource.Endpoint to use
resolver.Endpoint, ensuring that attributes (like the endpoint's
hostname) are correctly stored and accessible to the picker.
* xDS ConfigSelector changes (#8740): Updated the xDS resolver to
propagate the auto_host_rewrite flag from the Route Configuration to the
Load Balancer via the ConfigSelector.

RELEASE NOTES: 
* xDS: Added support for the :authority rewriting (gRFC A81). When
`autoHostRewrite` is enabled in the xDS RouteConfiguration, the client
will rewrite the HTTP/2 :authority header to the value of the selected
endpoint's hostname.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: xDS Includes everything xDS related, including LB policies used with xDS. Type: Feature New features or improvements in behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants