Commit Graph

10 Commits

Author SHA1 Message Date
Praveen Thirumurugan
276aa4fb29 Enhance logging and update README for SSRF warning
- Updated console log messages in cost.ts and proxy.ts for clarity and consistency.
- Added important SSRF warning in README.md regarding localhost access issues with certain clients, along with solutions using external proxy services.
2025-12-24 16:33:54 +05:30
Praveen Thirumurugan
18d4c93216 feat: update configuration for OpenAI and Anthropic endpoints
- Created a new .env.example file with default environment variables for PORT, OPENAI_UPSTREAM_URL, ANTHROPIC_UPSTREAM_URL, and DATABASE_URL.
- Updated .npmignore to exclude all .env files except .env.example.
- Revised CONTRIBUTING.md to simplify the contribution process and provide clearer setup instructions.
- Enhanced cost.ts with detailed type definitions and improved cost calculation logic.
- Updated proxy.ts to include new environment variables and improved logging functionality.
- Modified README.md to reflect new configuration instructions and usage examples.
- Removed unnecessary dashboard files and streamlined the project structure.
2025-12-23 12:37:40 +05:30
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