mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-21 11:25:56 +00:00
chore(reborn): MR3.1 semantic audit, i18n localization, and fail-closed cleanup
This commit is contained in:
1 parent
351ace1c56
commit
a48717340b
12 files changed
+140
-64
No files matched your search
@@ -183,13 +183,17 @@ impl<'a> HostService<'a> {
|
||||
});
|
||||
}
|
||||
if let Some((_, rs)) = self.server_id.split_once(':') {
|
||||
if let Ok(host_ruleset) = rs.parse::<crate::portable::Ruleset>() {
|
||||
if offer.ruleset != host_ruleset || model.ruleset != host_ruleset {
|
||||
return Err(PortableError::RulesetMismatch {
|
||||
character: model.ruleset,
|
||||
realm: host_ruleset,
|
||||
});
|
||||
}
|
||||
let host_ruleset = rs.parse::<crate::portable::Ruleset>().map_err(|_| {
|
||||
PortableError::Invalid(format!(
|
||||
"malformed or unknown ruleset suffix in server_id: {:?}",
|
||||
self.server_id
|
||||
))
|
||||
})?;
|
||||
if offer.ruleset != host_ruleset || model.ruleset != host_ruleset {
|
||||
return Err(PortableError::RulesetMismatch {
|
||||
character: model.ruleset,
|
||||
realm: host_ruleset,
|
||||
});
|
||||
}
|
||||
}
|
||||
self.store
|
||||
|
||||
@@ -1561,6 +1561,20 @@ fn reborn_hostile_attacks_are_rejected_with_zero_mutation() {
|
||||
coll_err2.is_err(),
|
||||
"Reborn merging wildcard:vanity must fail"
|
||||
);
|
||||
|
||||
// 9. HostService with malformed server_id ruleset suffixes fails closed
|
||||
for bad_server_id in ["srv-1:unknown", "srv-1:garbage", "srv-1:reborn:extra"] {
|
||||
let mut h_bad = HostService::new(&mut host, bad_server_id, HostConfig::default());
|
||||
let mut offer_bad = OwnerService::new(&mut owner)
|
||||
.offer(id_reb, "srv-1:reborn")
|
||||
.unwrap();
|
||||
offer_bad.server_id = bad_server_id.to_string();
|
||||
let res_bad = h_bad.accept_offer(host_profile, &offer_bad);
|
||||
assert!(
|
||||
res_bad.is_err(),
|
||||
"accept_offer on malformed server id {bad_server_id} must fail closed"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user