]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings, config: Don't allow named list filters to begin with "__"
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 9 Jan 2024 22:10:39 +0000 (17:10 -0500)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:11 +0000 (12:34 +0200)
These are reserved for filters created in the code.

src/config/config-parser.c
src/lib-settings/settings.c

index 98e9ae15a59e4c62874caea37b060187c1edd80c..e6f41ad48657c3210ce0531c63f26662d5e051a2 100644 (file)
@@ -572,6 +572,13 @@ config_apply_exact_line(struct config_parser_context *ctx,
                                return -1;
                        break;
                case SET_FILTER_ARRAY:
+                       if (str_begins_with(value, "__")) {
+                               /* These are reserved for internal filters */
+                               ctx->error = p_strdup_printf(ctx->pool,
+                                       "Named list filter name must not begin with '__': %s",
+                                       value);
+                               return -1;
+                       }
                        if (config_apply_filter_array(ctx, line, value,
                                        &l->settings[config_key->define_idx].array) < 0)
                                return -1;
index d23eff07c9018ad6f73f5de7ac14ad6217fac422..15dcf185f26db2b1ecf4bb9bdfaf1c08c352290d 100644 (file)
@@ -1484,6 +1484,14 @@ settings_instance_override(struct settings_apply_ctx *ctx,
                        }
                        value = str_c(ctx->str);
                }
+               if (ctx->info->defines[key_idx].type == SET_FILTER_ARRAY &&
+                   set->type <= SETTINGS_OVERRIDE_TYPE_CLI_PARAM &&
+                   str_begins_with(value, "__")) {
+                       *error_r = t_strdup_printf(
+                               "Named list filter name must not begin with '__': %s",
+                               value);
+                       return -1;
+               }
 
                if (value != set->value)
                        value = p_strdup(&ctx->mpool->pool, value);