diff options
author | Heiko <heiko@schaefer.name> | 2021-05-21 15:16:21 +0200 |
---|---|---|
committer | Heiko <heiko@schaefer.name> | 2021-05-21 15:16:21 +0200 |
commit | 4d591f1cfd6a952186f57f2ff913e0860a967909 (patch) | |
tree | 55782c61b52d5b4ca139c025dada6b4a2823d8f3 | |
parent | 246e79fe7bf280e957eb0c1cfc50508aacf85ff4 (diff) | |
download | openpgp-ca-4d591f1cfd6a952186f57f2ff913e0860a967909.tar.gz |
Adjust domain name syntax checks following upstream changes (use addr instead of publicsuffix), see https://gitlab.com/openpgp-ca/openpgp-ca/-/issues/55
-rw-r--r-- | Cargo.lock | 28 | ||||
-rw-r--r-- | openpgp-ca-lib/Cargo.toml | 2 | ||||
-rw-r--r-- | openpgp-ca-lib/src/bridge.rs | 4 | ||||
-rw-r--r-- | openpgp-ca-lib/src/ca_secret.rs | 4 |
4 files changed, 28 insertions, 10 deletions
@@ -1,6 +1,16 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. [[package]] +name = "addr" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c54ccac949a2afafdfc889e15c753bbc6ee8783e026bbe3d057b00b13907db70" +dependencies = [ + "psl", + "psl-types", +] + +[[package]] name = "addr2line" version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1756,6 +1766,7 @@ dependencies = [ name = "openpgp-ca-lib" version = "0.10.1" dependencies = [ + "addr", "anyhow", "chbs", "chrono", @@ -1763,7 +1774,6 @@ dependencies = [ "diesel_migrations", "gnupg-test-wrapper", "openpgp-keylist", - "publicsuffix", "sequoia-net", "sequoia-openpgp", "sha2", @@ -2088,17 +2098,21 @@ dependencies = [ ] [[package]] -name = "publicsuffix" -version = "1.5.6" +name = "psl" +version = "2.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b4ce31ff0a27d93c8de1849cf58162283752f065a90d508f1105fa6c9a213f" +checksum = "4cdd5ca7b2a36e9ffa93e63f6b3cdfff3fb2ba68b6b3acb8c91caa34fb080bf3" dependencies = [ - "idna", - "native-tls", - "url", + "psl-types", ] [[package]] +name = "psl-types" +version = "2.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b398073e7cdd6f05934389a8f5961e3aabfa66675b6f440df4e2c793d51a4f" + +[[package]] name = "quick-error" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/openpgp-ca-lib/Cargo.toml b/openpgp-ca-lib/Cargo.toml index 5cab6da..14f046f 100644 --- a/openpgp-ca-lib/Cargo.toml +++ b/openpgp-ca-lib/Cargo.toml @@ -28,7 +28,7 @@ chrono = { version = "0.4", features = ["serde"] } tokio = { version = "0.2.22", features = ["fs", "io-std", "io-util", "rt-threaded", "sync", "signal", "macros"] } chbs = "0.0.8" -publicsuffix = "1.5" +addr = "0.14" sha2 = "0.9" diff --git a/openpgp-ca-lib/src/bridge.rs b/openpgp-ca-lib/src/bridge.rs index ddf014a..c61ff72 100644 --- a/openpgp-ca-lib/src/bridge.rs +++ b/openpgp-ca-lib/src/bridge.rs @@ -147,7 +147,9 @@ pub fn bridge_revoke(oca: &OpenpgpCa, email: &str) -> Result<()> { /// /// ("other.org" => "<[^>]+[@.]other\\.org>$") fn domain_to_regex(domain: &str) -> Result<String> { - if publicsuffix::Domain::has_valid_syntax(domain) { + use addr::parser::DomainName; + use addr::psl::List; + if List.parse_domain_name(domain).is_ok() { // if valid syntax: transform domain to regex let escaped_domain = &domain.split('.').collect::<Vec<_>>().join("\\."); diff --git a/openpgp-ca-lib/src/ca_secret.rs b/openpgp-ca-lib/src/ca_secret.rs index 03180be..47d758e 100644 --- a/openpgp-ca-lib/src/ca_secret.rs +++ b/openpgp-ca-lib/src/ca_secret.rs @@ -102,7 +102,9 @@ impl CaSec for DbCa { } // domainname syntax check - if !publicsuffix::Domain::has_valid_syntax(domainname) { + use addr::parser::DomainName; + use addr::psl::List; + if List.parse_domain_name(domainname).is_err() { return Err(anyhow::anyhow!( "Invalid domainname: '{}'", domainname |