Implement gRFC A97: xDS JWT Call Credentials - #12951
Conversation
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces JwtTokenFileCallCredentials to load, parse, cache, and refresh JWT tokens from a file, and integrates it into the xDS bootstrap configuration to support call_creds. The review feedback identifies two bugs in JwtTokenFileCallCredentials: a critical issue where valid cached tokens are ignored during backoff after a failed background refresh, and a potential integer overflow when calculating expirationTimeMillis from large exp claims.
Add a defensive check to prevent overflow by capping the expiration time at Long.MAX_VALUE if expSeconds is too large. Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces JwtTokenFileCallCredentials to load, parse, and cache JWT tokens from a file, and integrates it into the xDS bootstrap configuration under an experimental flag. It also updates GrpcXdsTransportFactory to support composite call credentials. The review feedback highlights two important safety improvements in JwtTokenFileCallCredentials: using a bounded stream when reading the token file to prevent potential OutOfMemoryError on special devices, and adding a null check on the parsed JSON element to avoid a NullPointerException when handling malformed payloads.
| */ | ||
| @ThreadSafe | ||
| @Internal | ||
| public final class LoadStatsManager2 { |
There was a problem hiding this comment.
The changes in LoadStatsManager2.java, LoadReportClientTest.java and LoadStatsManager2Test.java are unrelated to gRPC A97.
| } | ||
|
|
||
| @VisibleForTesting | ||
| public static ServerInfo create( |
There was a problem hiding this comment.
No need for the new overload, as this method is now left with no other callers in non-test code. Just modify signature of existing method.
There was a problem hiding this comment.
While it has no production callers left, the 6-argument ServerInfo.create() is heavily used across dozens of test suites. Keeping it as a @VisibleForTesting overload prevents polluting all those test calls with unnecessary null values for CallCredentials.
1088069 to
535f3c9
Compare
Implements gRFC A97 to support file-based JSON Web Token (JWT) Call Credentials for xDS-enabled clients. Implemented using an experimental coding agent.
Summary of Changes