0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 15:30:52 +01:00

ircd:Ⓜ️:vm: Option to verify origin signature on eval.

This commit is contained in:
Jason Volk 2018-03-22 01:31:17 -07:00
parent ce084a1df0
commit 9c26c5facd
2 changed files with 11 additions and 0 deletions

View file

@ -131,6 +131,9 @@ struct ircd::m::vm::opts
/// replayed through the system (not recommended).
bool replays {false};
// Verify the origin signature
bool verify {true};
/// TODO: Y
bool prev_check_exists {true};

View file

@ -168,6 +168,7 @@ ircd::m::vm::commit(const event &event,
commit_hook(event);
vm::opts opts_{opts};
opts_.verify = false;
// Some functionality on this server may create an event on behalf
// of remote users. It's safe for us to mask this here, but eval'ing
@ -358,6 +359,13 @@ ircd::m::vm::_eval_pdu(eval &eval,
fault::EXISTS, "Event has already been evaluated."
};
if(opts.verify)
if(!m::event::verify(event))
throw m::BAD_SIGNATURE
{
"Signature verification failed"
};
eval_hook(event);
const auto &depth