Context injection: revert per-route model, inject X-Hero-Context from authenticated user identity #23
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_proxy#23
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?
Follow-up to #21 and the implementation in #22.
Motivation
The per-route context model in #22 is the wrong shape per
hero_skills/hero_os_architecture/context_and_security.md. Context is a header dimension tied to who is authenticated, not to which hostname was hit. Hero_proxy (as the trusted boundary / ingress) must derive context from the authenticated caller and injectX-Hero-Contextaccordingly. Services trust the header because they trust the boundary.Quote from the skill doc:
In our setup,
hero_proxyplays the role the doc ascribes tohero_router(TCP ingress; trusted header source).What comes out (revert from #22)
domain_routes.contextcolumn +DomainRoute.contextfield + all SELECT/INSERT changescontextsSQLite table +upsert_context/prune_contexts_except/context_name_exists/seed_default_context/list_contextscontext_syncmodule + background polling task +HERO_PROXY_CONTEXT_SYNC_SECSenv var + initial-sync call in main.rsWhat goes in
users.contextcolumn (default0, meaning admin/internal-trust) + idempotent migrationdispatch_domain_routesuccessfully resolves a user, injectX-Hero-Context: <user.context>0usersrow by email, useuser.contextusersrow by pubkey (if the model supports it) or fall back to0user.context0(admin/internal-trust) per the skill docSome(&user_context_string)toresolve_claims_for_userso the existingrole.contextsfilter stays correct (the filter compares strings, so stringify the integer)What doesn't change
userstable continues to be the identity sourceresolve_claims_for_usersignature and logicstrip_proxy_headersstill strips incomingX-Hero-*for spoof prevention (client-supplied values are untrusted)Contextschema changes in hero_osis#21 — those are fine, they describe what contexts exist, not how proxy picks oneDeferred to separate issues
users.contexton create/editX-Hero-Context: N, validate against the user's allowed list, fall back to default otherwise)base.context_getvalidation atusers.contextwrite time (nice-to-have; not required for first pass — unknown contexts just fail at hero_osis downstream)Closes #21 on merge.
Closed — merged in #24. users.context column + user-sourced X-Hero-Context injection shipped.