update(userspace/falco): throw logic errors on invalid config values for metadata download

Signed-off-by: Michele Zuccala <michele@zuccala.com>
This commit is contained in:
Michele Zuccala 2021-07-09 10:16:55 +00:00 committed by poiana
parent 812aa9b566
commit a684bec007

View File

@ -254,8 +254,17 @@ void falco_configuration::init(string conf_filename, list<string> &cmdline_optio
} }
m_metadata_download_max_mb = m_config->get_scalar<uint32_t>("metadata_download", "max_mb", 100); m_metadata_download_max_mb = m_config->get_scalar<uint32_t>("metadata_download", "max_mb", 100);
if(m_metadata_download_max_mb > 1024)
{
throw logic_error("Error reading config file(" + m_config_file + "): metadata download maximum size should be < 1024 Mb");
}
m_metadata_download_chunk_wait_us = m_config->get_scalar<uint32_t>("metadata_download", "chunk_wait_us", 1000); m_metadata_download_chunk_wait_us = m_config->get_scalar<uint32_t>("metadata_download", "chunk_wait_us", 1000);
m_metadata_download_watch_freq_sec = m_config->get_scalar<uint32_t>("metadata_download", "watch_freq_sec", 1); m_metadata_download_watch_freq_sec = m_config->get_scalar<uint32_t>("metadata_download", "watch_freq_sec", 1);
if(m_metadata_download_watch_freq_sec == 0)
{
throw logic_error("Error reading config file(" + m_config_file + "): metadata download watch frequency seconds must be an unsigned integer > 0");
}
} }
void falco_configuration::read_rules_file_directory(const string &path, list<string> &rules_filenames) void falco_configuration::read_rules_file_directory(const string &path, list<string> &rules_filenames)