feat: enhance file description endpoint with security and error handling improvements

- Implemented path validation against ALLOWED_ROOT_DIRECTORY to prevent arbitrary file reads and prompt injection attacks.
- Added error handling for file reading, including specific responses for forbidden paths and file not found scenarios.
- Updated the description generation logic to truncate large files and provide structured prompts for analysis.
- Enhanced logging for better traceability of file access and errors.

These changes aim to improve the security and reliability of the file description functionality.
This commit is contained in:
Test User
2025-12-22 02:08:47 -05:00
parent 35cda4eb8c
commit 3b0a1a7eb2
5 changed files with 163 additions and 58 deletions

View File

@@ -3,7 +3,7 @@
*/
export const CLAUDE_MODEL_MAP: Record<string, string> = {
haiku: 'claude-haiku-4-5-20251001',
sonnet: 'claude-sonnet-4-20250514',
sonnet: 'claude-sonnet-4-5-20250929',
opus: 'claude-opus-4-5-20251101',
} as const;