Summary
In src/app/admin_add_solver.rs, when the incoming message has a missing or
wrong-typed payload, the handler logs an error but returns Ok(()):
let payload = if let Some(payload) = &inner_message.payload {
payload
} else {
error!("No pubkey found!");
return Ok(()); // ← silent success on invalid input
};
let npubkey = if let Payload::TextMessage(p) = payload {
p
} else {
error!("No pubkey found!");
return Ok(()); // ← same here
};
Impact
- The admin who sent the malformed request gets no feedback, no DM, no error
- The call site sees a successful result, making the failure invisible
- This is inconsistent with every other handler in
src/app/ which returns
Err(MostroCantDo(...)) or Err(MostroInternalErr(...)) for invalid input
Suggested Fix
Replace the silent Ok(()) returns with appropriate errors, for example:
} else {
return Err(MostroInternalErr(ServiceError::InvalidPayload));
};
This would allow the caller to send a proper error DM to the admin and surface
the failure in logs with the correct severity level.
Related
- Consistent with how
add_invoice_action and admin_take_dispute_action handle
invalid input they return Err(...) rather than silently returning Ok(())
I wrote a failing test that reproduces this. Add to src/app/admin_add_solver.rs and run:
cargo test admin_add_solver_missing_payload
test app::admin_add_solver::tests::admin_add_solver_missing_payload_should_return_err_not_ok ... FAILED
BUG REPRODUCED: admin_add_solver_action returned Ok(()) on missing payload
instead of Err. The admin gets no feedback and the failure is invisible to the caller.
Summary
In
src/app/admin_add_solver.rs, when the incoming message has a missing orwrong-typed payload, the handler logs an error but returns
Ok(()):Impact
src/app/which returnsErr(MostroCantDo(...))orErr(MostroInternalErr(...))for invalid inputSuggested Fix
Replace the silent
Ok(())returns with appropriate errors, for example:This would allow the caller to send a proper error DM to the admin and surface
the failure in logs with the correct severity level.
Related
add_invoice_actionandadmin_take_dispute_actionhandleinvalid input they return
Err(...)rather than silently returningOk(())I wrote a failing test that reproduces this. Add to src/app/admin_add_solver.rs and run:
cargo test admin_add_solver_missing_payload
test app::admin_add_solver::tests::admin_add_solver_missing_payload_should_return_err_not_ok ... FAILED
BUG REPRODUCED: admin_add_solver_action returned Ok(()) on missing payload
instead of Err. The admin gets no feedback and the failure is invisible to the caller.