Buckets:

download
raw
2.73 kB
{
"role_mappings": [
{
"role": "Subject",
"status": "missing",
"symbol": "",
"file": "",
"lines": "",
"notes": "Callers (Alexa skill, mobile apps, web UI) live outside the repo; no in-repo client sends the X-API-Key token to the API (searched src/ and cli/ for X-API-Key, requests, httpx)."
},
{
"role": "Enforcer",
"status": "present",
"symbol": "get_api_token",
"file": "src/pytrain_api/endpoints.py",
"lines": "224",
"notes": "FastAPI dependency installed on every /pytrain/v1 route via APIRouter(dependencies=[Depends(get_api_token)]) at endpoints.py:592 (router included at :2009); it reads the X-API-Key header (APIKeyHeader, :166) and raises HTTPException 401/498 on failure. The verification decision is inline in the same function, so it is also the Verifier."
},
{
"role": "Verifier",
"status": "present",
"symbol": "get_api_token",
"file": "src/pytrain_api/endpoints.py",
"lines": "224",
"notes": "Same function as the Enforcer (inline decision, no smaller helper): for JWT-shaped tokens it calls jwt.decode at endpoints.py:270 (signature + exp check), then accepts on claims magic==API_NAME or SERVER==API_SERVER/GUID. Caveat: non-JWT values take a raw API-key comparison path (opaque-token lookalike)."
},
{
"role": "Key manager",
"status": "present",
"symbol": "SECRET_KEY",
"file": "src/pytrain_api/endpoints.py",
"lines": "100",
"notes": "Reached from get_api_token's jwt.decode(api_key, SECRET_KEY, ...) at endpoints.py:270; the HMAC secret is a module-level constant loaded from the environment/.env via os.environ.get, with no retrieving method, so the variable is cited. The .env secret is generated by pytrain_api.py:407 (setup, off the verification path)."
},
{
"role": "Cryptographer",
"status": "external",
"symbol": "decode",
"file": "src/pytrain_api/endpoints.py",
"lines": "270",
"notes": "Called by get_api_token (endpoints.py:224); PyJWT jwt.decode (imported at :20) verifies the HMAC signature with SECRET_KEY and algorithm from ALGORITHM env (:104) and checks expiry. Token issuing uses jwt.encode in create_api_token (:193), off the runtime path."
},
{
"role": "System",
"status": "present",
"symbol": "stop_all",
"file": "src/pytrain_api/endpoints.py",
"lines": "840",
"notes": "Representative protected handler registered on the guarded router (decorators at endpoints.py:838-839, router :592); runs only after get_api_token passes and sends STOP_IMMEDIATE commands. All other /pytrain/v1 handlers are equally protected."
}
]
}

Xet Storage Details

Size:
2.73 kB
·
Xet hash:
694b88f5181088806bf53f9f88f298f285868d5c75ce3e94314dad3a7bcacb8b

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