P3 review follow-ups: bounded shutdown, unit hardening, host guard, more tests
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YShymaPrXmc3KYRUg2HMSs
This commit is contained in:
1 parent
acedb9522e
commit
533659dfc1
8 files changed
+355
-14
No files matched your search
@@ -249,6 +249,11 @@ impl Config {
|
||||
|
||||
/// Cross-field validation.
|
||||
pub fn validate(&self) -> Result<(), ConfigError> {
|
||||
if self.server.port == 0 {
|
||||
return Err(ConfigError::Invalid(
|
||||
"server.port must be greater than zero".into(),
|
||||
));
|
||||
}
|
||||
if !self.auth.enabled && !self.server.bind.is_loopback() {
|
||||
return Err(ConfigError::Invalid(format!(
|
||||
"auth.enabled = false is only allowed on a loopback bind address (server.bind = {})",
|
||||
@@ -291,6 +296,18 @@ mod tests {
|
||||
Config::load(file.map(Path::new), cli)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn port_zero_rejected() {
|
||||
Jail::expect_with(|_| {
|
||||
let cli = CliOverrides {
|
||||
port: Some(0),
|
||||
..Default::default()
|
||||
};
|
||||
assert!(load(None, &cli).is_err());
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn defaults_only() {
|
||||
Jail::expect_with(|_| {
|
||||
|
||||
Reference in new issue
Block a user