Skip to content

Commit

Permalink
verify: handle potential crashes when verifying checkout objects
Browse files Browse the repository at this point in the history
not sure why this is happening yet, but let's make sure we are not
crashing on bad inputs.

Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed Jan 29, 2024
1 parent e0e840b commit 8ef07cd
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/router_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,16 @@ function config_router(app) {
error_response(res, 'Could not parse checkout_id')
return
}
const response = await app.invoice_manager.verify_checkout_object(checkout_id, req.authorized_pubkey)
if (response.request_error) {
invalid_request(res, response.request_error)
}
if (response.checkout_object) {
json_response(res, response.checkout_object)
try {
const response = await app.invoice_manager.verify_checkout_object(checkout_id, req.authorized_pubkey)
if (response.request_error) {
invalid_request(res, response.request_error)
}
if (response.checkout_object) {
json_response(res, response.checkout_object)
}
} catch (e) {
invalid_request(res, e)
}
})

Expand Down

0 comments on commit 8ef07cd

Please sign in to comment.