This commit is contained in:
Felix Ableitner 2026-01-28 14:39:32 +01:00
parent 5880a52a47
commit f20cf41c39
2 changed files with 2 additions and 2 deletions

View file

@ -188,7 +188,7 @@ impl<T: Clone> FederationConfig<T> {
// TODO: Use is_global() once stabilized // TODO: Use is_global() once stabilized
// https://doc.rust-lang.org/std/net/enum.IpAddr.html#method.is_global // https://doc.rust-lang.org/std/net/enum.IpAddr.html#method.is_global
let mut ips = lookup_host((domain.to_owned(), 80)).await?; let mut ips = lookup_host((domain.to_owned(), 80)).await?;
let allow_local = std::env::var("APUB_DANGER_ALLOW_LOCAL_IP").is_ok(); let allow_local = std::env::var("DANGER_FEDERATION_ALLOW_LOCAL_IP").is_ok();
let invalid_ip = !allow_local let invalid_ip = !allow_local
&& ips.any(|addr| match addr.ip() { && ips.any(|addr| match addr.ip() {
IpAddr::V4(addr) => { IpAddr::V4(addr) => {

View file

@ -29,7 +29,7 @@ pub enum Error {
#[error("URL failed verification: {0}")] #[error("URL failed verification: {0}")]
UrlVerificationError(&'static str), UrlVerificationError(&'static str),
/// Resolving domain points to local IP. /// Resolving domain points to local IP.
#[error("Resolving domain {0} points to local IP {1}. This may indicate an attacker attempting to access internal services. If intentional, you can ignore this error by setting DANGER_APUB_ALLOW_LOCAL_IP=1")] #[error("Resolving domain {0} points to local IP {1}. This may indicate an attacker attempting to access internal services. If intentional, you can ignore this error by setting DANGER_FEDERATION_ALLOW_LOCAL_IP=1")]
DomainResolveError(String, String), DomainResolveError(String, String),
/// Incoming activity has invalid digest for body /// Incoming activity has invalid digest for body
#[error("Incoming activity has invalid digest for body")] #[error("Incoming activity has invalid digest for body")]