Skip to content

A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy injectors to reality checkers. Each agent is a specialized expert with personality, processes, and proven deliverables.

Shell

fix(security): require JWT expiry and audit subject claims

Rudy Celekli363d6ac24bf2
diff --git a/security/security-architect.md b/security/security-architect.md
index 0dbc2272..b0c504f5 100644
--- a/security/security-architect.md
+++ b/security/security-architect.md
@@ -128,6 +128,7 @@ from pydantic import BaseModel, Field, field_validator
from slowapi import Limiter
from slowapi.util import get_remote_address
import re
+import jwt # PyJWT; settings and audit_log come from the application's configuration
app = FastAPI(docs_url=None, redoc_url=None) # Disable docs in production
security = HTTPBearer()
@@ -154,6 +155,7 @@ async def verify_token(credentials: HTTPAuthorizationCredentials = Depends(secur
algorithms=["RS256"],
audience=settings.JWT_AUDIENCE,
issuer=settings.JWT_ISSUER,
+ options={"require": ["exp", "sub"]}, # missing expiry or actor is not a valid access token
)
return payload
except jwt.InvalidTokenError: