File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,34 @@ along with libdnf. If not, see <https://www.gnu.org/licenses/>.
37
37
#include < iostream>
38
38
#include < string>
39
39
40
+ static const std::unordered_set<std::string> ALLOWED_MAIN_CONF_OVERRIDES = {
41
+ " allow_downgrade" ,
42
+ " allow_vendor_change" ,
43
+ " best" ,
44
+ " clean_requirements_on_remove" ,
45
+ " disable_excludes" ,
46
+ " exclude_from_weak" ,
47
+ " exclude_from_weak_autodetect" ,
48
+ " excludepkgs" ,
49
+ " ignorearch" ,
50
+ " includepkgs" ,
51
+ " installonly_limit" ,
52
+ " installonlypkgs" ,
53
+ " install_weak_deps" ,
54
+ " keepcache" ,
55
+ " module_obsoletes" ,
56
+ " module_platform_id" ,
57
+ " module_stream_switch" ,
58
+ " multilib_policy" ,
59
+ " obsoletes" ,
60
+ " optional_metadata_types" ,
61
+ " protect_running_kernel" ,
62
+ " reposdir" ,
63
+ " skip_broken" ,
64
+ " skip_if_unavailable" ,
65
+ " skip_unavailable" ,
66
+ " strict" ,
67
+ };
40
68
41
69
Session::Session (
42
70
std::vector<std::unique_ptr<libdnf5::Logger>> && loggers,
@@ -65,7 +93,12 @@ Session::Session(
65
93
auto value = opt.second ;
66
94
auto bind = opt_binds.find (key);
67
95
if (bind != opt_binds.end ()) {
68
- bind->second .new_string (libdnf5::Option::Priority::RUNTIME, value);
96
+ if (ALLOWED_MAIN_CONF_OVERRIDES.find (key) != ALLOWED_MAIN_CONF_OVERRIDES.end ()) {
97
+ bind->second .new_string (libdnf5::Option::Priority::RUNTIME, value);
98
+ } else {
99
+ base->get_logger ()->warning (" Config option {} not allowed." , key);
100
+ continue ;
101
+ }
69
102
} else {
70
103
base->get_logger ()->warning (" Unknown config option: {}" , key);
71
104
}
You can’t perform that action at this time.
0 commit comments