From c05b505ce9299c2aaa1d17f737cda3c03464aa82 Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Thu, 22 Feb 2024 13:06:24 +0100 Subject: [PATCH 01/10] Run `cargo update` --- backend/Cargo.lock | 630 +++++++++++++++++++++++++-------------------- 1 file changed, 346 insertions(+), 284 deletions(-) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index f0ee47108..cd2bd59d1 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "d713b3834d76b85304d4d525563c1276e2e30dc97cc67bfb4585a4a29fc2c89f" dependencies = [ "cfg-if", "getrandom", @@ -56,9 +56,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.4" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540" dependencies = [ "anstyle", "anstyle-parse", @@ -70,43 +70,43 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" dependencies = [ "backtrace", ] @@ -145,13 +145,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.50", ] [[package]] @@ -183,9 +183,9 @@ checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -210,9 +210,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "block-buffer" @@ -225,9 +225,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.7.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" +checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" dependencies = [ "memchr", "regex-automata", @@ -246,9 +246,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "a3b1be7772ee4501dba05acbe66bb1e8760f6a6c474a36035631638e4415f130" [[package]] name = "bunt" @@ -292,11 +292,10 @@ checksum = "a2698f953def977c68f935bb0dfa959375ad4638570e969e2f1e9f433cbf1af6" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "7f9fa1897e4325be0d68d48df6aa1a71ac2ed4d27723887e7754192705350730" dependencies = [ - "jobserver", "libc", ] @@ -308,22 +307,22 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", "serde", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] name = "clap" -version = "4.4.7" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" +checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" dependencies = [ "clap_builder", "clap_derive", @@ -331,9 +330,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.7" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" +checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" dependencies = [ "anstream", "anstyle", @@ -343,21 +342,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.50", ] [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" @@ -380,18 +379,18 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" +checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" dependencies = [ "crossbeam-utils", ] [[package]] name = "confique" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944dc1c6dec3f9b3adc127a921affd93baeea3d04c9b2d0a84380a243c9258b" +checksum = "c37945ed2efccb10339a12eea282a5af9ebac77720d088723b2bbbdc44eca964" dependencies = [ "confique-macro", "serde", @@ -400,9 +399,9 @@ dependencies = [ [[package]] name = "confique-macro" -version = "0.0.8" +version = "0.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7305b4979ffd6d8b02006da5520b21c66bfab961cd688b9b6db00780f61448ce" +checksum = "3821efdaaab3c5297054a90201cc3afa2061fc6ba2bc5d2fa558b850a7dabefe" dependencies = [ "heck 0.3.3", "proc-macro2", @@ -412,9 +411,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "convert_case" @@ -437,9 +436,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -447,42 +446,39 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.10" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crypto-bigint" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", "rand_core", @@ -502,24 +498,24 @@ dependencies = [ [[package]] name = "curl" -version = "0.4.44" +version = "0.4.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509bd11746c7ac09ebd19f0b17782eae80aadee26237658a6b4808afb5c11a22" +checksum = "1e2161dd6eba090ff1594084e95fd67aeccf04382ffea77999ea94ed42ec67b6" dependencies = [ "curl-sys", "libc", "openssl-probe", "openssl-sys", "schannel", - "socket2 0.4.10", - "winapi", + "socket2 0.5.5", + "windows-sys 0.52.0", ] [[package]] name = "curl-sys" -version = "0.4.68+curl-8.4.0" +version = "0.4.72+curl-8.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4a0d18d88360e374b16b2273c832b5e57258ffc1d4aa4f96b108e0738d5752f" +checksum = "29cbdc8314c447d11e8fd156dcdd031d9e02a7a976163e396b548c03153bc9ea" dependencies = [ "cc", "libc", @@ -528,7 +524,7 @@ dependencies = [ "openssl-sys", "pkg-config", "vcpkg", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -538,7 +534,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.2", + "hashbrown 0.14.3", "lock_api", "once_cell", "parking_lot_core", @@ -591,9 +587,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", "serde", @@ -630,9 +626,9 @@ checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" [[package]] name = "ecdsa" -version = "0.16.8" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", "digest", @@ -644,18 +640,18 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" dependencies = [ "serde", ] [[package]] name = "elliptic-curve" -version = "0.13.6" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97ca172ae9dc9f9b779a6e3a65d308f2af74e5b8c921299075bdb4a0370e914" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "base64ct", @@ -692,12 +688,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.5" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -761,18 +757,18 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] [[package]] name = "futures" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -785,9 +781,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -795,9 +791,9 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-enum" @@ -812,9 +808,9 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -823,9 +819,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" @@ -844,32 +840,32 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.50", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -896,9 +892,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -907,17 +903,17 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "git2" -version = "0.18.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd" +checksum = "1b3ba52851e73b46a4c3df1d89343741112003f0f6f13beb0dfac9e457c3fdcd" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "libc", "libgit2-sys", "log", @@ -957,7 +953,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.0.2", + "indexmap 2.2.3", "slab", "tokio", "tokio-util", @@ -972,9 +968,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "heck" @@ -993,9 +989,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" [[package]] name = "hex" @@ -1005,9 +1001,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hkdf" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ "hmac", ] @@ -1034,9 +1030,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes", "fnv", @@ -1045,9 +1041,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", "http", @@ -1068,9 +1064,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -1083,7 +1079,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2 0.5.5", "tokio", "tower-service", "tracing", @@ -1092,9 +1088,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http", @@ -1121,9 +1117,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1144,9 +1140,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1165,12 +1161,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", - "hashbrown 0.14.2", + "hashbrown 0.14.3", ] [[package]] @@ -1231,24 +1227,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" - -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -1267,9 +1254,9 @@ dependencies = [ [[package]] name = "juniper" -version = "0.15.11" +version = "0.15.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52adf17d43d0b526eed31fac15d9312941c5c2558ffbfb105811690b96d6e2f1" +checksum = "875dca5a0c08b1521e1bb0ed940e9955a9f38971008aaa2a9f64a2ac6b59e1b5" dependencies = [ "async-trait", "chrono", @@ -1304,9 +1291,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libgit2-sys" @@ -1322,9 +1309,9 @@ dependencies = [ [[package]] name = "libnghttp2-sys" -version = "0.1.8+1.55.1" +version = "0.1.9+1.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fae956c192dadcdb5dace96db71fa0b827333cce7c7b38dc71446f024d8a340" +checksum = "b57e858af2798e167e709b9d969325b6d8e9d50232fcbc494d7d54f976854a64" dependencies = [ "cc", "libc", @@ -1332,9 +1319,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.12" +version = "1.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" dependencies = [ "cc", "libc", @@ -1442,9 +1429,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "mime" @@ -1470,18 +1457,18 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.9" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "wasi", @@ -1498,11 +1485,17 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -1519,9 +1512,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -1548,9 +1541,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl-probe" @@ -1560,18 +1553,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.1.5+3.1.3" +version = "300.2.3+3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "559068e4c12950d7dcaa1857a61725c0d38d4fc03ff8e070ab31a75d6e316491" +checksum = "5cff92b6f71555b61bb9315f7c64da3ca43d87531622120fea0195fc761b4843" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.93" +version = "0.9.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +checksum = "dda2b0f344e78efc2facf7d195d098df0dd72151b26ab98da807afc26c198dff" dependencies = [ "cc", "libc", @@ -1606,9 +1599,9 @@ dependencies = [ [[package]] name = "palette" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e2f34147767aa758aa649415b50a69eeb46a67f9dc7db8011eeb3d84b351dc" +checksum = "3d38e6e5ca1612e2081cc31188f08c3cba630ce4ba44709a153f1a0f38d678f2" dependencies = [ "approx", "fast-srgb8", @@ -1617,13 +1610,13 @@ dependencies = [ [[package]] name = "palette_derive" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7db010ec5ff3d4385e4f133916faacd9dad0f6a09394c92d825b3aed310fa0a" +checksum = "e05d1c929301fee6830dafa764341118829b2535c216b0571e3821ecac5c885b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.50", ] [[package]] @@ -1672,9 +1665,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "phf" @@ -1696,22 +1689,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.50", ] [[package]] @@ -1738,9 +1731,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "polling" @@ -1767,7 +1760,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.50", ] [[package]] @@ -1818,9 +1811,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "primeorder" -version = "0.13.2" +version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c2fcef82c0ec6eefcc179b978446c399b3cdf73c392c35604e399eee6df1ee3" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" dependencies = [ "elliptic-curve", ] @@ -1851,9 +1844,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -1893,14 +1886,14 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.50", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1946,9 +1939,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", @@ -1958,9 +1951,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -2048,16 +2041,17 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.5" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", "getrandom", "libc", "spin 0.9.8", "untrusted 0.9.0", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2068,9 +2062,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.36.16" +version = "0.36.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6da3636faa25820d8648e0e31c5d519bbb01f72fdf57131f0f5f7da5fed36eab" +checksum = "305efbd14fde4139eb501df5f136994bb520b033fa9fbdce287507dc23b8c7ed" dependencies = [ "bitflags 1.3.2", "errno", @@ -2082,12 +2076,12 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.8" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", - "ring 0.17.5", + "ring 0.17.8", "rustls-webpki", "sct", ] @@ -2106,9 +2100,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ "base64", ] @@ -2119,23 +2113,23 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.17.5", + "ring 0.17.8", "untrusted 0.9.0", ] [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2150,7 +2144,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.5", + "ring 0.17.8", "untrusted 0.9.0", ] @@ -2204,29 +2198,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.193" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.50", ] [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -2235,11 +2229,11 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.25" +version = "0.9.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574" +checksum = "8fd075d994154d4a774f95b51fb96bdc2832b0ea48425c92546073816cda1f2f" dependencies = [ - "indexmap 2.0.2", + "indexmap 2.2.3", "itoa", "ryu", "serde", @@ -2269,9 +2263,9 @@ dependencies = [ [[package]] name = "signature" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest", "rand_core", @@ -2305,9 +2299,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smartstring" @@ -2354,9 +2348,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "spki" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", "der", @@ -2381,9 +2375,9 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" [[package]] name = "subtle" @@ -2404,9 +2398,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" dependencies = [ "proc-macro2", "quote", @@ -2421,31 +2415,31 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "termcolor" -version = "1.3.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.50", ] [[package]] @@ -2470,12 +2464,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -2490,10 +2485,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -2604,7 +2600,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.50", ] [[package]] @@ -2659,9 +2655,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", @@ -2706,7 +2702,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.50", ] [[package]] @@ -2730,9 +2726,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typenum" @@ -2751,9 +2747,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -2763,18 +2759,18 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-xid" @@ -2811,9 +2807,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -2828,9 +2824,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.5.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ "getrandom", ] @@ -2876,9 +2872,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2886,24 +2882,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.50", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" dependencies = [ "cfg-if", "js-sys", @@ -2913,9 +2909,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2923,28 +2919,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.50", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" dependencies = [ "js-sys", "wasm-bindgen", @@ -2993,11 +2989,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] @@ -3018,6 +3014,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + [[package]] name = "windows-targets" version = "0.42.2" @@ -3048,6 +3053,21 @@ dependencies = [ "windows_x86_64_msvc 0.48.5", ] +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -3060,6 +3080,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -3072,6 +3098,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -3084,6 +3116,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -3096,6 +3134,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -3108,6 +3152,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -3120,6 +3170,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -3132,6 +3188,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + [[package]] name = "yaup" version = "0.2.1" @@ -3159,11 +3221,11 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.50", ] [[package]] name = "zeroize" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" From 8aeb42e653b3e530156da634ee6caa0731a9c5e2 Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Thu, 22 Feb 2024 13:21:48 +0100 Subject: [PATCH 02/10] Update `cookie` from 0.17 -> 0.18 --- backend/Cargo.lock | 4 ++-- backend/Cargo.toml | 2 +- backend/src/auth/session_id.rs | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index cd2bd59d1..049617147 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -426,9 +426,9 @@ dependencies = [ [[package]] name = "cookie" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7efb37c3e1ccb1ff97164ad95ac1606e8ccd35b3fa0a7d99a304c7f4a428cc24" +checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" dependencies = [ "time", "version_check", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index bf7e87e13..6adc14b10 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -26,7 +26,7 @@ bytes = "1" chrono = { version = "0.4", default-features = false, features = ["serde", "std"] } clap = { version = "4.2.2", features = ["derive", "string"] } confique = { version = "0.2.0", default-features = false, features = ["toml"] } -cookie = "0.17.0" +cookie = "0.18.0" dashmap = "5.5.3" deadpool = { version = "0.9.0", default-features = false, features = ["managed", "rt_tokio_1"] } deadpool-postgres = { version = "0.10", default-features = false, features = ["rt_tokio_1"] } diff --git a/backend/src/auth/session_id.rs b/backend/src/auth/session_id.rs index 236b4d70a..aee013d18 100644 --- a/backend/src/auth/session_id.rs +++ b/backend/src/auth/session_id.rs @@ -56,7 +56,7 @@ impl SessionId { /// Returns a cookie for a `set-cookie` header in order to store the session /// ID in the client's cookie jar. pub(crate) fn set_cookie(&self, session_duration: Duration) -> Cookie { - Cookie::build(SESSION_COOKIE, base64encode(self.0.expose_secret())) + Cookie::build((SESSION_COOKIE, base64encode(self.0.expose_secret()))) // Only send via HTTPS as it contains sensitive information. .secure(true) @@ -81,18 +81,18 @@ impl SessionId { // because we parse the duration as `u32` anyway. session_duration.try_into().expect("session duration too large"), ) - .finish() + .build() } /// Returns a cookie for a `set-cookie` header that removes the session ID /// from the client's cookie jar. pub(crate) fn unset_cookie() -> Cookie<'static> { - Cookie::build(SESSION_COOKIE, "") + Cookie::build((SESSION_COOKIE, "")) .max_age(time::Duration::ZERO) .secure(true) .http_only(true) .same_site(cookie::SameSite::Lax) - .finish() + .build() } /// Tries to remove this session from the DB. Returns `Some(username)` if From 286c62308c8a862eed8861acedba16263b3a6800 Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Thu, 22 Feb 2024 13:32:24 +0100 Subject: [PATCH 03/10] Update Tokio from 1.28 to 1.36 Fixes #934 --- backend/Cargo.lock | 28 +++++++++------------------- backend/Cargo.toml | 2 +- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 049617147..39fd76c4d 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -507,7 +507,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "socket2 0.5.5", + "socket2", "windows-sys 0.52.0", ] @@ -1079,7 +1079,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.5.5", + "socket2", "tokio", "tower-service", "tracing", @@ -2314,16 +2314,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "socket2" version = "0.5.5" @@ -2577,26 +2567,26 @@ dependencies = [ [[package]] name = "tokio" -version = "1.28.2" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", "mio", "num_cpus", "pin-project-lite", - "socket2 0.4.10", + "socket2", "tokio-macros", "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", @@ -2623,7 +2613,7 @@ dependencies = [ "postgres-protocol", "postgres-types", "rand", - "socket2 0.5.5", + "socket2", "tokio", "tokio-util", "whoami", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 6adc14b10..fd0825472 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -71,7 +71,7 @@ static_assertions = "1" tap = "1" termcolor = "1.1.1" time = "0.3" -tokio = { version = "=1.28", features = ["fs", "rt-multi-thread", "macros", "time"] } +tokio = { version = "1.36", features = ["fs", "rt-multi-thread", "macros", "time"] } tokio-postgres = { version = "0.7", features = ["with-chrono-0_4", "with-serde_json-1"] } tokio-postgres-rustls = "0.10.0" url = "2.4.1" From 0a434e69f0719cb5ab75355206b7bb6794cc34db Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Thu, 22 Feb 2024 13:35:50 +0100 Subject: [PATCH 04/10] Update `deadpool*` dependencies --- backend/Cargo.lock | 17 +++++------------ backend/Cargo.toml | 4 ++-- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 39fd76c4d..b1cfdce0b 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -542,27 +542,26 @@ dependencies = [ [[package]] name = "deadpool" -version = "0.9.5" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "421fe0f90f2ab22016f32a9881be5134fdd71c65298917084b0c7477cbc3856e" +checksum = "fb84100978c1c7b37f09ed3ce3e5f843af02c2a2c431bae5b19230dad2c1b490" dependencies = [ "async-trait", "deadpool-runtime", "num_cpus", - "retain_mut", "tokio", ] [[package]] name = "deadpool-postgres" -version = "0.10.5" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a24a9d49deefe610b8b60c767a7412e9a931d79a89415cd2d2d71630ca8d7" +checksum = "bda39fa1cfff190d8924d447ad04fd22772c250438ca5ce1dfb3c80621c05aaa" dependencies = [ "deadpool", - "log", "tokio", "tokio-postgres", + "tracing", ] [[package]] @@ -2008,12 +2007,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "retain_mut" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" - [[package]] name = "rfc6979" version = "0.4.0" diff --git a/backend/Cargo.toml b/backend/Cargo.toml index fd0825472..1485c8f96 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -28,8 +28,8 @@ clap = { version = "4.2.2", features = ["derive", "string"] } confique = { version = "0.2.0", default-features = false, features = ["toml"] } cookie = "0.18.0" dashmap = "5.5.3" -deadpool = { version = "0.9.0", default-features = false, features = ["managed", "rt_tokio_1"] } -deadpool-postgres = { version = "0.10", default-features = false, features = ["rt_tokio_1"] } +deadpool = { version = "0.10.0", default-features = false, features = ["managed", "rt_tokio_1"] } +deadpool-postgres = { version = "0.12.1", default-features = false, features = ["rt_tokio_1"] } elliptic-curve = { version = "0.13.4", features = ["jwk", "sec1"] } fallible-iterator = "0.2.0" form_urlencoded = "1.1.0" From 3c13718f2d201d559097e56e55b161c0eb8a12bd Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Thu, 22 Feb 2024 14:17:20 +0100 Subject: [PATCH 05/10] Update crypto-related crates This was a fairly annoying update as it contains many breaking changes. And `ring` is annoying as usual by not providing a changelog. Now that rustls supports other crypto providers, maybe we can get rid of ring at some point. To be honest, I have not tested all code paths. I think it should work, but we should probably try loading a certificate and using TLS with the DB before the next release... or ideally before this PR is merged. --- backend/Cargo.lock | 149 ++++++++++++++++++++++++++++++++++++---- backend/Cargo.toml | 10 +-- backend/src/auth/jwt.rs | 12 ++-- backend/src/db/mod.rs | 42 ++++++----- 4 files changed, 170 insertions(+), 43 deletions(-) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index b1cfdce0b..d3448a535 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -193,6 +193,16 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "bcder" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c627747a6774aab38beb35990d88309481378558875a41da1a4b2e373c906ef0" +dependencies = [ + "bytes", + "smallvec", +] + [[package]] name = "bincode" version = "1.3.3" @@ -1095,10 +1105,10 @@ dependencies = [ "http", "hyper", "log", - "rustls", - "rustls-native-certs", + "rustls 0.21.10", + "rustls-native-certs 0.6.3", "tokio", - "tokio-rustls", + "tokio-rustls 0.24.1", ] [[package]] @@ -1653,6 +1663,16 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +[[package]] +name = "pem" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8fcc794035347fb64beda2d3b462595dd2753e3f268d89c5aae77e8cf2c310" +dependencies = [ + "base64", + "serde", +] + [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -2075,10 +2095,24 @@ checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", "ring 0.17.8", - "rustls-webpki", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" +dependencies = [ + "log", + "ring 0.17.8", + "rustls-pki-types", + "rustls-webpki 0.102.2", + "subtle", + "zeroize", +] + [[package]] name = "rustls-native-certs" version = "0.6.3" @@ -2086,7 +2120,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" dependencies = [ "openssl-probe", - "rustls-pemfile", + "rustls-pemfile 1.0.4", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-native-certs" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" +dependencies = [ + "openssl-probe", + "rustls-pemfile 2.1.0", + "rustls-pki-types", "schannel", "security-framework", ] @@ -2100,6 +2147,22 @@ dependencies = [ "base64", ] +[[package]] +name = "rustls-pemfile" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c333bb734fcdedcea57de1602543590f545f127dc8b533324318fd492c5c70b" +dependencies = [ + "base64", + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "048a63e5b3ac996d78d402940b5fa47973d2d080c6c6fffa1d0f19c4445310b7" + [[package]] name = "rustls-webpki" version = "0.101.7" @@ -2110,6 +2173,17 @@ dependencies = [ "untrusted 0.9.0", ] +[[package]] +name = "rustls-webpki" +version = "0.102.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" +dependencies = [ + "ring 0.17.8", + "rustls-pki-types", + "untrusted 0.9.0", +] + [[package]] name = "ryu" version = "1.0.17" @@ -2539,10 +2613,10 @@ dependencies = [ "rand", "regex", "reinda", - "ring 0.16.20", - "rustls", - "rustls-native-certs", - "rustls-pemfile", + "ring 0.17.8", + "rustls 0.22.2", + "rustls-native-certs 0.7.0", + "rustls-pemfile 2.1.0", "secrecy", "serde", "serde_json", @@ -2614,16 +2688,17 @@ dependencies = [ [[package]] name = "tokio-postgres-rustls" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd5831152cb0d3f79ef5523b357319ba154795d64c7078b2daa95a803b54057f" +checksum = "0ea13f22eda7127c827983bdaf0d7fff9df21c8817bab02815ac277a21143677" dependencies = [ "futures", - "ring 0.16.20", - "rustls", + "ring 0.17.8", + "rustls 0.22.2", "tokio", "tokio-postgres", - "tokio-rustls", + "tokio-rustls 0.25.0", + "x509-certificate", ] [[package]] @@ -2632,7 +2707,18 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls", + "rustls 0.21.10", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.2", + "rustls-pki-types", "tokio", ] @@ -3177,6 +3263,25 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +[[package]] +name = "x509-certificate" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66534846dec7a11d7c50a74b7cdb208b9a581cad890b7866430d438455847c85" +dependencies = [ + "bcder", + "bytes", + "chrono", + "der", + "hex", + "pem", + "ring 0.17.8", + "signature", + "spki", + "thiserror", + "zeroize", +] + [[package]] name = "yaup" version = "0.2.1" @@ -3212,3 +3317,17 @@ name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 1485c8f96..1c522b262 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -59,10 +59,10 @@ prometheus-client = "0.20.0" rand = "0.8.4" regex = "1.7.1" reinda = "0.2" -ring = "0.16" -rustls = { version = "0.21.0", features = ["dangerous_configuration"] } -rustls-native-certs = "0.6.2" -rustls-pemfile = "1.0.0" +ring = "0.17.8" +rustls = "0.22.2" +rustls-native-certs = "0.7.0" +rustls-pemfile = "2.1.0" secrecy = { version = "0.8", features = ["serde"] } serde = { version = "1.0.192", features = ["derive"] } serde_json = "1" @@ -73,7 +73,7 @@ termcolor = "1.1.1" time = "0.3" tokio = { version = "1.36", features = ["fs", "rt-multi-thread", "macros", "time"] } tokio-postgres = { version = "0.7", features = ["with-chrono-0_4", "with-serde_json-1"] } -tokio-postgres-rustls = "0.10.0" +tokio-postgres-rustls = "0.11.1" url = "2.4.1" [target.'cfg(target_os = "linux")'.dependencies] diff --git a/backend/src/auth/jwt.rs b/backend/src/auth/jwt.rs index aa7219300..9452d80ac 100644 --- a/backend/src/auth/jwt.rs +++ b/backend/src/auth/jwt.rs @@ -120,12 +120,13 @@ impl JwtContext { impl JwtConfig { fn load_auth(&self) -> Result { + let rng = ring::rand::SystemRandom::new(); if let Some(secret_key_path) = &self.secret_key { let pem_encoded = std::fs::read(secret_key_path) .context("could not load secret key file")?; let (_label, pkcs8_bytes) = pem_rfc7468::decode_vec(&pem_encoded) .context("secret key file is not a valid PEM encoded key")?; - JwtAuth::load_es(self.signing_algorithm, &pkcs8_bytes) + JwtAuth::load_es(self.signing_algorithm, &pkcs8_bytes, &rng) } else { let ring_algo = match self.signing_algorithm { Algorithm::ES256 => &ring::signature::ECDSA_P256_SHA256_FIXED_SIGNING, @@ -136,11 +137,10 @@ impl JwtConfig { "No JWT key specified, generating key for algorithm {}", self.signing_algorithm.to_str(), ); - let rng = ring::rand::SystemRandom::new(); let pkcs8_bytes = ring::signature::EcdsaKeyPair::generate_pkcs8(ring_algo, &rng) - .context("failed to generate JWT ECDSA key")?; + .map_err(|_| anyhow!("failed to generate JWT ECDSA key"))?; - JwtAuth::load_es(self.signing_algorithm, pkcs8_bytes.as_ref()) + JwtAuth::load_es(self.signing_algorithm, pkcs8_bytes.as_ref(), &rng) } } } @@ -154,7 +154,7 @@ struct JwtAuth { impl JwtAuth { /// Loads an elliptic curve key. `algo` has to be `ES256` or `ES384`! - fn load_es(algo: Algorithm, key: &[u8]) -> Result { + fn load_es(algo: Algorithm, key: &[u8], rng: &dyn SecureRandom) -> Result { use elliptic_curve::pkcs8::DecodePrivateKey; // Create a `ring` key pair that is used for signing. @@ -162,7 +162,7 @@ impl JwtAuth { Algorithm::ES256 => &ring::signature::ECDSA_P256_SHA256_FIXED_SIGNING, Algorithm::ES384 => &ring::signature::ECDSA_P384_SHA384_FIXED_SIGNING, }; - let ring_key = EcdsaKeyPair::from_pkcs8(ring_algo, key).map_err(|e| { + let ring_key = EcdsaKeyPair::from_pkcs8(ring_algo, key, rng).map_err(|e| { anyhow!("`jwt.secret_key` is not a valid ECDSA keypair for the expected \ algorithm in PKCS8 format: {e}") })?; diff --git a/backend/src/db/mod.rs b/backend/src/db/mod.rs index 97b8e296a..14fdfb319 100644 --- a/backend/src/db/mod.rs +++ b/backend/src/db/mod.rs @@ -4,7 +4,7 @@ use deadpool_postgres::{Config as PoolConfig, Pool, Runtime}; use secrecy::{ExposeSecret, Secret}; use rustls::{ Error, DigitallySignedStruct, - client::{ServerCertVerifier, ServerCertVerified, HandshakeSignatureValid}, + client::danger::{ServerCertVerifier, ServerCertVerified, HandshakeSignatureValid}, }; use std::{ fmt::Write, @@ -150,7 +150,7 @@ pub(crate) async fn create_pool(config: &DbConfig) -> Result { let system_count = system_certs.len(); for cert in system_certs { - root_certs.add(&rustls::Certificate(cert.0)) + root_certs.add(cert) .context("failed to load system-wide certificate")?; } debug!("Loaded {system_count} system-wide certificates"); @@ -164,7 +164,6 @@ pub(crate) async fn create_pool(config: &DbConfig) -> Result { } let mut tls_config = rustls::ClientConfig::builder() - .with_safe_defaults() .with_root_certificates(root_certs) .with_no_client_auth(); @@ -294,12 +293,15 @@ pub(crate) async fn get_conn_or_service_unavailable(pool: &Pool) -> Result Result { let file = fs::read(path).context("could not read file")?; + let mut read = &*file; - let items = rustls_pemfile::read_all(&mut &*file).context("could not parse file as PEM")?; - let count = items.len(); + let items = rustls_pemfile::read_all(&mut read); + let mut count = 0; for item in items { + count += 1; + let item = item.context("could not parse file as PEM")?; if let rustls_pemfile::Item::X509Certificate(cert) = item { - root_certs.add(&rustls::Certificate(cert)).context("failed to load X509 certificate")?; + root_certs.add(cert).context("failed to load X509 certificate")?; } else { bail!("found unexpected item, expected X509 certificate"); } @@ -312,36 +314,42 @@ fn load_pem_file(path: &Path, root_certs: &mut rustls::RootCertStore) -> Result< /// used in the "don't check certificates" mode. Unfortunately, as rustls /// values an API where it's hard to do potentially insecure things, it's a bit /// of boilerplate. +#[derive(Debug)] pub(crate) struct DangerousAlwaysAcceptCerts; impl ServerCertVerifier for DangerousAlwaysAcceptCerts { fn verify_server_cert( &self, - _end_entity: &rustls::Certificate, - _intermediates: &[rustls::Certificate], - _server_name: &rustls::client::ServerName, - _scts: &mut dyn Iterator, + _end_entity: &rustls::pki_types::CertificateDer<'_>, + _intermediates: &[rustls::pki_types::CertificateDer<'_>], + _server_name: &rustls::pki_types::ServerName<'_>, _ocsp_response: &[u8], - _now: std::time::SystemTime, - ) -> Result { - Ok(rustls::client::ServerCertVerified::assertion()) + _now: rustls::pki_types::UnixTime, + ) -> std::prelude::v1::Result { + Ok(ServerCertVerified::assertion()) } fn verify_tls12_signature( &self, _message: &[u8], - _cert: &rustls::Certificate, + _cert: &rustls::pki_types::CertificateDer<'_>, _dss: &DigitallySignedStruct, - ) -> Result { + ) -> std::prelude::v1::Result { Ok(HandshakeSignatureValid::assertion()) } + fn verify_tls13_signature( &self, _message: &[u8], - _cert: &rustls::Certificate, + _cert: &rustls::pki_types::CertificateDer<'_>, _dss: &DigitallySignedStruct, - ) -> Result { + ) -> std::prelude::v1::Result { Ok(HandshakeSignatureValid::assertion()) + } + fn supported_verify_schemes(&self) -> Vec { + rustls::crypto::ring::default_provider() + .signature_verification_algorithms + .supported_schemes() } } From 4a37bf88a6b59533874da976112c5cb87bc2651b Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Thu, 22 Feb 2024 14:22:51 +0100 Subject: [PATCH 06/10] Update `procfs` and `prometheus-client` Both without breaking changes affecting us, luckily. --- backend/Cargo.lock | 113 +++++++++------------------------------------ backend/Cargo.toml | 4 +- 2 files changed, 25 insertions(+), 92 deletions(-) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index d3448a535..488f273db 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -1187,17 +1187,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "isahc" version = "1.7.2" @@ -1340,9 +1329,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.1.4" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "litrs" @@ -1872,24 +1861,35 @@ dependencies = [ [[package]] name = "procfs" -version = "0.15.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "943ca7f9f29bab5844ecd8fdb3992c5969b6622bb9609b9502fef9b4310e3f1f" +checksum = "731e0d9356b0c25f16f33b5be79b1c57b562f141ebfcdb0ad8ac2c13a24293b4" dependencies = [ - "bitflags 1.3.2", - "byteorder", + "bitflags 2.4.2", "chrono", "flate2", "hex", "lazy_static", + "procfs-core", "rustix", ] +[[package]] +name = "procfs-core" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3554923a69f4ce04c4a754260c338f505ce22642d3830e049a399fc2059a29" +dependencies = [ + "bitflags 2.4.2", + "chrono", + "hex", +] + [[package]] name = "prometheus-client" -version = "0.20.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e227aeb6c2cfec819e999c4773b35f8c7fa37298a203ff46420095458eee567e" +checksum = "6f87c10af16e0af74010d2a123d202e8363c04db5acfa91d8747f64a8524da3a" dependencies = [ "dtoa", "itoa", @@ -2075,16 +2075,15 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.36.17" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305efbd14fde4139eb501df5f136994bb520b033fa9fbdce287507dc23b8c7ed" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "errno", - "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.45.0", + "windows-sys 0.52.0", ] [[package]] @@ -3065,15 +3064,6 @@ dependencies = [ "windows-targets 0.52.0", ] -[[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.48.0" @@ -3092,21 +3082,6 @@ dependencies = [ "windows-targets 0.52.0", ] -[[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.48.5" @@ -3137,12 +3112,6 @@ dependencies = [ "windows_x86_64_msvc 0.52.0", ] -[[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.48.5" @@ -3155,12 +3124,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" -[[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.48.5" @@ -3173,12 +3136,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" -[[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.48.5" @@ -3191,12 +3148,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" -[[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.48.5" @@ -3209,12 +3160,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" -[[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.48.5" @@ -3227,12 +3172,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" -[[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.48.5" @@ -3245,12 +3184,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" -[[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.48.5" diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 1c522b262..4524d3ef5 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -55,7 +55,7 @@ pem-rfc7468 = { version = "0.7.0", features = ["std"] } percent-encoding = "2.1.0" postgres-protocol = "0.6.6" postgres-types = { version = "0.2.2", features = ["derive", "array-impls"] } -prometheus-client = "0.20.0" +prometheus-client = "0.22.1" rand = "0.8.4" regex = "1.7.1" reinda = "0.2" @@ -77,7 +77,7 @@ tokio-postgres-rustls = "0.11.1" url = "2.4.1" [target.'cfg(target_os = "linux")'.dependencies] -procfs = "0.15.1" +procfs = "0.16.0" [target.'cfg(not(target_env = "msvc"))'.dependencies] tikv-jemallocator = "0.5" From 0cf6da88cf63dea2d0cd6665521b58652af5ed2b Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Thu, 22 Feb 2024 15:35:22 +0100 Subject: [PATCH 07/10] Bump minimum required Rust version The dependency upgrades required that. --- util/scripts/check-system.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/scripts/check-system.sh b/util/scripts/check-system.sh index 6636949e7..862eef3df 100755 --- a/util/scripts/check-system.sh +++ b/util/scripts/check-system.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -MIN_RUST_VERSION="1.71.0" +MIN_RUST_VERSION="1.74.0" MIN_NPM_VERSION="7.0" has_command() { From f78a60dcedd0f0375ce76434baf9f83ac911f623 Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Thu, 22 Feb 2024 15:34:56 +0100 Subject: [PATCH 08/10] Prepare hyper update --- backend/Cargo.toml | 2 +- backend/src/auth/handlers.rs | 11 ++++++----- backend/src/auth/mod.rs | 4 ++-- backend/src/http/handlers.rs | 8 +++++--- backend/src/sync/client.rs | 5 +++-- backend/src/util.rs | 16 +++++++++++++++- 6 files changed, 32 insertions(+), 14 deletions(-) diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 4524d3ef5..cf5e22d5d 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -36,7 +36,7 @@ form_urlencoded = "1.1.0" futures = { version = "0.3.1", default-features = false, features = ["std"] } hex = "0.4.3" hostname = "0.3" -hyper = { version = "0.14", features = ["client", "http1", "http2"] } +hyper = { version = "0.14", features = ["client", "http1", "http2", "backports", "deprecated"] } hyper-rustls = { version = "0.24.0", features = ["http2"] } hyperlocal = { version = "0.8", default-features = false, features = ["server"] } isahc = { version = "1", features = ["static-ssl"] } diff --git a/backend/src/auth/handlers.rs b/backend/src/auth/handlers.rs index 07a63c37f..6aa38c9ea 100644 --- a/backend/src/auth/handlers.rs +++ b/backend/src/auth/handlers.rs @@ -5,11 +5,12 @@ use hyper::{Body, StatusCode}; use serde::Deserialize; use crate::{ + auth::config::LoginCredentialsHandler, + config::OpencastConfig, db, - http::{self, Context, Request, Response, response::bad_request}, + http::{self, response::bad_request, Context, Request, Response}, prelude::*, - config::OpencastConfig, - auth::config::LoginCredentialsHandler, + util::download_body, }; use super::{config::SessionEndpointHandler, AuthSource, SessionId, User}; @@ -126,7 +127,7 @@ pub(crate) async fn handle_post_login(req: Request, ctx: &Context) -> Resp } // Download whole body. - let body = match hyper::body::to_bytes(req.into_body()).await { + let body = match download_body(req.into_body()).await { Ok(v) => v, Err(e) => { error!("Failed to download login request body: {e}"); @@ -233,7 +234,7 @@ async fn check_opencast_login( email: Option, } - let body = hyper::body::to_bytes(response.into_body()).await?; + let body = download_body(response.into_body()).await?; let mut info: InfoMeResponse = serde_json::from_slice(&body) .context("Could not deserialize `/info/me.json` response")?; diff --git a/backend/src/auth/mod.rs b/backend/src/auth/mod.rs index 3a89aee12..40829f74f 100644 --- a/backend/src/auth/mod.rs +++ b/backend/src/auth/mod.rs @@ -9,7 +9,7 @@ use secrecy::ExposeSecret; use serde::Deserialize; use tokio_postgres::Error as PgError; -use crate::{prelude::*, db::util::select, http::{Response, response, Request}}; +use crate::{db::util::select, http::{response, Request, Response}, prelude::*, util::download_body}; mod cache; @@ -285,7 +285,7 @@ impl User { callback_bad_gateway() })?; let (parts, body) = response.into_parts(); - let body = hyper::body::to_bytes(body).await.map_err(|e| { + let body = download_body(body).await.map_err(|e| { error!("Error downloading body from auth callback: {e}"); callback_bad_gateway() })?; diff --git a/backend/src/http/handlers.rs b/backend/src/http/handlers.rs index 042909e9e..873782ff9 100644 --- a/backend/src/http/handlers.rs +++ b/backend/src/http/handlers.rs @@ -11,11 +11,13 @@ use std::{ use crate::{ api, auth::{self, AuthContext}, - Config, db::{self, Transaction}, http::response::bad_request, metrics::HttpReqCategory, - prelude::*, rss, + prelude::*, + rss, + util::download_body, + Config, }; use super::{Context, Request, Response, response}; @@ -247,7 +249,7 @@ async fn handle_api(req: Request, ctx: &Context) -> Result Result<(T, usize)> { let (parts, body) = response.into_parts(); - let body = hyper::body::to_bytes(body).await + let body = download_body(body).await .with_context(|| format!("failed to download body from '{uri}'"))?; if parts.status != StatusCode::OK { diff --git a/backend/src/util.rs b/backend/src/util.rs index ff05cb664..2564a877d 100644 --- a/backend/src/util.rs +++ b/backend/src/util.rs @@ -1,5 +1,6 @@ use std::fmt; -use hyper::client::HttpConnector; +use bytes::Bytes; +use hyper::{body::HttpBody, client::HttpConnector}; use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder}; use rand::{RngCore, CryptoRng}; use secrecy::Secret; @@ -96,3 +97,16 @@ impl InspectExt for Result { }) } } + +pub(crate) async fn download_body(body: B) -> Result +where + B: HttpBody, + B::Error: 'static + Send + Sync + std::error::Error, +{ + // TODO: this should somehow limit the size in order to prevent DOS attacks + // https://github.com/elan-ev/tobira/issues/667 + body.collect().await + .context("failed to download HTTP body")? + .to_bytes() + .pipe(Ok) +} From 6682be0ea54edccf903a626af6d4d5edeafe895d Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Thu, 22 Feb 2024 17:59:59 +0100 Subject: [PATCH 09/10] Update hyper to 1.0 Wow, that was a painful update. There is still some work to be done: - At two places we create a client and `unwrap`. That client needs to be created only once during startup. - Syncing and all other HTTP client using things need to be tested. - Unix socket have to be tested (including proper output) --- backend/Cargo.lock | 184 +++++++++++++++++------------------ backend/Cargo.toml | 7 +- backend/src/auth/config.rs | 3 +- backend/src/auth/handlers.rs | 28 +++--- backend/src/auth/jwt.rs | 9 +- backend/src/auth/mod.rs | 10 +- backend/src/cmd/check.rs | 2 +- backend/src/http/assets.rs | 8 +- backend/src/http/handlers.rs | 31 +++--- backend/src/http/mod.rs | 87 ++++++++--------- backend/src/http/response.rs | 10 +- backend/src/prelude.rs | 2 +- backend/src/sync/client.rs | 29 +++--- backend/src/sync/mod.rs | 2 +- backend/src/sync/stats.rs | 6 +- backend/src/util.rs | 40 +++++++- 16 files changed, 241 insertions(+), 217 deletions(-) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 488f273db..9f57d27b8 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -952,16 +952,16 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", + "http 1.0.0", "indexmap 2.2.3", "slab", "tokio", @@ -1048,14 +1048,37 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" -version = "0.4.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ "bytes", - "http", + "http 1.0.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +dependencies = [ + "bytes", + "futures-util", + "http 1.0.0", + "http-body", "pin-project-lite", ] @@ -1073,55 +1096,62 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.28" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", "h2", - "http", + "http 1.0.0", "http-body", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] name = "hyper-rustls" -version = "0.24.2" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" dependencies = [ "futures-util", - "http", + "http 1.0.0", "hyper", + "hyper-util", "log", - "rustls 0.21.10", - "rustls-native-certs 0.6.3", + "rustls", + "rustls-native-certs", + "rustls-pki-types", "tokio", - "tokio-rustls 0.24.1", + "tokio-rustls", + "tower-service", ] [[package]] -name = "hyperlocal" -version = "0.8.0" +name = "hyper-util" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fafdf7b2b2de7c9784f76e02c0935e65a8117ec3b768644379983ab333ac98c" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" dependencies = [ + "bytes", + "futures-channel", "futures-util", - "hex", + "http 1.0.0", + "http-body", "hyper", - "pin-project", + "pin-project-lite", + "socket2", "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -1201,7 +1231,7 @@ dependencies = [ "encoding_rs", "event-listener", "futures-lite", - "http", + "http 0.2.11", "log", "mime", "once_cell", @@ -2086,18 +2116,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rustls" -version = "0.21.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" -dependencies = [ - "log", - "ring 0.17.8", - "rustls-webpki 0.101.7", - "sct", -] - [[package]] name = "rustls" version = "0.22.2" @@ -2107,23 +2125,11 @@ dependencies = [ "log", "ring 0.17.8", "rustls-pki-types", - "rustls-webpki 0.102.2", + "rustls-webpki", "subtle", "zeroize", ] -[[package]] -name = "rustls-native-certs" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" -dependencies = [ - "openssl-probe", - "rustls-pemfile 1.0.4", - "schannel", - "security-framework", -] - [[package]] name = "rustls-native-certs" version = "0.7.0" @@ -2131,21 +2137,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" dependencies = [ "openssl-probe", - "rustls-pemfile 2.1.0", + "rustls-pemfile", "rustls-pki-types", "schannel", "security-framework", ] -[[package]] -name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64", -] - [[package]] name = "rustls-pemfile" version = "2.1.0" @@ -2162,16 +2159,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "048a63e5b3ac996d78d402940b5fa47973d2d080c6c6fffa1d0f19c4445310b7" -[[package]] -name = "rustls-webpki" -version = "0.101.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" -dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", -] - [[package]] name = "rustls-webpki" version = "0.102.2" @@ -2204,16 +2191,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", -] - [[package]] name = "sec1" version = "0.7.3" @@ -2588,9 +2565,10 @@ dependencies = [ "futures", "hex", "hostname", + "http-body-util", "hyper", "hyper-rustls", - "hyperlocal", + "hyper-util", "isahc", "juniper", "libz-sys", @@ -2613,9 +2591,9 @@ dependencies = [ "regex", "reinda", "ring 0.17.8", - "rustls 0.22.2", - "rustls-native-certs 0.7.0", - "rustls-pemfile 2.1.0", + "rustls", + "rustls-native-certs", + "rustls-pemfile", "secrecy", "serde", "serde_json", @@ -2693,30 +2671,20 @@ checksum = "0ea13f22eda7127c827983bdaf0d7fff9df21c8817bab02815ac277a21143677" dependencies = [ "futures", "ring 0.17.8", - "rustls 0.22.2", + "rustls", "tokio", "tokio-postgres", - "tokio-rustls 0.25.0", + "tokio-rustls", "x509-certificate", ] -[[package]] -name = "tokio-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" -dependencies = [ - "rustls 0.21.10", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ - "rustls 0.22.2", + "rustls", "rustls-pki-types", "tokio", ] @@ -2744,6 +2712,28 @@ dependencies = [ "serde", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" diff --git a/backend/Cargo.toml b/backend/Cargo.toml index cf5e22d5d..d0da1450e 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -36,9 +36,10 @@ form_urlencoded = "1.1.0" futures = { version = "0.3.1", default-features = false, features = ["std"] } hex = "0.4.3" hostname = "0.3" -hyper = { version = "0.14", features = ["client", "http1", "http2", "backports", "deprecated"] } -hyper-rustls = { version = "0.24.0", features = ["http2"] } -hyperlocal = { version = "0.8", default-features = false, features = ["server"] } +hyper = { version = "1", features = ["client", "http1", "http2"] } +http-body-util = "0.1" +hyper-rustls = { version = "0.26.0", features = ["http2"] } +hyper-util = { version = "0.1.3", features = ["client", "server", "http1", "http2"] } isahc = { version = "1", features = ["static-ssl"] } juniper = { version = "0.15.10", default-features = false, features = ["chrono", "schema-language"] } libz-sys = { version = "1", features = ["static"] } diff --git a/backend/src/auth/config.rs b/backend/src/auth/config.rs index 4339dd3bd..2d1fc0ed4 100644 --- a/backend/src/auth/config.rs +++ b/backend/src/auth/config.rs @@ -1,7 +1,6 @@ use std::time::Duration; -use hyper::Uri; -use isahc::http::HeaderName; +use hyper::{http::HeaderName, Uri}; use secrecy::Secret; use serde::{Deserialize, Deserializer, de::Error}; diff --git a/backend/src/auth/handlers.rs b/backend/src/auth/handlers.rs index 6aa38c9ea..f44b0bf1f 100644 --- a/backend/src/auth/handlers.rs +++ b/backend/src/auth/handlers.rs @@ -1,23 +1,24 @@ use std::unreachable; use base64::Engine; -use hyper::{Body, StatusCode}; +use bytes::Bytes; +use hyper::{body::Incoming, StatusCode, Request}; use serde::Deserialize; use crate::{ auth::config::LoginCredentialsHandler, config::OpencastConfig, db, - http::{self, response::bad_request, Context, Request, Response}, + http::{self, response::bad_request, Context, Response}, prelude::*, - util::download_body, + util::{download_body, ByteBody}, }; use super::{config::SessionEndpointHandler, AuthSource, SessionId, User}; /// Handles POST requests to `/~session`. pub(crate) async fn handle_post_session( - req: Request, + req: Request, ctx: &Context, ) -> Result { let user = match &ctx.config.auth.session.from_session_endpoint { @@ -71,7 +72,7 @@ pub(crate) async fn handle_post_session( /// settings. That's the proper tool to remove sessions. Still: /// /// TODO: maybe notify the user about these failures? -pub(crate) async fn handle_delete_session(req: Request, ctx: &Context) -> Response { +pub(crate) async fn handle_delete_session(req: Request, ctx: &Context) -> Response { if ctx.config.auth.source != AuthSource::TobiraSession { warn!("Got DELETE /~session request, but due to 'auth.source', this endpoint is disabled"); return http::response::not_found(); @@ -80,7 +81,7 @@ pub(crate) async fn handle_delete_session(req: Request, ctx: &Context) -> let response = Response::builder() .status(StatusCode::NO_CONTENT) .header("set-cookie", SessionId::unset_cookie().to_string()) - .body(Body::empty()) + .body(ByteBody::empty()) .unwrap(); @@ -110,7 +111,7 @@ const USERID_FIELD: &str = "userid"; const PASSWORD_FIELD: &str = "password"; /// Handles `POST /~login` request. -pub(crate) async fn handle_post_login(req: Request, ctx: &Context) -> Response { +pub(crate) async fn handle_post_login(req: Request, ctx: &Context) -> Response { if ctx.config.auth.session.from_login_credentials == LoginCredentialsHandler::None { warn!("Got POST /~login request, but due to 'auth.mode', this endpoint is disabled."); return http::response::not_found(); @@ -131,7 +132,7 @@ pub(crate) async fn handle_post_login(req: Request, ctx: &Context) -> Resp Ok(v) => v, Err(e) => { error!("Failed to download login request body: {e}"); - return bad_request(None); + return bad_request(""); }, }; @@ -185,7 +186,10 @@ pub(crate) async fn handle_post_login(req: Request, ctx: &Context) -> Resp }; match user { - None => Response::builder().status(StatusCode::FORBIDDEN).body(Body::empty()).unwrap(), + None => Response::builder() + .status(StatusCode::FORBIDDEN) + .body(ByteBody::empty()) + .unwrap(), Some(user) => create_session(user, ctx).await.unwrap_or_else(|e| e), } } @@ -196,7 +200,7 @@ async fn check_opencast_login( config: &OpencastConfig, ) -> Result> { trace!("Checking Opencast login..."); - let client = crate::util::http_client(); + let client = crate::util::http_client().expect("TODO"); // TODO!!!! // Send request. We use basic auth here: our configuration checks already // assert that we use HTTPS or Opencast is running on the same machine @@ -207,7 +211,7 @@ async fn check_opencast_login( let req = Request::builder() .uri(config.sync_node().clone().with_path_and_query("/info/me.json")) .header(hyper::header::AUTHORIZATION, auth_header) - .body(Body::empty()) + .body(http_body_util::Empty::::new()) .unwrap(); let response = client.request(req).await?; @@ -275,7 +279,7 @@ async fn create_session(mut user: User, ctx: &Context) -> Result &str { + pub(crate) fn jwks(&self) -> &Bytes { &self.auth.jwks } @@ -149,7 +150,7 @@ impl JwtConfig { struct JwtAuth { signer: Box, - jwks: String, + jwks: Bytes, } impl JwtAuth { @@ -191,7 +192,7 @@ impl JwtAuth { } /// Serializes the given `jwk` from `elliptic_curve` into the expected JWKS structure. -fn jwk_to_jwks(algo: Algorithm, jwk: impl Serialize) -> String { +fn jwk_to_jwks(algo: Algorithm, jwk: impl Serialize) -> Bytes { #[derive(Serialize)] struct Jwk { #[serde(flatten)] @@ -213,7 +214,7 @@ fn jwk_to_jwks(algo: Algorithm, jwk: impl Serialize) -> String { alg: algo.to_str(), }] }; - serde_json::to_string(&jwks).expect("failed to serialize JWKS") + serde_json::to_string(&jwks).expect("failed to serialize JWKS").into() } /// A signature algorithm with corresponding key. Can sign a message. diff --git a/backend/src/auth/mod.rs b/backend/src/auth/mod.rs index 40829f74f..7a1ca5d26 100644 --- a/backend/src/auth/mod.rs +++ b/backend/src/auth/mod.rs @@ -3,13 +3,13 @@ use std::{borrow::Cow, time::Duration, collections::HashSet}; use base64::Engine; use cookie::Cookie; use deadpool_postgres::Client; -use hyper::{HeaderMap, http::HeaderValue, StatusCode, Uri}; +use hyper::{http::HeaderValue, HeaderMap, Request, StatusCode, Uri}; use once_cell::sync::Lazy; use secrecy::ExposeSecret; use serde::Deserialize; use tokio_postgres::Error as PgError; -use crate::{db::util::select, http::{response, Request, Response}, prelude::*, util::download_body}; +use crate::{db::util::select, http::{response, Response}, prelude::*, util::{self, download_body, ByteBody}}; mod cache; @@ -219,7 +219,7 @@ impl User { // and just remove the headers we are not interested in. This is kind // of blocked by this: https://github.com/hyperium/http/issues/541 - let mut req = Request::new(hyper::Body::empty()); + let mut req = Request::new(ByteBody::empty()); for h in auth_config.callback.relevant_headers.iter().flatten() { for value in headers.get_all(h) { req.headers_mut().append(h.clone(), value.clone()); @@ -271,14 +271,14 @@ impl User { /// Impl for `callback:...` and `login-callback:...`. pub async fn from_callback_impl( - req: Request, + req: Request, auth_config: &AuthConfig, ) -> Result, Response> { trace!("Sending request to callback '{}'", req.uri()); // Send request and download response. // TOOD: Only create client once! - let client = hyper::Client::new(); + let client = util::http_client().expect("TODO"); // TODO let response = client.request(req).await.map_err(|e| { // TODO: maybe limit how quickly that can be logged? error!("Error contacting auth callback: {e}"); diff --git a/backend/src/cmd/check.rs b/backend/src/cmd/check.rs index 49c4b783e..68b56277f 100644 --- a/backend/src/cmd/check.rs +++ b/backend/src/cmd/check.rs @@ -147,7 +147,7 @@ async fn check_meili(config: &Config) -> Result { } async fn check_opencast_sync(config: &Config) -> Result<()> { - let client = OcClient::new(config); + let client = OcClient::new(config)?; crate::sync::check_compatibility(&client).await?; client.test_harvest().await?; Ok(()) diff --git a/backend/src/http/assets.rs b/backend/src/http/assets.rs index 05cdf9784..178f3ff26 100644 --- a/backend/src/http/assets.rs +++ b/backend/src/http/assets.rs @@ -1,13 +1,13 @@ use std::collections::HashMap; use bstr::ByteSlice; -use hyper::{Body, StatusCode}; +use hyper::{StatusCode}; use reinda::{assets, Setup}; use secrecy::ExposeSecret; use serde_json::json; -use crate::{auth::AuthSource, config::Config, prelude::*}; -use super::{Response, handlers::CommonHeadersExt}; +use crate::{auth::AuthSource, config::Config, prelude::*, util::ByteBody}; +use super::{handlers::CommonHeadersExt, Response}; const ASSETS: Setup = assets! { @@ -216,7 +216,7 @@ impl Assets { builder = builder.header("cache-control", "public, max-age=31536000, immutable"); } - let body = Body::from(data); + let body = ByteBody::new(data); Some(builder.body(body).expect("bug: invalid response")) } diff --git a/backend/src/http/handlers.rs b/backend/src/http/handlers.rs index 873782ff9..1a1295c59 100644 --- a/backend/src/http/handlers.rs +++ b/backend/src/http/handlers.rs @@ -1,4 +1,9 @@ -use hyper::{Body, Method, StatusCode, http::{HeaderValue, uri::PathAndQuery}, header, Uri}; +use hyper::{ + body::Incoming, + header, + http::{uri::PathAndQuery, HeaderValue}, + Method, Request, StatusCode, Uri, +}; use juniper::{http::GraphQLResponse, graphql_value}; use std::{ collections::HashSet, @@ -16,14 +21,14 @@ use crate::{ metrics::HttpReqCategory, prelude::*, rss, - util::download_body, + util::{download_body, ByteBody}, Config, }; -use super::{Context, Request, Response, response}; +use super::{Context, Response, response}; /// This is the main HTTP entry point, called for each incoming request. -pub(super) async fn handle(req: Request, ctx: Arc) -> Response { +pub(super) async fn handle(req: Request, ctx: Arc) -> Response { let time_incoming = Instant::now(); trace!( "Incoming HTTP {:?} request to '{}'", @@ -79,7 +84,7 @@ pub(super) async fn handle(req: Request, ctx: Arc) -> Response { Response::builder() .status(StatusCode::METHOD_NOT_ALLOWED) .header("Content-Type", "text/plain; charset=UTF-8") - .body(Body::from("405 Method not allowed")) + .body(ByteBody::new("405 Method not allowed".into())) .unwrap() } @@ -120,7 +125,7 @@ pub(super) async fn handle(req: Request, ctx: Arc) -> Response { register_req!(HttpReqCategory::Other); Response::builder() .header("Content-Type", "application/json") - .body(Body::from(ctx.jwt.jwks().to_owned())) + .body(ByteBody::new(ctx.jwt.jwks().clone())) .unwrap() } @@ -188,13 +193,13 @@ async fn handle_rss_request(path: &str, ctx: &Arc) -> Result, ctx: &Context) -> Result { +async fn handle_api(req: Request, ctx: &Context) -> Result { // TODO: With Juniper 0.16, this function can likely be simplified! /// This is basically `juniper::http::GraphQLRequest`. We unfortunately have @@ -243,7 +248,7 @@ async fn handle_api(req: Request, ctx: &Context) -> Result, ctx: &Context) -> Result(&raw_body).map_err(|e| { warn!("Failed to deserialize GraphQL request: {e}"); - response::bad_request(Some("invalid GraphQL request body")) + response::bad_request("invalid GraphQL request body") })?; @@ -365,7 +370,7 @@ async fn handle_api(req: Request, ctx: &Context) -> Result { @@ -535,7 +540,7 @@ trait MakeNoindexExt { fn make_noindex(self, noindex: bool) -> Self; } -impl MakeNoindexExt for hyper::Response { +impl MakeNoindexExt for Response { /// Adds the `x-robots-tag: noindex` header if `noindex` is true. fn make_noindex(mut self, noindex: bool) -> Self { if noindex { diff --git a/backend/src/http/mod.rs b/backend/src/http/mod.rs index 808bcaa0f..8f9e3f1e6 100644 --- a/backend/src/http/mod.rs +++ b/backend/src/http/mod.rs @@ -4,11 +4,9 @@ //! `hyper` server and catches errors. The main logic is in `handlers.rs`. use deadpool_postgres::Pool; -use hyper::{ - Body, Server, - service::{make_service_fn, service_fn}, -}; -use hyperlocal::UnixServerExt; +use hyper::service::service_fn; +use hyper_util::{rt::{TokioExecutor, TokioIo}, server::conn::auto::Builder}; +use tokio::net::{TcpListener, UnixListener}; use std::{ convert::Infallible, fs, @@ -24,10 +22,11 @@ use crate::{ api, auth::{self, JwtContext}, config::Config, + default_enable_backtraces, metrics, prelude::*, search, - default_enable_backtraces, + util::ByteBody, }; use self::{ assets::Assets, @@ -62,8 +61,8 @@ pub(crate) struct HttpConfig { // Our requests and responses always use the hyper provided body type. -pub(crate) type Response = hyper::Response; -pub(crate) type Request = hyper::Request; +pub(crate) type Response = hyper::Response; +// pub(crate) type Request = hyper::Request; /// Context that the request handler has access to. @@ -105,61 +104,53 @@ pub(crate) async fn serve( ctx_clone.auth_caches.maintainence_task(&ctx_clone.config).await; }); - // This sets up all the hyper server stuff. It's a bit of magic and touching - // this code likely results in strange lifetime errors. - // - // In short: a hyper "service" is something that can handle requests. The - // outer closure is called whenever hyper needs a new service instance (as - // far as I understand it, it does that only for each worker thread, for - // example). The inner closure is actually called each time a request is - // received. Seems a bit more complicated than a single "handler" function, - // but I'm sure hyper knows what they are doing. - // - // All our logic is encoded in the function `handle`. The only thing we are - // doing here is to pass the context to that function, and clone its `Arc` - // accordingly. - // - // We wrap the factory definition in a macro because we need two slightly - // different factories. One for binding to a unix socket and one for - // binding to a TCP socket. The code for defining the factory is exactly - // the same, but due to type inference, it results in a different type. The - // macro avoids code duplication. - macro_rules! factory { - () => { - make_service_fn(move |_| { + + // Helper macro to avoid duplicate code. It's basically just an abstraction + // over TcpListener and UnixListener, which is otherwise annoying to do. + macro_rules! listen { + ($listener:ident) => { + default_enable_backtraces(); + + loop { + let (tcp, _) = $listener.accept().await.context("failed to accept TCP connection")?; + let io = TokioIo::new(tcp); + let ctx = Arc::clone(&ctx); - async { - Ok::<_, Infallible>(service_fn(move |req| { - handle_internal_errors(handle(req, Arc::clone(&ctx))) - })) - } - }) - } + tokio::task::spawn(async move { + let res = Builder::new(TokioExecutor::new()) + .serve_connection(io, service_fn(move |req| { + handle_internal_errors(handle(req, Arc::clone(&ctx))) + })) + .await; + if let Err(e) = res { + warn!("Error serving connectiion: {e:#}"); + } + }); + } + }; } - // Start the server with our service. if let Some(unix_socket) = &http_config.unix_socket { // Bind to Unix domain socket. if unix_socket.exists() { fs::remove_file(unix_socket)?; } - let server = Server::bind_unix(&unix_socket)?.serve(factory!()); - default_enable_backtraces(); - info!("Listening on unix://{}", unix_socket.display()); + let listener = UnixListener::bind(unix_socket) + .context(format!("failed to bind unix socket {}", unix_socket.display()))?; let permissions = fs::Permissions::from_mode(http_config.unix_socket_permissions); fs::set_permissions(unix_socket, permissions)?; - server.await?; + info!("Listening on unix://{}", unix_socket.display()); + listen!(listener); } else { // Bind to TCP socket. let addr = SocketAddr::new(http_config.address, http_config.port); - let server = Server::bind(&addr).serve(factory!()); - default_enable_backtraces(); - info!("Listening on http://{}", server.local_addr()); - server.await?; + let listener = TcpListener::bind(&addr).await + .context(format!("failed to bind socket address {addr}"))?; + info!("Listening on http://{}", + listener.local_addr().context("failed to acquire local addr")?); + listen!(listener); } - - Ok(()) } /// This just wraps another future and catches all panics that might occur when diff --git a/backend/src/http/response.rs b/backend/src/http/response.rs index b87dd8945..dd622f067 100644 --- a/backend/src/http/response.rs +++ b/backend/src/http/response.rs @@ -1,5 +1,7 @@ +use bytes::Bytes; use hyper::StatusCode; +use crate::prelude::*; use super::Response; @@ -10,14 +12,10 @@ pub(crate) fn service_unavailable() -> Response { .unwrap() } -pub(crate) fn bad_request<'a>(msg: impl Into>) -> Response { - let body = match msg.into() { - Some(s) => hyper::Body::from(s.to_owned()), - None => hyper::Body::from("Bad request"), - }; +pub(crate) fn bad_request(msg: impl Into) -> Response { Response::builder() .status(StatusCode::BAD_REQUEST) - .body(body) + .body(msg.into().into()) .unwrap() } diff --git a/backend/src/prelude.rs b/backend/src/prelude.rs index 0e4fc7d50..22fa35df9 100644 --- a/backend/src/prelude.rs +++ b/backend/src/prelude.rs @@ -9,5 +9,5 @@ pub(crate) use tap::Pipe; pub(crate) use crate::{ auth::HasRoles, db::util::{dbargs, FromDb}, - util::InspectExt, + util::{InspectExt, ResponseExt, FullBodyExt}, }; diff --git a/backend/src/sync/client.rs b/backend/src/sync/client.rs index 9776ffe16..4a3662f6f 100644 --- a/backend/src/sync/client.rs +++ b/backend/src/sync/client.rs @@ -1,13 +1,15 @@ use std::time::{Duration, Instant}; use base64::Engine; +use bytes::Bytes; use chrono::{DateTime, Utc, TimeZone}; use hyper::{ - Body, Request, Response, StatusCode, - client::{Client, HttpConnector}, - http::{uri::{Authority, Scheme, Uri}, request, self}, + Response, Request, StatusCode, + body::Incoming, + http::{self, request, uri::{Authority, Scheme, Uri}}, }; use hyper_rustls::HttpsConnector; +use hyper_util::client::legacy::{connect::HttpConnector, Client}; use secrecy::{ExposeSecret, Secret}; use tap::TapFallible; @@ -20,10 +22,13 @@ use crate::{ use super::VersionResponse; +// Most requests have an empty body, but sending stats requires sending data in +// the body. +type RequestBody = http_body_util::Full; /// Used to send request to the harvesting API. pub(crate) struct OcClient { - http_client: Client, Body>, + http_client: Client, RequestBody>, scheme: Scheme, authority: Authority, auth_header: Secret, @@ -35,8 +40,8 @@ impl OcClient { const VERSION_PATH: &'static str = "/tobira/version"; const STATS_PATH: &'static str = "/tobira/stats"; - pub(crate) fn new(config: &Config) -> Self { - let http_client = crate::util::http_client(); + pub(crate) fn new(config: &Config) -> Result { + let http_client = crate::util::http_client()?; // Prepare authentication let credentials = format!( @@ -47,13 +52,13 @@ impl OcClient { let encoded_credentials = base64::engine::general_purpose::STANDARD.encode(credentials); let auth_header = format!("Basic {}", encoded_credentials); - Self { + Ok(Self { http_client, scheme: config.opencast.sync_node().scheme.clone(), authority: config.opencast.sync_node().authority.clone(), auth_header: Secret::new(auth_header), username: config.sync.user.clone(), - } + }) } pub(crate) async fn get_version(&self) -> Result { @@ -113,7 +118,7 @@ impl OcClient { } /// Sends the given serialized JSON to the `/stats` endpoint in Opencast. - pub async fn send_stats(&self, stats: String) -> Result> { + pub async fn send_stats(&self, stats: String) -> Result> { let req = self.req_builder(Self::STATS_PATH) .method(http::Method::POST) .header(http::header::CONTENT_TYPE, "application/json") @@ -123,9 +128,9 @@ impl OcClient { self.http_client.request(req).await.map_err(Into::into) } - fn build_req(&self, path_and_query: &str) -> (Uri, Request) { + fn build_req(&self, path_and_query: &str) -> (Uri, Request) { let req = self.req_builder(path_and_query) - .body(Body::empty()) + .body(RequestBody::empty()) .expect("bug: failed to build request"); (req.uri().clone(), req) @@ -146,7 +151,7 @@ impl OcClient { async fn deserialize_response serde::Deserialize<'de>>( &self, - response: Response, + response: Response, uri: &Uri, ) -> Result<(T, usize)> { let (parts, body) = response.into_parts(); diff --git a/backend/src/sync/mod.rs b/backend/src/sync/mod.rs index fd81413a5..027180a4f 100644 --- a/backend/src/sync/mod.rs +++ b/backend/src/sync/mod.rs @@ -19,7 +19,7 @@ const MIN_REQUIRED_API_VERSION: ApiVersion = ApiVersion::new(1, 0); pub(crate) async fn run(daemon: bool, db: DbConnection, config: &Config) -> Result<()> { - let client = OcClient::new(config); + let client = OcClient::new(config)?; check_compatibility(&client).await?; harvest::run(daemon, config, &client, db).await } diff --git a/backend/src/sync/stats.rs b/backend/src/sync/stats.rs index f4aed7b7e..6a160aa6a 100644 --- a/backend/src/sync/stats.rs +++ b/backend/src/sync/stats.rs @@ -4,7 +4,7 @@ use hyper::StatusCode; use serde::Serialize; use tokio_postgres::Row; -use crate::{config::Config, db::DbConnection, prelude::*}; +use crate::{config::Config, db::DbConnection, prelude::*, util::Never}; use super::OcClient; @@ -16,12 +16,12 @@ const SEND_PERIOD: Duration = Duration::from_secs(60 * 60 * 24); /// to sharing basic data as part of adopter registration, this data is sent to /// the Opencast server. Otherwise it is not used at all (and only stored in /// memory at the Opencast side). -pub(crate) async fn run_daemon(db: DbConnection, config: &Config) -> ! { +pub(crate) async fn run_daemon(db: DbConnection, config: &Config) -> Result { // Let the other more important worker processes do stuff first. This is // mainly to have less interleaved output in the log. tokio::time::sleep(Duration::from_secs(3)).await; - let client = OcClient::new(config); + let client = OcClient::new(config)?; loop { if let Err(e) = send_stats(&client, &db, config).await { diff --git a/backend/src/util.rs b/backend/src/util.rs index 2564a877d..c31614a4a 100644 --- a/backend/src/util.rs +++ b/backend/src/util.rs @@ -1,11 +1,12 @@ use std::fmt; use bytes::Bytes; -use hyper::{body::HttpBody, client::HttpConnector}; +use http_body_util::BodyExt; use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder}; +use hyper_util::client::legacy::{connect::HttpConnector, Client}; use rand::{RngCore, CryptoRng}; use secrecy::Secret; -use crate::prelude::*; +use crate::{http::Response, prelude::*}; /// A lazy `fmt` formatter, specified by a callable. Usually created via @@ -63,15 +64,44 @@ pub(crate) fn gen_random_bytes_crypto() -> Secret<[u8; N]> { Secret::new(imp(rand::thread_rng())) } +pub(crate) type HttpsClient = Client, B>; + /// Returns an HTTP client that can also speak HTTPS. HTTPS is _not_ enforced! -pub(crate) fn http_client() -> hyper::Client, hyper::Body> { +pub(crate) fn http_client() -> Result> +where + B: hyper::body::Body + Send, + B::Data: Send, +{ let https = HttpsConnectorBuilder::new() .with_native_roots() + .context("failed to load native certificate roots")? .https_or_http() .enable_http1() .enable_http2() .build(); - hyper::Client::builder().build(https) + Ok(Client::builder(hyper_util::rt::TokioExecutor::new()).build(https)) +} + +pub(crate) type ByteBody = http_body_util::Full; + +pub(crate) trait FullBodyExt { + fn empty() -> Self; +} + +impl FullBodyExt for ByteBody { + fn empty() -> Self { + Self::new(Bytes::new()) + } +} + +pub(crate) trait ResponseExt { + fn builder() -> hyper::http::response::Builder; +} + +impl ResponseExt for Response { + fn builder() -> hyper::http::response::Builder { + hyper::Response::builder() + } } /// This just adds a stable version of `Result::inspect` and `Option::inspect`. @@ -100,7 +130,7 @@ impl InspectExt for Result { pub(crate) async fn download_body(body: B) -> Result where - B: HttpBody, + B: hyper::body::Body, B::Error: 'static + Send + Sync + std::error::Error, { // TODO: this should somehow limit the size in order to prevent DOS attacks From a6322b10a5ca4256c189de60fbb5e328823ab0bf Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Fri, 23 Feb 2024 09:50:20 +0100 Subject: [PATCH 10/10] Put `HttpsClient` in context to avoid recreating one for every request --- backend/src/auth/handlers.rs | 22 +++++---------- backend/src/auth/mod.rs | 53 ++++++++++++++++++------------------ backend/src/http/handlers.rs | 7 +---- backend/src/http/mod.rs | 4 ++- 4 files changed, 38 insertions(+), 48 deletions(-) diff --git a/backend/src/auth/handlers.rs b/backend/src/auth/handlers.rs index f44b0bf1f..19aa020b9 100644 --- a/backend/src/auth/handlers.rs +++ b/backend/src/auth/handlers.rs @@ -1,13 +1,11 @@ use std::unreachable; use base64::Engine; -use bytes::Bytes; use hyper::{body::Incoming, StatusCode, Request}; use serde::Deserialize; use crate::{ auth::config::LoginCredentialsHandler, - config::OpencastConfig, db, http::{self, response::bad_request, Context, Response}, prelude::*, @@ -31,12 +29,7 @@ pub(crate) async fn handle_post_session( User::from_auth_headers(&req.headers(), &ctx.config.auth) } SessionEndpointHandler::Callback(callback_url) => { - User::from_auth_callback( - &req.headers(), - &callback_url, - &ctx.config.auth, - &ctx.auth_caches, - ).await? + User::from_auth_callback(&req.headers(), &callback_url, ctx).await? } }; @@ -160,7 +153,7 @@ pub(crate) async fn handle_post_login(req: Request, ctx: &Context) -> // Check the login data. let user = match &ctx.config.auth.session.from_login_credentials { LoginCredentialsHandler::Opencast => { - match check_opencast_login(&userid, &password, &ctx.config.opencast).await { + match check_opencast_login(&userid, &password, ctx).await { Err(e) => { error!("Error occured while checking Opencast login data: {e:#}"); return http::response::internal_server_error(); @@ -177,7 +170,7 @@ pub(crate) async fn handle_post_login(req: Request, ctx: &Context) -> *req.method_mut() = hyper::Method::POST; *req.uri_mut() = callback_url.clone(); - match User::from_callback_impl(req, &ctx.config.auth).await { + match User::from_callback_impl(req, ctx).await { Err(e) => return e, Ok(user) => user, } @@ -197,10 +190,9 @@ pub(crate) async fn handle_post_login(req: Request, ctx: &Context) -> async fn check_opencast_login( userid: &str, password: &str, - config: &OpencastConfig, + ctx: &Context, ) -> Result> { trace!("Checking Opencast login..."); - let client = crate::util::http_client().expect("TODO"); // TODO!!!! // Send request. We use basic auth here: our configuration checks already // assert that we use HTTPS or Opencast is running on the same machine @@ -209,11 +201,11 @@ async fn check_opencast_login( .encode(&format!("{userid}:{password}")); let auth_header = format!("Basic {}", credentials); let req = Request::builder() - .uri(config.sync_node().clone().with_path_and_query("/info/me.json")) + .uri(ctx.config.opencast.sync_node().clone().with_path_and_query("/info/me.json")) .header(hyper::header::AUTHORIZATION, auth_header) - .body(http_body_util::Empty::::new()) + .body(ByteBody::empty()) .unwrap(); - let response = client.request(req).await?; + let response = ctx.http_client.request(req).await?; // We treat all non-OK response as invalid login data. diff --git a/backend/src/auth/mod.rs b/backend/src/auth/mod.rs index 7a1ca5d26..fede626c8 100644 --- a/backend/src/auth/mod.rs +++ b/backend/src/auth/mod.rs @@ -9,7 +9,12 @@ use secrecy::ExposeSecret; use serde::Deserialize; use tokio_postgres::Error as PgError; -use crate::{db::util::select, http::{response, Response}, prelude::*, util::{self, download_body, ByteBody}}; +use crate::{ + db::util::select, + http::{response, Context, Response}, + prelude::*, + util::{download_body, ByteBody}, +}; mod cache; @@ -66,19 +71,18 @@ pub(crate) struct User { impl AuthContext { pub(crate) async fn new( headers: &HeaderMap, - auth_config: &AuthConfig, db: &Client, - caches: &Caches, + ctx: &Context, ) -> Result { if let Some(given_key) = headers.get("x-tobira-trusted-external-key") { - if let Some(trusted_key) = &auth_config.trusted_external_key { + if let Some(trusted_key) = &ctx.config.auth.trusted_external_key { if trusted_key.expose_secret() == given_key { return Ok(Self::TrustedExternal); } } } - User::new(headers, auth_config, db, caches) + User::new(headers, db, ctx) .await? .map_or(Self::Anonymous, Self::User) .pipe(Ok) @@ -105,22 +109,21 @@ impl User { /// `auth.source`. The `users` table is updated if appropriate. pub(crate) async fn new( headers: &HeaderMap, - auth_config: &AuthConfig, db: &Client, - caches: &Caches, + ctx: &Context, ) -> Result, Response> { - let mut out = match &auth_config.source { + let mut out = match &ctx.config.auth.source { AuthSource::None => None, - AuthSource::TobiraSession => Self::from_session(headers, db, auth_config).await?, - AuthSource::TrustAuthHeaders => Self::from_auth_headers(headers, auth_config), + AuthSource::TobiraSession => Self::from_session(headers, db, &ctx.config.auth).await?, + AuthSource::TrustAuthHeaders => Self::from_auth_headers(headers, &ctx.config.auth), AuthSource::Callback(uri) => { - Self::from_auth_callback(headers, uri, auth_config, caches).await? + Self::from_auth_callback(headers, uri, ctx).await? } }; if let Some(user) = &mut out { user.add_default_roles(); - caches.user.upsert_user_info(user, db).await; + ctx.auth_caches.user.upsert_user_info(user, db).await; } @@ -212,21 +215,20 @@ impl User { pub(crate) async fn from_auth_callback( headers: &HeaderMap, callback_url: &Uri, - auth_config: &AuthConfig, - caches: &Caches, + ctx: &Context, ) -> Result, Response> { // TODO: instead of creating a new header map, we could take the old one // and just remove the headers we are not interested in. This is kind // of blocked by this: https://github.com/hyperium/http/issues/541 let mut req = Request::new(ByteBody::empty()); - for h in auth_config.callback.relevant_headers.iter().flatten() { + for h in ctx.config.auth.callback.relevant_headers.iter().flatten() { for value in headers.get_all(h) { req.headers_mut().append(h.clone(), value.clone()); } } - if let Some(relevant_cookies) = &auth_config.callback.relevant_cookies { + if let Some(relevant_cookies) = &ctx.config.auth.callback.relevant_cookies { headers.get_all(hyper::header::COOKIE) .into_iter() .filter_map(|value| value.to_str().ok()) // Ignore non-UTF8 cookies @@ -250,20 +252,21 @@ impl User { // Check cache. let mut header_copy = None; - if !auth_config.callback.cache_duration.is_zero() { + if !ctx.config.auth.callback.cache_duration.is_zero() { header_copy = Some(req.headers().clone()); - if let Some(user) = caches.callback.get(req.headers(), &auth_config.callback) { + let callback_config = &ctx.config.auth.callback; + if let Some(user) = ctx.auth_caches.callback.get(req.headers(), callback_config) { return Ok(user); } } // Cache miss or disabled cache: ask the callback. *req.uri_mut() = callback_url.clone(); - let out = Self::from_callback_impl(req, auth_config).await?; + let out = Self::from_callback_impl(req, ctx).await?; // Insert into cache - if !auth_config.callback.cache_duration.is_zero() { - caches.callback.insert(header_copy.unwrap(), out.clone()); + if !ctx.config.auth.callback.cache_duration.is_zero() { + ctx.auth_caches.callback.insert(header_copy.unwrap(), out.clone()); } Ok(out) @@ -272,14 +275,12 @@ impl User { /// Impl for `callback:...` and `login-callback:...`. pub async fn from_callback_impl( req: Request, - auth_config: &AuthConfig, + ctx: &Context, ) -> Result, Response> { trace!("Sending request to callback '{}'", req.uri()); // Send request and download response. - // TOOD: Only create client once! - let client = util::http_client().expect("TODO"); // TODO - let response = client.request(req).await.map_err(|e| { + let response = ctx.http_client.request(req).await.map_err(|e| { // TODO: maybe limit how quickly that can be logged? error!("Error contacting auth callback: {e}"); callback_bad_gateway() @@ -327,7 +328,7 @@ impl User { error!("Auth callback returned empty strings as user info"); return Err(callback_bad_gateway()); } - if !auth_config.is_user_role(&user_role) { + if !ctx.config.auth.is_user_role(&user_role) { error!("Auth callback returned a user role that does not start \ with the configured user role prefix."); return Err(callback_bad_gateway()); diff --git a/backend/src/http/handlers.rs b/backend/src/http/handlers.rs index 1a1295c59..365b97ef0 100644 --- a/backend/src/http/handlers.rs +++ b/backend/src/http/handlers.rs @@ -271,12 +271,7 @@ async fn handle_api(req: Request, ctx: &Context) -> Result tx, diff --git a/backend/src/http/mod.rs b/backend/src/http/mod.rs index 8f9e3f1e6..0fe400f62 100644 --- a/backend/src/http/mod.rs +++ b/backend/src/http/mod.rs @@ -26,7 +26,7 @@ use crate::{ metrics, prelude::*, search, - util::ByteBody, + util::{self, ByteBody, HttpsClient}, }; use self::{ assets::Assets, @@ -75,6 +75,7 @@ pub(crate) struct Context { pub(crate) search: Arc, pub(crate) metrics: Arc, pub(crate) auth_caches: auth::Caches, + pub(crate) http_client: HttpsClient, } @@ -97,6 +98,7 @@ pub(crate) async fn serve( search: Arc::new(search), metrics: Arc::new(metrics::Metrics::new()), auth_caches: auth::Caches::new(), + http_client: util::http_client().context("failed to create HTTP client")?, }); let ctx_clone = ctx.clone();