mirror of
https://github.com/matrix-construct/construct
synced 2024-05-29 08:13:46 +02:00
ircd:Ⓜ️:fetch: Add redaction query for non-conformity check; conf item.
This commit is contained in:
parent
91d57ea989
commit
d44ad15261
|
@ -728,6 +728,7 @@ namespace ircd::m::fetch
|
|||
extern conf::item<bool> check_event_id;
|
||||
extern conf::item<bool> check_conforms;
|
||||
extern conf::item<bool> check_signature;
|
||||
extern conf::item<bool> check_redacted;
|
||||
}
|
||||
|
||||
decltype(ircd::m::fetch::check_event_id)
|
||||
|
@ -744,6 +745,13 @@ ircd::m::fetch::check_conforms
|
|||
{ "default", true },
|
||||
};
|
||||
|
||||
decltype(ircd::m::fetch::check_redacted)
|
||||
ircd::m::fetch::check_redacted
|
||||
{
|
||||
{ "name", "ircd.m.fetch.check.redacted" },
|
||||
{ "default", true },
|
||||
};
|
||||
|
||||
decltype(ircd::m::fetch::check_signature)
|
||||
ircd::m::fetch::check_signature
|
||||
{
|
||||
|
@ -871,12 +879,22 @@ ircd::m::fetch::_check_event(const request &request,
|
|||
|
||||
if(check_conforms)
|
||||
{
|
||||
thread_local char buf[128];
|
||||
const m::event::conforms conforms
|
||||
m::event::conforms conforms
|
||||
{
|
||||
event
|
||||
};
|
||||
|
||||
const bool redacted
|
||||
{
|
||||
check_redacted && conforms.has(m::event::conforms::MISMATCH_HASHES)?
|
||||
bool(m::redacted(request.opts.event_id)):
|
||||
false
|
||||
};
|
||||
|
||||
if(redacted || !check_redacted)
|
||||
conforms.del(m::event::conforms::MISMATCH_HASHES);
|
||||
|
||||
thread_local char buf[128];
|
||||
const string_view failures
|
||||
{
|
||||
conforms.string(buf)
|
||||
|
|
Loading…
Reference in a new issue