use lemmy_utils::{location_info, settings::Settings, LemmyError};
use lemmy_websocket::LemmyContext;
use serde::Serialize;
+use std::net::IpAddr;
use url::{ParseError, Url};
/// Activitystreams type for community
};
}
+ let host = apub_id.host_str().context(location_info!())?;
+ let host_as_ip = host.parse::<IpAddr>();
+ if host == "localhost" || host_as_ip.is_ok() {
+ return Err(anyhow!("invalid hostname: {:?}", host).into());
+ }
+
if apub_id.scheme() != Settings::get().get_protocol_string() {
return Err(anyhow!("invalid apub id scheme: {:?}", apub_id.scheme()).into());
}