security: reject path traversal in echo-cancel aec_method parameter

The aec_method parameter is interpolated into a SPA library path
as "aec/libspa-aec-%s". A client could use "../" sequences to
load arbitrary SPA plugins. Reject values containing ".." or "/".

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Wim Taymans 2026-04-30 17:44:28 +02:00
parent 5d0e806bdb
commit c551408ec2

View file

@ -275,6 +275,10 @@ static int module_echo_cancel_prepare(struct module * const module)
if ((str = pw_properties_get(props, "aec_method")) == NULL) if ((str = pw_properties_get(props, "aec_method")) == NULL)
str = "webrtc"; str = "webrtc";
if (strstr(str, "..") != NULL || strchr(str, '/') != NULL) {
res = -EINVAL;
goto out;
}
pw_properties_setf(global_props, "library.name", "aec/libspa-aec-%s", str); pw_properties_setf(global_props, "library.name", "aec/libspa-aec-%s", str);
if ((str = pw_properties_get(props, "source_name")) != NULL) { if ((str = pw_properties_get(props, "source_name")) != NULL) {