mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 08:42:34 +01:00
ircd:Ⓜ️:vm: Option to verify origin signature on eval.
This commit is contained in:
parent
ce084a1df0
commit
9c26c5facd
2 changed files with 11 additions and 0 deletions
|
@ -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};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue