mirror of
https://github.com/lxc/incus
synced 2026-08-02 05:26:46 +00:00
shared/validate: Reject compression algorithm arguments
This addresses CVE-2026-48755 Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
This commit is contained in:
parent
cbefa31ae0
commit
873a032a46
@ -640,6 +640,14 @@ func IsCompressionAlgorithm(value string) error {
|
||||
return errors.New("Invalid compressor provided")
|
||||
}
|
||||
|
||||
// Only allow known-safe arguments (compression levels) to avoid argument injection.
|
||||
allowedArgs := []string{"-1", "-2", "-3", "-4", "-5", "-6", "-7", "-8", "-9", "--rsyncable"}
|
||||
for _, arg := range fields[1:] {
|
||||
if !slices.Contains(allowedArgs, arg) {
|
||||
return fmt.Errorf("Compression algorithm argument %q isn't allowed", arg)
|
||||
}
|
||||
}
|
||||
|
||||
// Check that we're dealing with a supported option.
|
||||
if !slices.Contains([]string{
|
||||
"bzip2",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user