Skip to content

feat(framework): Add --root-certificates argument for flwr-* commands and flower-superexec#6986

Merged
danieljanes merged 24 commits intomainfrom
rt-cert-for-apps
Apr 29, 2026
Merged

feat(framework): Add --root-certificates argument for flwr-* commands and flower-superexec#6986
danieljanes merged 24 commits intomainfrom
rt-cert-for-apps

Conversation

@panh99
Copy link
Copy Markdown
Member

@panh99 panh99 commented Apr 9, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 9, 2026 13:50
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 39d56b39b1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread framework/py/flwr/supercore/tls.py Outdated
Comment on lines +35 to +36
if insecure or root_cert_path is None:
return None
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Distinguish secure system-CA mode from insecure mode

Returning None when root_cert_path is omitted conflates two different states: secure TLS with system CAs and fully insecure transport. The new callers in flwr_clientapp, flwr_serverapp, and flwr_simulation pass this value as certificates, and their runtime connections compute insecure=(certificates is None), so --insecure off plus no --root-certificates now opens a plaintext channel instead of TLS (and fails against TLS-only AppIO endpoints). This is a silent security downgrade introduced by enabling these code paths without preserving the explicit insecure/secure signal.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
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 --root-certificates CLI flag to enable TLS (with custom roots) for AppIO-style gRPC connections used by flwr-* executor commands and flower-superexec, and adds supporting exit codes/docs/tests.

Changes:

  • Add --root-certificates to common flwr-* app CLI args and to flower-superexec.
  • Introduce flwr.supercore.tls.load_root_certificates plus new exit codes/docs for TLS flag conflicts and invalid paths.
  • Wire root certificate loading through SuperExec and executor processes, with added unit tests.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
framework/py/flwr/supernode/cli/flwr_clientapp.py Uses load_root_certificates and forwards cert bytes into run_clientapp.
framework/py/flwr/supercore/tls.py Adds helper to validate/resolve root certificate bytes and enforce flag compatibility.
framework/py/flwr/supercore/tls_test.py Adds tests for the TLS helper behavior and error paths.
framework/py/flwr/supercore/superexec/run_superexec.py Adds TLS parameters to SuperExec channel creation and forwards TLS config into plugins.
framework/py/flwr/supercore/superexec/plugin/exec_plugin.py Extends plugin base class to retain TLS-related settings.
framework/py/flwr/supercore/superexec/plugin/base_exec_plugin.py Forwards --insecure or --root-certificates when spawning executor subprocesses.
framework/py/flwr/supercore/superexec/plugin/base_exec_plugin_test.py Adds coverage for forwarding/omitting TLS flags in subprocess args.
framework/py/flwr/supercore/cli/flower_superexec.py Adds --root-certificates CLI arg and forwards it into run_superexec.
framework/py/flwr/simulation/app.py Loads root certs and passes them into the Simulation AppIO connection wiring.
framework/py/flwr/simulation/app_test.py Adds parsing test for --root-certificates and verifies certs passed into connection.
framework/py/flwr/server/serverapp/app.py Loads root certs and passes them into the ServerApp gRPC grid wiring.
framework/py/flwr/common/exit/exit_code.py Adds new exit codes 603/604 and help text.
framework/py/flwr/common/args.py Adds --root-certificates to shared executor CLI args.
framework/docs/source/ref-exit-codes/603.rst Documents new exit code for incompatible TLS flags.
framework/docs/source/ref-exit-codes/604.rst Documents new exit code for invalid path arguments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread framework/py/flwr/supernode/cli/flwr_clientapp.py Outdated
Comment thread framework/py/flwr/server/serverapp/app.py
Comment thread framework/py/flwr/simulation/app.py Outdated
Comment thread framework/py/flwr/supercore/superexec/run_superexec.py Outdated
Comment thread framework/docs/source/ref-exit-codes/603.rst
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf0e4a8179

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread framework/py/flwr/supercore/tls.py
Comment thread framework/py/flwr/supercore/tls.py Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc99645923

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread framework/py/flwr/supercore/superexec/run_superexec.py Outdated
@github-actions github-actions Bot added the Maintainer Used to determine what PRs (mainly) come from Flower maintainers. label Apr 9, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b3fc32a1f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread framework/py/flwr/supercore/superexec/run_superexec.py Outdated
Comment thread framework/py/flwr/supercore/tls.py Outdated
jafermarq
jafermarq previously approved these changes Apr 9, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6852c8a898

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread framework/py/flwr/supercore/tls.py
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f19ee028af

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread framework/py/flwr/supercore/superexec/run_superexec.py
msheller
msheller previously approved these changes Apr 24, 2026
Copy link
Copy Markdown
Member

@msheller msheller left a comment

Choose a reason for hiding this comment

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

LGTM! Just small text/naming suggestions.

Comment thread framework/py/flwr/common/args.py Outdated
Comment thread framework/py/flwr/server/grid/grpc_grid.py
Comment thread framework/py/flwr/supercore/tls.py
Comment thread framework/py/flwr/supercore/tls.py
Comment thread framework/py/flwr/supercore/cli/flower_superexec.py Outdated
Comment thread framework/py/flwr/supercore/superexec/run_superexec.py
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: acc1e95c63

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread framework/py/flwr/common/args.py
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1c1f758ad1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread framework/py/flwr/common/args.py
Comment thread framework/py/flwr/supercore/superexec/run_superexec.py
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6eda1e3981

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

clientappio_api_address=args.clientappio_api_address,
token=args.token,
certificates=None,
insecure=args.insecure,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Return non-zero when secure ClientAppIo connection fails

Forwarding insecure=args.insecure here makes the secure path reachable for flwr-clientapp, but run_clientapp still catches grpc.RpcError and then exits with ExitCode.SUCCESS unconditionally (framework/py/flwr/supernode/runtime/run_clientapp.py). On deployments where ClientAppIo is still plain gRPC (for example, SuperNode currently starts it with certificates=None), omitting --insecure now produces TLS/RPC failures that are reported as a successful run, which can silently break automation.

Useful? React with 👍 / 👎.

@danieljanes danieljanes enabled auto-merge (squash) April 29, 2026 16:15
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d4c6ab05a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +95 to +98
insecure=args.insecure,
certificates=validate_and_resolve_root_certificates(
args.root_certificates, args.insecure
),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep ServerApp runners in insecure mode until AppIO supports TLS

This change enables secure mode by default for flwr-serverapp/flwr-simulation (--insecure defaults to false), but the SuperLink still starts ServerAppIo with certificates=None (framework/py/flwr/server/app.py, run_serverappio_api_grpc call), so these runners will now attempt TLS against a plaintext endpoint and fail the connection handshake. Previously this path was blocked with COMMON_TLS_NOT_SUPPORTED; now default secure invocations fail later and cannot succeed until server-side TLS is actually wired for ServerAppIo.

Useful? React with 👍 / 👎.

@danieljanes danieljanes merged commit 5d6a643 into main Apr 29, 2026
70 checks passed
@danieljanes danieljanes deleted the rt-cert-for-apps branch April 29, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Maintainer Used to determine what PRs (mainly) come from Flower maintainers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants