Repository navigation
Stop leaking the raw error from changeProjectVisibility - #4370
Open
boluwatifeajayi wants to merge 1 commit into
Open
boluwatifeajayi wants to merge 1 commit into
boluwatifeajayi wants to merge 1 commit into
Conversation
The catch block returned the caught error as the response body, which can expose stack traces and database internals. Log it on the server and send a generic message in the same shape as the other project controller errors. Fixes processing#3898
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
boluwatifeajayi
requested a deployment
to
e2e-tests
October 20, 2026 16:54 — with
GitHub Actions
Waiting
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue:
Fixes #3898
The issue lists several controllers that sent the caught error straight into
res.json(). I checked them against current develop and all but one already return a generic message (the user controllers now sendInternal server error). The remaining one ischangeProjectVisibilityinserver/controllers/project.controller.js, whose catch block didres.status(500).json(error). That sends the error object as the response body, so a database failure could expose a stack trace or mongoose internals to the client, and it also bypasses the global error handler because it never callsnext().Changes:
console.error, like the other handlers in this file do.{ success: false, message: 'Failed to change project visibility.' }, the same shape the rest of this function and the other project endpoints use.I have verified that this pull request:
npm run lint), I ran eslint on the two changed filesnpm run test), I ran the project controller test file (10 passing)npm run typecheck), not run, only plain JS changeddevelopbranch.Fixes #123