Buckets:
AnonymousSpottedToad/candidate_bucket / preliminary /mappings /python /verifiable_token_based_authentication /tyvekzhang_fastlib.json
| { | |
| "role_mappings": [ | |
| { | |
| "role": "Subject", | |
| "status": "missing", | |
| "symbol": "", | |
| "file": "", | |
| "lines": "", | |
| "notes": "fastlib is a FastAPI helper library with no in-repo client (UI, SDK or CLI) that sends the Bearer token to jwt_middleware (fastlib/middleware/jwt.py:49); callers are consumer apps outside the repo. tests/ hold only unit tests and do not count." | |
| }, | |
| { | |
| "role": "Enforcer", | |
| "status": "present", | |
| "symbol": "jwt_middleware", | |
| "file": "fastlib/middleware/jwt.py", | |
| "lines": "49", | |
| "notes": "Anchor: HTTP middleware that skips whitelisted routes, reads the Authorization header (line 88), calls security.validate_token (line 92) and security.get_user_id (line 93), sets the user context and only then calls call_next (line 115); it returns 401 when the header is missing (line 107). It is exported for consumer apps in fastlib/middleware/__init__.py:4 but not registered in-repo (library), and an invalid token surfaces as an HTTPException from decode_jwt_token rather than the caught PyJWTError, so the request is still blocked; the alternative Depends-style guard current_user in get_current_user (fastlib/security.py:57) uses the same verifier chain." | |
| }, | |
| { | |
| "role": "Verifier", | |
| "status": "present", | |
| "symbol": "validate_token", | |
| "file": "fastlib/security.py", | |
| "lines": "140", | |
| "notes": "Reached from jwt_middleware at fastlib/middleware/jwt.py:92. It calls decode_jwt_token (fastlib/security.py:153 -> :20), which runs jwt.decode with the secret key and raises a 401 HTTPException on an invalid or expired token, then re-checks the exp claim (line 154) and returns True. The principal is extracted separately by get_user_id (fastlib/security.py:164, called at jwt.py:93), which decodes the token again via decode_jwt_token." | |
| }, | |
| { | |
| "role": "Key manager", | |
| "status": "present", | |
| "symbol": "secret_key", | |
| "file": "fastlib/config/_security_config.py", | |
| "lines": "32", | |
| "notes": "Reached from decode_jwt_token, which passes security_config.secret_key directly to jwt.decode (fastlib/security.py:35); no retrieving method exists, so the SecurityConfig field is cited. It is loaded from the config file via ConfigManager.get_security_config (fastlib/config/manager.py:166) or the SECRET_KEY env var (default_factory and __post_init__ at line 54), with an insecure placeholder default and a single HS256 key, so there is no rotation." | |
| }, | |
| { | |
| "role": "Cryptographer", | |
| "status": "external", | |
| "symbol": "decode", | |
| "file": "fastlib/security.py", | |
| "lines": "33", | |
| "notes": "Reached from validate_token -> decode_jwt_token (fastlib/security.py:153 -> :20). PyJWT's jwt.decode (imported at line 7) verifies the HMAC signature with security_config.secret_key and the configured algorithm (HS256 by default) and checks exp. The issuing counterpart is jwt.encode in create_token (fastlib/security.py:108)." | |
| }, | |
| { | |
| "role": "System", | |
| "status": "missing", | |
| "symbol": "", | |
| "file": "", | |
| "lines": "", | |
| "notes": "Library repo (rule 7): jwt_middleware forwards via call_next (fastlib/middleware/jwt.py:115) to handlers that consumer apps define, but no in-repo business handler sits behind it. register_router (fastlib/router.py:21) only auto-discovers controllers from the consumer's directories, and the openapi.py docs routes are not protected business actions." | |
| } | |
| ] | |
| } | |
Xet Storage Details
- Size:
- 3.5 kB
- Xet hash:
- 1c887beaf6f46622edd5d293775c7e1495f13fe6e0ab22c27bde530e2e361241
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.