fix(rpc): UDS transport silently drops X-Hero-Context headers — context isolation broken for direct socket calls #40
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_biz#40
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Root cause (code-verified, 2026-05-07)
Finding 1 — hero_rpc UDS transport drops X-Hero-Context headers (real bug)
File:
hero_rpc/crates/openrpc/src/transport.rsThe
post_raw_json_with_headers()method accepts a header slice but silently ignores it for Unix Domain Socket transport. Only HTTP transport passes headers through. The docstring documents this explicitly:This means any service talking to another service directly over UDS while relying on
X-Hero-Contextfor context isolation will silently get the wrong context. Tracked in lhumina_code/hero_rpc#42.Finding 2 — hero_osis OsisClient endpoint and header construction is already correct
File:
hero_rpc/crates/openrpc_http_client_lib/src/lib.rsOsisClient::new()constructs{base_url}/hero_osis_{domain}/rpcand callspost_raw_json_with_headerswith[("X-Hero-Context", &self.context)]. Since this uses HTTP transport (through hero_router), the header is forwarded correctly.The Cargo.lock in hero_osis pins
hero_rpc_clientat commite512c1bf(development branch) — the endpoint format is already correct in the current state.The
cargo updaterecommendation in lhumina_code/hero_osis#46 and the endpoint format analysis in #37 were based on stale/hallucinated analysis and do not reflect the actual code.What needs to happen
P1 — Fix UDS header forwarding in hero_rpc
Thread
extra_headersthroughhttp_post_unix()intransport.rsso thatX-Hero-ContextandX-Hero-Claimssurvive the UDS hop. This is required for any service that communicates with another service directly over UDS and needs context isolation.Tracked in lhumina_code/hero_rpc#42.
Stale analysis to disregard
cargo updatefor hero_rpc_client) — current Cargo.lock already has the correct endpoint formatOwner: Casper (lhumina_code/hero_rpc#42 UDS fix)
Source: Code-verified 2026-05-07
fix(ai): AI assistant hallucinates CRM data — tools not wired to OSISto fix(rpc): UDS transport silently drops X-Hero-Context headers — context isolation broken for direct socket callsRoot cause found — and it is different from all previous analyses
After tracing the full call chain from hero_biz through hero_router down to the OSIS dispatch layer, the actual bug was found in
hero_rpc/crates/osis/src/rpc/dispatch.rs.What was actually broken
dispatch_jsonrpc_auto_contextread the context name exclusively fromparams._contextin the JSON body, defaulting to"root"if absent:OsisClientsends context via theX-Hero-ContextHTTP header, not in the body.RequestContext::from_headerscorrectly parses the header intohero_context_name, butdispatch_jsonrpc_auto_contextnever consulted it — so every call silently fell back to"root".Fix applied
dispatch_jsonrpc_auto_contextnow prefersrequest_context.hero_context_name(from the header) and falls back toparams._contextfor backwards compatibility:Why the previous analyses went off track
hero_rpc#42 / home#233 — focused on whether UDS transport drops
X-Hero-Contextheaders. The transport was a red herring: the header was being forwarded correctly all the way to the server. The server just never used it for context selection.The UDS header fix was architecturally wrong anyway — per the
herolib_openrpc_authorizeandhero_contextskills, all context-aware calls go throughhero_router, which injects headers. Direct UDS calls are trusted internal calls with no context header — the UDS header-dropping behaviour is correct by design.The Cargo.lock / endpoint format analyses — also red herrings;
OsisClientwas already using the correct endpoint and the correct header. The problem was one layer deeper in how the server processed that header.Summary
The bug was always in the dispatch layer, not in the transport. Fixed in
hero_rpccrates/osis/src/rpc/dispatch.rs.