fix(security): redact raw SQL in MCP tools and R2 config in uploads #118

Merged
yuris merged 1 commit from fix/77-mcp-sql-leak into main 2026-09-28 20:49:02 +00:00
Owner

Resolves #77

  • Redact raw Drizzle SQL / driver error disclosure from MCP tools (create_purchase, update_purchase, delete_purchase, create_order, upload_receipt), while preserving safe ServiceRejection and ZodError messages and logging unexpected errors server-side.
  • In r2.ts, distinguish client-actionable errors (R2ClientError, e.g. unsupported MIME, file size limit) from infrastructure errors (missing env vars, S3 connection failure).
  • In uploads.ts, return 422 for client-actionable rejections and redact infrastructure errors to generic 500 without leaking Cloudflare account IDs, bucket names, or R2 endpoint domains.
Resolves #77 - Redact raw Drizzle SQL / driver error disclosure from MCP tools (`create_purchase`, `update_purchase`, `delete_purchase`, `create_order`, `upload_receipt`), while preserving safe `ServiceRejection` and `ZodError` messages and logging unexpected errors server-side. - In `r2.ts`, distinguish client-actionable errors (`R2ClientError`, e.g. unsupported MIME, file size limit) from infrastructure errors (missing env vars, S3 connection failure). - In `uploads.ts`, return 422 for client-actionable rejections and redact infrastructure errors to generic 500 without leaking Cloudflare account IDs, bucket names, or R2 endpoint domains.
fix(security): redact raw SQL in MCP tools and R2 config in uploads (#77)
All checks were successful
Checks / test @garage/catalog (pull_request) Successful in 1m14s
Checks / test garage (pull_request) Successful in 1m21s
Checks / test garage-store (pull_request) Successful in 1m18s
Checks / lint (biome) (pull_request) Successful in 12s
Checks / typecheck apps/management (pull_request) Successful in 1m35s
Checks / typecheck apps/store (pull_request) Successful in 1m21s
2e032e1447
yuris left a comment

VERDICT: approve

  • Redacts raw Drizzle SQL, driver errors, and connection string fragments from MCP responses (purchases.ts, orders.ts, images.ts) to generic server errors while preserving ServiceRejection and ZodError.
  • Typed R2ClientError distinguishes client-actionable errors from infrastructure faults; upload routes no longer leak account IDs, bucket names, or r2.cloudflarestorage.com.
  • Full server-side error logging maintained.
  • Verified with unit and wiring tests in all affected surfaces.
VERDICT: approve - Redacts raw Drizzle SQL, driver errors, and connection string fragments from MCP responses (`purchases.ts`, `orders.ts`, `images.ts`) to generic server errors while preserving `ServiceRejection` and `ZodError`. - Typed `R2ClientError` distinguishes client-actionable errors from infrastructure faults; upload routes no longer leak account IDs, bucket names, or `r2.cloudflarestorage.com`. - Full server-side error logging maintained. - Verified with unit and wiring tests in all affected surfaces.
yuris merged commit 103343c127 into main 2026-09-28 20:49:02 +00:00
yuris changed title from fix(security): redact raw SQL in MCP tools and R2 config in uploads (#77) to fix(security): redact raw SQL in MCP tools and R2 config in uploads 2026-09-28 21:09:17 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yuris/garage!118
No description provided.