Buckets:
AnonymousSpottedToad/candidate_bucket / preliminary /mappings /python /session_based_access_control /Percolation-Labs_percolate.json
| { | |
| "role_mappings": [ | |
| { | |
| "role": "Subject", | |
| "status": "missing", | |
| "symbol": "", | |
| "file": "", | |
| "lines": "", | |
| "notes": "No in-repo production client sends the 'session' cookie to the API; the browser after Google OAuth login is outside the repo. Only api/examples/client_examples.py (example code, excluded) and the docstring curl in routes/auth/__init__.py:10 show it." | |
| }, | |
| { | |
| "role": "Authentication enforcer", | |
| "status": "missing", | |
| "symbol": "", | |
| "file": "", | |
| "lines": "", | |
| "notes": "The only session flow uses a Starlette signed client-side cookie (SessionMiddleware, clients/python/percolate/percolate/api/main.py:123), which section 6 treats as self-contained and not this pattern. The would-be enforcer is HybridAuthWithRole.__call__ (clients/python/percolate/percolate/api/routes/auth/__init__.py:343), attached via Depends at api/routes/entities/router.py:119." | |
| }, | |
| { | |
| "role": "Verifier", | |
| "status": "missing", | |
| "symbol": "", | |
| "file": "", | |
| "lines": "", | |
| "notes": "get_user_from_session (clients/python/percolate/percolate/api/routes/auth/__init__.py:118) resolves user_id from the signed cookie (request.session['user_id'], set at api/routes/auth/router.py:393). Its fallback DB lookup of p8.\"User\".session_id against the cookie (__init__.py:173) is not on the real path: nothing writes the cookie value to User.session_id (router.py:347-390 only logs it; jwt_provider.py:170 stores a refresh token there)." | |
| }, | |
| { | |
| "role": "Session manager", | |
| "status": "missing", | |
| "symbol": "", | |
| "file": "", | |
| "lines": "", | |
| "notes": "No server-side session store. Sessions are kept in an itsdangerous-signed cookie by Starlette SessionMiddleware (clients/python/percolate/percolate/api/main.py:123); the DB fallback at api/routes/auth/__init__.py:173 never finds a match because no code stores the cookie in User.session_id. session_fix.py (a file-backed session store) is not registered." | |
| }, | |
| { | |
| "role": "Authorisation enforcer", | |
| "status": "present", | |
| "symbol": "prepare_agent_for_save", | |
| "file": "clients/python/percolate/percolate/api/routes/entities/router.py", | |
| "lines": "57", | |
| "notes": "Called by create_agent at clients/python/percolate/percolate/api/routes/entities/router.py:141 with (user_id, role_level) from the hybrid_auth_with_role dependency (signed-cookie session or bearer key). It blocks with 409 when a role_level <= 1 user would overwrite a public agent, and with 401 when a user-bound agent has no user_id. It is mapped because the authorisation roles do not depend on the credential type." | |
| }, | |
| { | |
| "role": "Decider", | |
| "status": "present", | |
| "symbol": "prepare_agent_for_save", | |
| "file": "clients/python/percolate/percolate/api/routes/entities/router.py", | |
| "lines": "57", | |
| "notes": "Decision is inline in the Authorisation enforcer (same method): the check 'if role_level <= 1' plus existing-public-agent lookup (lines 85-91) and the user_id requirement (lines 97-101). No smaller helper performs the decision." | |
| }, | |
| { | |
| "role": "Policy provider", | |
| "status": "present", | |
| "symbol": "role_level", | |
| "file": "clients/python/percolate/percolate/models/p8/types.py", | |
| "lines": "953", | |
| "notes": "The privilege used by the Decider is User.role_level (0=God..100=Public) stored in p8.\"User\"; it is fetched inline in HybridAuthWithRole.__call__ via SELECT role_level (routes/auth/__init__.py:357-360) and passed to prepare_agent_for_save. No dedicated getter method exists, so the field is cited." | |
| }, | |
| { | |
| "role": "System", | |
| "status": "present", | |
| "symbol": "create_agent", | |
| "file": "clients/python/percolate/percolate/api/routes/entities/router.py", | |
| "lines": "109", | |
| "notes": "POST /entities/ handler (wired via set_routes, api/routes/__init__.py:20 and main.py:239), guarded by the Authorisation enforcer prepare_agent_for_save, which it calls at router.py:141. Once that check passes it saves the agent with repo.update_records (line 144). Authentication is by signed cookie or bearer key only (session roles missing)." | |
| } | |
| ] | |
| } | |
Xet Storage Details
- Size:
- 4.23 kB
- Xet hash:
- cc86261bd4845769b5655b004daf9b7feab1eb03b8fb0a68fb7d23b99828f4e2
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.