From d5ddaa221ce9cfbbf0d926ed445729cd92f7f111 Mon Sep 17 00:00:00 2001 From: Martin Hoffmann Date: Tue, 17 Feb 2026 15:13:54 +0100 Subject: [PATCH] Upgrade MSRV to 1.88 and upgrade dependencies. (#1358) --- .github/workflows/ci.yml | 6 +- Cargo.lock | 473 ++++++++++++++---- Cargo.toml | 9 +- Dockerfile | 2 +- src/api/ca.rs | 9 +- src/api/history.rs | 30 +- src/cli/client.rs | 9 +- .../crypto/signing/signers/kmip/signer.rs | 9 +- .../crypto/signing/signers/pkcs11/signer.rs | 9 +- src/commons/file.rs | 24 +- src/commons/queue.rs | 6 +- src/commons/storage/backends/disk.rs | 22 +- src/commons/storage/backends/memory.rs | 6 +- src/commons/storage/ident.rs | 6 +- src/config.rs | 31 +- .../auth/providers/openid_connect/provider.rs | 45 +- src/daemon/http/dispatch/cas.rs | 19 +- src/daemon/start.rs | 8 +- src/server/bgp/analyser.rs | 11 +- src/server/ca/certauth.rs | 49 +- src/server/ca/child.rs | 9 +- src/server/ca/manager.rs | 99 ++-- .../ca/upgrades/pre_0_10_0/migration.rs | 9 +- .../ca/upgrades/pre_0_14_0/migration.rs | 9 +- src/server/pubd/access.rs | 40 +- src/server/pubd/rrdp.rs | 84 ++-- src/server/taproxy.rs | 18 +- src/upgrades/mod.rs | 15 +- tests/functional_old_data.rs | 2 +- 29 files changed, 677 insertions(+), 391 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d43eaf6..4eedd998 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: # Test against the oldest supported version. # Test against beta Rust to get early warning of any problems that might occur with the upcoming Rust release. # Order: oldest Rust to newest Rust. - rust: [1.85.0, stable, beta] + rust: [1.88.0, stable, beta] # Test with no features and all features. args: ["--no-default-features", "--all-features"] @@ -67,7 +67,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - rust: [1.85.0, stable, beta] + rust: [1.88.0, stable, beta] features: ["hsm", "hsm,hsm-tests-kmip"] steps: - name: Checkout repository @@ -113,7 +113,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - rust: [1.85.0, stable, beta] + rust: [1.88.0, stable, beta] features: ["hsm,hsm-tests-pkcs11"] steps: - name: Checkout repository diff --git a/Cargo.lock b/Cargo.lock index 356ef5fd..f6e516b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -118,6 +118,28 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "aws-lc-rs" +version = "1.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b7b6141e96a8c160799cc2d5adecd5cbbe5054cb8c7c4af53da0f83bb7ad256" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.37.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b092fe214090261288111db7a2b2c2118e5a7f30dc2569f1732c4069a6840549" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", +] + [[package]] name = "backoff" version = "0.4.0" @@ -223,9 +245,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" dependencies = [ "find-msvc-tools", + "jobserver", + "libc", "shlex", ] +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cfg-if" version = "1.0.4" @@ -314,12 +344,31 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" +[[package]] +name = "cmake" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75443c44cd6b379beb8c5b45d85d0773baf31cce901fe7bb252f4eff3008ef7d" +dependencies = [ + "cc", +] + [[package]] name = "colorchoice" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -571,6 +620,12 @@ dependencies = [ "syn 2.0.116", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "dyn-clone" version = "1.0.20" @@ -806,6 +861,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures-channel" version = "0.3.32" @@ -881,6 +942,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", +] + [[package]] name = "getrandom" version = "0.4.1" @@ -1082,22 +1157,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", -] - [[package]] name = "hyper-util" version = "0.1.20" @@ -1368,6 +1427,38 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + [[package]] name = "js-sys" version = "0.3.85" @@ -1513,9 +1604,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "libc" -version = "0.2.182" +version = "0.2.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" [[package]] name = "libflate" @@ -1595,6 +1686,12 @@ version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + [[package]] name = "maybe-async" version = "0.2.10" @@ -1629,23 +1726,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "native-tls" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5d26952a508f321b4d3d2e80e78fc2603eaefcdf0c30783867f19586518bdc" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -1654,9 +1734,9 @@ checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "nix" -version = "0.30.1" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" +checksum = "225e7cfe711e0ba79a68baeddb2982723e4235247aefce1482f2f16c27865b66" dependencies = [ "bitflags", "cfg-if", @@ -1682,9 +1762,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" [[package]] name = "num-integer" @@ -1740,7 +1820,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "sha2", - "thiserror", + "thiserror 1.0.69", "url", ] @@ -1783,7 +1863,7 @@ dependencies = [ "serde_with", "sha2", "subtle", - "thiserror", + "thiserror 1.0.69", "url", ] @@ -2043,6 +2123,62 @@ dependencies = [ "memchr", ] +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.18", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +dependencies = [ + "aws-lc-rs", + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand 0.9.2", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.18", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.60.2", +] + [[package]] name = "quote" version = "1.0.44" @@ -2076,10 +2212,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", + "rand_chacha 0.3.1", "rand_core 0.6.4", ] +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + [[package]] name = "rand" version = "0.10.0" @@ -2101,6 +2247,16 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -2110,6 +2266,15 @@ dependencies = [ "getrandom 0.2.17", ] +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + [[package]] name = "rand_core" version = "0.10.0" @@ -2142,7 +2307,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom 0.2.17", "libredox", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2196,9 +2361,9 @@ checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c" [[package]] name = "reqwest" -version = "0.12.28" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +checksum = "ab3f43e3283ab1488b624b44b0e988d0acea0b3214e694730a055cb6b2efa801" dependencies = [ "base64 0.22.1", "bytes", @@ -2210,21 +2375,21 @@ dependencies = [ "http-body-util", "hyper", "hyper-rustls", - "hyper-tls", "hyper-util", "js-sys", "log", "mime", - "native-tls", "percent-encoding", "pin-project-lite", + "quinn", + "rustls", "rustls-pki-types", + "rustls-platform-verifier", "serde", "serde_json", - "serde_urlencoded", "sync_wrapper", "tokio", - "tokio-native-tls", + "tokio-rustls", "tower", "tower-http", "tower-service", @@ -2323,6 +2488,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + [[package]] name = "rustc_version" version = "0.4.1" @@ -2351,15 +2522,27 @@ version = "0.23.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" dependencies = [ + "aws-lc-rs", "log", "once_cell", - "ring", "rustls-pki-types", "rustls-webpki", "subtle", "zeroize", ] +[[package]] +name = "rustls-native-certs" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pemfile" version = "2.2.0" @@ -2375,15 +2558,44 @@ version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" dependencies = [ + "web-time", "zeroize", ] +[[package]] +name = "rustls-platform-verifier" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d99feebc72bae7ab76ba994bb5e121b8d83d910ca40b36e0921f53becc41784" +dependencies = [ + "core-foundation 0.10.1", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + [[package]] name = "rustls-webpki" version = "0.103.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" dependencies = [ + "aws-lc-rs", "ring", "rustls-pki-types", "untrusted", @@ -2395,12 +2607,6 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" -[[package]] -name = "ryu" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" - [[package]] name = "salsa20" version = "0.10.2" @@ -2623,18 +2829,6 @@ dependencies = [ "serde_core", ] -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - [[package]] name = "serde_with" version = "3.16.1" @@ -2925,7 +3119,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", ] [[package]] @@ -2939,6 +3142,17 @@ dependencies = [ "syn 2.0.116", ] +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.116", +] + [[package]] name = "thread_local" version = "1.1.9" @@ -2950,9 +3164,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.45" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9e442fc33d7fdb45aa9bfeb312c095964abdf596f7567261062b2a7107aaabd" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" dependencies = [ "deranged", "itoa", @@ -2967,15 +3181,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "time-macros" -version = "0.2.25" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e552d1249bf61ac2a52db88179fd0673def1e1ad8243a00d9ec9ed71fee3dd" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" dependencies = [ "num-conv", "time-core", @@ -3042,16 +3256,6 @@ dependencies = [ "syn 2.0.116", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.26.4" @@ -3310,11 +3514,11 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasip2" -version = "1.0.1+wasi-0.2.4" +version = "1.0.2+wasi-0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" dependencies = [ - "wit-bindgen 0.46.0", + "wit-bindgen", ] [[package]] @@ -3323,7 +3527,7 @@ version = "0.4.0+wasi-0.3.0-rc-2026-01-06" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" dependencies = [ - "wit-bindgen 0.51.0", + "wit-bindgen", ] [[package]] @@ -3429,6 +3633,25 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "804f18a4ac2676ffb4e8b5b5fa9ae38af06df08162314f96a68d2a363e21a8ca" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "winapi" version = "0.3.9" @@ -3530,6 +3753,15 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.52.0" @@ -3566,6 +3798,21 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-targets" version = "0.52.6" @@ -3599,6 +3846,12 @@ dependencies = [ "windows_x86_64_msvc 0.53.1", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -3611,6 +3864,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" @@ -3623,6 +3882,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -3647,6 +3912,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.52.6" @@ -3659,6 +3930,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" @@ -3671,6 +3948,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" @@ -3683,6 +3966,12 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -3701,12 +3990,6 @@ version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" -[[package]] -name = "wit-bindgen" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" - [[package]] name = "wit-bindgen" version = "0.51.0" diff --git a/Cargo.toml b/Cargo.toml index 1b1362cf..3e38a7ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "krill" version = "0.15.1-dev" edition = "2024" -rust-version = "1.85" +rust-version = "1.88" authors = ["NLnet Labs "] description = "Resource Public Key Infrastructure (RPKI) daemon" homepage = "https://www.nlnetlabs.nl/projects/routing/krill/" @@ -42,14 +42,14 @@ percent-encoding = "2.3.1" pin-project-lite = "0.2.16" rand = "0.10" regex = { version = "1.11.1", default-features = false, features = [ "std" ] } -reqwest = { version = "0.12.23", features = ["json"] } +reqwest = { version = "0.13.2", features = ["json"] } rpki = { version = "0.19.2", features = ["ca", "compat", "rrdp"] } rustls-pemfile = "2.2.0" serde = { version = "1.0", features = ["derive", "rc"] } serde_json = "1.0" tempfile = "3.19.1" tokio = { version = "1", features = [ "macros", "rt", "rt-multi-thread", "signal", "time" ] } -tokio-rustls = { version = "0.26", default-features = false, features = [ "ring", "logging", "tls12" ] } +tokio-rustls = { version = "0.26" } toml = "0.9.5" url = { version = "2.5.4", features = ["serde"] } uuid = { version = "1.16", features = ["serde", "v4"] } @@ -78,7 +78,7 @@ urlparse = { version = "0.7", optional = true } [target.'cfg(unix)'.dependencies] syslog = "7.0.0" -nix = { version = "0.30.1", features = ["user"] } +nix = { version = "0.31.1", features = ["user"] } [features] default = ["multi-user", "hsm"] @@ -102,7 +102,6 @@ hsm-tests-pkcs11 = ["hsm"] [dev-dependencies] tar = "0.4" stderrlog = "0.6" -tempfile = "3.19.1" urlparse = "0.7" # Make sure that Krill crashes on panics, rather than losing threads and diff --git a/Dockerfile b/Dockerfile index 2729fc68..f53f9170 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,7 @@ ARG MODE=build # ======== # # Only used when MODE=build. -ARG BASE_IMG=alpine:3.22 +ARG BASE_IMG=alpine:3.23 # CARGO_ARGS diff --git a/src/api/ca.rs b/src/api/ca.rs index 15266ff4..33ac0682 100644 --- a/src/api/ca.rs +++ b/src/api/ca.rs @@ -1532,10 +1532,11 @@ impl ChildExchange { if agent == "local-child" { return true; } - else if let Some(version) = agent.strip_prefix("krill/") { - if let Ok(krill_version) = KrillVersion::from_str(version) { - return krill_version > KrillVersion::release(0, 9, 1); - } + else if + let Some(version) = agent.strip_prefix("krill/") + && let Ok(krill_version) = KrillVersion::from_str(version) + { + return krill_version > KrillVersion::release(0, 9, 1); } } false diff --git a/src/api/history.rs b/src/api/history.rs index 16f92146..bc89336f 100644 --- a/src/api/history.rs +++ b/src/api/history.rs @@ -274,15 +274,11 @@ pub struct CommandHistoryCriteria { impl CommandHistoryCriteria { /// Returns whether the given timestamp is included in the criteria. fn matches_timestamp(&self, stamp: i64) -> bool { - if let Some(before) = self.before { - if stamp > before { - return false; - } + if let Some(before) = self.before && stamp > before { + return false; } - if let Some(after) = self.after { - if stamp < after { - return false; - } + if let Some(after) = self.after && stamp < after { + return false; } true } @@ -297,15 +293,17 @@ impl CommandHistoryCriteria { /// Returns whether the given label is included in the criteria. fn matches_label(&self, label: &String) -> bool { - if let Some(includes) = &self.label_includes { - if !includes.contains(label) { - return false; - } + if + let Some(includes) = &self.label_includes + && !includes.contains(label) + { + return false; } - if let Some(excludes) = &self.label_excludes { - if excludes.contains(label) { - return false; - } + if + let Some(excludes) = &self.label_excludes + && excludes.contains(label) + { + return false; } true diff --git a/src/cli/client.rs b/src/cli/client.rs index 4547ea24..7fbd6e0e 100644 --- a/src/cli/client.rs +++ b/src/cli/client.rs @@ -1128,10 +1128,11 @@ impl TryFrom for ServerUri { } // Check for a five-character scheme. - if let Some(scheme) = value.as_bytes().get(0..8) { - if scheme.eq_ignore_ascii_case(b"https://") { - return Ok(Self::Http(value)) - } + if + let Some(scheme) = value.as_bytes().get(0..8) + && scheme.eq_ignore_ascii_case(b"https://") + { + return Ok(Self::Http(value)) } Err("unsupported URI scheme") diff --git a/src/commons/crypto/signing/signers/kmip/signer.rs b/src/commons/crypto/signing/signers/kmip/signer.rs index 6f9469dc..71146edd 100644 --- a/src/commons/crypto/signing/signers/kmip/signer.rs +++ b/src/commons/crypto/signing/signers/kmip/signer.rs @@ -324,10 +324,11 @@ impl KmipSigner { } pub fn get_info(&self) -> Option { - if let Ok(status) = self.server.status(Self::probe_server) { - if let Ok(state) = status.state() { - return Some(state.conn_info.clone()); - } + if + let Ok(status) = self.server.status(Self::probe_server) + && let Ok(state) = status.state() + { + return Some(state.conn_info.clone()); } None } diff --git a/src/commons/crypto/signing/signers/pkcs11/signer.rs b/src/commons/crypto/signing/signers/pkcs11/signer.rs index 6486838e..6a0fe3d8 100644 --- a/src/commons/crypto/signing/signers/pkcs11/signer.rs +++ b/src/commons/crypto/signing/signers/pkcs11/signer.rs @@ -396,10 +396,11 @@ impl Pkcs11Signer { } pub fn get_info(&self) -> Option { - if let Ok(status) = self.server.status(Self::probe_server) { - if let Ok(state) = status.state() { - return Some(state.conn_info.clone()); - } + if + let Ok(status) = self.server.status(Self::probe_server) + && let Ok(state) = status.state() + { + return Some(state.conn_info.clone()); } None } diff --git a/src/commons/file.rs b/src/commons/file.rs index 3181257c..706f871e 100644 --- a/src/commons/file.rs +++ b/src/commons/file.rs @@ -55,19 +55,17 @@ pub fn remove_dir_all(dir: &Path) -> Result<(), KrillIoError> { /// Creates a new File or opens an exiting one. If the file did not exist, the /// path will be created if it did not exist yet. pub fn create_file_with_path(path: &Path) -> Result { - if !path.exists() { - if let Some(parent) = path.parent() { - trace!("Creating path: {}", parent.to_string_lossy()); - fs::create_dir_all(parent).map_err(|e| { - KrillIoError::new( - format!( - "Could not create dir path for: {}", - parent.to_string_lossy() - ), - e, - ) - })?; - } + if !path.exists() && let Some(parent) = path.parent() { + trace!("Creating path: {}", parent.to_string_lossy()); + fs::create_dir_all(parent).map_err(|e| { + KrillIoError::new( + format!( + "Could not create dir path for: {}", + parent.to_string_lossy() + ), + e, + ) + })?; } File::create(path).map_err(|e| { KrillIoError::new( diff --git a/src/commons/queue.rs b/src/commons/queue.rs index 3a552f54..d646415d 100644 --- a/src/commons/queue.rs +++ b/src/commons/queue.rs @@ -230,10 +230,8 @@ impl Queue { if ts > now { return acc } - if let Some((acc_ts, _)) = acc { - if acc_ts < ts { - return acc - } + if let Some((acc_ts, _)) = acc && acc_ts < ts { + return acc } Some((ts, key)) diff --git a/src/commons/storage/backends/disk.rs b/src/commons/storage/backends/disk.rs index 0aef1178..624d11c6 100644 --- a/src/commons/storage/backends/disk.rs +++ b/src/commons/storage/backends/disk.rs @@ -263,14 +263,14 @@ impl Store { )); } }; - if file_type.is_file() { - if let Some(name) = - item.file_name().into_string().ok().and_then(|name| { + if + file_type.is_file() + && let Some(name) + = item.file_name().into_string().ok().and_then(|name| { Ident::boxed_from_string(name).ok() }) - { - res.push(name) - } + { + res.push(name) } } @@ -320,14 +320,14 @@ impl Store { )); } }; - if file_type.is_dir() { - if let Some(name) = + if + file_type.is_dir() + && let Some(name) = item.file_name().into_string().ok().and_then(|name| { Ident::boxed_from_string(name).ok() }) - { - res.push(name) - } + { + res.push(name) } } diff --git a/src/commons/storage/backends/memory.rs b/src/commons/storage/backends/memory.rs index a18db641..29706234 100644 --- a/src/commons/storage/backends/memory.rs +++ b/src/commons/storage/backends/memory.rs @@ -331,10 +331,8 @@ impl MemoryScopes { key: key.into() }) }; - if let Some(scope) = scope { - if values.is_empty() { - self.remove(scope); - } + if let Some(scope) = scope && values.is_empty() { + self.remove(scope); } Ok(value) } diff --git a/src/commons/storage/ident.rs b/src/commons/storage/ident.rs index 9927f7fc..019dba73 100644 --- a/src/commons/storage/ident.rs +++ b/src/commons/storage/ident.rs @@ -243,10 +243,8 @@ impl Ident { if src.is_empty() { return Cow::Borrowed(const { Ident::make("_") }) } - if !src.starts_with('_') { - if let Ok(ident) = Self::from_str(src) { - return Cow::Borrowed(ident) - } + if !src.starts_with('_') && let Ok(ident) = Self::from_str(src) { + return Cow::Borrowed(ident) } let mut res = Vec::with_capacity(src.len() + 1); res.push(b'_'); diff --git a/src/config.rs b/src/config.rs index 7afa95d9..d2e10d3a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -215,19 +215,21 @@ impl ConfigDefaults { } pub fn roa_aggregate_threshold() -> usize { - if let Ok(from_env) = env::var("KRILL_ROA_AGGREGATE_THRESHOLD") { - if let Ok(nr) = usize::from_str(&from_env) { - return nr; - } + if + let Ok(from_env) = env::var("KRILL_ROA_AGGREGATE_THRESHOLD") + && let Ok(nr) = usize::from_str(&from_env) + { + return nr; } 100 } pub fn roa_deaggregate_threshold() -> usize { - if let Ok(from_env) = env::var("KRILL_ROA_DEAGGREGATE_THRESHOLD") { - if let Ok(nr) = usize::from_str(&from_env) { - return nr; - } + if + let Ok(from_env) = env::var("KRILL_ROA_DEAGGREGATE_THRESHOLD") + && let Ok(nr) = usize::from_str(&from_env) + { + return nr; } 90 } @@ -1615,12 +1617,13 @@ impl Config { )); } - if let Some(threshold) = self.suspend_child_after_inactive_hours { - if threshold < CA_SUSPEND_MIN_HOURS { - return Err(ConfigError::Other(format!( - "suspend_child_after_inactive_hours must be {CA_SUSPEND_MIN_HOURS} or higher (or not set at all)" - ))); - } + if + let Some(threshold) = self.suspend_child_after_inactive_hours + && threshold < CA_SUSPEND_MIN_HOURS + { + return Err(ConfigError::Other(format!( + "suspend_child_after_inactive_hours must be {CA_SUSPEND_MIN_HOURS} or higher (or not set at all)" + ))); } if let Some(benchmark) = &self.benchmark { diff --git a/src/daemon/http/auth/providers/openid_connect/provider.rs b/src/daemon/http/auth/providers/openid_connect/provider.rs index e4d84df9..e0383049 100644 --- a/src/daemon/http/auth/providers/openid_connect/provider.rs +++ b/src/daemon/http/auth/providers/openid_connect/provider.rs @@ -825,34 +825,35 @@ impl AuthProvider { } fn get_auth(&self, request: &HyperRequest) -> Option { - if let Some(query) = - urlparse(request.uri().to_string()).get_parsed_query() + if + let Some(query) = urlparse( + request.uri().to_string() + ).get_parsed_query() + && let Some(code) = query.get_first_from_str("code") { - if let Some(code) = query.get_first_from_str("code") { - trace!("OpenID Connect: Processing potential RFC-6749 section 4.1.2 redirected Authorization Response"); - if let Some(state) = query.get_first_from_str("state") { - if let Some(nonce) = - self.extract_cookie(request, NONCE_COOKIE_NAME) + trace!("OpenID Connect: Processing potential RFC-6749 section 4.1.2 redirected Authorization Response"); + if let Some(state) = query.get_first_from_str("state") { + if let Some(nonce) = + self.extract_cookie(request, NONCE_COOKIE_NAME) + { + if let Some(csrf_token_hash) = + self.extract_cookie(request, CSRF_COOKIE_NAME) { - if let Some(csrf_token_hash) = - self.extract_cookie(request, CSRF_COOKIE_NAME) - { - trace!("OpenID Connect: Detected RFC-6749 section 4.1.2 redirected Authorization Response"); - return Some(Auth { - code: Token::from(code), - state, - nonce, - csrf_token_hash, - }); - } else { - debug!("OpenID Connect: Ignoring potential RFC-6749 section 4.1.2 redirected Authorization Response due to missing CSRF token hash cookie."); - } + trace!("OpenID Connect: Detected RFC-6749 section 4.1.2 redirected Authorization Response"); + return Some(Auth { + code: Token::from(code), + state, + nonce, + csrf_token_hash, + }); } else { - debug!("OpenID Connect: Ignoring potential RFC-6749 section 4.1.2 redirected Authorization Response due to missing nonce cookie."); + debug!("OpenID Connect: Ignoring potential RFC-6749 section 4.1.2 redirected Authorization Response due to missing CSRF token hash cookie."); } } else { - debug!("OpenID Connect: Ignoring potential RFC-6749 section 4.1.2 redirected Authorization Response due to missing 'state' query parameter."); + debug!("OpenID Connect: Ignoring potential RFC-6749 section 4.1.2 redirected Authorization Response due to missing nonce cookie."); } + } else { + debug!("OpenID Connect: Ignoring potential RFC-6749 section 4.1.2 redirected Authorization Response due to missing 'state' query parameter."); } } diff --git a/src/daemon/http/dispatch/cas.rs b/src/daemon/http/dispatch/cas.rs index 6ae701e2..adf792b4 100644 --- a/src/daemon/http/dispatch/cas.rs +++ b/src/daemon/http/dispatch/cas.rs @@ -748,15 +748,16 @@ fn extract_parent_ca_req( let req: ParentCaReq = serde_json::from_slice(bytes).map_err( Error::JsonError )?; - if let Some(parent_override) = parent_override { - if req.handle != parent_override { - return Err(Error::Custom(format!( - "Used different parent names on path ({}) and \ - submitted JSON ({}) for adding/updating a parent", - parent_override, - req.handle - ))); - } + if + let Some(parent_override) = parent_override + && req.handle != parent_override + { + return Err(Error::Custom(format!( + "Used different parent names on path ({}) and \ + submitted JSON ({}) for adding/updating a parent", + parent_override, + req.handle + ))); } Ok(req) } diff --git a/src/daemon/start.rs b/src/daemon/start.rs index eabd98cf..822da468 100644 --- a/src/daemon/start.rs +++ b/src/daemon/start.rs @@ -219,11 +219,9 @@ async fn single_unix_listener( ) { use tokio::net::UnixListener; - if path.exists() { - if let Err(err) = std::fs::remove_file(&path) { - error!("Fatal error in UNIX socket: {err}"); - return; - }; + if path.exists() && let Err(err) = std::fs::remove_file(&path) { + error!("Fatal error in UNIX socket: {err}"); + return; } let listener = match UnixListener::bind(&path) { diff --git a/src/server/bgp/analyser.rs b/src/server/bgp/analyser.rs index ac753333..8bf586c8 100644 --- a/src/server/bgp/analyser.rs +++ b/src/server/bgp/analyser.rs @@ -125,12 +125,13 @@ impl BgpAnalyser { // neither goes directly into the `entries` as ‘not held.’ let mut roas_held = Vec::new(); for roa in roas { - if let Some(limit) = limited_scope.as_ref() { - if !limit.contains_roa_address( + if + let Some(limit) = limited_scope.as_ref() + && !limit.contains_roa_address( &roa.roa_configuration.payload.as_roa_ip_address() - ) { - continue - } + ) + { + continue } if resources_held.contains_roa_address( diff --git a/src/server/ca/certauth.rs b/src/server/ca/certauth.rs index cbb39b4e..56c2208b 100644 --- a/src/server/ca/certauth.rs +++ b/src/server/ca/certauth.rs @@ -1142,21 +1142,22 @@ impl CertAuth { )?; // Add a resource class name mapping if applicable - if let Some(name_for_child) = class_name_override { - if name_for_child != my_rcn { - let mapping = ResourceClassNameMapping { - name_in_parent: my_rcn.clone(), - name_for_child, - }; + if + let Some(name_for_child) = class_name_override + && name_for_child != my_rcn + { + let mapping = ResourceClassNameMapping { + name_in_parent: my_rcn.clone(), + name_for_child, + }; - events.push( - CertAuthEvent::ChildUpdatedResourceClassNameMapping { - child: child_handle.clone(), - name_in_parent: mapping.name_in_parent, - name_for_child: mapping.name_for_child, - }, - ); - } + events.push( + CertAuthEvent::ChildUpdatedResourceClassNameMapping { + child: child_handle.clone(), + name_in_parent: mapping.name_in_parent, + name_for_child: mapping.name_for_child, + }, + ); } // Issue a certificate for the imported child @@ -1697,10 +1698,11 @@ impl CertAuth { let mut res = HashMap::new(); for (name, rc) in self.resources.iter() { let mut revokes = vec![]; - if let Some(req) = rc.revoke_request() { - if rc.parent_handle() == parent { - revokes.push(req.clone()) - } + if + let Some(req) = rc.revoke_request() + && rc.parent_handle() == parent + { + revokes.push(req.clone()) } res.insert(name.clone(), revokes); } @@ -2513,11 +2515,12 @@ impl CertAuth { let mut keys = HashMap::new(); for (rcn, rc) in self.resources.iter() { - if let Some(rc_resources) = rc.current_resources() { - if !rc_resources.intersection(&request.resources).is_empty() { - let key = signer.create_key()?; - keys.insert(rcn.clone(), key); - } + if + let Some(rc_resources) = rc.current_resources() + && !rc_resources.intersection(&request.resources).is_empty() + { + let key = signer.create_key()?; + keys.insert(rcn.clone(), key); } } diff --git a/src/server/ca/child.rs b/src/server/ca/child.rs index 89dc7f9e..8d644d71 100644 --- a/src/server/ca/child.rs +++ b/src/server/ca/child.rs @@ -132,10 +132,11 @@ impl ChildDetails { let mut res = vec![]; for (ki, used_key_state) in self.used_keys.iter() { - if let UsedKeyState::InUse(found_rcn) = used_key_state { - if found_rcn == parent_rcn { - res.push(*ki) - } + if + let UsedKeyState::InUse(found_rcn) = used_key_state + && found_rcn == parent_rcn + { + res.push(*ki) } } diff --git a/src/server/ca/manager.rs b/src/server/ca/manager.rs index 4081871c..a3bfea93 100644 --- a/src/server/ca/manager.rs +++ b/src/server/ca/manager.rs @@ -1483,14 +1483,15 @@ impl CaManager { /// normally replanned on the task queue automatically if suspension is /// enabled. pub fn cas_schedule_suspend_all(&self) -> KrillResult<()> { - if self.config.suspend_child_after_inactive_seconds().is_some() { - if let Ok(cas) = self.ca_store.list() { - for ca in cas { - self.tasks.schedule( - Task::SuspendChildrenIfNeeded { ca_handle: ca }, - now(), - )?; - } + if + self.config.suspend_child_after_inactive_seconds().is_some() + && let Ok(cas) = self.ca_store.list() + { + for ca in cas { + self.tasks.schedule( + Task::SuspendChildrenIfNeeded { ca_handle: ca }, + now(), + )?; } } Ok(()) @@ -1515,44 +1516,45 @@ impl CaManager { .filter(|secs| started < Timestamp::now_minus_seconds(*secs)); // suspend inactive children, if so configured - if let Some(threshold_seconds) = threshold_seconds { - if let Ok(ca_status) = self.get_ca_status(ca_handle) { - let connections = ca_status.get_children_connection_stats(); + if + let Some(threshold_seconds) = threshold_seconds + && let Ok(ca_status) = self.get_ca_status(ca_handle) + { + let connections = ca_status.get_children_connection_stats(); - for child in connections.suspension_candidates( - threshold_seconds + for child in connections.suspension_candidates( + threshold_seconds + ) { + if log::log_enabled!(log::Level::Info) { + let threshold_string = if threshold_seconds >= 3600 { + format!("{} hours", threshold_seconds / 3600) + } else { + format!("{threshold_seconds} seconds") + }; + + info!( + "Child '{child}' under CA '{ca_handle}' was inactive for more \ + than {threshold_string}. Will suspend it." + ); + } + if let Err(e) = + self.status_store.set_child_suspended( + ca_handle, &child + ) + { + panic!( + "System level error encountered while updating \ + ca status: {e}" + ); + } + + let req = UpdateChildRequest::suspend(); + if let Err(e) = self.ca_child_update( + ca_handle, child, req, actor ) { - if log::log_enabled!(log::Level::Info) { - let threshold_string = if threshold_seconds >= 3600 { - format!("{} hours", threshold_seconds / 3600) - } else { - format!("{threshold_seconds} seconds") - }; - - info!( - "Child '{child}' under CA '{ca_handle}' was inactive for more \ - than {threshold_string}. Will suspend it." - ); - } - if let Err(e) = - self.status_store.set_child_suspended( - ca_handle, &child - ) - { - panic!( - "System level error encountered while updating \ - ca status: {e}" - ); - } - - let req = UpdateChildRequest::suspend(); - if let Err(e) = self.ca_child_update( - ca_handle, child, req, actor - ) { - error!( - "Could not suspend inactive child, error: {e}" - ); - } + error!( + "Could not suspend inactive child, error: {e}" + ); } } } @@ -2492,10 +2494,11 @@ impl CaManager { let service_uri = service_uri.as_str(); let base_uri = base_uri.as_str(); - if let Some(path) = service_uri.strip_prefix(base_uri) { - if let Some(ca_name) = path.strip_prefix("rfc6492/") { - return ParentHandle::from_str(ca_name).ok(); - } + if + let Some(path) = service_uri.strip_prefix(base_uri) + && let Some(ca_name) = path.strip_prefix("rfc6492/") + { + return ParentHandle::from_str(ca_name).ok(); } None diff --git a/src/server/ca/upgrades/pre_0_10_0/migration.rs b/src/server/ca/upgrades/pre_0_10_0/migration.rs index 59da0a48..ee520a33 100644 --- a/src/server/ca/upgrades/pre_0_10_0/migration.rs +++ b/src/server/ca/upgrades/pre_0_10_0/migration.rs @@ -218,10 +218,11 @@ impl UpgradeAggregateStorePre0_14 for CasMigration { // if the new command would be a no-op because no events are // actually migrated, then return // CommandMigrationEffect::Nothing - if let Some(events) = new_command.events() { - if events.is_empty() { - return Ok(CommandMigrationEffect::Nothing); - } + if + let Some(events) = new_command.events() + && events.is_empty() + { + return Ok(CommandMigrationEffect::Nothing); } Ok(CommandMigrationEffect::StoredCommand(new_command)) diff --git a/src/server/ca/upgrades/pre_0_14_0/migration.rs b/src/server/ca/upgrades/pre_0_14_0/migration.rs index 3a6a4967..6edc4a24 100644 --- a/src/server/ca/upgrades/pre_0_14_0/migration.rs +++ b/src/server/ca/upgrades/pre_0_14_0/migration.rs @@ -199,10 +199,11 @@ impl UpgradeAggregateStorePre0_14 for CasMigration { // if the new command would be a no-op because no events are // actually migrated, then return // CommandMigrationEffect::Nothing - if let Some(events) = new_command.events() { - if events.is_empty() { - return Ok(CommandMigrationEffect::Nothing); - } + if + let Some(events) = new_command.events() + && events.is_empty() + { + return Ok(CommandMigrationEffect::Nothing); } Ok(CommandMigrationEffect::StoredCommand(new_command)) diff --git a/src/server/pubd/access.rs b/src/server/pubd/access.rs index 7921801e..caa632ac 100644 --- a/src/server/pubd/access.rs +++ b/src/server/pubd/access.rs @@ -59,27 +59,25 @@ impl RepositoryAccessProxy { )?; let key = MyHandle::from_str(PUBSERVER_DFLT).unwrap(); - if store.has(&key)? { - if let Err(e) = store.warm() { - // Start to 'warm' the cache. This serves two purposes: - // 1. this ensures that the `RepositoryAccess` struct is - // available in memory - // 2. this ensures that there are no apparent data issues - // - // If there are issues, then we need to bail out. Krill - // 0.14.0+ uses single files for all change - // sets, and files are first completely written to disk, - // and only then renamed. - // - // In other words, if we fail to warm the cache then this - // points at: - // - data corruption - // - user started - error!( - "Could not warm up cache, data seems corrupt. \ - You may need to restore a backup. Error was: {e}" - ); - } + if store.has(&key)? && let Err(e) = store.warm() { + // Start to 'warm' the cache. This serves two purposes: + // 1. this ensures that the `RepositoryAccess` struct is + // available in memory + // 2. this ensures that there are no apparent data issues + // + // If there are issues, then we need to bail out. Krill + // 0.14.0+ uses single files for all change + // sets, and files are first completely written to disk, + // and only then renamed. + // + // In other words, if we fail to warm the cache then this + // points at: + // - data corruption + // - user started + error!( + "Could not warm up cache, data seems corrupt. \ + You may need to restore a backup. Error was: {e}" + ); } Ok(RepositoryAccessProxy { store, key }) diff --git a/src/server/pubd/rrdp.rs b/src/server/pubd/rrdp.rs index 48e560fb..e30ff98c 100644 --- a/src/server/pubd/rrdp.rs +++ b/src/server/pubd/rrdp.rs @@ -478,16 +478,16 @@ impl RrdpServer { rpki::rrdp::NotificationFile::parse(bytes.as_ref()).ok() }); - if let Some(old_notification) = old_notification_opt.as_ref() { - if old_notification.serial() == self.serial - && old_notification.session_id() == self.session.uuid() - { - debug!( - "Existing notification file matches current session \ - and serial. Nothing to write." - ); - return Ok(()); - } + if + let Some(old_notification) = old_notification_opt.as_ref() + && old_notification.serial() == self.serial + && old_notification.session_id() == self.session.uuid() + { + debug!( + "Existing notification file matches current session \ + and serial. Nothing to write." + ); + return Ok(()); } let deltas = self.write_delta_files(old_notification_opt)?; @@ -575,18 +575,19 @@ impl RrdpServer { let last_written_serial = deltas_from_old_notification.last(); let mut deltas = vec![]; for delta in &self.deltas { - if let Some(last) = last_written_serial { - if delta.serial() <= last.serial() { - // Already included. We can skip this and assume that it - // was written to disk before. - // And no one went in and messed with it.. - debug!( - "Skip writing delta for serial {}. \ - File should exist.", - delta.serial() - ); - continue; - } + if + let Some(last) = last_written_serial + && delta.serial() <= last.serial() + { + // Already included. We can skip this and assume that it + // was written to disk before. + // And no one went in and messed with it.. + debug!( + "Skip writing delta for serial {}. \ + File should exist.", + delta.serial() + ); + continue; } // New delta, write it and add its distinctiveness to deltas // (DeltaInfo vec) to include in the notification file @@ -783,19 +784,18 @@ impl RrdpServer { // random dir as the delta that we still need to keep for // this serial, so we just remove the // file and leave its parent directory in place. - if let Ok(Some(snapshot_file_to_remove)) = - Self::session_dir_snapshot(&session_dir, serial) - { - if let Err(e) = + if + let Ok(Some(snapshot_file_to_remove)) = + Self::session_dir_snapshot(&session_dir, serial) + && let Err(e) = fs::remove_file(&snapshot_file_to_remove) - { - warn!( - "Could not delete snapshot file '{}'. \ - Error was: {}", - snapshot_file_to_remove.to_string_lossy(), - e - ); - } + { + warn!( + "Could not delete snapshot file '{}'. \ + Error was: {}", + snapshot_file_to_remove.to_string_lossy(), + e + ); } } else { // archiving was enabled, keep the old snapshot file until @@ -1409,15 +1409,13 @@ impl CurrentObjects { for (uri_key, base64) in self.iter() { // Add all manifests - as long as they are syntactically correct - // do not crash on incorrect objects. - if uri_key.as_str().ends_with("mft") { - if let Ok(mft) = - Manifest::decode(base64.to_bytes().as_ref(), false) - { - if let Ok(stats) = PublisherManifestStats::try_from(&mft) - { - manifests.push(stats) - } - } + if + uri_key.as_str().ends_with("mft") + && let Ok(mft) = Manifest::decode( + base64.to_bytes().as_ref(), false + ) && let Ok(stats) = PublisherManifestStats::try_from(&mft) + { + manifests.push(stats) } } diff --git a/src/server/taproxy.rs b/src/server/taproxy.rs index 836e44c2..f64e1d6b 100644 --- a/src/server/taproxy.rs +++ b/src/server/taproxy.rs @@ -326,16 +326,16 @@ impl TrustAnchorProxy { &self, signer: TrustAnchorSignerInfo, ) -> KrillResult> { - if let Some(s) = &self.signer { - if s.ta_cert_details.cert.key_identifier() == + if + let Some(s) = &self.signer + && s.ta_cert_details.cert.key_identifier() == signer.ta_cert_details.cert.key_identifier() - { - // It is not possible to add a signer that has a different - // public key - return Ok(vec![ - TrustAnchorProxyEvent::SignerUpdated(signer) - ]); - } + { + // It is not possible to add a signer that has a different + // public key + return Ok(vec![ + TrustAnchorProxyEvent::SignerUpdated(signer) + ]); } Err(Error::TaProxyHasDifferentSigner) } diff --git a/src/upgrades/mod.rs b/src/upgrades/mod.rs index ec198b81..52e6dd98 100644 --- a/src/upgrades/mod.rs +++ b/src/upgrades/mod.rs @@ -643,14 +643,15 @@ pub trait UpgradeAggregateStorePre0_14 { let code_version = KrillVersion::code_version(); const VERSION: &Ident = Ident::make("version"); - if let Ok(Some(existing_migration_version)) = self - .preparation_key_value_store() - .get::(None, VERSION) + if + let Ok(Some(existing_migration_version)) + = self.preparation_key_value_store().get::( + None, VERSION + ) + && existing_migration_version != code_version { - if existing_migration_version != code_version { - warn!("Found prepared data for Krill version {existing_migration_version}, will remove it and start from scratch for {code_version}"); - self.preparation_key_value_store().wipe()?; - } + warn!("Found prepared data for Krill version {existing_migration_version}, will remove it and start from scratch for {code_version}"); + self.preparation_key_value_store().wipe()?; } self.preparation_key_value_store() diff --git a/tests/functional_old_data.rs b/tests/functional_old_data.rs index 76f91dbf..871a7a7c 100644 --- a/tests/functional_old_data.rs +++ b/tests/functional_old_data.rs @@ -44,7 +44,7 @@ async fn functional_old_data() { &signer_config ).unwrap(); - config.ta_timing = signer_config.ta_timing.clone(); + config.ta_timing = signer_config.ta_timing; eprintln!(">>>> Check whether Krill still starts."); let server = common::KrillServer::start_with_config(config).await;