Potential fix for code scanning alert no. 4: Information exposure through a stack trace - #6182
Draft
0xcucumbersalad wants to merge 1 commit into
Draft
Potential fix for code scanning alert no. 4: Information exposure through a stack trace#61820xcucumbersalad wants to merge 1 commit into
0xcucumbersalad wants to merge 1 commit into
Conversation
…ough a stack trace Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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.
Potential fix for https://github.com/decocms/studio/security/code-scanning/4
To fix this without changing functional behavior, keep HTTP status codes and route behavior the same, but replace client-visible error details derived from caught exceptions with a generic message. If debugging detail is still needed, log the caught error on the server (
stderr) instead of returning it in the response payload.Best single approach in this file:
packages/sandbox/daemon-e2e/stub-daemon.mjs, update bothcatch (e)blocks in:POST /_sandbox/writePOST /_sandbox/readreturn send(res, 400, { error: String(e?.message ?? e) });with:{ error: "invalid request" }.No imports or external dependencies are needed.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.
Summary by cubic
Stops exposing exception details from the sandbox daemon stub by returning a generic error to clients and logging the stack to stderr. Preserves all route behavior and HTTP status codes to address the information exposure alert.
POST /_sandbox/writeandPOST /_sandbox/read: still return 400 on failure, but payload is{ error: "invalid request" }; full error/stack is written to stderr.Written for commit fc07d5a. Summary will update on new commits.