Skip to content

feat(BA-8639): let coordinator subapps require the API secret through a middleware - #15906

Closed
jopemachine wants to merge 2 commits into
mainfrom
feat/BA-8639-coordinator-secret-middleware
Closed

jopemachine wants to merge 2 commits into
mainfrom
feat/BA-8639-coordinator-secret-middleware

Conversation

@jopemachine

@jopemachine jopemachine commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

📚 Stacked PRs

Part of the AppProxy worker Ingress stack (epic BA-8433). Merge in order (bottom-up):

  1. 👉 feat(BA-8639): let coordinator subapps require the API secret through a middleware #15906 — feat(BA-8639): let coordinator subapps require the API secret through a middleware ← you are here
  2. feat(BA-8443): push ingresses from the coordinator to api-delivery workers #15833 — feat(BA-8443): push ingresses from the coordinator to api-delivery workers
  3. feat(BA-8444): add the coordinator client that writes ingresses to Traefik etcd #15893 — feat(BA-8444): export ingresses from the coordinator to Traefik etcd

Resolves #15905 (BA-8639)

Summary

  • check_api_secret(request) holds the API secret check that auth_required did inline: X-BackendAI-Token (bare, Bearer, BackendAI) or Authorization: Bearer <JWT signed with the secret>.
  • auth_required calls it, so the coordinator's existing handlers accept the same tokens as before.
  • New auth_required_middleware calls it too, so a subapp of api_handler class methods, which auth_required cannot wrap because their first argument is self, requires the secret on every route. feat(BA-8443): push ingresses from the coordinator to api-delivery workers #15833 uses it for the coordinator /v2/ingress API.

Test plan

  • tests/unit/appproxy/coordinator/api/test_utils.py: each accepted token form passes; a missing token, a wrong token, a JWT signed with another secret and an unsupported method are rejected without reaching the handler
  • pants check / pants test on tests/unit/appproxy::

🤖 Generated with Claude Code

jopemachine added a commit that referenced this pull request Oct 20, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the size:L 100~500 LoC label Oct 20, 2026
@github-actions github-actions Bot added the comp:app-proxy Related to App Proxy component label Oct 20, 2026
jopemachine and others added 2 commits October 20, 2026 15:24
… a middleware

Move the API secret check out of auth_required into check_api_secret,
which auth_required and the new api_secret_auth_middleware both call, so
a subapp of api_handler class methods can require the secret on every
route.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jopemachine
jopemachine force-pushed the feat/BA-8639-coordinator-secret-middleware branch from 0b1fe41 to ae0e362 Compare October 20, 2026 06:24
@jopemachine

Copy link
Copy Markdown
Member Author

#15833 attaches auth_required to each handler, so the subapp middleware is no longer used.

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

Labels

comp:app-proxy Related to App Proxy component size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let coordinator subapps require the shared API secret through a middleware

1 participant