feat(framework): Wire serverappio and clientappio auth interceptors#6796
Open
feat(framework): Wire serverappio and clientappio auth interceptors#6796
Conversation
…or.py Co-authored-by: Heng Pan <pan@flower.ai>
…or.py Co-authored-by: Heng Pan <pan@flower.ai>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR wires token-auth gRPC interceptors into the ServerAppIo and ClientAppIo APIs (server- and client-side), adds policy coverage for ClientAppIo RPCs, and adjusts token lifecycle handling so tokens are deleted when a run finishes (rather than during PushAppOutputs).
Changes:
- Add/wire AppIo token auth interceptors for ServerAppIo and ClientAppIo servers/clients, plus policy maps/tests.
- Enforce token usage in GrpcGrid/SimulationIoConnection wiring and add unit/integration tests for interceptor behavior.
- Move ServerAppIo token deletion from
PushAppOutputstoUpdateRunStatus(FINISHED)with dedicated integration coverage.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| framework/py/flwr/supernode/start_client_internal.py | Wires ClientAppIo server interceptor into SuperNode ClientAppIo gRPC server startup. |
| framework/py/flwr/supernode/servicer/clientappio/clientappio_auth_integration_test.py | New integration tests asserting ClientAppIo protected vs no-auth RPC behavior. |
| framework/py/flwr/supernode/runtime/run_clientapp_test.py | New unit test asserting ClientApp runtime attaches token client interceptor to the channel. |
| framework/py/flwr/supernode/runtime/run_clientapp.py | Adds AppIo token client interceptor to ClientApp runtime channel creation. |
| framework/py/flwr/supercore/interceptors/appio_token_interceptor_test.py | Extends interceptor/policy tests to include ClientAppIo policy coverage and factory behavior. |
| framework/py/flwr/supercore/interceptors/appio_token_interceptor.py | Adds ClientAppIo interceptor factory and imports ClientAppIo policy map. |
| framework/py/flwr/supercore/interceptors/init.py | Exports the ClientAppIo interceptor factory helper. |
| framework/py/flwr/supercore/auth/policy.py | Adds ClientAppIo per-method token policy map alongside ServerAppIo policy map. |
| framework/py/flwr/supercore/auth/init.py | Exposes ClientAppIo policy map from the auth package. |
| framework/py/flwr/simulation/simulationio_connection_test.py | New unit tests asserting SimulationIoConnection passes token interceptor and enforces non-empty token. |
| framework/py/flwr/simulation/simulationio_connection.py | Requires non-empty keyword-only token and attaches token interceptor to outbound ServerAppIo calls. |
| framework/py/flwr/simulation/app_test.py | New unit test ensuring simulation runtime passes token into SimulationIoConnection. |
| framework/py/flwr/simulation/app.py | Passes token into SimulationIoConnection. |
| framework/py/flwr/server/superlink/serverappio/serverappio_token_lifecycle_integration_test.py | New integration tests covering token retention on PushAppOutputs and deletion on UpdateRunStatus(FINISHED). |
| framework/py/flwr/server/superlink/serverappio/serverappio_servicer_test.py | Updates tests to use token-auth metadata interceptor on the default test channel. |
| framework/py/flwr/server/superlink/serverappio/serverappio_servicer.py | Moves token deletion to UpdateRunStatus(FINISHED) and stops deleting on PushAppOutputs. |
| framework/py/flwr/server/superlink/serverappio/serverappio_grpc.py | Wires ServerAppIo server interceptor into gRPC server startup. |
| framework/py/flwr/server/superlink/serverappio/serverappio_auth_integration_test.py | New integration tests asserting ServerAppIo protected vs no-auth RPC behavior. |
| framework/py/flwr/server/serverapp/app.py | Passes token into GrpcGrid creation for ServerApp runtime. |
| framework/py/flwr/server/grid/grpc_grid_test.py | Updates GrpcGrid construction to require token and adds tests for interceptor wiring and empty-token rejection. |
| framework/py/flwr/server/grid/grpc_grid.py | Requires non-empty keyword-only token and attaches token interceptor to outbound ServerAppIo calls. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3a12e08 to
eefd34d
Compare
…entappio-auth-interceptors
…entappio-auth-interceptors
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.
Issue
*Apps can impersonate each other when calling *AppIo RPCs.
Description
Not all AppIo RPCs authenticate the calling *App, such that an *App could potentially impersonate another. In particular, the token used to authenticate the calling *App is only used in some of the RPCs.
Proposal
This is a BEHAVIOR CHANGING PR that wires the new appio auth token interceptor into the ServerAppIo and ClientAppIo servers and clients.
Note the additions beyond RFC PRs 2&3 (will update the RFC).
Explanation
This PR adds the following changes:
RFC PR 2: ServerAppIo end-to-end wiring:
ServerAppIogRPC server startup.ServerAppIoauth integration tests.RFC PR 3: ClientAppIo end-to-end wiring:
ClientAppIoserver startup.ClientAppIoauth integration tests.policy tableand factory forClientAppIoClientAppIotests for interceptors andpolicy table.Token Lifecycle Fix:
Additional Asks:
Checklist
#contributions)Any other comments?
We are deferring run_id and token consistency checks, which have far-reaching impacts on our tests. This should be included in our cleanup PR. These checks will ensure all claimed run_id and token values match in requests and in interceptor metadata.