Skip to content

Commit 63ee35e

Browse files
committed
fix(security): always strip multi-line content in sanitizeConnectionError
Take the first line of the error message regardless of length to prevent leaking sensitive data from multi-line error messages.
1 parent 820df09 commit 63ee35e

File tree

1 file changed

+2
-8
lines changed
  • apps/sim/app/api/mcp/servers/test-connection

1 file changed

+2
-8
lines changed

apps/sim/app/api/mcp/servers/test-connection/route.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,8 @@ function sanitizeConnectionError(error: unknown): string {
5151
return 'Unknown connection error'
5252
}
5353

54-
const msg = error.message
55-
56-
if (msg.length > 200) {
57-
const firstLine = msg.split('\n')[0]
58-
return firstLine.length > 200 ? `${firstLine.slice(0, 200)}...` : firstLine
59-
}
60-
61-
return msg
54+
const firstLine = error.message.split('\n')[0]
55+
return firstLine.length > 200 ? `${firstLine.slice(0, 200)}...` : firstLine
6256
}
6357

6458
/**

0 commit comments

Comments
 (0)