Fix auth bypasses, race condition, stale connections, and unbounded query
- Block disabled accounts at login and unimpersonate (C4, C2) - Catch IntegrityError on register commit to return 409 instead of 500 (C5) - Stop _seed_admin from overwriting existing admin password on restart (C8) - Cap public/stats query at 500 users to bound memory usage (C3) - Rate-limit PUT /me/password at 5/minute (C6) - Bump SQLAlchemy to 2.0.50 and aiomysql to 0.3.2; re-enable pool_pre_ping (C7) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@ router = APIRouter(prefix="/api/public", tags=["public"])
|
||||
@limiter.limit("30/minute")
|
||||
async def public_stats(request: Request, db: AsyncSession = Depends(get_db)):
|
||||
users_result = await db.execute(
|
||||
select(User).options(selectinload(User.entries))
|
||||
select(User).options(selectinload(User.entries)).limit(500)
|
||||
)
|
||||
users = users_result.scalars().all()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user