hst: check for insecure PulseAudio enablement
Some checks failed
Test / Create distribution (push) Successful in 37s
Test / Sandbox (push) Successful in 2m41s
Test / Sandbox (race detector) (push) Successful in 4m44s
Test / Hakurei (push) Successful in 5m5s
Test / Hakurei (race detector) (push) Successful in 6m31s
Test / Flake checks (push) Has been cancelled
Test / Hpkg (push) Has been cancelled

This is currently still a noop, but required for #26.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-12-08 02:53:07 +09:00
parent 104eeecf65
commit 2c0f4e231e
7 changed files with 34 additions and 5 deletions

View File

@@ -60,6 +60,9 @@ var (
// ErrEnviron is returned by [Config.Validate] if an environment variable name contains '=' or NUL.
ErrEnviron = errors.New("invalid environment variable name")
// ErrInsecure is returned by [Config.Validate] if the configuration is considered insecure.
ErrInsecure = errors.New("configuration is insecure")
)
// Validate checks [Config] and returns [AppError] if an invalid value is encountered.
@@ -106,6 +109,13 @@ func (config *Config) Validate() error {
}
}
// EPulse without EPipeWire is insecure
if et := config.Enablements.Unwrap(); !config.DirectPulse &&
et&EPipeWire == 0 && et&EPulse != 0 {
return &AppError{Step: "validate configuration", Err: ErrInsecure,
Msg: "enablement PulseAudio requires PipeWire, which is not set"}
}
return nil
}