fix(security): stop leaking internal error details from web API routes (CWE-209) - #1147
fix(security): stop leaking internal error details from web API routes (CWE-209)#1147groupthinking wants to merge 3 commits into
Conversation
🚨 Severity: MEDIUM 💡 Vulnerability: Exposes raw backend error messages directly to the client 🎯 Impact: Could leak internal architecture details or timeout diagnostics 🔧 Fix: Log the detailed error internally and return a generic safe message ✅ Verification: Verified via linting and tests
🚨 Severity: MEDIUM 💡 Vulnerability: Exposes raw backend error messages directly to the client 🎯 Impact: Could leak internal architecture details or timeout diagnostics 🔧 Fix: Log the detailed error internally and return a generic safe message ✅ Verification: Verified via linting and tests
The prior error-leakage hardening removed 'details: String(uploadError)' from the client response but left the caught 'uploadError' binding unused, which trips strict no-unused-vars lint and drops the internal diagnostic. Add a server-side console.error so the detailed error is preserved for monitoring while the client still receives only a generic message. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NFDfJ3C6qTJ2Xda8SW93Pf
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository YAML (base), Repository UI (inherited), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
Agent Completion Truth Gate: BLOCKEDReasons: Machine-readable verdict{
"details": {
"invalid_fields": [
"issue.number",
"policy.agent_login",
"policy.run_id"
]
},
"reasons": [
"invalid_payload"
],
"verdict": "blocked"
} |
Automated remediation status —
|
Closing as a duplicate of #1145This PR turned out to duplicate #1145 — both carry the identical 8-file error-leakage fix on the same head commit Per the repo's "no competing PR implements the same issue" rule, I'm closing this in favor of #1145. The only delta this PR added — a Generated by Claude Code |
Canonical issue
Closes #
Outcome
Next.js API routes no longer return raw exception strings (
String(error),error.message,details: String(...)) to clients. Each handler now responds with a static, non-revealing message and logs the full error server-side viaconsole.error. This removes a reconnaissance vector where backend hostnames, connection diagnostics, or stack context could leak to callers.Scope
apps/web/src/app/api/agents/dispatch/route.ts,agents/status/route.ts— dropdetails: String(error)from 502 responses.apps/web/src/app/api/extract-events/route.ts— replace leakederror.messagewith"Event extraction failed".apps/web/src/app/api/jobs/[jobId]/route.ts— add server-sideconsole.error, return generic"Failed to fetch job status".apps/web/src/app/api/training/status/route.ts,training/trigger/route.ts— dropdetails: String(...); addconsole.errorfor the upload/trigger failure path so the detailed error is preserved internally without reaching the client.apps/web/src/app/api/video/search/route.ts— replace leakederror.messagewith a generic message..jules/sentinel.md— records the vulnerability/learning/prevention note.Risk
details/messagestring for diagnostics would now see only a generic message. No internal control flow depends on these strings.Verification
List exact automated and manual checks, tied to the current head SHA.
messagein extract-events,uploadErrorin training/trigger) and no remaining unused catch bindings.Production evidence
Not applicable at PR-open time — awaiting CI / Vercel preview on the current head.
Agent handoff
mainbranch.🤖 Generated with Claude Code
https://claude.ai/code/session_01NFDfJ3C6qTJ2Xda8SW93Pf
Generated by Claude Code