mirror of
https://github.com/Monkopedia/rouse-context.git
synced 2026-11-29 11:13:05 +00:00
The Android RelayApiClient and the relay's POST /renew endpoint had drifted
apart on both request and response shapes: the client was sending
{ csrPem, authMethod, currentCertPem } while the relay required
{ csr, subdomain, firebase_token, signature }, and the client expected
{ certificatePem } in the response while the relay returned
{ server_cert, client_cert, relay_ca_cert }. Neither side had integration
coverage on the renew path, so /renew returned 422 unconditionally in
production and cert renewal was quietly broken until devices approached
expiry.
This change keeps the relay's response shape (it already matched
/register/certs) and aligns the client to the relay side, plus a small
relay-side simplification so both auth paths are body-driven:
Request (both paths):
{ csr, subdomain, signature, firebase_token? }
Path A ("mTLS-equivalent", cert still valid): omit firebase_token.
Path B (cert expired): include firebase_token.
The relay verifies the signature against the public key it registered
earlier, and additionally verifies firebase_token (+ UID match) on Path B.
Response (matches /register/certs):
{ server_cert, client_cert, relay_ca_cert }
Wire-contract tests pin both sides:
- relay/tests/api_renew_test.rs gains a Path A signature-only success case
and a bad-signature-on-Path-A case; pre-existing tests were adjusted
for the new "signature always required" rule.
- core/tunnel CertRenewalTest gains serializer tests that assert the
snake_case field names on both the request and the response, so a
future rename on either side fails loudly here first.
CertRenewalFlow now routes the signature through a CsrSigner (parallel to
the existing FirebaseRenewalCredentialsProvider) so both paths sign over
the freshly-generated CSR DER rather than accepting a pre-computed value,
and stores all three cert bundle fields (mirroring CertProvisioningFlow).
RenewalAuthProvider in :work gains a signCsr hook to match.
docs/design/relay-api.md is updated to the new shape; the old stale
"Path A uses TLS client cert" language no longer reflects reality and
would have slowly misled future work.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| android-app.md | ||
| health-connect-expansion.md | ||
| notifications-integration.md | ||
| outreach-integration.md | ||
| overall.md | ||
| per-integration-hostnames.md | ||
| relay-api.md | ||
| relay.md | ||
| secret-prefix-bot-rejection.md | ||
| tunnel-client.md | ||
| ui.md | ||
| usage-integration.md | ||