feat: roster serves TLS on both surfaces, with required material #5
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/app-tier-tls"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
feat: roster serves TLS on both surfaces, with required material
What this is
Part of the fleet app-tier TLS change. Design and plan live in the
starfleetdocs repo:docs/superpowers/specs/2026-10-17-app-tier-tls-design.mddocs/superpowers/plans/2026-10-17-app-tier-tls.mddocs/superpowers/plans/2026-10-17-app-tier-tls-runbook.md(the live cutover)Roster served plain HTTP on
:4020(API + admin UI) and:4021(MCP). Theadmin UI carried a bearer token in
localStorageover cleartext, and the MCPsurface was reached over cleartext. Nothing in the roster docs mentioned
transport security — the plaintext default was by omission, not by decision.
After this branch roster can only serve TLS, and a missing or partial
tls_cert/tls_keypair is a startup error naming the missing key rather thana silent plaintext fallback.
Change
Config.
[api] tls_cert/tls_keyand a new[trust] ca_bundle, mappedto
api_tls_cert,api_tls_key,trust_ca_bundle, all joined to_PATH_FIELDS. Parsing stays validation-free —load_configis used bynon-serving commands, so the required-pair check lives in the serve paths.
One assembly point.
server_kwargs(cfg)builds the uvicorn kwargs andraises
ConfigErrornamingtls_certortls_keyon an incomplete pair. Bothserve()andmcp_server.main()consume it, so the two surfaces cannotdiverge — and it is evaluated before
roster.start(), so a bad pair nolonger fires a scheduler tick first.
The MCP surface needed real work. The installed
mcpSDK'srun_streamable_http_asyncbuilds its ownuvicorn.Configand exposes nossl arguments, so it cannot serve TLS. It now builds
streamable_http_app(...)and runs our ownuvicorn.Config, preserving everyother transport default of the helper it replaced — including
host=, withoutwhich DNS-rebinding protection would auto-enable for
127.0.0.1while bound to0.0.0.0and 403 real LAN clients.Outbound trust. New
trust.py::resolve_ca_bundleresolves--ca-bundle→$STARFLEET_CA_BUNDLE→[trust] ca_bundle→ConfigErrornaming all three, and validates the resolved bundle with
load_verify_locations. A path that is missing or is not a PEM therefore failsat resolution, naming the setting and the path — not at the first request, where
it would look like "the server is down" (and, for the MCP process, only after
it had already bound its socket).
RosterClientgained aca_bundleparameter;delivery.py's crew POST uses the resolved bundle; the MCP process talks to theAPI over
https://127.0.0.1:<api_port>.Two config hazards fixed.
Config.expand()now leaves an empty path valueempty — the new TLS fields are the first empty-default
_PATH_FIELDSmembers,and
Path("")becomes".", which would have made the required-pair checkunfirable. And
serve()/mcp_server.main()now expand the loaded config atall: they never did, and a
~/.config/…cert path would have reached uvicornraw.
CLI.
--ca-bundle(global to the client subcommands, as in crew); thedefault
--urlis nowhttps://127.0.0.1:4020.main()catchesConfigErrorfor every command, so a missing or unreadable CA prints a clean
error: …and exits 1 instead of a stack trace —
serve/mcpstill refuse to start, whichis the intended loud failure; only the presentation changed.
Docs. README (TLS section, CA resolution order,
httpsURLs) androster.toml.example.Verification
Sandbox suite at the branch head: 235 passed,
ruff check/ruff format --check/mypy src/clean.Verification is proven by real TLS, not mocks: one test stands up a self-signed
TLS peer and asserts both the positive control (trusting the peer's own cert
succeeds) and the negative (a different bundle refuses the handshake); another
serves the real
streamable_http_appunder a realuvicorn.Serverwith aself-signed leaf and completes a handshake against
/mcp. Tests that assertedplaintext behaviour were inverted, not deleted.
Cross-repo / ops
crewandcommunicator-esp32carry the sibling pieces.starfleetdocs repo, deliberately ordered server-first so the OpenCodeMCP URL is flipped only after roster serves TLS.
Deferred minors (triaged ship)
info(equals the SDK'seffective default today).
the
[trust] ca_bundletier.--ca-bundleonserve; env and config cover the delivery POST.delivery.pyrequires a resolvable CA even when the target URL is plaintext —one contract beats a conditional one.
selftest's mid-poll API loss now printserror:rather thanselftest FAIL:;doctor's newly clean error path is untested.pytest.skipwhenopensslis absent (green-by-skip on such a machine).verify=<str>is deprecated in httpx 0.28.1 — this is a plan flaw (the planmandated the string form); verification is on today, but a future httpx bump
removes the form. Migration is to pass an
ssl.SSLContext.