diff options
| author | Zousar Shaker <[email protected]> | 2025-05-08 16:01:40 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-05-08 16:01:40 +0100 |
| commit | 4207b2d5d3eebee504bc72195aa588b1ac17e3fe (patch) | |
| tree | b7f5c985bc14aa93f169b1bc9ddd918c03e1ba18 | |
| parent | 5.6.7 (diff) | |
| parent | Changelog (diff) | |
| download | zen-4207b2d5d3eebee504bc72195aa588b1ac17e3fe.tar.xz zen-4207b2d5d3eebee504bc72195aa588b1ac17e3fe.zip | |
Merge pull request #386 from ue-foundation/zs/plugin-config-hardening
Zs/plugin config hardening
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | src/zenserver/config.cpp | 16 |
2 files changed, 9 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index befdd1944..56eb3af53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Bugfix: Validate compact binary objects stored in cache before attempting to parse them to avoid crash when data is corrupt - Bugfix: Don't report redundant error if disk is full when writing GC state or GC log - Bugfix: Properly handle empty directories when using `zen wipe` command +- Bugfix: Handle invalid plugin config file without terminating - Improvement: If garbage collection fails due to out of disk or out of memory we issue a warning instead of reporting an error to Sentry - Improvement: Improved cache bucket state index write time with ~15% and cache bucket side-car write time with ~20% - Improvement: Optimize block compact reducing memcpy operations diff --git a/src/zenserver/config.cpp b/src/zenserver/config.cpp index e81e8eb54..7b8e38e80 100644 --- a/src/zenserver/config.cpp +++ b/src/zenserver/config.cpp @@ -527,15 +527,15 @@ ParsePluginsConfigFile(const std::filesystem::path& Path, ZenServerOptions& Serv json11::Json PluginsInfo = json11::Json::parse(JsonText, JsonError); if (!JsonError.empty()) { - throw std::runtime_error(fmt::format("failed parsing json file '{}'. Reason: '{}'", Path, JsonError)); + ZEN_WARN("failed parsing plugins config file '{}'. Reason: '{}'", Path, JsonError); + return; } for (const json11::Json& PluginInfo : PluginsInfo.array_items()) { if (!PluginInfo.is_object()) { - throw std::runtime_error(fmt::format("the json file '{}' does not contain a valid plugin definition, object expected, got '{}'", - Path, - PluginInfo.dump())); + ZEN_WARN("the json file '{}' does not contain a valid plugin definition, object expected, got '{}'", Path, PluginInfo.dump()); + continue; } HttpServerPluginConfig Config = {}; @@ -546,10 +546,10 @@ ParsePluginsConfigFile(const std::filesystem::path& Path, ZenServerOptions& Serv { if (!Items.second.is_string()) { - throw std::runtime_error( - fmt::format("the json file '{}' does not contain a valid plugins definition, string expected, got '{}'", - Path, - Items.second.dump())); + ZEN_WARN("the json file '{}' does not contain a valid plugins definition, string expected, got '{}'", + Path, + Items.second.dump()); + continue; } const std::string& Name = Items.first; |