Security: skip more print_host related info
This commit is contained in:
parent
32418eb66e
commit
8d56490dad
3 changed files with 14 additions and 7 deletions
|
@ -4369,16 +4369,19 @@ void GCode::append_full_config(const Print &print, std::string &str)
|
|||
{
|
||||
const DynamicPrintConfig &cfg = print.full_print_config();
|
||||
// Sorted list of config keys, which shall not be stored into the G-code. Initializer list.
|
||||
static constexpr auto banned_keys = {
|
||||
static const std::set<std::string_view> banned_keys( {
|
||||
"compatible_printers"sv,
|
||||
"compatible_prints"sv,
|
||||
"print_host"sv,
|
||||
"print_host_webui"sv,
|
||||
"printhost_apikey"sv,
|
||||
"printhost_cafile"sv
|
||||
};
|
||||
assert(std::is_sorted(banned_keys.begin(), banned_keys.end()));
|
||||
"printhost_cafile"sv,
|
||||
"printhost_user"sv,
|
||||
"printhost_password"sv,
|
||||
"printhost_port"sv
|
||||
});
|
||||
auto is_banned = [](const std::string &key) {
|
||||
return std::binary_search(banned_keys.begin(), banned_keys.end(), key);
|
||||
return banned_keys.find(key) != banned_keys.end();
|
||||
};
|
||||
std::ostringstream ss;
|
||||
for (const std::string& key : cfg.keys()) {
|
||||
|
|
|
@ -1835,7 +1835,7 @@ std::pair<Preset*, bool> PresetCollection::load_external_preset(
|
|||
keys.erase(std::remove_if(keys.begin(), keys.end(),
|
||||
[](std::string &val) {
|
||||
return val == "print_host" || val == "print_host_webui" || val == "printhost_apikey" ||
|
||||
val == "printhost_cafile";
|
||||
val == "printhost_cafile" || val == "printhost_user" || val == "printhost_password" || val == "printhost_port";
|
||||
}),
|
||||
keys.end());
|
||||
cfg.apply_only(combined_config, keys, true);
|
||||
|
|
|
@ -1962,7 +1962,11 @@ DynamicPrintConfig PresetBundle::full_config_secure() const
|
|||
config.erase("print_host");
|
||||
config.erase("print_host_webui");
|
||||
config.erase("printhost_apikey");
|
||||
config.erase("printhost_cafile"); return config;
|
||||
config.erase("printhost_cafile");
|
||||
config.erase("printhost_user");
|
||||
config.erase("printhost_password");
|
||||
config.erase("printhost_port");
|
||||
return config;
|
||||
}
|
||||
|
||||
const std::set<std::string> ignore_settings_list ={
|
||||
|
|
Loading…
Reference in a new issue