diff --git a/CHANGELOG.md b/CHANGELOG.md index a789cbba5f..b12ec2d2a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ Post 1.0.0 release, the changelog format is based on [Keep a Changelog](https:// - native & socks5 clients: deduplicate big chunks of init logic - validator: fixed local docker-compose setup to work on Apple M1 ([#1329]) - explorer-api: listen out for SIGTERM and SIGQUIT too, making it play nicely as a system service ([#1482]). +- network-requester: fix filter for suffix-only domains ([#1487]) ### Changed @@ -75,6 +76,7 @@ Post 1.0.0 release, the changelog format is based on [Keep a Changelog](https:// [#1463]: https://github.com/nymtech/nym/pull/1463 [#1478]: https://github.com/nymtech/nym/pull/1478 [#1482]: https://github.com/nymtech/nym/pull/1482 +[#1487]: https://github.com/nymtech/nym/pull/1487 ## [nym-connect-v1.0.1](https://github.com/nymtech/nym/tree/nym-connect-v1.0.1) (2022-07-22) diff --git a/contracts/Cargo.lock b/contracts/Cargo.lock index 5438f45804..e0676f0832 100644 --- a/contracts/Cargo.lock +++ b/contracts/Cargo.lock @@ -1392,18 +1392,18 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.4" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "rfc6979" diff --git a/nym-connect/README.md b/nym-connect/README.md index 5433a366d6..5a247235ab 100644 --- a/nym-connect/README.md +++ b/nym-connect/README.md @@ -32,7 +32,7 @@ yarn install ## Development mode -You can compile nym-connectin development mode by running the following command inside the `nym-connect` directory: +You can compile nym-connect in development mode by running the following command inside the `nym-connect` directory: ``` yarn dev diff --git a/nym-wallet/Cargo.lock b/nym-wallet/Cargo.lock index e365222be2..9f57f987f3 100644 --- a/nym-wallet/Cargo.lock +++ b/nym-wallet/Cargo.lock @@ -3996,9 +3996,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.4" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -4016,9 +4016,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "remove_dir_all" diff --git a/service-providers/network-requester/src/allowed_hosts.rs b/service-providers/network-requester/src/allowed_hosts.rs index 294a75edab..3746d9a706 100644 --- a/service-providers/network-requester/src/allowed_hosts.rs +++ b/service-providers/network-requester/src/allowed_hosts.rs @@ -109,9 +109,14 @@ impl OutboundRequestFilter { } /// Attempts to get the root domain, shorn of subdomains, using publicsuffix. + /// If the domain is itself a suffix, then just use the full address as root. fn get_domain_root(&self, host: &str) -> Option { match self.domain_list.parse_domain(host) { - Ok(d) => d.root().map(|root| root.to_string()), + Ok(d) => Some( + d.root() + .map(|root| root.to_string()) + .unwrap_or_else(|| d.full().to_string()), + ), Err(_) => { log::warn!("Error parsing domain: {:?}", host); None // domain couldn't be parsed @@ -348,9 +353,12 @@ mod tests { } #[test] - fn returns_none_on_nonsense_domains() { + fn returns_full_on_suffix_domains() { let filter = setup(); - assert_eq!(None, filter.get_domain_root("flappappa")); + assert_eq!( + Some("s3.amazonaws.com".to_string()), + filter.get_domain_root("s3.amazonaws.com") + ); } }