Summary
The local SNS devtools server in devtools/node/httpserver.js parses every POST body with JSON.parse(body) inside handleBody() without catching malformed JSON.
A malformed or non-JSON POST body can therefore raise an uncaught exception and terminate the devtools process instead of logging/rejecting the invalid payload.
Impact
This affects local webhook/SNS debugging: one malformed request can take down the process and require a manual restart.
Relevant code
const handleBody = (body) => {
const envelope = JSON.parse(body)
validator.validate(envelope, (err) => {
// ...
})
}
Expected behavior
Malformed JSON should be handled explicitly, for example by logging a clear error and returning a 400 response or otherwise avoiding process termination.
Possible fix
Wrap JSON.parse in a try/catch and keep SNS validation behavior unchanged for valid JSON envelopes.
Summary
The local SNS devtools server in
devtools/node/httpserver.jsparses every POST body withJSON.parse(body)insidehandleBody()without catching malformed JSON.A malformed or non-JSON POST body can therefore raise an uncaught exception and terminate the devtools process instead of logging/rejecting the invalid payload.
Impact
This affects local webhook/SNS debugging: one malformed request can take down the process and require a manual restart.
Relevant code
Expected behavior
Malformed JSON should be handled explicitly, for example by logging a clear error and returning a 400 response or otherwise avoiding process termination.
Possible fix
Wrap
JSON.parsein atry/catchand keep SNS validation behavior unchanged for valid JSON envelopes.