fix: Carry relay auth material into the per-space network config - #148
fix: Carry relay auth material into the per-space network config#148ThetaSinner wants to merge 1 commit into
Conversation
`base64_auth_material_relay` only seeds the transport at startup. The config `NetworkConfig::to_k2_config` builds carries `irohTransport.relayUrl` but no material, and kitsune2 re-inserts the relay from that config when a space is created - tokenless, which an authenticated relay refuses. The node keeps authenticating and keeps its relay allowlist entry alive, so nothing in the auth path looks wrong; it simply reaches no peers from the moment its first cell is created. A node with a public address never notices, because it connects directly and never exercises the relay socket. Write the material into `network.advanced` as well, where kitsune2 reads it per space. `to_k2_config` merges into `advanced` rather than replacing it, so the value survives alongside the URL it writes, and a caller's own advanced settings survive too. Both injection sites are covered: the boot path and `restart_with_hc_auth`. Patching only the first works on a cold start and fails after an in-app restart.
|
✔️ d386016 - Conventional commits check succeeded. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe runtime adds a helper that stores relay authentication material at Suggested reviewers: Merge Risk: 🔵 Low · up to The change restores authenticated relay connectivity during boot and restart, but it carries a bounded merge-readiness risk: the relay bearer credential is duplicated in generic configuration where redaction is unverified, and incompatible configuration shapes could still leave authenticated nodes unable to use the relay. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Description checkExplanation The description is detailed and directly explains the symptom, cause, fix, affected paths, tests, end-to-end verification, and follow-up concerns. It does not include the template's explicit Summary or TODO checklist sections, but the required change information is substantially present. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 Clippy (1.97.1)Clippy execution timed out Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closing: this fixes the symptom from the outside. The per-space configuration hook runs even when no override was requested, so the transport reconfigures the relay it already authenticated to and loses the token. Having every consumer write the material into per-space settings papers over that, and copies a bearer credential into a field that gets logged in clear text. Fixing it in kitsune2 instead, where the hook should not be firing for a space that overrides nothing. |
A conductor using an authenticated relay loses relay access the moment its first
cell is created, and nothing in the auth path reports a problem.
Symptom
The HTTP auth never fails. The keepalive keeps succeeding every two minutes for
as long as the process runs, so the node holds a valid token and a live allowlist
entry while being refused at the socket. The only symptom is that it reaches no
peers, with every service reporting healthy.
Cause
base64_auth_material_relayseeds the transport at startup only. The configNetworkConfig::to_k2_configbuilds carriesirohTransport.relayUrlbut nomaterial, and
IrohTransport::configure_for_spacere-inserts the relay from thatconfig when a space is created:
relay_urlis always present andauth_materialnever is, so the authenticatedrelay is replaced by a tokenless one.
TokenAccess::on_connectgates both of itsallow-paths on a token being present, so the recovery allowlist cannot admit it
either.
A node with a public address never notices — it connects directly and never
exercises the relay socket. It only bites peers behind NAT, which is why a fleet
of public nodes can look entirely healthy while every desktop client fails.
Fix
Write the material into
network.advancedas well, where kitsune2 reads it perspace.
to_k2_configmerges intoadvancedrather than replacing it, so thevalue survives alongside the URL it writes — and a caller's own advanced settings
(a testnet build sets
relayAllowPlainTextthere) survive too, which the secondtest pins.
Both injection sites are covered: the boot path and
restart_with_hc_auth.Patching only the first works on a cold start and fails after an in-app restart.
Verification
Two unit tests, plus an end-to-end check: a NAT'd desktop client that previously
never reached a peer now joins a production network behind an authenticated
kitsune2_bootstrap_srvand syncs. A public peer passes either way, so it is nota useful test of this.
Two things worth a second opinion
auth_material_relay_base64as "Ignored in the global config", which forcesevery consumer to duplicate the material per space. If that asymmetry is not
deliberate, the better fix is for holochain's
to_k2_configto carry it — orfor kitsune2 to fall back to the global material when a per-space override
supplies none. This change is correct regardless, but it is a workaround for
an awkward contract.
auth_material_relayin its debug output but printsnetwork_configin full,so the material now appears in clear text in the boot line. It is effectively a
bearer credential for the relay. Worth pairing with redaction wherever this
lands.