feat(proxy): source X-Hero-Context from authenticated user, not route #24
No reviewers
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!24
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat_23_user_context"
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?
Closes #21 (via the corrected model in #23).
Why this reverts #22's per-route model
Per
hero_skills/hero_os_architecture/context_and_security.md, context is a header dimension tied to identity, injected by the trusted boundary (hero_router in the doc; hero_proxy here) based on who is authenticated — not based on hostname. Services trust the header because they trust the boundary.#22 put context on
domain_routes, which pins context to hostname. That's the wrong shape. This PR corrects it.What changed
Out:
domain_routes.context,contextscache table,context_syncpolling module + env var, request-path 404-on-unknown-context, all associated DB helpers + tests.In:
users.contextcolumn (default 0). After each auth branch (none/oauth/signature+ path-prefix IP auth) resolves a user, injectX-Hero-Context: <user.context>and pass toresolve_claims_for_userso the existingrole.contextsfilter applies correctly. Unauthenticated requests get no injection — upstream treats missing header as 0 (admin/internal-trust).Net: +144 / -492 lines. #22 was mostly deleted.
Test plan
cargo test --workspace— all green (26 integration + 13 unit including 3 new for user.context)context=5, hit an oauth-protected route as that user, verify hero_osis side receivesX-Hero-Context: 5What's NOT in this PR
users.context(the DB column +AddUser.context/UpdateUser.contextare there; RPC surface + UI form field is a follow-up)X-Hero-Contextvalidated against user's allowed listbase.context_getvalidation atusers.contextwrite time🤖 Generated with Claude Code