Buckets:

download
raw
4.07 kB
{
"role_mappings": [
{
"role": "Subject",
"status": "missing",
"symbol": "",
"file": "",
"lines": "",
"notes": "The cookie-bearing caller is an external browser. The in-repo Panel UI (ragna/deploy/_ui) calls Engine in-process rather than sending the session cookie, and ragna/_docs.py:get_http_client is docs tooling; neither counts as an in-repo client of the traced enforcer."
},
{
"role": "Authentication enforcer",
"status": "present",
"symbol": "dispatch",
"file": "ragna/deploy/_auth.py",
"lines": "63",
"notes": "dispatch in SessionMiddleware (BaseHTTPMiddleware) intercepts every request, routes a 'ragna' cookie to _cookie_dispatch (line 69), and returns 401 for /api or redirects /ui to /login when there is no credential. It is installed via app.add_middleware(SessionMiddleware) at ragna/deploy/_auth.py:260, which is invoked from ragna/deploy/_core.py:93."
},
{
"role": "Verifier",
"status": "present",
"symbol": "_cookie_dispatch",
"file": "ragna/deploy/_auth.py",
"lines": "110",
"notes": "Reached from dispatch at ragna/deploy/_auth.py:69. It resolves the opaque uuid4 cookie via self._sessions.get(cookie) (line 113), redirects to /login and deletes the cookie when no session exists, and otherwise sets request.state.session (principal) and refreshes the expiry. The Bearer API-key branch (_api_token_dispatch, line 82) is an alternative credential path."
},
{
"role": "Session manager",
"status": "present",
"symbol": "get",
"file": "ragna/deploy/_key_value_store.py",
"lines": "63",
"notes": "_cookie_dispatch calls self._sessions.get at ragna/deploy/_auth.py:113. _sessions is config.key_value_store() (_auth.py:56), and its default is InMemoryKeyValueStore (ragna/deploy/_config.py:57), so this get returns the stored Session and evicts it if expired. RedisKeyValueStore.get (line 106) is the opt-in alternative; sessions are created in _login_dispatch (_auth.py:173-174)."
},
{
"role": "Authorisation enforcer",
"status": "present",
"symbol": "_get_orm_chat",
"file": "ragna/deploy/_database.py",
"lines": "231",
"notes": "The principal flows from request.state.session through the UserDependency/_get_user dependencies (_auth.py:205-223) into the get_chat route (ragna/deploy/_api.py:98), then Engine.get_chat (_engine.py:244) and Database.get_chat (_database.py:253), which reaches _get_orm_chat. That method raises RagnaException at line 248 when the chat is not owned by the user. The ownership check is inline, so the same method is also cited as Decider."
},
{
"role": "Decider",
"status": "present",
"symbol": "_get_orm_chat",
"file": "ragna/deploy/_database.py",
"lines": "231",
"notes": "This is the same method as the Authorisation enforcer, because the decision is inline. Its query requires Chat.id == id AND Chat.user_id == the principal's user id (lines 236-242, using _get_orm_user_by_name at line 38), and it rejects with an exception when there is no match. Caveat: document access is not owner-checked (FIXME at _database.py:136)."
},
{
"role": "Policy provider",
"status": "present",
"symbol": "user_id",
"file": "ragna/deploy/_orm.py",
"lines": "134",
"notes": "The ownership policy is the Chat.user_id foreign key column in the chats table, which _get_orm_chat queries at ragna/deploy/_database.py:239. No dedicated method returns privileges; the policy is implicit row ownership in the DB, so the column is cited."
},
{
"role": "System",
"status": "present",
"symbol": "get_chat",
"file": "ragna/deploy/_api.py",
"lines": "97",
"notes": "This is the GET /api/chats/{id} route handler (router mounted at ragna/deploy/_core.py:96). It runs after SessionMiddleware has set the session and returns the chat via engine.get_chat, which applies the ownership check."
}
]
}

Xet Storage Details

Size:
4.07 kB
·
Xet hash:
e027273b70f19955f167d42e3588af528c972175f299895a8829b2ccd004ae58

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.