hst: check for insecure PulseAudio enablement
All checks were successful
Test / Create distribution (push) Successful in 37s
Test / Sandbox (push) Successful in 43s
Test / Sandbox (race detector) (push) Successful in 42s
Test / Hakurei (push) Successful in 47s
Test / Hakurei (race detector) (push) Successful in 46s
Test / Hpkg (push) Successful in 5m39s
Test / Flake checks (push) Successful in 1m32s

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 422efcf258
8 changed files with 37 additions and 7 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
}