mirror of
https://github.com/lxc/incus
synced 2026-08-02 05:26:46 +00:00
internal/instance: Prevent line breaks in environment variables
LXC doesn't currently have a syntax to hold a multi-line environment variable in its configuration. The use of multi-line environment variables leads to a corrupted configuration file and to a security issue where additional lines may be added by an unprivileged user to escalate their privileges. This fixes CVE-2026-23953. Reported-by: Rory McNamara <rory.mcnamara@snyk.io> Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
This commit is contained in:
parent
938fee4d0e
commit
cdf037409f
@ -1485,7 +1485,13 @@ func ConfigKeyChecker(key string, instanceType api.InstanceType) (func(value str
|
||||
// liveupdate: yes
|
||||
// shortdesc: Free-form environment key/value
|
||||
if strings.HasPrefix(key, "environment.") {
|
||||
return validate.IsAny, nil
|
||||
return func(val string) error {
|
||||
if strings.Contains(val, "\n") {
|
||||
return errors.New("Environment variables cannot contain line breaks")
|
||||
}
|
||||
|
||||
return nil
|
||||
}, nil
|
||||
}
|
||||
|
||||
// gendoc:generate(entity=instance, group=miscellaneous, key=user.*)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user