Buckets:
AnonymousSpottedToad/candidate_bucket / preliminary /mappings /python /session_based_access_control /FastJango_FastJango.json
| { | |
| "role_mappings": [ | |
| { | |
| "role": "Subject", | |
| "status": "missing", | |
| "symbol": "", | |
| "file": "", | |
| "lines": "", | |
| "notes": "The sessionid cookie is sent automatically by an external browser; no in-repo client code (UI/SDK/CLI) sends the session id to AuthenticationMiddleware. The example home page HTML (fastjango/middleware/example_middleware_usage.py:218) only links to /staff and posts login forms, so it was not counted as a Subject." | |
| }, | |
| { | |
| "role": "Authentication enforcer", | |
| "status": "present", | |
| "symbol": "dispatch", | |
| "file": "fastjango/middleware/authentication.py", | |
| "lines": "152", | |
| "notes": "dispatch in AuthenticationMiddleware intercepts every request and calls backend.authenticate (authentication.py:168), attaching the principal to request.state.user (line 175); it is registered by default in core/settings.py:118 and via app.add_middleware in example_middleware_usage.py:131. Caveat: it does not itself reject; rejection on a missing principal happens in the login_required/staff_member_required wrappers, and the cookie->session lookup is done beforehand by SessionMiddleware.dispatch (session.py:220, 240)." | |
| }, | |
| { | |
| "role": "Verifier", | |
| "status": "present", | |
| "symbol": "authenticate", | |
| "file": "fastjango/middleware/authentication.py", | |
| "lines": "65", | |
| "notes": "Reached from AuthenticationMiddleware.dispatch (authentication.py:168); SessionAuthenticationBackend.authenticate reads user_id from the session resolved for the sessionid cookie (get_session_data, line 67) and returns the User via get_user (line 69) or None. The TokenAuthenticationBackend (line 94) is the alternative default backend for Authorization headers and is not the session flow." | |
| }, | |
| { | |
| "role": "Session manager", | |
| "status": "present", | |
| "symbol": "get", | |
| "file": "fastjango/middleware/session.py", | |
| "lines": "109", | |
| "notes": "MemorySessionStore.get (default store, session.py:175) looks up the opaque session key, checks expiry and returns the session data; called from SessionMiddleware.dispatch at session.py:240 and exposed to the Verifier through get_session_data (session.py:308). FileSessionStore.get (session.py:55) is an alternative non-default store; sessions are opened by login (authentication.py:224) with keys from secrets.token_urlsafe (session.py:187)." | |
| }, | |
| { | |
| "role": "Authorisation enforcer", | |
| "status": "present", | |
| "symbol": "wrapper", | |
| "file": "fastjango/middleware/authentication.py", | |
| "lines": "280", | |
| "notes": "Inner wrapper of the staff_member_required decorator (authentication.py:270), applied to the /staff route in example_middleware_usage.py:336; it reads the principal set by AuthenticationMiddleware.dispatch and returns 403 unless allowed. Decision logic is inline in this same method (see Decider); sibling decorators superuser_required (line 300) and permission_required (line 321) are unused in the repo." | |
| }, | |
| { | |
| "role": "Decider", | |
| "status": "present", | |
| "symbol": "wrapper", | |
| "file": "fastjango/middleware/authentication.py", | |
| "lines": "280", | |
| "notes": "Same method as the Authorisation enforcer: the decision `if not user or not user.is_staff` (authentication.py:282) is inline in the staff_member_required wrapper with no separate helper. User.has_perm (line 37) exists for permission_required but is not on the traced path." | |
| }, | |
| { | |
| "role": "Policy provider", | |
| "status": "present", | |
| "symbol": "get_user", | |
| "file": "fastjango/middleware/authentication.py", | |
| "lines": "72", | |
| "notes": "The Decider at authentication.py:282 reads the principal's is_staff privilege, which is supplied by SessionAuthenticationBackend.get_user (called from authenticate at line 69); it hard-codes user 1 as staff/superuser. Caveat: the policy is just hard-coded role flags on the User dataclass (line 28), not a stored policy." | |
| }, | |
| { | |
| "role": "System", | |
| "status": "present", | |
| "symbol": "staff_dashboard", | |
| "file": "fastjango/middleware/example_middleware_usage.py", | |
| "lines": "337", | |
| "notes": "Reached after the staff_member_required wrapper (authentication.py:285) lets the request through; the example app wires the same SessionMiddleware/AuthenticationMiddleware (example_middleware_usage.py:127,131) and decorates this /staff handler (line 336). Repo is a framework, so the only wired protected handler is in this in-package example module (rule 7)." | |
| } | |
| ] | |
| } | |
Xet Storage Details
- Size:
- 4.57 kB
- Xet hash:
- 17f72aaae90e856126eb28b6c9d6a3ffc33656c68d2aa9e3b3c0334e142165e3
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.