cacti
cacti copied to clipboard
security(plugin-htlc-coordinator-besu): 500 responses expose raw exceptions and stack traces
Summary
Two HTLC coordinator Besu endpoints expose internal exception details in HTTP 500 responses instead of returning a sanitized error payload.
Affected code
extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/web-services/own-htlc-endpoint.ts:104-109extensions/cactus-plugin-htlc-coordinator-besu/src/main/typescript/web-services/counterparty-htlc-endpoint.ts:109-114
Details
OwnHtlcEndpoint#handleRequest() returns the raw caught exception object:
res.status(500).json({
message: "Internal Server Error",
error: ex,
});
CounterpartyHtlcEndpoint#handleRequest() returns ex?.stack || ex?.message, which can expose server-side stack traces to API clients.
res.status(500).json({
message: "Internal Server Error",
error: ex?.stack || ex?.message,
});
This creates an information disclosure risk and is inconsistent with safer patterns elsewhere in the repo that avoid reflecting raw exceptions back to callers.
Expected behavior
HTTP 500 responses should return a stable, sanitized error body such as:
{ "message": "Internal Server Error" }
or a bounded public error code/message that does not include stack traces or raw exception objects.
Suggested fix
- Avoid serializing
exdirectly into the response body. - Avoid returning
ex.stackto clients. - Keep full exception detail in server logs only.