Skip to content

feat(framework): Add authn abstraction layer#6758

Open
msheller wants to merge 16 commits intomainfrom
appio-authn/1-2-add-authn-abstraction
Open

feat(framework): Add authn abstraction layer#6758
msheller wants to merge 16 commits intomainfrom
appio-authn/1-2-add-authn-abstraction

Conversation

@msheller
Copy link
Contributor

@msheller msheller commented Mar 12, 2026

Issue

This is PR 1.2 in the AppIo Auth changes.

Changing authn mechanisms (e.g. token, signed metadata) and/or policy (e.g. which interfaces require which mechanisms) is too intrusive and bespoke, complicating implementation, review and testing of essential security code.

Proposal

Add a lightweight authn abstraction layer to seperate authn logic into:

  1. mechanism
  2. decision engine
  3. method policy (i.e. RPC authn requirements)
  4. identity (i.e. specific SuperExec or ClientApp)
  5. authn material

This enables new mechanisms or policies with minimal change and makes reasoning and testing much simpler.

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:

  • Transport layer = parsing + plumbing
  • Auth layer = policy + verification + identity
  • Servicer layer = business logic with authenticated identity

Checklist

  • Implement proposed change
  • Write tests
  • Update documentation
  • Make CI checks pass
  • Ping maintainers on Slack (channel #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).

Base automatically changed from remove-getrun-from-serverapp to main March 12, 2026 18:58
@msheller msheller changed the title Authn abstraction layer implementation (feat)framework: Add Authn abstraction layer Mar 12, 2026
@msheller msheller changed the title (feat)framework: Add Authn abstraction layer (feat)framework: Add authn abstraction layer Mar 12, 2026
@github-actions github-actions bot added the Contributor Used to determine what PRs (mainly) come from external contributors. label Mar 12, 2026
@msheller msheller changed the title (feat)framework: Add authn abstraction layer feat(framework): Add authn abstraction layer Mar 12, 2026
@msheller msheller marked this pull request as ready for review March 12, 2026 19:50
Copilot AI review requested due to automatic review settings March 12, 2026 19:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a transport-agnostic authentication (“authn”) abstraction layer for AppIo services, aiming to separate mechanism handling, policy/decision logic, and identity representation to simplify future authn changes.

Changes:

  • Added core authn primitives (auth input, caller identity, decision engine, and a token authenticator).
  • Added method-level auth policy types plus validation helper for policy tables.
  • Added constants and unit tests for the new authn layer.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
framework/py/flwr/supercore/auth/appio_auth.py Adds the core authn domain model and decision engine, plus token mechanism implementation.
framework/py/flwr/supercore/auth/policy.py Introduces method auth policy types and a helper to validate per-RPC policy maps.
framework/py/flwr/supercore/auth/constant.py Defines shared mechanism/caller-type identifiers and metadata key constants.
framework/py/flwr/supercore/auth/appio_auth_test.py Adds unit tests covering engine behavior, token auth, signed-metadata presence semantics, and policy table validation.
framework/py/flwr/supercore/auth/__init__.py Exposes the new authn layer public API via package exports.

💡 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.

msheller and others added 2 commits March 12, 2026 13:57
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.


💡 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.

@msheller msheller requested a review from Copilot March 12, 2026 23:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 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.

Comment on lines +47 to +48
# Expected SuperExec plugin scope (for allowlist/policy checks).
plugin_type: str | None = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Could remove the plugin_type? It would nice to make the auth abstract agnostic to plugins.

Copy link
Contributor

@panh99 panh99 left a comment

Choose a reason for hiding this comment

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

General question: just curious, can this abstraction be applied to node authentication as well?

Comment on lines +61 to +72
# True means signed-metadata auth material was supplied on the request path.
# This can be True while ``signed_metadata`` is None when extraction sees a
# partial/malformed signed-metadata payload.
signed_metadata_present: bool = False
signed_metadata: SignedMetadataAuthInput | None = None

def __post_init__(self) -> None:
"""Validate signed metadata presence invariants."""
if self.signed_metadata is not None and not self.signed_metadata_present:
raise ValueError(
"signed_metadata_present must be True when signed_metadata is set."
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we remove signed_metadata_present? Or is there an case when signed_metadata_present == True and signed_metadata == None but still pass the check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contributor Used to determine what PRs (mainly) come from external contributors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants