Skip to content

Commit b518672

Browse files
Mathéoclaude
andcommitted
Strip stack traces from RPC error responses (OAC-05)
Remove the `stack` property from serialized error objects in RpcState.reply() to prevent internal file paths, line numbers, and code structure from leaking to callers via postMessage or URL-encoded redirect responses. The full error (including stack) is still logged via console.debug for debugging purposes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2b42a9d commit b518672

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/RpcServer.es.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ class RpcState {
148148
reply(status, result) {
149149
console.debug('RpcServer REPLY', result);
150150
if (status === ResponseStatus.ERROR) {
151-
// serialize error objects
151+
// serialize error objects, omitting stack traces to avoid leaking internal details
152152
result = typeof result === 'object'
153-
? { message: result.message, stack: result.stack, name: result.name }
153+
? { message: result.message, name: result.name }
154154
: { message: result };
155155
}
156156
if (this._postMessage) {

0 commit comments

Comments
 (0)