feat(framework): Add AppIo auth interceptors#6730
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces the first part of an AppIo authentication framework by adding transport-level gRPC interceptors plus a transport-agnostic auth/policy abstraction, enabling upcoming PRs to apply consistent authentication enforcement across AppIo servicers.
Changes:
- Add AppIo gRPC client/server interceptors for token and (future) signed-metadata auth inputs.
- Introduce transport-agnostic auth primitives (decision engine, authenticators, policies) and signed-metadata header constants.
- Add unit tests covering token auth flows, signed-metadata extraction/presence semantics, and policy validation.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| framework/py/flwr/supercore/interceptors/appio_auth_interceptor_test.py | Adds interceptor-focused tests for token handling, denial behavior, and signed-metadata extraction. |
| framework/py/flwr/supercore/interceptors/appio_auth_interceptor.py | Implements AppIo client/server interceptors plus helper accessors for authenticated context. |
| framework/py/flwr/supercore/interceptors/init.py | Exposes interceptor APIs from the interceptors package. |
| framework/py/flwr/supercore/auth/policy.py | Adds MethodAuthPolicy and strict policy-table validation helper. |
| framework/py/flwr/supercore/auth/constant.py | Defines auth mechanism identifiers and signed-metadata header keys. |
| framework/py/flwr/supercore/auth/appio_auth_test.py | Adds unit tests for decision engine behavior, token authenticator, and policy validation. |
| framework/py/flwr/supercore/auth/appio_auth.py | Implements the core auth abstractions (AuthInput, decision engine, token authenticator). |
| framework/py/flwr/supercore/auth/init.py | Exposes auth primitives/constants as a package API. |
| framework/py/flwr/common/constant.py | Adds the APP_TOKEN_HEADER constant for AppIo token metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
framework/py/flwr/supercore/interceptors/appio_auth_interceptor.py
Outdated
Show resolved
Hide resolved
framework/py/flwr/supercore/interceptors/appio_auth_interceptor.py
Outdated
Show resolved
Hide resolved
framework/py/flwr/supercore/interceptors/appio_auth_interceptor.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…r.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…r.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
SuperExecs and *Apps can impersonate each other when calling *AppIo RPCs.
Proposal
Part 1 of 5 PRs.
Full set proposal:
Using gRPC intercetors:
This PR is 1 of 5 planned PRs:
Explanation
Created a light-weight auth abstraction intended to simplify the next set of PRs. See internal RFC for abstraction details.
The mental model is:
This PR introduces the interceptor transport layer, the auth layer and the token mechanism. It does NOT touch servicers. I chose to include these three in the same PR because:
Checklist
#contributions)Any other comments?
NOTE: this solution version conflates authentication-mechanism policy with authorization policy: SuperExecs and *Apps are distinguished by authentication mechanism (token vs. signed metadata). While I believe this is okay for now, we should separate these concerns as soon as we add authorization complexity, or if we ever decide to support multiple mechanisms for a given process (i.e. if *Apps can use tokens or signed metadata).
Codex gave me this nice summary:
Summary
This PR introduces the AppIo authentication foundation and interceptor framework, without wiring it into specific services yet.
What’s included
Added a transport-agnostic auth core in
framework/py/flwr/supercore/auth/:AuthInput,SignedMetadataAuthInput,CallerIdentityAuthenticatorprotocolAuthDecisionEngineMethodAuthPolicyand policy-map validation helpersAdded general AppIo interceptors in
framework/py/flwr/supercore/interceptors/:get_authenticated_*)verify_authenticated_run_matches_request_run_id)Added test coverage for both layers:
framework/py/flwr/supercore/auth/appio_auth_test.pyframework/py/flwr/supercore/interceptors/appio_auth_interceptor_test.pyHardening and cleanup
absentvspresent but malformed).APP_TOKEN_HEADERfromcommon/constant.pytosupercore/auth/constant.py.Scope boundary