Commit Graph

8 Commits

Author SHA1 Message Date
Claude
8b90fa2b9e Fix critical bugs for security and data accuracy
This commit addresses three important bugs:

1. SQL Injection Prevention (proxy.ts:70-75):
   - Added whitelist validation for DATABASE_TABLE environment variable
   - Table names are now validated against ALLOWED_TABLES before use
   - Prevents potential SQL injection through malicious table names

2. SQL Interval Parameter Bug (dashboard/app/api/metrics/route.ts):
   - Fixed incorrect INTERVAL syntax in PostgreSQL queries
   - Changed from INTERVAL '$1 hours' to INTERVAL '1 hour' * $1
   - Properly uses parameterized queries with interval multiplication
   - Affects all 4 queries: summary, recent, model breakdown, and trends

3. Incorrect Property Reference (proxy.ts:206):
   - Fixed usage.cached_tokens to usage.prompt_tokens_details?.cached_tokens
   - Aligns with OpenAI API response structure for cached tokens
   - Ensures accurate logging of cached token usage
2025-11-23 06:18:11 +00:00
Claude
2770745618 Fix multiple small bugs for security and robustness
- Add input validation for hours and limit query parameters to prevent NaN and DoS attacks
- Replace || with ?? for proper null coalescing in metrics summary
- Fix IPv6 normalization to prevent empty string when IP is malformed
- Fix stream parsing to skip empty JSON strings and avoid parse errors
- Remove redundant .toString() calls on authorization header
2025-11-23 04:24:46 +00:00
Praveen Thirumurugan
f592b4b029 feat: add IP normalization for IPv6-mapped addresses in proxy request logging 2025-10-18 02:33:42 +05:30
Praveen Thirumurugan
0a69232257 feat: add UUID generation for request tracking and update PostgreSQL schema 2025-10-18 02:22:52 +05:30
Praveen Thirumurugan
ee0e5033ec refactor: remove redundant provider information from log data in proxy request 2025-10-18 02:10:03 +05:30
Praveen Thirumurugan
4c6610eecc feat: add UPSTREAM_URL validation and error handling in proxy request 2025-10-18 01:57:44 +05:30
Praveen Thirumurugan
1b3ce75155 fix: normalize model names to lowercase in cost calculation and proxy request handling 2025-10-18 01:40:56 +05:30
Praveen Thirumurugan
6839ae6f6a feat: init llm-proxy 2025-10-18 01:22:02 +05:30