[platform] OSIS authorization: proposal grounded in the freezone gate (please review) #310
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/home_lhumina#310
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?
@timur @despiegk could you review this and let me know what you think?
Context
Migrating hero_biz to OSIS surfaced a gap we should decide on as a team: OSIS authenticates the caller (the request context carries the user id and claims) but does not authorize. The generated CRUD ignores the caller, so reads and writes like
*_listand*_getare open to anyone who can reach the socket. This is the same class of issue freezone already hit and fixed. See the migration writeup in lhumina_code/home#309 for where this came up.What freezone already does (I audited it)
freezone solved this without changing its codegen, as a small gate layer in the backend:
identity_bind.rs): the caller id is not trusted from the request params (it is attacker controllable). One middleware rewrites it to the server verified principal (verified proxy pubkey, then API key owner, then verified JWT subject) or strips it entirely if there is no verified principal. This closes the cross tenant IDOR where a caller sets someone else's id and passes every ownership check.tenant_boundary.rs): a per method table maps each leaky method to an ownership rule. The rule kinds are owner match (row.user_id equals caller), membership or role tier (for example company roles), caller equals a named param, and a recursive case that resolves an opaque target to its owning entity and applies that entity's rule. Default is fail closed, admin can bypass.Links: identity_bind.rs and tenant_boundary.rs.
The gap for Hero
freezone's gate is a hand maintained table of methods. That works for one service but does not scale across many services and thousands of generated methods, which is exactly the problem we will have once the whole stack is on OSIS. So I think we want the same rules, but declared in the schema so the generator emits the gate, rather than a table per service.
Proposed direction (two steps)
The ask
Does the schema level direction look right to you, or would you rather keep a central per service table like freezone has today? Anything in the freezone model we should or should not carry over? If we agree on the direction I will draft the concrete schema annotations plus a reference gate so the Egypt team has it before they start migrating services in parallel.
mik-tf referenced this issue2026-06-21 00:29:52 +00:00