Skip to content

Commit fee54a4

Browse files
committed
addressed bot identified issues
1 parent 87f5d81 commit fee54a4

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

backend/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,12 @@ async def websocket_endpoint(websocket: WebSocket):
177177
"""
178178
await websocket.accept()
179179

180-
# Basic auth: derive user from query parameters or use test user
180+
# Basic auth: derive user from query parameters - reject if not provided
181181
user_email = websocket.query_params.get('user')
182182
if not user_email:
183-
# Fallback to test user or require auth
184-
config_manager = app_factory.get_config_manager()
185-
user_email = config_manager.app_settings.test_user or '[email protected]'
183+
# Reject connection if user is not provided or authentication fails
184+
await websocket.close(code=4401, reason="Unauthorized: user authentication required")
185+
return
186186

187187
session_id = uuid4()
188188

backend/routes/files_routes.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,13 @@ async def upload_file(
6060
# Validate base64 content size (configurable limit to prevent abuse)
6161
try:
6262
content_size = len(request.content_base64) * 3 // 4 # approximate decoded size
63-
max_size = 50 * 1024 * 1024 # 50MB default (configurable)
64-
if content_size > max_size:
65-
raise HTTPException(status_code=413, detail=f"File too large. Maximum size is {max_size // (1024*1024)}MB")
6663
except Exception:
6764
raise HTTPException(status_code=400, detail="Invalid base64 content")
6865

66+
max_size = 250 * 1024 * 1024 # 250MB default (configurable)
67+
if content_size > max_size:
68+
raise HTTPException(status_code=413, detail=f"File too large. Maximum size is {max_size // (1024*1024)}MB")
69+
6970
try:
7071
s3_client = app_factory.get_file_storage()
7172
result = await s3_client.upload_file(
@@ -127,11 +128,8 @@ async def list_files(
127128
processed_files = []
128129
for file_data in result:
129130
processed_file = file_data.copy()
130-
if isinstance(processed_file.get('last_modified'), str):
131-
# If already a string, keep it
132-
pass
133-
else:
134-
# Convert datetime to ISO format string
131+
if not isinstance(processed_file.get('last_modified'), str):
132+
# Convert datetime to ISO format string if it's not already a string
135133
try:
136134
processed_file['last_modified'] = processed_file['last_modified'].isoformat()
137135
except AttributeError:

frontend/src/components/SessionFilesView.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useState, useEffect } from 'react'
21
import {
32
File,
43
Image,

0 commit comments

Comments
 (0)