π‘οΈ Sentinel: [MEDIUM] Fix information leakage in API error responses - #170
π‘οΈ Sentinel: [MEDIUM] Fix information leakage in API error responses#170fysp11 wants to merge 1 commit into
Conversation
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: Several backend API endpoints integrating with Cloudflare Workers AI and Google AI Studio were returning specific error details (
error.message), raw upstream error messages, and in some fallback instances, the actual rawresultpayloads from downstream providers directly to the client. This risked leaking internal configuration, underlying model choices, or details about the upstream infrastructure.π― Impact: If exploited or encountered, attackers could gain information on infrastructure specifics or configuration which could potentially be used to craft more targeted attacks or extract data about internal models.
π§ Fix: Refactored the catch blocks and edge-case conditionals across
ai-chat.ts,ai-image.ts,google-chat.ts, andtts.ts. Replaced direct error forwarding with secure server-side logging usingconsole.errorand updated client responses to use generic, non-descriptive JSON error messages (e.g.,{"error": "Internal error"}). Also removed theraw: datareturn on successful google chat responses to prevent unnecessary data leakage.β Verification: Verified by checking out the branch and running
pnpm run checkto ensure no functionality regressions in the build process. A test can be run manually against these API endpoints by simulating invalid input or missing credentials to confirm generic errors are returned while detailed specific logs are written to standard error.PR created automatically by Jules for task 8960069957697747644 started by @fysp11