Buckets:

download
raw
2.85 kB
{
"role_mappings": [
{
"role": "Subject",
"status": "missing",
"symbol": "",
"file": "",
"lines": "",
"notes": "The WebUI that sends the Bearer token (mentioned at lightrag/api/utils_api.py:486) is not part of this clone (no lightrag_webui sources); grep for Authorization/Bearer found only outbound LLM/rerank clients, which do not target this Enforcer. Caller is outside the repo."
},
{
"role": "Enforcer",
"status": "present",
"symbol": "combined_dependency",
"file": "lightrag/api/utils_api.py",
"lines": "411",
"notes": "FastAPI dependency built by get_combined_auth_dependency (utils_api.py:375) and attached via Depends(combined_auth) on routes, e.g. graph_routes.py:170. It reads the OAuth2 Bearer token, calls auth_handler.validate_token at utils_api.py:434, and raises 401 unless the token fits the auth mode (non-guest when AUTH_ACCOUNTS set); X-API-Key is an alternative path."
},
{
"role": "Verifier",
"status": "present",
"symbol": "validate_token",
"file": "lightrag/api/auth.py",
"lines": "182",
"notes": "Reached from combined_dependency (utils_api.py:434). AuthHandler.validate_token verifies the JWT via jwt.decode with self.secret and the allowed algorithm (rejects 'none'), checks sub and exp claims and expiry, and returns username/role/metadata or raises HTTP 401."
},
{
"role": "Key manager",
"status": "present",
"symbol": "__init__",
"file": "lightrag/api/auth.py",
"lines": "51",
"notes": "AuthHandler.__init__ loads the HMAC secret into self.secret from global_args.token_secret (TOKEN_SECRET env, config.py:872) and the algorithm from JWT_ALGORITHM (default HS256); validate_token (auth.py:203) uses self.secret directly. Caveat: falls back to a public DEFAULT_TOKEN_SECRET (config.py:65) when no AUTH_ACCOUNTS are configured; no key rotation."
},
{
"role": "Cryptographer",
"status": "external",
"symbol": "decode",
"file": "lightrag/api/auth.py",
"lines": "203",
"notes": "Called by validate_token (auth.py:182): PyJWT jwt.decode(token, self.secret, algorithms=[...]) verifies the HMAC signature (HS256 by default) and exp. The same library's jwt.encode (auth.py:180) generates tokens in create_token."
},
{
"role": "System",
"status": "present",
"symbol": "get_graph_labels",
"file": "lightrag/api/routers/graph_routes.py",
"lines": "171",
"notes": "Example protected handler reached after combined_dependency passes: GET /graph/label/list declared with dependencies=[Depends(combined_auth)] at graph_routes.py:170; it returns rag.get_graph_labels(). Many other routes (documents, query, ollama_api.py:435 etc.) are guarded the same way."
}
]
}

Xet Storage Details

Size:
2.85 kB
·
Xet hash:
33a91eba3c1dc099952f030126abe24e89a8fbe56d772877746a55e0137523a3

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