π‘οΈ Sentinel: [MEDIUM] Fix sensitive data leakage in API error responses - #169
π‘οΈ Sentinel: [MEDIUM] Fix sensitive data leakage in API error responses#169fysp11 wants to merge 1 commit into
Conversation
Co-authored-by: fysp11 <13081700+fysp11@users.noreply.github.com>
Preview deployments for fysp11.github.io β‘οΈ
Commit: Deployment ID: Static site name: |
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
π¨ Severity: MEDIUM
π‘ Vulnerability: Backend API routes (
src/pages/api/*) were directly returning underlyingerror.messageand downstream text payloads to clients on500or502errors. This could potentially leak internal system paths, configuration secrets, stack traces, or upstream provider responses to untrusted users.π― Impact: Information disclosure. Attackers or malicious clients could use leaked stack traces or backend provider payloads to gain insights into the system's architecture, dependencies, or configuration, escalating to further attacks.
π§ Fix: Refactored the
catchblocks across all backend API routes to log the detailed error server-side viaconsole.error(), while uniformly returning a generic{"error": "Internal server error"}payload to the client. This follows the "Defense in depth" and "Fail securely" principles.β Verification: Trigger any of the API endpoints (
/api/ai-chat,/api/ai-image,/api/google-chat,/api/tts) in a way that forces an error (e.g. failing upstream fetch), verify that the response returned is only{ "error": "Internal server error" }and the detailed error log appears in the server logs. Passedpnpm run checkand type-checking successfully.PR created automatically by Jules for task 13548440865515388479 started by @fysp11