mirror of
https://github.com/moby/buildkit.git
synced 2026-08-09 09:11:45 +00:00
Reject unknown SecurityMode values before generating executor specs. Ensure only SecurityMode_INSECURE takes the insecure path, while validated non-insecure modes keep sandbox security options. Add gateway, raw LLB, and LLB marshal regression coverage for invalid enum values. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> (cherry picked from commit 972895718f963c71388aeebb7cff423ef6963a92)
13 lines
248 B
Go
13 lines
248 B
Go
package pb
|
|
|
|
import "github.com/pkg/errors"
|
|
|
|
func ValidateSecurityMode(mode SecurityMode) error {
|
|
switch mode {
|
|
case SecurityMode_SANDBOX, SecurityMode_INSECURE:
|
|
return nil
|
|
default:
|
|
return errors.Errorf("invalid security mode %d", mode)
|
|
}
|
|
}
|