Log exceptions thrown during enclave init (#3866) (#3884)

This commit is contained in:
Eddy Ashton 2022-05-24 15:42:05 +01:00 коммит произвёл GitHub
Родитель 0ece25eca9
Коммит deec3409c6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 22 добавлений и 6 удалений

Просмотреть файл

@ -231,20 +231,35 @@ extern "C"
cc.consensus,
cc.node_certificate.curve_id);
}
catch (const ccf::ccf_oe_attester_init_error&)
catch (const ccf::ccf_oe_attester_init_error& e)
{
LOG_FAIL_FMT(
"ccf_oe_attester_init_error during enclave init: {}", e.what());
return CreateNodeStatus::OEAttesterInitFailed;
}
catch (const ccf::ccf_oe_verifier_init_error&)
catch (const ccf::ccf_oe_verifier_init_error& e)
{
LOG_FAIL_FMT(
"ccf_oe_verifier_init_error during enclave init: {}", e.what());
return CreateNodeStatus::OEVerifierInitFailed;
}
catch (const ccf::ccf_openssl_rdrand_init_error&)
catch (const ccf::ccf_openssl_rdrand_init_error& e)
{
LOG_FAIL_FMT(
"ccf_openssl_rdrand_init_error during enclave init: {}", e.what());
return CreateNodeStatus::OpenSSLRDRANDInitFailed;
}
catch (const std::exception&)
catch (const std::exception& e)
{
// In most places, logging exception messages directly is unsafe because
// they may contain confidential information. In this instance the chance
// of confidential information is extremely low - this is early during
// node startup, when it has not communicated with any other nodes to
// retrieve confidential state, and any secrets it may have generated are
// about to be discarded as this node terminates. The debugging benefit is
// substantial, while the risk is low, so in this case we promote the
// generic exception message to FAIL.
LOG_FAIL_FMT("exception during enclave init: {}", e.what());
return CreateNodeStatus::EnclaveInitFailed;
}

Просмотреть файл

@ -408,8 +408,9 @@ namespace ccf::indexing::strategies
if (kv::get_security_domain(map_name_) != kv::SecurityDomain::PUBLIC)
{
throw std::logic_error(fmt::format(
"This Strategy is currently only implemented for public tables, so "
"cannot be used for '{}'",
"This Strategy ({}) is currently only implemented for public tables, "
"so cannot be used for '{}'",
get_name(),
map_name_));
}