orbital-navigation: close residual data leaks

This commit is contained in:
scandalist-trash committed 2026-10-25 05:31:54 -04:00
1 parent 29c864990a
commit 5d2407b076
2 files changed
+29 -5

No files matched your search

+23 -1
View File
@@ -219,6 +219,27 @@ impl Server {
fs::create_dir_all(root.join("work"))?;
let mut state = load_state(&root)?;
let ships = &state.ships;
state.sources.retain(|source, owner| {
ships.get(&canonical(source)) == Some(owner)
});
let profiles = &state.profiles;
for job in state.jobs.values_mut() {
let valid = profiles.get(&job.profile).is_some_and(|profile| {
profile.owner == job.owner && ships.get(&profile.ship) == Some(&job.owner)
});
if !valid {
job.result = None;
}
}
let now = unix_time();
state.grants.retain(|_, grant| {
grant.expires >= now
&& grant
.rights
.iter()
.all(|right| matches!(right.as_str(), "geometry.read" | "delegate"))
});
let old_cache = std::mem::take(&mut state.geometry_cache);
for flight_id in old_cache.values() {
if let Some(flight) = state.flights.get(flight_id) {
@@ -325,6 +346,7 @@ impl Server {
check_owner(s.sources.get(source).ok_or("unknown source")?, &user)?;
let ship = canonical(source);
check_owner(s.ships.get(&ship).ok_or("unknown ship")?, &user)?;
Ok(json!({"messages":s.messages.get(&ship).cloned().unwrap_or_default()}))
}
"create_profile" => {
@@ -819,7 +841,7 @@ impl Server {
.map_err(|e| format!("resolve {host}:{port}: {e}"))?
.next()
.ok_or("no address")?;
if addr.ip().is_loopback() {
if addr.ip().is_loopback() || addr.ip().is_unspecified() {
return Err("internal source forbidden".into());
}