fix(frontend): sanitize API error messages to prevent info disclosure#48
fix(frontend): sanitize API error messages to prevent info disclosure#48SandeepChauhan00 wants to merge 1 commit intoINCF:mainfrom
Conversation
|
Hi team! 👋 Following up on this security enhancement PR. This addresses Issue #47 Changes:
This is a low-risk change that improves security. I've completed all Would appreciate your feedback when you have a moment. Happy to discuss Thanks! |
|
Legitimate security concern and the ErrorHandler structure is well thought out. The problem is the isErrorResponse heuristic pattern-matches on strings like 'error', 'timeout', 'unauthorized' — an AI response that mentions these words in context (e.g. 'this dataset had an error rate of...') will be incorrectly sanitized. The detection logic needs to distinguish between actual HTTP/API errors and AI-generated text that happens to contain those words, e.g. by checking response structure rather than string content. Please revise and reopen. |
🔗 Related Issue
Closes #47
📋 Summary
Sanitizes API error messages to prevent exposing internal system details to users.
🐛 Problem
When API errors occur, raw error responses including sensitive details are displayed:
gemini-2.5-flash-lite)FreeTier)quotaValue: 20)_ssl.c:1032)This violates OWASP security best practices.
✅ Solution
Added
ErrorHandler.tsutility that:📁 Files Changed
src/utils/ErrorHandler.tssrc/App.tsx🔄 Before & After
429 RESOURCE_EXHAUSTED gemini-2.5-flash-lite[SSL: UNEXPECTED_EOF] _ssl.c:1032504 Gateway Timeout🧪 Testing Performed
✅ Checklist