Skip to content

Potential fix for code scanning alert no. 5: Information exposure through a stack trace#206

Open
Yostra wants to merge 1 commit intomainfrom
alert-autofix-5
Open

Potential fix for code scanning alert no. 5: Information exposure through a stack trace#206
Yostra wants to merge 1 commit intomainfrom
alert-autofix-5

Conversation

@Yostra
Copy link
Copy Markdown
Collaborator

@Yostra Yostra commented Mar 30, 2026

Potential fix for https://github.com/stripe/sync-engine/security/code-scanning/5

To fix the problem, the stack trace and other low-level error details should no longer be returned to the client. Instead, the server should log the full error (including err.stack) and send back a generic, high-level error message. This preserves debuggability while preventing remote callers from learning about internal structure.

Concretely, in packages/sync-engine/src/supabase/edge-functions/sigma-data-worker.ts:

  1. In the catch block around postgres(dbUrl, ...) (lines 38–50), replace the jsonResponse body so that it does not contain details or stack. Optionally log the error server-side with console.error.
  2. In the catch block around StripeSync.create(...) (lines 84–95), likewise stop including details and stack in the JSON response, and optionally log the error.
  3. In the outermost try/catch (lines 309–313), stop returning { error: err.message, stack: err.stack } and instead return a generic message, while logging the full error including stack.

No changes are needed in packages/sync-engine/src/database/postgres.ts; the stack there is simply thrown and only becomes problematic when it is formatted into HTTP responses. We can use existing console.error for logging, so no new imports are required. Functionality from the client’s perspective remains the same in terms of status codes and high-level messages (still 500s, still indicate failure), but without leaking stack traces.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…ough a stack trace

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@Yostra Yostra marked this pull request as ready for review March 30, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant