π‘οΈ Sentinel: [MEDIUM] Fix Information Leakage in API Routes - #186
π‘οΈ Sentinel: [MEDIUM] Fix Information Leakage in API Routes#186fysp11 wants to merge 1 commit into
Conversation
Updated API error responses to return generic error messages (e.g., "Internal server error") instead of raw error objects or downstream API contexts that leak internal implementations. Actual errors and API statuses are now securely logged server-side via console.error. Co-authored-by: fysp11 <13081700+fysp11@users.noreply.github.com>
|
π 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. |
Preview deployments for fysp11.github.io β‘οΈ
Commit: Deployment ID: Static site name: |
π¨ Severity: MEDIUM
π‘ Vulnerability: Information Leakage in API Responses. Multiple API routes (
ai-chat.ts,ai-image.ts,google-chat.ts,tts.ts) were directly returning internal system errors, actual error properties like(err as Error).message, or raw upstream API errors to the client on failure. This inherently risks leaking implementation details, third-party structures, system paths, or environment specifics to untrusted clients.π― Impact: Potential exposure of sensitive data via stack traces and API keys configurations to unauthorized parties who purposefully send malformed queries to prompt unhandled backend exceptions.
π§ Fix: Substituted explicit error data in JSON error returns with a generic "Internal server error" string. Maintained the internal visibility for admins and developers by persisting raw details to server logs using
console.error().β Verification: Run
pnpm run checkand manually assert that triggering an error on these API endpoints no longer echoes explicit.messagecontent from unhandled promises or third party providers back onto the client network trace.PR created automatically by Jules for task 14566050397298368181 started by @fysp11