diff --git a/Cargo.lock b/Cargo.lock index 0ea19c1..729c186 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,69 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aead" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1973cfbc1a2daf9cf550e74e1f088c28e7f7d8c1e1418fb6c9dc5184b7e84c99" +dependencies = [ + "crypto-common 0.2.2", + "inout", +] + +[[package]] +name = "aes" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fc36d7440d015b45468ba08a21e80e056ebbd014c611c6298bb7503e04bd1" +dependencies = [ + "cipher", + "cpubits", + "cpufeatures 0.3.1", +] + +[[package]] +name = "aes-gcm" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2b8006a0c83f52b62ba44a97b58bf76fe2f70a329e588f67f89691d93d498f" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ctutils", + "ghash", +] + +[[package]] +name = "aes-keywrap" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf71a903b87eeef4903e7077cc9689f0c8449e093395db09dc48d1a39934e770" +dependencies = [ + "aes", + "byteorder", +] + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + [[package]] name = "anstream" version = "1.0.0" @@ -58,18 +121,205 @@ version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "askama" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6024d73179f43f15ccd2b881bfea6fee7f3a46ec53f33b52210dea749ebebaa4" +dependencies = [ + "askama_macros", + "itoa", + "percent-encoding", + "serde", + "serde_json", +] + +[[package]] +name = "askama_derive" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071ee5ebf2138e3ad180e0aacf6940c2cab5e6d8333741d9925c7bee2b153f39" +dependencies = [ + "askama_parser", + "basic-toml", + "glob", + "memchr", + "proc-macro2", + "quote", + "rustc-hash", + "serde", + "serde_derive", + "syn 3.0.10", +] + +[[package]] +name = "askama_macros" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643e1c7cbb6aec1d920332fe51a7c0d8219e273dcb8602db03f5263e4d16487b" +dependencies = [ + "askama_derive", +] + +[[package]] +name = "askama_parser" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c5ae75772275d268b03ab8bdccdd12117b6169ee23256942b34e46c9f476583" +dependencies = [ + "rustc-hash", + "serde", + "serde_derive", + "unicode-ident", + "winnow 1.0.5", +] + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" +[[package]] +name = "axum" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b698c5f9a010f6573133b09e0de5408834d0c82f8d7475a89fc1867a71cd90" +dependencies = [ + "axum-core", + "bytes", + "form_urlencoded", + "futures-util", + "http 1.5.0", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" +dependencies = [ + "bytes", + "futures-core", + "http 1.5.0", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base16ct" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd307490d624467aa6f74b0eabb77633d1f758a7b25f12bceb0b22e08d9726f6" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "basic-toml" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a" +dependencies = [ + "serde", +] + +[[package]] +name = "binstring" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1c05f270702529040b45d3389e1245bc21c5e5df78b2a509e1e3d7bcd47a18e" + [[package]] name = "bitflags" version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +[[package]] +name = "blake2b_simd" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3560a7b1951efe814fcd721938313adc56753ca39f4b23847d7e9a2402f5dbff" +dependencies = [ + "arrayvec", + "constant_time_eq", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -79,6 +329,37 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-buffer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" +dependencies = [ + "hybrid-array", + "zeroize", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "bumpalo" +version = "3.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "bytes" version = "1.12.2" @@ -107,6 +388,31 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "rand_core 0.10.1", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + [[package]] name = "ciborium" version = "0.2.2" @@ -134,6 +440,17 @@ dependencies = [ "half", ] +[[package]] +name = "cipher" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf2a2c93cd704877c0858356ed03480ff301ee950b43f1cbe4573b088bfa6c" +dependencies = [ + "block-buffer 0.12.1", + "crypto-common 0.2.2", + "inout", +] + [[package]] name = "clap" version = "4.6.8" @@ -174,12 +491,76 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0921b3876b3a1df8a1c9f912e7f94342458022c2e84288015893d83c4d62a79" +[[package]] +name = "cmov" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" + +[[package]] +name = "coarsetime" +version = "0.1.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae63702c5627c75addbfb1ea9d1b3842205a6ffd43e4cce884a2a9eb1828fd7" +dependencies = [ + "libc", + "wasix", + "wasm-bindgen", +] + [[package]] name = "colorchoice" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" +[[package]] +name = "const-oid" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d6f2aa4d0537bcc1c74df8755072bd31c1ef1a3a1b85a68e8404a8c353b7b8b" + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "const-oid" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a" + +[[package]] +name = "constant_time_eq" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" + +[[package]] +name = "cookie" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a373e3602691c3cdea496d2f0ee5935151e6168fe87739483c463db1b2f2f87" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpubits" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15b85f9c39137c3a891689859392b1bd49812121d0d61c9caf00d46ed5ce06ae" + [[package]] name = "cpufeatures" version = "0.2.17" @@ -189,12 +570,65 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + [[package]] name = "crunchy" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-bigint" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914c195c4d7fbc5ed7f88d14cbf85914d5c664967658d43404b263913a477e82" +dependencies = [ + "cpubits", + "ctutils", + "getrandom 0.4.3", + "hybrid-array", + "num-traits", + "rand_core 0.10.1", + "serdect", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.7" @@ -205,20 +639,195 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "getrandom 0.4.3", + "hybrid-array", + "rand_core 0.10.1", +] + +[[package]] +name = "crypto-primes" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3633a51a39c69ebbaa4feaa694bd83d241e4093901c84a0963b19d9bb3f0cf8f" +dependencies = [ + "crypto-bigint 0.7.11", + "rand_core 0.10.1", +] + +[[package]] +name = "ct-codecs" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd9f3db6f2cfef61c10613071955154ffdc9e515daebff26de4b54e35038fdd" + +[[package]] +name = "ctr" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baaca1c4b237092596f64d571e9db6ce4109c4ef9742e27590f1709594461f21" +dependencies = [ + "cipher", +] + +[[package]] +name = "ctutils" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261af4dc7a06ea8a527a8717d8cbba3417530d6ea14e1edb3de6b67806be474f" +dependencies = [ + "cmov", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5eed333089e2e1c1ac8c6c0398e5e2497b4c9926ca6d0365ed1e099afa5bc23" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "curve25519-dalek-derive", + "digest 0.11.3", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 3.0.10", +] + +[[package]] +name = "darling_macro" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" +dependencies = [ + "darling_core", + "quote", + "syn 3.0.10", +] + [[package]] name = "data-encoding" version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" +[[package]] +name = "der" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79b71cca7d95d7681a4b3b9cdf63c8dbc3730d0584c2c74e31416d64a90493f4" +dependencies = [ + "const-oid 0.6.2", + "der_derive", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid 0.9.6", + "pem-rfc7468 0.7.0", + "zeroize", +] + +[[package]] +name = "der" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a996a108feb8b427a6e12fcf6af4aa83409b79d72c15337d7741368131ee004" +dependencies = [ + "const-oid 0.10.3", + "pem-rfc7468 1.0.0", + "zeroize", +] + +[[package]] +name = "der_derive" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8aed3b3c608dc56cf36c45fe979d04eda51242e6703d8d0bb03426ef7c41db6a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure 0.12.6", +] + +[[package]] +name = "deranged" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" +dependencies = [ + "serde_core", +] + [[package]] name = "digest" version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", - "crypto-common", + "block-buffer 0.10.4", + "const-oid 0.9.6", + "crypto-common 0.1.7", + "subtle", +] + +[[package]] +name = "digest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +dependencies = [ + "block-buffer 0.12.1", + "const-oid 0.10.3", + "crypto-common 0.2.2", + "ctutils", + "zeroize", ] [[package]] @@ -232,6 +841,142 @@ dependencies = [ "syn 3.0.10", ] +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der 0.7.10", + "digest 0.10.7", + "elliptic-curve 0.13.8", + "rfc6979 0.4.0", + "signature 2.2.0", + "spki 0.7.3", +] + +[[package]] +name = "ecdsa" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0681a4fc24c767085329728d8dfba959af91228aa4610cca4f8ce317ba46ae0" +dependencies = [ + "der 0.8.3", + "digest 0.11.3", + "elliptic-curve 0.14.3", + "rfc6979 0.6.0", + "signature 3.0.0", + "spki 0.8.1", + "zeroize", +] + +[[package]] +name = "ece" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2467bac73e5a36d75e16cab0fa8d40676f075db6afde7d78b35f033e1f66e37" +dependencies = [ + "base64 0.22.1", + "byteorder", + "hex", + "hkdf", + "lazy_static", + "once_cell", + "openssl", + "serde", + "sha2 0.10.9", + "thiserror 2.0.21", +] + +[[package]] +name = "ed25519" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29fcf32e6c73d1079f83ab4d782de2d81620346a5f38c6237a86a22f8368980a" +dependencies = [ + "pkcs8 0.11.0", + "signature 3.0.0", +] + +[[package]] +name = "ed25519-compact" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9547879431a90e352a35863a54416d92898a787b9af09e6ae2e09a96bd78be80" +dependencies = [ + "ct-codecs", + "getrandom 0.4.3", +] + +[[package]] +name = "ed25519-dalek" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ebaa1a2bf1290ab3bfe5a7b771d050ebffab2711c19a81691c683a5144a25de" +dependencies = [ + "curve25519-dalek", + "ed25519", + "serde", + "sha2 0.11.1", + "signature 3.0.0", + "subtle", + "zeroize", +] + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct 0.2.0", + "crypto-bigint 0.5.5", + "digest 0.10.7", + "ff 0.13.1", + "generic-array", + "group 0.13.0", + "hkdf", + "pem-rfc7468 0.7.0", + "pkcs8 0.10.2", + "rand_core 0.6.4", + "sec1 0.7.3", + "subtle", + "zeroize", +] + +[[package]] +name = "elliptic-curve" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900f37e7e18d74a2347389af6cd69e3a30d5cc9e697f40004865679aa75e9c7c" +dependencies = [ + "base16ct 1.0.0", + "crypto-bigint 0.7.11", + "crypto-common 0.2.2", + "digest 0.11.3", + "ff 0.14.0", + "group 0.14.0", + "hybrid-array", + "pem-rfc7468 1.0.0", + "pkcs8 0.11.0", + "rand_core 0.10.1", + "sec1 0.8.1", + "subtle", + "zeroize", +] + [[package]] name = "equivalent" version = "1.0.3" @@ -248,18 +993,83 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + [[package]] name = "fastrand" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "ff" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f686ab92a9fb0eaf188f6c6c87b89490baa6fdb0db4544ba4dc47f7942489f" +dependencies = [ + "rand_core 0.10.1", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64cd1e32ddd350061ae6edb1b082d7c54915b5c672c389143b9a63403a109f24" + [[package]] name = "find-msvc-tools" version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.2.2" @@ -365,6 +1175,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -374,8 +1185,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -397,8 +1210,48 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi 6.0.0", + "rand_core 0.10.1", + "wasm-bindgen", +] + +[[package]] +name = "ghash" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eecf2d5dc9b66b732b97707a0210906b1d30523eb773193ab777c0c84b3e8d5" +dependencies = [ + "polyval", +] + +[[package]] +name = "glob" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff 0.13.1", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "group" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fd1a1c7a5206c5b7a3f5a0d7ccd3ff85d0c8f5133d62a02680255b0004af5f4" +dependencies = [ + "ff 0.14.0", + "rand_core 0.10.1", + "subtle", ] [[package]] @@ -412,11 +1265,38 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "foldhash", +] + [[package]] name = "hashbrown" version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashlink" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a596f1b20ed2cc5ecac41a164aaebc7258057060f06c0cf7a2ba3991ee7990fb" +dependencies = [ + "hashbrown 0.17.1", +] [[package]] name = "heck" @@ -430,6 +1310,73 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac 0.12.1", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "hmac" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f" +dependencies = [ + "digest 0.11.3", +] + +[[package]] +name = "hmac-sha1-compact" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5286b48a73829e3541cd9f533359c01150f7879e2716796eda0631ad5fe7e668" +dependencies = [ + "digest 0.11.3", +] + +[[package]] +name = "hmac-sha256" +version = "1.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad320b3b96fb2a455a0726d16efe0a5afdbd34b71dea5bc53b05ea057714d4e" +dependencies = [ + "digest 0.10.7", + "digest 0.11.3", +] + +[[package]] +name = "hmac-sha512" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66de62217b456dfbbba2bed965a134a4df57c48f0eac4c772018aee528e72244" +dependencies = [ + "digest 0.10.7", + "digest 0.11.3", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http" version = "1.5.0" @@ -440,18 +1387,143 @@ dependencies = [ "itoa", ] +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http 1.5.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http 1.5.0", + "http-body", + "pin-project-lite", +] + [[package]] name = "httparse" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + [[package]] name = "humantime" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15cdd26707701c53297e2fa6afb323d55fbc1d0810c3aec078ae3ef0424c3c15" +[[package]] +name = "hybrid-array" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" +dependencies = [ + "ctutils", + "subtle", + "typenum", + "zeroize", +] + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-core", + "http 1.5.0", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" +dependencies = [ + "http 1.5.0", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots 1.0.12", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http 1.5.0", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "icu_collections" version = "2.4.0" @@ -535,6 +1607,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "1.1.0" @@ -556,6 +1634,17 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + [[package]] name = "indexmap" version = "2.14.2" @@ -563,27 +1652,243 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.17.1", + "serde", + "serde_core", ] +[[package]] +name = "inout" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a580c13f0ffc335ef42dd3f6b1a41b726051c5e1656d9a3aa6fddb3c5dfbbf9" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + [[package]] name = "is_terminal_polyfill" version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" +[[package]] +name = "jiff" +version = "0.2.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175dc66334db3b9ab9985bf8b61cfed50dc16d20964bb47f9e479adcae984a7f" +dependencies = [ + "jiff-core 0.1.8", + "jiff-static 0.2.46", + "jiff-tzdb-platform 0.1.3", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-link", +] + +[[package]] +name = "jiff" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e77cbfb9fff4798e283c2d69dff39fc2c45e7da017e5ce95b654e46ea41236" +dependencies = [ + "jiff-core 1.0.1", + "jiff-static 1.0.2", + "jiff-tzdb-platform 1.0.0", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-link", +] + +[[package]] +name = "jiff-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e599b80292e597019b8b3e392de3f4bea2959ddfb8c7dff60e035e9e311a2c1b" +dependencies = [ + "log", +] + +[[package]] +name = "jiff-core" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b46a105a9874634dd96231021526bf24ca04955a5998c59a9c7666e634b7b8" +dependencies = [ + "log", +] + +[[package]] +name = "jiff-static" +version = "0.2.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7b1af7547d47354bc438d797e3854601bde8f8d185780c5ba4ab27afa54f1ba" +dependencies = [ + "jiff-core 0.1.8", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jiff-static" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9067a0b23e5be3147d56b2dcf652b18e6b1364caca93fb157653b6fbcab23a9" +dependencies = [ + "jiff-core 1.0.1", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "jiff-tzdb" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0980fca2cc272465bd60e82397607ba9f33add9e48defd77923301bbd03808f2" + +[[package]] +name = "jiff-tzdb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e71a1b68a875a44a33bb7a1dd84392cb77145a3367a552a3cfe6a4f5cf3afc" + +[[package]] +name = "jiff-tzdb-platform" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" +dependencies = [ + "jiff-tzdb 0.1.10", +] + +[[package]] +name = "jiff-tzdb-platform" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc65b284afcfa8f6cf189c7274c805505314a7ab975c60e1f548bff56525420e" +dependencies = [ + "jiff-tzdb 1.0.0", +] + +[[package]] +name = "js-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "jwt-simple" +version = "0.12.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06a4207b9d1f423858853fb9ee8b34aebc2b661f3b446ca4efda46c4b3700a2f" +dependencies = [ + "anyhow", + "binstring", + "blake2b_simd", + "coarsetime", + "ct-codecs", + "ed25519-compact", + "hmac-sha1-compact", + "hmac-sha256", + "hmac-sha512", + "k256", + "p256 0.13.2", + "p384 0.13.1", + "rand 0.8.8", + "serde", + "serde_json", + "superboring", + "thiserror 2.0.21", + "zeroize", +] + +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa 0.16.9", + "elliptic-curve 0.13.8", + "once_cell", + "sha2 0.10.9", + "signature 2.2.0", +] + +[[package]] +name = "keccak" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8f198d1db720e4940b5a493201d199d9f24f568f8f746bd13706243a2f71598" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", +] + +[[package]] +name = "lazy_static" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" +dependencies = [ + "spin", +] + [[package]] name = "libc" version = "0.2.191" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libsqlite3-sys" +version = "0.38.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1d20bef17f513b9b3004532233187769cd072d790971f4e4da0e346eb6401e8" +dependencies = [ + "pkg-config", + "vcpkg", +] + [[package]] name = "linux-raw-sys" version = "0.12.1" @@ -611,6 +1916,18 @@ version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" +[[package]] +name = "lru-slab" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f" + +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + [[package]] name = "memchr" version = "2.8.3" @@ -626,6 +1943,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mime" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5848f5a9e8117cf94f2f90faac24a87ff81600ff8628c1e3deaab572e76bfa1" + [[package]] name = "mio" version = "1.2.5" @@ -637,6 +1960,33 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "ml-dsa" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f6d49c3f3f0e10e18ca975ffda66f8da0ec36521c1d911adcbc521bf0743f5c" +dependencies = [ + "const-oid 0.10.3", + "crypto-common 0.2.2", + "ctutils", + "hybrid-array", + "module-lattice", + "pkcs8 0.11.0", + "shake", + "signature 3.0.0", +] + +[[package]] +name = "module-lattice" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e412c8ee83a1c678f427806219c49c96b2511b9f07497514f0e43fb26155" +dependencies = [ + "ctutils", + "hybrid-array", + "num-traits", +] + [[package]] name = "nix" version = "0.31.4" @@ -650,6 +2000,77 @@ dependencies = [ "memoffset", ] +[[package]] +name = "num-bigint-dig" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7" +dependencies = [ + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand 0.8.8", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "oauth2" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51e219e79014df21a225b1860a479e2dcd7cbd9130f4defd4bd0e191ea31d67d" +dependencies = [ + "base64 0.22.1", + "chrono", + "getrandom 0.2.17", + "http 1.5.0", + "rand 0.8.8", + "reqwest", + "serde", + "serde_json", + "serde_path_to_error", + "sha2 0.10.9", + "thiserror 1.0.69", + "url", +] + [[package]] name = "once_cell" version = "1.21.4" @@ -662,6 +2083,135 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" +[[package]] +name = "openidconnect" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df0d098a59353679624d406825940139e2b2d554a52b64c9fb1b1bc42a11fe5c" +dependencies = [ + "base64 0.22.1", + "chrono", + "dyn-clone", + "ed25519-dalek", + "getrandom 0.4.3", + "hmac 0.12.1", + "http 1.5.0", + "itertools", + "log", + "oauth2", + "p256 0.14.0", + "p384 0.14.0", + "rand 0.8.8", + "rsa 0.9.10", + "serde", + "serde-value", + "serde_json", + "serde_path_to_error", + "serde_plain", + "serde_with", + "sha2 0.10.9", + "subtle", + "thiserror 1.0.69", + "url", +] + +[[package]] +name = "openssl" +version = "0.10.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4de8111e94a56adca7ebfe6c365b6d42f99deb69b74b6becacd4204e2f193aa2" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "openssl-sys" +version = "0.9.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19c413d6ec9ebaf5e1c829d355cb3e9f783778d700f135be0921d52fce3c60ae" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa 0.16.9", + "elliptic-curve 0.13.8", + "primeorder 0.13.6", + "sha2 0.10.9", +] + +[[package]] +name = "p256" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c9239b2dbc807adbbe147e8cf72ea7450c3a0aabe62cb8e75ff4ec22e1f72a" +dependencies = [ + "ecdsa 0.17.0", + "elliptic-curve 0.14.3", + "primefield", + "primeorder 0.14.0", + "sha2 0.11.1", +] + +[[package]] +name = "p384" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6" +dependencies = [ + "ecdsa 0.16.9", + "elliptic-curve 0.13.8", + "primeorder 0.13.6", + "sha2 0.10.9", +] + +[[package]] +name = "p384" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d17b851e6b3e378ab4ecb07fa2ed23f4d15f075735f8fec9fa1e7bdce5f8301f" +dependencies = [ + "ecdsa 0.17.0", + "elliptic-curve 0.14.3", + "fiat-crypto", + "primefield", + "primeorder 0.14.0", + "sha2 0.11.1", +] + [[package]] name = "parking_lot" version = "0.12.5" @@ -685,6 +2235,45 @@ dependencies = [ "windows-link", ] +[[package]] +name = "pem" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb" +dependencies = [ + "base64 0.13.1", + "once_cell", + "regex", +] + +[[package]] +name = "pem" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be" +dependencies = [ + "base64 0.22.1", + "serde_core", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "pem-rfc7468" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6305423e0e7738146434843d1694d621cce767262b2a86910beab705e4493d9" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.3.2" @@ -697,6 +2286,79 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der 0.7.10", + "pkcs8 0.10.2", + "spki 0.7.3", +] + +[[package]] +name = "pkcs1" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6250dd7321adbe93d12b750aee0ced159fd13e77f625edcdf1cb6f83cd99f650" +dependencies = [ + "der 0.8.3", + "spki 0.8.1", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der 0.7.10", + "spki 0.7.3", +] + +[[package]] +name = "pkcs8" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "451913da69c775a56034ea8d9003d27ee8948e12443eae7c038ba100a4f21cb7" +dependencies = [ + "der 0.8.3", + "spki 0.8.1", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "polyval" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0fa31d631f2b2cb2a544d0aa321ce847a94764d701ca2becc411138b93d49cd" +dependencies = [ + "cpubits", + "cpufeatures 0.3.1", + "universal-hash", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + [[package]] name = "potential_utf" version = "0.1.6" @@ -706,6 +2368,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "powerfmt" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -715,6 +2383,42 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "primefield" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c555a6e4eb7d4e158fcb028c835c3b8642206ddc279b5c6b202ef9a8bdb592f4" +dependencies = [ + "crypto-bigint 0.7.11", + "crypto-common 0.2.2", + "ff 0.14.0", + "rand_core 0.10.1", + "subtle", + "zeroize", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve 0.13.8", +] + +[[package]] +name = "primeorder" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c9f42978c78a00e3d68f69fc03e57a234debae69da4020a4fb588fcdcd07b06" +dependencies = [ + "elliptic-curve 0.14.3", + "once_cell", + "primefield", + "serdect", + "wnaf", +] + [[package]] name = "proc-macro2" version = "1.0.107" @@ -724,6 +2428,62 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "quinn" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.21", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe" +dependencies = [ + "bytes", + "getrandom 0.4.3", + "lru-slab", + "rand 0.10.4", + "rand_pcg", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.21", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.61.2", +] + [[package]] name = "quote" version = "1.0.47" @@ -745,14 +2505,46 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + [[package]] name = "rand" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" dependencies = [ - "rand_chacha", - "rand_core", + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", ] [[package]] @@ -762,7 +2554,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", ] [[package]] @@ -774,6 +2575,21 @@ dependencies = [ "getrandom 0.3.4", ] +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_pcg" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb95882a1e14462c69aea9984bb261293ccfe6022ef8de0eda18bd5afb0052df" +dependencies = [ + "rand_core 0.10.1", +] + [[package]] name = "redox_syscall" version = "0.5.18" @@ -783,6 +2599,113 @@ dependencies = [ "bitflags", ] +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "regex" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "http 1.5.0", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 1.0.12", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac 0.12.1", + "subtle", +] + +[[package]] +name = "rfc6979" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4a459cddafb3fe76b31fd8f1108007566c40301feb64dc7b54656eb7388172b" +dependencies = [ + "crypto-bigint 0.7.11", + "hmac 0.13.0", +] + [[package]] name = "ring" version = "0.17.14" @@ -797,6 +2720,106 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rmp" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ba8be72d372b2c9b35542551678538b562e7cf86c3315773cae48dfbfe7790c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "rmp-serde" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f81bee8c8ef9b577d1681a70ebbc962c232461e397b22c208c43c04b67a155" +dependencies = [ + "rmp", + "serde", +] + +[[package]] +name = "rsa" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" +dependencies = [ + "const-oid 0.9.6", + "digest 0.10.7", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1 0.7.5", + "pkcs8 0.10.2", + "rand_core 0.6.4", + "signature 2.2.0", + "spki 0.7.3", + "subtle", + "zeroize", +] + +[[package]] +name = "rsa" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e77fd77e0dea28b3011fd62d15445b7de7959333b0276d930e03be0f755699" +dependencies = [ + "const-oid 0.10.3", + "crypto-bigint 0.7.11", + "crypto-common 0.2.2", + "crypto-primes", + "digest 0.11.3", + "hmac 0.13.0", + "pkcs1 0.8.0", + "pkcs8 0.11.0", + "rand_core 0.10.1", + "sha2 0.11.1", + "signature 3.0.0", + "spki 0.8.1", + "zeroize", +] + +[[package]] +name = "rsqlite-vfs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c51c9ae4df8a7fba42103df5c621fa3c37eccf3a3c650879e90fc48b11cc192c" +dependencies = [ + "hashbrown 0.16.1", + "thiserror 2.0.21", +] + +[[package]] +name = "rusqlite" +version = "0.40.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23f2a97da3e3873c73cb2a2e71b35c40ff95e0b1eefa8d72d8499a6928c3b5b3" +dependencies = [ + "bitflags", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec", + "sqlite-wasm-rs", +] + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "1.1.6" @@ -830,6 +2853,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "102f35f7de7b06d8c61f1cff6592f5253e0dea431c74867aad5dfd70f44663fb" dependencies = [ + "web-time", "zeroize", ] @@ -844,12 +2868,93 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct 0.2.0", + "der 0.7.10", + "generic-array", + "pkcs8 0.10.2", + "subtle", + "zeroize", +] + +[[package]] +name = "sec1" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56d437c2f19203ce5f7122e507831de96f3d2d4d3be5af44a0b0a09d8a80e4d" +dependencies = [ + "base16ct 1.0.0", + "ctutils", + "der 0.8.3", + "hybrid-array", + "subtle", + "zeroize", +] + +[[package]] +name = "sec1_decode" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6326ddc956378a0739200b2c30892dccaf198992dfd7323274690b9e188af23" +dependencies = [ + "der 0.4.5", + "pem 0.8.3", + "thiserror 1.0.69", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + [[package]] name = "serde" version = "1.0.229" @@ -860,6 +2965,16 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + [[package]] name = "serde_bytes" version = "0.11.19" @@ -903,6 +3018,26 @@ dependencies = [ "zmij", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + +[[package]] +name = "serde_plain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1fc6db65a611022b23a0dec6975d63fb80a302cb3388835ff02c097258d50" +dependencies = [ + "serde", +] + [[package]] name = "serde_spanned" version = "1.1.3" @@ -912,6 +3047,62 @@ dependencies = [ "serde_core", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56cb1ca7c93ae63d6439b5250f6b6b040f7e121f32e5dd2f5d523dd4149b3204" +dependencies = [ + "base64 0.23.1", + "bs58", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.14.2", + "jiff 0.2.46", + "jiff 1.0.2", + "schemars 0.9.0", + "schemars 1.2.3", + "serde_core", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff15a7c864bbec77d9586ca6822bc7c369bdf19e9243134a62b0b51ce26b31f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serdect" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66cf8fedced2fcf12406bcb34223dffb92eaf34908ede12fed414c82b7f00b3e" +dependencies = [ + "base16ct 1.0.0", + "serde", +] + [[package]] name = "sha1" version = "0.10.7" @@ -919,8 +3110,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" dependencies = [ "cfg-if", - "cpufeatures", - "digest", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "digest 0.11.3", +] + +[[package]] +name = "shake" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09057cb2149ad4cbd2da1e26b351f9a4c354219421229c69c3063e6f61947c4a" +dependencies = [ + "digest 0.11.3", + "keccak", + "sponge-cursor", ] [[package]] @@ -939,6 +3163,26 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[package]] +name = "signature" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d567dcbaf0049cb8ac2608a76cd95ff9e4412e1899d389ee400918ca7537f5" +dependencies = [ + "digest 0.11.3", + "rand_core 0.10.1", +] + [[package]] name = "slab" version = "0.4.12" @@ -950,6 +3194,10 @@ name = "slop-broker" version = "0.1.0" dependencies = [ "anyhow", + "askama", + "async-trait", + "axum", + "base64 0.23.1", "bytes", "ciborium", "clap", @@ -957,18 +3205,23 @@ dependencies = [ "hex", "humantime", "nix", - "rand", + "openidconnect", + "rand 0.9.5", "rustls", "serde", "serde_bytes", "serde_json", + "sha2 0.11.1", "tempfile", "tokio", "tokio-tungstenite", "tokio-util", "tokio-vsock", "toml", + "tower-sessions", + "tower-sessions-rusqlite-store", "url", + "web-push", ] [[package]] @@ -987,6 +3240,50 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "spin" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der 0.7.10", +] + +[[package]] +name = "spki" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef958a98b9d5da290cfc78946e9f3e61e1e62a18db0d92cac0b83cc161491a9" +dependencies = [ + "base64ct", + "der 0.8.3", +] + +[[package]] +name = "sponge-cursor" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a0219bd7d979d58245a4f41f695e1ac9f8befdffadd7f61f1bae9e39abc6620" + +[[package]] +name = "sqlite-wasm-rs" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc3efc0da82635d7e1ced0053bbbfa8c7ab9645d0bf36ceb4f7127bb85315d75" +dependencies = [ + "cc", + "js-sys", + "rsqlite-vfs", + "wasm-bindgen", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -1005,6 +3302,34 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "superboring" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180c01a1d6c13ab0576bcd041ebfe0b66c455fa605de35909f3cee3f5bbf730f" +dependencies = [ + "aes-gcm", + "aes-keywrap", + "getrandom 0.4.3", + "hmac-sha1-compact", + "hmac-sha256", + "hmac-sha512", + "ml-dsa", + "rand 0.10.4", + "rsa 0.10.0", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.119" @@ -1027,6 +3352,27 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "unicode-xid", +] + [[package]] name = "synstructure" version = "0.14.0" @@ -1051,13 +3397,33 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + [[package]] name = "thiserror" version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" dependencies = [ - "thiserror-impl", + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", ] [[package]] @@ -1071,6 +3437,36 @@ dependencies = [ "syn 3.0.10", ] +[[package]] +name = "time" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tinystr" version = "0.8.5" @@ -1081,6 +3477,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + [[package]] name = "tokio" version = "1.54.1" @@ -1109,6 +3511,17 @@ dependencies = [ "syn 3.0.10", ] +[[package]] +name = "tokio-rusqlite" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bce5670317c76f8505e7e5a8d655330a435fc35d3deaf756de8406db64a94e8c" +dependencies = [ + "crossbeam-channel", + "rusqlite", + "tokio", +] + [[package]] name = "tokio-rustls" version = "0.26.6" @@ -1168,7 +3581,7 @@ version = "0.9.12+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" dependencies = [ - "indexmap", + "indexmap 2.14.2", "serde_core", "serde_spanned", "toml_datetime", @@ -1201,6 +3614,171 @@ version = "1.2.0+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "009dbb7700f11c55ef83aebbe4c0e9cf1f1ac0844bd8d6f00dc38f302026e13a" +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-cookies" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151b5a3e3c45df17466454bb74e9ecedecc955269bdedbf4d150dfa393b55a36" +dependencies = [ + "axum-core", + "cookie", + "futures-util", + "http 1.5.0", + "parking_lot", + "pin-project-lite", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http 1.5.0", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tower-sessions" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "518dca34b74a17cadfcee06e616a09d2bd0c3984eff1769e1e76d58df978fc78" +dependencies = [ + "async-trait", + "http 1.5.0", + "time", + "tokio", + "tower-cookies", + "tower-layer", + "tower-service", + "tower-sessions-core", + "tower-sessions-memory-store", + "tracing", +] + +[[package]] +name = "tower-sessions-core" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "568531ec3dfcf3ffe493de1958ae5662a0284ac5d767476ecdb6a34ff8c6b06c" +dependencies = [ + "async-trait", + "axum-core", + "base64 0.22.1", + "futures", + "http 1.5.0", + "parking_lot", + "rand 0.9.5", + "serde", + "serde_json", + "thiserror 2.0.21", + "time", + "tokio", + "tracing", +] + +[[package]] +name = "tower-sessions-memory-store" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713fabf882b6560a831e2bbed6204048b35bdd60e50bbb722902c74f8df33460" +dependencies = [ + "async-trait", + "time", + "tokio", + "tower-sessions-core", +] + +[[package]] +name = "tower-sessions-rusqlite-store" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91eb815303f7c401966f9f5e80c83859e74d7a194a3b9adbd8b6951073b2ca1d" +dependencies = [ + "async-trait", + "rmp-serde", + "rusqlite", + "thiserror 2.0.21", + "time", + "tokio-rusqlite", + "tower-sessions-core", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "tungstenite" version = "0.27.0" @@ -1209,14 +3787,14 @@ checksum = "eadc29d668c91fcc564941132e17b28a7ceb2f3ebf0b9dae3e03fd7a6748eb0d" dependencies = [ "bytes", "data-encoding", - "http", + "http 1.5.0", "httparse", "log", - "rand", + "rand 0.9.5", "rustls", "rustls-pki-types", "sha1", - "thiserror", + "thiserror 2.0.21", "utf-8", ] @@ -1232,6 +3810,22 @@ version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "universal-hash" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4987bdc12753382e0bec4a65c50738ffaabc998b9cdd1f952fb5f39b0048a96" +dependencies = [ + "crypto-common 0.2.2", + "ctutils", +] + [[package]] name = "untrusted" version = "0.9.0" @@ -1248,6 +3842,7 @@ dependencies = [ "idna", "percent-encoding", "serde", + "serde_derive", ] [[package]] @@ -1277,6 +3872,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.5" @@ -1293,6 +3894,15 @@ dependencies = [ "nix", ] +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" @@ -1308,6 +3918,110 @@ dependencies = [ "wit-bindgen", ] +[[package]] +name = "wasix" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae86f02046da16a333a9129d31451423e1657737ecdafed4193838a5f54c5cfe" +dependencies = [ + "wasi", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" +dependencies = [ + "cfg-if", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.10", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-push" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5c305b9ee2993ab68b7744b13ef32231d83600dd879ac8183b4c76ae31d28ac" +dependencies = [ + "async-trait", + "chrono", + "ct-codecs", + "ece", + "http 0.2.12", + "jwt-simple", + "log", + "pem 3.0.6", + "sec1_decode", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "web-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "webpki-roots" version = "0.26.11" @@ -1326,12 +4040,65 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + [[package]] name = "windows-sys" version = "0.52.0" @@ -1425,6 +4192,9 @@ name = "winnow" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef" +dependencies = [ + "memchr", +] [[package]] name = "wit-bindgen" @@ -1432,6 +4202,18 @@ version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" +[[package]] +name = "wnaf" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "795ca18b3fdb5e62bf982199278341ddcf7ebf7d32e25e212ad05d496e95f6fa" +dependencies = [ + "ff 0.14.0", + "group 0.14.0", + "hybrid-array", + "primefield", +] + [[package]] name = "writeable" version = "0.6.4" @@ -1458,7 +4240,7 @@ dependencies = [ "proc-macro2", "quote", "syn 3.0.10", - "synstructure", + "synstructure 0.14.0", ] [[package]] @@ -1499,7 +4281,7 @@ dependencies = [ "proc-macro2", "quote", "syn 3.0.10", - "synstructure", + "synstructure 0.14.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 54770d2..c1f95a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,10 @@ license = "MIT" [dependencies] anyhow = "1" +askama = "0.16" +async-trait = "0.1.92" +axum = { version = "0.8", default-features = false, features = ["http1", "tokio", "query", "form", "json"] } +base64 = "0.23.1" bytes = "1" ciborium = "0.2" clap = { version = "4", features = ["derive", "env"] } @@ -15,17 +19,22 @@ hex = "0.4" humantime = "2" # Already a dependency of `tokio-vsock` nix = { version = "0.31", default-features = false, features = ["signal", "user"] } +openidconnect = "4.1" rand = "0.9" rustls = { version = "0.23", default-features = false, features = ["ring", "std"] } serde = { version = "1", features = ["derive"] } serde_bytes = "0.11" serde_json = "1" +sha2 = "0.11.1" tokio = { version = "1", features = ["full"] } tokio-tungstenite = { version = "0.27", features = ["rustls-tls-webpki-roots"] } tokio-util = { version = "0.7", features = ["codec"] } tokio-vsock = "0.7" toml = { version = "0.9", default-features = false, features = ["parse", "serde", "std"] } +tower-sessions = "0.15" +tower-sessions-rusqlite-store = "0.15" url = "2" +web-push = { version = "0.11", default-features = false } [dev-dependencies] tempfile = "3" diff --git a/askama.toml b/askama.toml new file mode 100644 index 0000000..d4f6820 --- /dev/null +++ b/askama.toml @@ -0,0 +1,9 @@ +[general] +# Collapses the blank lines that tags leave behind +whitespace = "minimize" + +# What the pages show passes through `printable` before escaping, so control and bidirectional +# characters can't disguise what a request does +[[escaper]] +path = "crate::web::page::Printable" +extensions = ["html"] diff --git a/devenv.nix b/devenv.nix index a3ddcff..ff5e4ed 100644 --- a/devenv.nix +++ b/devenv.nix @@ -4,8 +4,9 @@ { languages.rust.enable = true; - # `git` for the builder's tests - packages = with pkgs; [ git nixpkgs-fmt ]; + # `pkg-config` with OpenSSL for Web Push's payload encryption and SQLite for the web app's + # sessions, `git` for the builder's tests + packages = with pkgs; [ pkg-config openssl sqlite git nixpkgs-fmt ]; scripts = { vm-test = { diff --git a/nix/modules/nixos/broker.nix b/nix/modules/nixos/broker.nix index c2bff49..8991306 100644 --- a/nix/modules/nixos/broker.nix +++ b/nix/modules/nixos/broker.nix @@ -10,6 +10,7 @@ let cfg = config.services.slop-broker; ha = cfg.homeAssistant; + web = cfg.web; isRuntimePath = p: hasPrefix "/" p && !(hasPrefix "/nix/store/" p); hasLocalRequesters = any (r: r.uid != null) (attrValues cfg.requesters); @@ -37,11 +38,14 @@ let options = { action = mkOpt' (enum [ "auto" "ask" "deny" ]) "ask" "What happens to a request."; leases = mkOpt' (listOf duration) [ ] "Lease lengths approvers are offered, like `5m` or `1h`."; + confirm = mkOpt' (nullOr (enum [ "passkey" ])) null + "Extra proof needed to approve: `passkey` means signing in again with a passkey in the web app."; rules = mkOpt' (listOf (submodule { options = { match = mkOpt' (attrsOf str) { } "Scope fields and the globs they must match."; action = mkOpt' (enum [ "auto" "ask" "deny" ]) null "Action for matching requests."; leases = mkOpt' (nullOr (listOf duration)) null "Leases for matching requests (null keeps the default)."; + confirm = mkOpt' (nullOr (enum [ "passkey" ])) null "Extra proof for matching requests (null keeps the default)."; }; })) [ ] "Rules checked in order; the first match wins."; }; @@ -115,6 +119,14 @@ let device_id = ha.deviceId; token = "ha-token"; } else null; + + web = if web.enable then { + listen = "${if hasInfix ":" web.address then "[${web.address}]" else web.address}:${toString web.port}"; + inherit (web) url issuer group; + client_id = web.clientId; + client_secret = "oidc-secret"; + state_dir = "/var/lib/slop-broker/web"; + } else null; }); in { @@ -174,6 +186,17 @@ in "The Companion app's own ID (the `device_id` in its notification answers, not the device registry's); the broker logs it when it ignores an answer."; tokenFile = mkOpt' str "" "Runtime path to a Home Assistant token; never a Nix store path."; }; + + web = { + enable = mkBoolOpt' false "Whether to serve the approvals web app (sign-in with OpenID Connect, Web Push)."; + address = mkOpt' str "127.0.0.1" "Address the web app listens on; only the reverse proxy should reach it."; + port = mkOpt' port 8095 "Port the web app listens on."; + url = mkOpt' str "" "Public URL of the web app, without a path."; + issuer = mkOpt' str "" "OpenID Connect issuer approvers sign in with."; + clientId = mkOpt' str "slop-approve" "OpenID Connect client ID."; + clientSecretFile = mkOpt' str "" "Runtime path to the client secret; never a Nix store path."; + group = mkOpt' str "slop-approvers" "Group (the ID token's `groups` claim) whose members may approve."; + }; }; config = mkIf cfg.enable { @@ -202,6 +225,10 @@ in assertion = ha.enable -> (ha.url != "" && ha.notifyService != "" && ha.deviceId != "" && isRuntimePath ha.tokenFile); message = "slop-broker Home Assistant needs a URL, service, device ID and runtime token file."; } + { + assertion = web.enable -> (web.url != "" && web.issuer != "" && isRuntimePath web.clientSecretFile); + message = "slop-broker's web app needs a URL, an issuer and a runtime client secret file."; + } ]; users = mkMerge [ @@ -228,6 +255,7 @@ in ]; environment.systemPackages = [ cfg.package ]; + boot.kernelModules = optional hasVsockRequesters "vhost_vsock"; systemd.services.slop-broker = { @@ -240,14 +268,15 @@ in LoadCredential = optional cfg.ssh.enable "ssh-key:${cfg.ssh.keyFile}" ++ optional cfg.cache.enable "cache-key:${cfg.cache.keyFile}" ++ - optional ha.enable "ha-token:${ha.tokenFile}"; + optional ha.enable "ha-token:${ha.tokenFile}" ++ + optional web.enable "oidc-secret:${web.clientSecretFile}"; User = "slop-broker"; Group = "slop-broker"; SupplementaryGroups = [ "slop-broker-approve" ] ++ optional hasRemote remoteUser; RuntimeDirectory = "slop-broker"; RuntimeDirectoryMode = "0755"; - StateDirectory = "slop-broker"; + StateDirectory = [ "slop-broker" ] ++ optional web.enable "slop-broker/web"; StateDirectoryMode = "0700"; Restart = "on-failure"; @@ -263,7 +292,7 @@ in LockPersonality = true; RestrictAddressFamilies = [ "AF_UNIX" ] ++ optional hasVsockRequesters "AF_VSOCK" - ++ optionals (cfg.ssh.enable || ha.enable) [ "AF_INET" "AF_INET6" ]; + ++ optionals (cfg.ssh.enable || ha.enable || web.enable) [ "AF_INET" "AF_INET6" ]; CapabilityBoundingSet = ""; UMask = "0077"; }; diff --git a/nix/package.nix b/nix/package.nix index 93783c6..d9d9e6e 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -1,4 +1,4 @@ -{ lib, rustPlatform, callPackage }: +{ lib, rustPlatform, pkg-config, openssl, sqlite }: let inherit (lib.fileset) toSource unions; in @@ -8,10 +8,14 @@ rustPlatform.buildRustPackage { src = toSource { root = ../.; - fileset = unions [ ../Cargo.toml ../Cargo.lock ../src ../tests ../slop-tools.md ]; + fileset = unions [ ../Cargo.toml ../Cargo.lock ../askama.toml ../src ../templates ../tests ../slop-tools.md ]; }; cargoLock.lockFile = ../Cargo.lock; + # OpenSSL for Web Push's payload encryption, SQLite for the web app's sessions + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ openssl sqlite ]; + postInstall = '' ln -s slop-broker $out/bin/slop-approve install -Dm644 slop-tools.md $out/share/slop-broker/slop-tools.md diff --git a/src/approve.rs b/src/approve.rs index dd6ba57..0074b2b 100644 --- a/src/approve.rs +++ b/src/approve.rs @@ -62,16 +62,17 @@ fn answer(broker: &Broker, approver: &str, request: ApproveRequest) -> Result Ok(ApproveResponse::Pending(broker.queue.list())), ApproveRequest::Decide { id, decision } => { - approve(broker, &id, decision, approver)?; + approve(broker, &id, decision, approver, false)?; Ok(ApproveResponse::Recorded) } ApproveRequest::Log { count } => Ok(ApproveResponse::Log(broker.audit.tail(count.min(MAX_LOG_RECORDS))?)), } } -/// Records a decision from any approver (terminal or phone). -pub fn approve(broker: &Broker, id: &str, decision: Decision, approver: &str) -> Result<()> { - let info = broker.queue.decide(id, decision, approver)?; +/// Records a decision from any approver (terminal, phone or web). `passkey` says the approver +/// just confirmed it with a passkey. +pub fn approve(broker: &Broker, id: &str, decision: Decision, approver: &str, passkey: bool) -> Result<()> { + let info = broker.queue.decide(id, decision, approver, passkey)?; broker.audit.log(Event::Decision { id: id.to_owned(), requester: info.requester, @@ -108,7 +109,10 @@ impl Client { } pub fn format(entry: &PendingInfo, full: bool) -> String { - let marker = if entry.sensitive { " [SENSITIVE]" } else { "" }; + let mut marker = if entry.sensitive { " [SENSITIVE]" } else { "" }.to_owned(); + if entry.passkey { + marker += " [PASSKEY: approve in the web app]"; + } let mut text = format!("{} {} {}{marker} (expires in {}s)\n", entry.id, entry.requester, entry.summary, entry.expires_in); @@ -315,6 +319,7 @@ mod tests { detail: String::new(), label: None, sensitive: false, + passkey: false, offers: vec![Decision::Once, Decision::Deny], expires_in: 60, } diff --git a/src/bin/slop-broker.rs b/src/bin/slop-broker.rs index 213a467..6fea7ee 100644 --- a/src/bin/slop-broker.rs +++ b/src/bin/slop-broker.rs @@ -9,7 +9,7 @@ use nix::sys::signal::{SigHandler, Signal, signal}; use slop_broker::config::{Config, credential, group_id, user_id}; use slop_broker::remote::{self, Role}; use slop_broker::server::{self, Broker}; -use slop_broker::{approve, ha}; +use slop_broker::{approve, ha, web}; #[derive(Parser)] #[command(about = "Approval broker for coding agents")] @@ -93,6 +93,17 @@ async fn serve(path: &Path) -> Result<()> { None => None, }; + let web = match &config.web { + Some(settings) => { + let secret = std::fs::read_to_string(credential(&settings.client_secret)) + .context("reading the OIDC client secret")?; + let secret = secret.trim().to_owned(); + anyhow::ensure!(!secret.is_empty(), "the OIDC client secret is empty"); + Some((settings.clone(), secret)) + } + None => None, + }; + server::check_runtime_dir(&config.approve_socket)?; let approve_listener = server::bind_unix(&config.approve_socket, 0o660, Some(group_id(&config.approver_group)?))?; let request_listener = match &config.request_socket { @@ -133,6 +144,10 @@ async fn serve(path: &Path) -> Result<()> { }); } + if let Some((settings, secret)) = web { + tasks.spawn(web::run(broker.clone(), settings, secret)); + } + eprintln!("<6>slop-broker ready"); // Any listener failing is fatal; systemd restarts the broker. tasks.join_next().await.context("no listeners")???; diff --git a/src/config.rs b/src/config.rs index ea9fe48..87f0301 100644 --- a/src/config.rs +++ b/src/config.rs @@ -43,6 +43,35 @@ pub struct Config { pub deploy: Option, #[serde(default)] pub cache: Option, + #[serde(default)] + pub web: Option, +} + +/// The approvals web app (see [`crate::web`]): approvers sign in through an OpenID Connect +/// provider, and get Web Push notifications. +#[derive(Debug, Clone, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct WebConfig { + /// Address to listen on, like `[::]:8095`; only the reverse proxy should reach it. + pub listen: std::net::SocketAddr, + /// Public URL of the app, like `https://approve.example.org`. + pub url: String, + /// OpenID Connect issuer. + pub issuer: String, + pub client_id: String, + /// Client secret; relative paths are resolved in `$CREDENTIALS_DIRECTORY`. + pub client_secret: PathBuf, + /// Only members of this group (the ID token's `groups` claim) may sign in. + pub group: String, + /// How long a session lasts without being used. + #[serde(default = "default_session", deserialize_with = "duration")] + pub session: u64, + /// Where sessions, push subscriptions and the push signing key are kept. + pub state_dir: PathBuf, +} + +fn default_session() -> u64 { + 7 * 86400 } /// Deploys: a builder evaluates and builds commits, then the broker copies and activates them diff --git a/src/ha.rs b/src/ha.rs index 2d73545..37a83bc 100644 --- a/src/ha.rs +++ b/src/ha.rs @@ -152,10 +152,14 @@ impl Notifier<'_> { } fn notification(&mut self, entry: &PendingInfo) -> Value { - // Android shows at most three actions: once, the shortest lease and deny. - let mut decisions = vec![Decision::Once]; - if let Some(&lease) = entry.offers.iter().find(|d| matches!(d, Decision::Lease(_))) { - decisions.push(lease); + // Android shows at most three actions: once, the shortest lease and deny. Requests that + // need a passkey can only be denied here. + let mut decisions = vec![]; + if !entry.passkey { + decisions.push(Decision::Once); + if let Some(&lease) = entry.offers.iter().find(|d| matches!(d, Decision::Lease(_))) { + decisions.push(lease); + } } decisions.push(Decision::Deny); @@ -174,6 +178,9 @@ impl Notifier<'_> { message += &format!("\nAgent says: {}", truncate(label, 120)); } message += &format!("\nFrom {}", entry.requester); + if entry.passkey { + message += "\nNeeds a passkey: approve in the web app"; + } let title = if entry.sensitive { "Agent approval (sensitive)" } else { "Agent approval" }; // Sticky, so tapping it doesn't remove it, and persistent, which stops swiping it away on @@ -207,7 +214,7 @@ impl Notifier<'_> { return; }; // Fails harmlessly if it expired, was answered in a terminal, or arrived twice. - let _ = approve::approve(self.broker, &id, decision, "home-assistant"); + let _ = approve::approve(self.broker, &id, decision, "home-assistant", false); self.actions.retain(|_, (other, _)| *other != id); } } diff --git a/src/lib.rs b/src/lib.rs index 86a402f..e83581e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,3 +13,4 @@ pub mod queue; pub mod remote; pub mod server; pub mod types; +pub mod web; diff --git a/src/policy.rs b/src/policy.rs index a1a33ba..006ec9d 100644 --- a/src/policy.rs +++ b/src/policy.rs @@ -5,14 +5,23 @@ use std::collections::BTreeMap; use serde::Deserialize; use serde_json::{Map, Value}; -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Deserialize)] #[serde(rename_all = "lowercase")] pub enum Action { Auto, + #[default] Ask, Deny, } +/// Extra proof an approver must give before approving. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum Confirm { + /// Signing in again with a passkey, in the web app. + Passkey, +} + #[derive(Debug, Clone, Deserialize)] #[serde(deny_unknown_fields)] pub struct OpPolicy { @@ -20,7 +29,9 @@ pub struct OpPolicy { /// Lease lengths in seconds that approvers are offered. #[serde(default, deserialize_with = "crate::config::durations")] pub leases: Vec, - /// First matching rule wins; otherwise `action` and `leases` apply. + #[serde(default)] + pub confirm: Option, + /// First matching rule wins; otherwise `action`, `leases` and `confirm` apply. #[serde(default)] pub rules: Vec, } @@ -33,13 +44,18 @@ pub struct Rule { pub action: Action, #[serde(default, deserialize_with = "crate::config::optional_durations")] pub leases: Option>, + /// Replaces the operation's `confirm` (null keeps it). + #[serde(default)] + pub confirm: Option, } /// What policy decided for one request. -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Default)] pub struct Verdict { pub action: Action, pub leases: Vec, + /// Approving needs a fresh passkey. + pub passkey: bool, } /// Limits an operation puts on its own requests, whatever the policy says. @@ -53,15 +69,16 @@ pub struct Limits { pub fn evaluate(policy: Option<&OpPolicy>, scope: &Map, limits: Limits) -> Verdict { let Some(policy) = policy else { - return Verdict { action: Action::Deny, leases: vec![] }; + return Verdict { action: Action::Deny, ..Verdict::default() }; }; - let (mut action, mut leases) = (policy.action, policy.leases.clone()); + let (mut action, mut leases, mut confirm) = (policy.action, policy.leases.clone(), policy.confirm); if let Some(rule) = policy.rules.iter().find(|r| matches(&r.matches, scope)) { action = rule.action; if let Some(rule_leases) = &rule.leases { leases = rule_leases.clone(); } + confirm = rule.confirm.or(confirm); } if limits.never_auto && action == Action::Auto { @@ -70,16 +87,18 @@ pub fn evaluate(policy: Option<&OpPolicy>, scope: &Map, limits: L if limits.never_lease { leases.clear(); } - Verdict { action, leases } + Verdict { action, leases, passkey: confirm == Some(Confirm::Passkey) } } -/// The strictest of several verdicts: the highest action, and only leases all of them allow. +/// The strictest of several verdicts: the highest action, only leases all of them allow, and a +/// passkey if any needs one. pub fn combine(verdicts: impl IntoIterator) -> Verdict { let mut verdicts = verdicts.into_iter(); - let Some(mut combined) = verdicts.next() else { return Verdict { action: Action::Deny, leases: vec![] } }; + let Some(mut combined) = verdicts.next() else { return Verdict { action: Action::Deny, ..Verdict::default() } }; for verdict in verdicts { combined.action = combined.action.max(verdict.action); combined.leases.retain(|l| verdict.leases.contains(l)); + combined.passkey |= verdict.passkey; } combined } @@ -129,9 +148,12 @@ mod tests { #[test] fn combining_takes_the_strictest() { - let verdict = |action, leases: &[u64]| Verdict { action, leases: leases.to_vec() }; + let verdict = |action, leases: &[u64]| Verdict { action, leases: leases.to_vec(), passkey: false }; let combined = combine([verdict(Action::Auto, &[300, 3600]), verdict(Action::Ask, &[300])]); assert_eq!(combined, verdict(Action::Ask, &[300])); + + let passkey = Verdict { passkey: true, ..verdict(Action::Ask, &[300]) }; + assert!(combine([verdict(Action::Ask, &[300]), passkey]).passkey); assert_eq!(combine([verdict(Action::Ask, &[]), verdict(Action::Deny, &[])]).action, Action::Deny); assert_eq!(combine([]).action, Action::Deny); } @@ -166,14 +188,25 @@ mod tests { "rules": [ {"match": {"target": "river"}, "action": "deny"}, {"match": {"target": "r*"}, "action": "auto", "leases": []}, + {"match": {"target": "stream"}, "action": "ask", "confirm": "passkey"}, ], })) .unwrap(); let verdict = |s| evaluate(Some(&policy), &scope(s), Limits::default()); assert_eq!(verdict(json!({"target": "river"})).action, Action::Deny); - assert_eq!(verdict(json!({"target": "rain"})), Verdict { action: Action::Auto, leases: vec![] }); - assert_eq!(verdict(json!({"target": "sfh"})), Verdict { action: Action::Ask, leases: vec![300, 3600] }); + assert_eq!( + verdict(json!({"target": "rain"})), + Verdict { action: Action::Auto, leases: vec![], passkey: false } + ); + assert_eq!( + verdict(json!({"target": "sfh"})), + Verdict { action: Action::Ask, leases: vec![300, 3600], passkey: false } + ); + assert_eq!( + verdict(json!({"target": "stream"})), + Verdict { action: Action::Ask, leases: vec![300, 3600], passkey: true } + ); assert_eq!(verdict(json!({"host": "river"})).action, Action::Ask); assert_eq!(verdict(json!({"target": 5})).action, Action::Ask); } @@ -183,6 +216,6 @@ mod tests { let policy: OpPolicy = serde_json::from_value(json!({"action": "auto", "leases": [300]})).unwrap(); let limits = Limits { never_auto: true, never_lease: true }; let verdict = evaluate(Some(&policy), &Map::new(), limits); - assert_eq!(verdict, Verdict { action: Action::Ask, leases: vec![] }); + assert_eq!(verdict, Verdict { action: Action::Ask, leases: vec![], passkey: false }); } } diff --git a/src/queue.rs b/src/queue.rs index 6793375..837d00e 100644 --- a/src/queue.rs +++ b/src/queue.rs @@ -95,6 +95,9 @@ pub struct PendingInfo { pub label: Option, /// Marks requests that reveal a secret or change who can read one. pub sensitive: bool, + /// Approving needs a fresh passkey, so only the web app can approve it. + #[serde(default)] + pub passkey: bool, pub offers: Vec, pub expires_in: u64, } @@ -107,6 +110,7 @@ pub struct NewRequest { pub detail: String, pub label: Option, pub sensitive: bool, + pub passkey: bool, pub leases: Vec, } @@ -207,10 +211,16 @@ impl Queue { } } - pub fn decide(&self, id: &str, decision: Decision, approver: &str) -> Result { + /// Records an answer. `passkey` says the approver just confirmed it with a passkey, which + /// requests that need one require for anything but a denial. + pub fn decide(&self, id: &str, decision: Decision, approver: &str, passkey: bool) -> Result { let mut state = self.state.lock().unwrap(); let entry = state.pending.get(id).ok_or_else(|| anyhow!("unknown or expired request"))?; + if entry.request.passkey && decision != Decision::Deny && !passkey { + bail!("this request needs a passkey; approve it in the web app"); + } + if let Decision::Lease(seconds) = decision && !entry.request.leases.contains(&seconds) { @@ -249,19 +259,29 @@ impl Queue { /// Active leases for one requester, as (scope key, seconds left). pub fn leases(&self, requester: &str) -> Vec<(String, u64)> { + self.all_leases().into_iter().filter(|(r, _, _)| r == requester).map(|(_, key, left)| (key, left)).collect() + } + + /// Every active lease, as (requester, scope key, seconds left). + pub fn all_leases(&self) -> Vec<(String, String, u64)> { let state = self.state.lock().unwrap(); let now = Instant::now(); let mut leases: Vec<_> = state .leases .iter() - .filter(|((r, _), until)| r == requester && **until > now) - .map(|((_, key), until)| (key.clone(), until.duration_since(now).as_secs())) + .filter(|(_, until)| **until > now) + .map(|((requester, key), until)| (requester.clone(), key.clone(), until.duration_since(now).as_secs())) .collect(); leases.sort(); leases } + + /// The current version of the pending set, which [`Queue::subscribe`] reports changes of. + pub fn version(&self) -> u64 { + self.state.lock().unwrap().sequence + } } fn info(id: &str, entry: &Entry, now: Instant) -> PendingInfo { @@ -279,6 +299,7 @@ fn info(id: &str, entry: &Entry, now: Instant) -> PendingInfo { detail: r.detail.clone(), label: r.label.clone(), sensitive: r.sensitive, + passkey: r.passkey, offers, expires_in: entry.deadline.saturating_duration_since(now).as_secs(), } @@ -297,6 +318,7 @@ mod tests { detail: String::new(), label: None, sensitive: false, + passkey: false, leases: vec![300], } } @@ -321,7 +343,7 @@ mod tests { async fn lease_covers_the_same_scope_only() { let queue = Queue::new(Duration::from_secs(60), 64); let (id, reply) = submit(&queue, "a", 4).unwrap(); - queue.decide(&id, Decision::Lease(300), "dev").unwrap(); + queue.decide(&id, Decision::Lease(300), "dev", false).unwrap(); assert_eq!(reply.await.unwrap(), Outcome::Approved { decision: Decision::Lease(300), approver: "dev".into() }); assert!(queue.leased("a", "k")); assert!(!queue.leased("a", "other")); @@ -332,23 +354,46 @@ mod tests { async fn once_and_deny_leave_no_lease() { let queue = Queue::new(Duration::from_secs(60), 64); let (id, reply) = submit(&queue, "a", 4).unwrap(); - queue.decide(&id, Decision::Once, "dev").unwrap(); + queue.decide(&id, Decision::Once, "dev", false).unwrap(); assert_eq!(reply.await.unwrap(), Outcome::Approved { decision: Decision::Once, approver: "dev".into() }); let (id, reply) = submit(&queue, "a", 4).unwrap(); - queue.decide(&id, Decision::Deny, "dev").unwrap(); + queue.decide(&id, Decision::Deny, "dev", false).unwrap(); assert_eq!(reply.await.unwrap(), Outcome::Denied); assert!(!queue.leased("a", "k")); - assert!(queue.decide(&id, Decision::Once, "dev").is_err()); + assert!(queue.decide(&id, Decision::Once, "dev", false).is_err()); } #[test] fn unoffered_leases_are_refused() { let queue = Queue::new(Duration::from_secs(60), 64); let (id, _reply) = submit(&queue, "a", 4).unwrap(); - assert!(queue.decide(&id, Decision::Lease(3600), "dev").is_err()); + assert!(queue.decide(&id, Decision::Lease(3600), "dev", false).is_err()); assert_eq!(queue.list().len(), 1); } + #[tokio::test] + async fn passkey_requests_need_a_passkey_to_approve() { + let queue = Queue::new(Duration::from_secs(60), 64); + let mut needs = request("a", "k"); + needs.passkey = true; + + let id = new_id(); + let reply = queue.submit(&id, needs, 4).unwrap(); + assert!(queue.decide(&id, Decision::Once, "dev", false).is_err()); + assert!(queue.decide(&id, Decision::Lease(300), "dev", false).is_err()); + assert!(queue.list()[0].passkey); + queue.decide(&id, Decision::Once, "dev", true).unwrap(); + assert_eq!(reply.await.unwrap(), Outcome::Approved { decision: Decision::Once, approver: "dev".into() }); + + // Anyone may deny. + let mut needs = request("a", "k"); + needs.passkey = true; + let id = new_id(); + let reply = queue.submit(&id, needs, 4).unwrap(); + queue.decide(&id, Decision::Deny, "dev", false).unwrap(); + assert_eq!(reply.await.unwrap(), Outcome::Denied); + } + #[test] fn limits_pending_requests() { let queue = Queue::new(Duration::from_secs(60), 3); diff --git a/src/server.rs b/src/server.rs index c4e20e3..f388e9f 100644 --- a/src/server.rs +++ b/src/server.rs @@ -351,6 +351,7 @@ async fn authorize( detail: parsed.detail.clone(), label, sensitive: parsed.sensitive, + passkey: verdict.passkey, leases: verdict.leases, }; diff --git a/src/web/assets/app.js b/src/web/assets/app.js new file mode 100644 index 0000000..2cf9290 --- /dev/null +++ b/src/web/assets/app.js @@ -0,0 +1,135 @@ +// Keeps the page current, counts down expiry times and manages this device's push subscription. +// The page works without it: answers are ordinary form submissions. +"use strict"; + +const csrf = () => document.querySelector('input[name="csrf"]')?.value; + +// Expiry countdowns, from the seconds left when the page or fragment was rendered. +function startCountdowns(root) { + const started = Date.now(); + for (const element of root.querySelectorAll(".expires")) { + element.dataset.until = String(started + Number(element.dataset.left) * 1000); + } +} + +function formatLeft(seconds) { + if (seconds >= 3600) return `${Math.floor(seconds / 3600)}h ${Math.floor((seconds % 3600) / 60)}m`; + if (seconds >= 60) return `${Math.floor(seconds / 60)}m ${seconds % 60}s`; + return `${seconds}s`; +} + +setInterval(() => { + for (const element of document.querySelectorAll(".expires[data-until]")) { + const seconds = Math.max(0, Math.round((Number(element.dataset.until) - Date.now()) / 1000)); + element.textContent = seconds > 0 ? `expires in ${formatLeft(seconds)}` : "expired"; + } +}, 1000); + +// Polls for changes to the pending set while the page is visible. +async function refresh() { + const pending = document.getElementById("pending"); + const request = document.getElementById("request"); + const container = pending || request; + if (!container || document.hidden) return; + + const response = await fetch("/api/version", { credentials: "same-origin" }); + if (response.status === 401) return location.reload(); + if (!response.ok) return; + const { version } = await response.json(); + if (String(version) === container.dataset.version) return; + + if (request) return location.reload(); + + // Swap in the new list, keeping open details open. + const open = new Set([...pending.querySelectorAll("article details[open]")].map((d) => d.closest("article").id)); + const fragment = await fetch("/pending", { credentials: "same-origin" }); + if (!fragment.ok) return; + pending.innerHTML = await fragment.text(); + pending.dataset.version = String(version); + for (const id of open) document.getElementById(id)?.querySelector("details")?.setAttribute("open", ""); + startCountdowns(pending); +} + +function base64urlToBytes(text) { + const base64 = text.replace(/-/g, "+").replace(/_/g, "/"); + const binary = atob(base64 + "=".repeat((4 - (base64.length % 4)) % 4)); + return Uint8Array.from(binary, (c) => c.charCodeAt(0)); +} + +async function post(path, body) { + const response = await fetch(path, { + method: "POST", + credentials: "same-origin", + headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf() }, + body: JSON.stringify(body), + }); + if (!response.ok) throw new Error(await response.text()); +} + +async function setUpPush() { + const section = document.getElementById("push"); + if (!section || !("serviceWorker" in navigator) || !("PushManager" in window)) return; + + const registration = await navigator.serviceWorker.register("/sw.js"); + const state = document.getElementById("push-state"); + const toggle = document.getElementById("push-toggle"); + + async function show() { + const subscription = await registration.pushManager.getSubscription(); + if (Notification.permission === "denied") { + state.textContent = "Notifications are blocked for this site in the browser."; + toggle.hidden = true; + } else if (subscription) { + state.textContent = "This device gets notifications."; + toggle.textContent = "Turn off"; + toggle.hidden = false; + } else { + state.textContent = "This device doesn't get notifications."; + toggle.textContent = "Turn on"; + toggle.hidden = false; + } + section.hidden = false; + } + + toggle.addEventListener("click", async () => { + toggle.disabled = true; + try { + const existing = await registration.pushManager.getSubscription(); + if (existing) { + await post("/push/unsubscribe", { endpoint: existing.endpoint }); + await existing.unsubscribe(); + } else if ((await Notification.requestPermission()) === "granted") { + const key = await (await fetch("/push/key", { credentials: "same-origin" })).text(); + const subscription = await registration.pushManager.subscribe({ + userVisibleOnly: true, + applicationServerKey: base64urlToBytes(key), + }); + await post("/push/subscribe", subscription.toJSON()); + } + } catch (error) { + state.textContent = `That didn't work: ${error.message}`; + toggle.disabled = false; + return; + } + toggle.disabled = false; + await show(); + }); + + await show(); +} + +// Audit times are UTC; show them in the browser's time zone. +function localTimes(root) { + for (const element of root.querySelectorAll("time[datetime]")) { + const date = new Date(element.getAttribute("datetime")); + if (isNaN(date)) continue; + element.textContent = date.toLocaleString(undefined, { dateStyle: "medium", timeStyle: "medium" }); + element.title = element.getAttribute("datetime"); + } +} + +localTimes(document); +startCountdowns(document); +setInterval(() => refresh().catch(() => {}), 3000); +document.addEventListener("visibilitychange", () => refresh().catch(() => {})); +setUpPush().catch(() => {}); diff --git a/src/web/assets/icon.svg b/src/web/assets/icon.svg new file mode 100644 index 0000000..342907b --- /dev/null +++ b/src/web/assets/icon.svg @@ -0,0 +1 @@ + diff --git a/src/web/assets/manifest.webmanifest b/src/web/assets/manifest.webmanifest new file mode 100644 index 0000000..67892c3 --- /dev/null +++ b/src/web/assets/manifest.webmanifest @@ -0,0 +1,10 @@ +{ + "name": "slop approvals", + "short_name": "Approvals", + "start_url": "/", + "scope": "/", + "display": "standalone", + "background_color": "#f6f6f3", + "theme_color": "#2f6f4f", + "icons": [{ "src": "/icon.svg", "sizes": "any", "type": "image/svg+xml" }] +} diff --git a/src/web/assets/style.css b/src/web/assets/style.css new file mode 100644 index 0000000..c1a7195 --- /dev/null +++ b/src/web/assets/style.css @@ -0,0 +1,312 @@ +:root { + --bg: #f6f6f3; + --surface: #ffffff; + --text: #1d1d1b; + --muted: #66665f; + --border: #d9d9d2; + --accent: #2f6f4f; + --accent-text: #ffffff; + --deny: #a4362b; + --warn-bg: #fbe9d0; + --warn-text: #7a4300; + --code-bg: #f0f0ea; + --key: #4b4fb8; + --key-bg: #e6e7fa; + --good: #2f6f4f; + --good-bg: #dcefe3; + --bad: #a4362b; + --bad-bg: #f7dfdb; + --active: #1f5f99; + --active-bg: #dbe9f6; + color-scheme: light; +} + +@media (prefers-color-scheme: dark) { + :root { + --bg: #161715; + --surface: #1f201e; + --text: #e8e8e3; + --muted: #a3a39b; + --border: #3a3b37; + --accent: #5fae83; + --accent-text: #0e1a13; + --deny: #e0766a; + --warn-bg: #4a3415; + --warn-text: #f3c98b; + --code-bg: #262724; + --key: #a9acf5; + --key-bg: #2c2d52; + --good: #8fd4ac; + --good-bg: #1f3a2a; + --bad: #f0a197; + --bad-bg: #4a2420; + --active: #9cc7f0; + --active-bg: #1d3247; + color-scheme: dark; + } +} + +* { + box-sizing: border-box; +} + +body { + margin: 0; + background: var(--bg); + color: var(--text); + font: 16px/1.45 system-ui, sans-serif; +} + +header { + display: flex; + flex-wrap: wrap; + gap: 8px 16px; + align-items: center; + justify-content: space-between; + padding: 10px 16px; + border-bottom: 1px solid var(--border); + background: var(--surface); +} + +nav a { + margin-right: 16px; +} + +main { + max-width: 960px; + margin: 0 auto; + padding: 16px; +} + +a { + color: var(--accent); +} + +h1 { + font-size: 1.4rem; + margin: 8px 0 16px; +} + +h2 { + font-size: 1.1rem; + margin: 0 0 4px; + overflow-wrap: anywhere; +} + +.account { + display: flex; + gap: 8px; + align-items: center; + color: var(--muted); +} + +.request { + background: var(--surface); + border: 1px solid var(--border); + border-radius: 8px; + padding: 12px 14px; + margin-bottom: 14px; +} + +.meta, +.note, +.empty { + color: var(--muted); + margin: 4px 0; +} + +.label { + margin: 6px 0; + font-style: italic; + overflow-wrap: anywhere; +} + +.badge { + display: inline-block; + padding: 0 6px; + border-radius: 4px; + font-size: 0.85rem; + background: var(--code-bg); + color: var(--text); +} + +.badge.warn { + background: var(--warn-bg); + color: var(--warn-text); +} + +details summary { + cursor: pointer; + color: var(--muted); +} + +pre { + background: var(--code-bg); + padding: 10px; + border-radius: 6px; + overflow-x: auto; + font-size: 0.85rem; + line-height: 1.35; + max-height: 70vh; +} + +pre.log { + max-height: none; + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +.answers { + display: flex; + flex-wrap: wrap; + gap: 8px; + margin-top: 10px; +} + +button { + font: inherit; + padding: 6px 14px; + border-radius: 6px; + border: 1px solid var(--border); + background: var(--surface); + color: var(--text); + cursor: pointer; +} + +button.approve { + background: var(--accent); + border-color: var(--accent); + color: var(--accent-text); +} + +button.deny { + border-color: var(--deny); + color: var(--deny); +} + +button.quiet { + padding: 2px 10px; +} + +table { + border-collapse: collapse; + width: 100%; + background: var(--surface); +} + +th, +td { + text-align: left; + padding: 6px 8px; + border-bottom: 1px solid var(--border); + vertical-align: top; + overflow-wrap: anywhere; +} + +code { + font-size: 0.85rem; +} + +.filters { + display: flex; + flex-wrap: wrap; + gap: 8px 12px; + align-items: end; +} + +.filters input { + font: inherit; + max-width: 100%; +} + +#push { + margin-bottom: 12px; + color: var(--muted); +} + +.request.needs-passkey { + border-left: 4px solid var(--key); +} + +.badge.passkey { + background: var(--key-bg); + color: var(--key); + font-weight: 600; +} + +.lock { + width: 0.85em; + height: 0.85em; + margin-right: 0.3em; + vertical-align: -0.05em; + fill: currentColor; +} + +.outcome { + display: inline-block; + padding: 0 6px; + border-radius: 4px; + font-size: 0.85rem; + white-space: nowrap; +} + +.outcome.good { + background: var(--good-bg); + color: var(--good); +} + +.outcome.bad { + background: var(--bad-bg); + color: var(--bad); +} + +.outcome.active { + background: var(--active-bg); + color: var(--active); +} + +.outcome.neutral { + background: var(--code-bg); + color: var(--muted); +} + +.scroll { + overflow-x: auto; +} + +table.log td:first-child { + white-space: nowrap; + color: var(--muted); + font-size: 0.9rem; +} + +table.log .label { + color: var(--muted); + font-size: 0.9rem; +} + +.timeline { + list-style: none; + padding: 0; + margin: 0 0 16px; + border-left: 2px solid var(--border); +} + +.timeline li { + padding: 4px 0 8px 14px; + overflow-wrap: anywhere; +} + +.timeline time { + display: block; + color: var(--muted); + font-size: 0.85rem; +} + +.filters select { + font: inherit; +} + +.filters { + margin-bottom: 16px; +} diff --git a/src/web/assets/sw.js b/src/web/assets/sw.js new file mode 100644 index 0000000..3ba5558 --- /dev/null +++ b/src/web/assets/sw.js @@ -0,0 +1,66 @@ +// Shows pushed requests as notifications and answers them from their buttons, with the same +// session the page uses. Anything that fails opens the request instead. +"use strict"; + +self.addEventListener("install", () => self.skipWaiting()); +self.addEventListener("activate", (event) => event.waitUntil(self.clients.claim())); + +self.addEventListener("push", (event) => { + const data = event.data?.json(); + if (!data) return; + const tag = `slop-${data.id}`; + + if (data.kind === "clear") { + event.waitUntil( + self.registration.getNotifications({ tag }).then((all) => all.forEach((n) => n.close())), + ); + return; + } + + event.waitUntil( + self.registration.showNotification(data.title, { + body: data.body, + tag, + requireInteraction: true, + icon: "/icon.svg", + data: { id: data.id, url: data.url }, + actions: data.actions, + }), + ); +}); + +async function answer(id, decision) { + const token = await fetch("/api/csrf", { credentials: "same-origin" }); + if (!token.ok) throw new Error("not signed in"); + const { csrf } = await token.json(); + + const response = await fetch(`/requests/${encodeURIComponent(id)}`, { + method: "POST", + credentials: "same-origin", + headers: { "X-CSRF-Token": csrf }, + body: new URLSearchParams({ decision }), + }); + if (!response.ok) throw new Error(await response.text()); +} + +async function open(url) { + const windows = await self.clients.matchAll({ type: "window", includeUncontrolled: true }); + for (const client of windows) { + if (new URL(client.url).origin === self.location.origin && "focus" in client) { + await client.navigate(url).catch(() => {}); + return client.focus(); + } + } + return self.clients.openWindow(url); +} + +self.addEventListener("notificationclick", (event) => { + const { id, url } = event.notification.data; + event.notification.close(); + + if (!event.action) { + event.waitUntil(open(url)); + return; + } + event.waitUntil(answer(id, event.action).catch(() => open(url))); +}); diff --git a/src/web/auth.rs b/src/web/auth.rs new file mode 100644 index 0000000..96f32a9 --- /dev/null +++ b/src/web/auth.rs @@ -0,0 +1,246 @@ +//! Signing approvers in through an OpenID Connect provider, and confirming single answers by +//! sending the approver back to sign in again (`max_age=0`), which a passkey-only provider turns +//! into a passkey prompt. +use std::time::{Duration, Instant}; + +use anyhow::{Context, Result, anyhow, ensure}; +use openidconnect::core::{ + CoreAuthDisplay, CoreAuthPrompt, CoreAuthenticationFlow, CoreErrorResponseType, CoreGenderClaim, CoreJsonWebKey, + CoreJweContentEncryptionAlgorithm, CoreJwsSigningAlgorithm, CoreProviderMetadata, CoreRevocableToken, + CoreRevocationErrorResponse, CoreTokenIntrospectionResponse, CoreTokenType, +}; +use openidconnect::{ + AdditionalClaims, AuthorizationCode, ClientId, ClientSecret, CsrfToken, EmptyExtraTokenFields, EndpointMaybeSet, + EndpointNotSet, EndpointSet, IdTokenFields, IssuerUrl, Nonce, PkceCodeChallenge, PkceCodeVerifier, RedirectUrl, + Scope, StandardErrorResponse, StandardTokenResponse, reqwest, +}; +use serde::{Deserialize, Serialize}; + +use crate::config::WebConfig; +use crate::queue::Decision; + +/// The `groups` claim, which providers such as Pocket ID add for the `groups` scope. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +pub struct Groups { + #[serde(default)] + groups: Vec, +} + +impl AdditionalClaims for Groups {} + +type TokenResponse = StandardTokenResponse< + IdTokenFields< + Groups, + EmptyExtraTokenFields, + CoreGenderClaim, + CoreJweContentEncryptionAlgorithm, + CoreJwsSigningAlgorithm, + >, + CoreTokenType, +>; + +type Client = openidconnect::Client< + Groups, + CoreAuthDisplay, + CoreGenderClaim, + CoreJweContentEncryptionAlgorithm, + CoreJsonWebKey, + CoreAuthPrompt, + StandardErrorResponse, + TokenResponse, + CoreTokenIntrospectionResponse, + CoreRevocableToken, + CoreRevocationErrorResponse, + EndpointSet, + EndpointNotSet, + EndpointNotSet, + EndpointNotSet, + EndpointMaybeSet, + EndpointMaybeSet, +>; + +/// How long the provider's metadata and keys are used before fetching them again. +const METADATA_LIFETIME: Duration = Duration::from_secs(3600); + +/// How long a sign-in may take. +pub const FLOW_LIFETIME: u64 = 600; + +/// Why the approver was sent to the provider. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub enum Purpose { + SignIn { + /// Local path to return to. + next: String, + }, + /// Approving one request, which needs a passkey. + Confirm { + id: String, + decision: Decision, + /// [`super::fingerprint`] of what the approver was shown. + shown: String, + }, +} + +/// A sign-in in progress, kept in the session until the provider sends the approver back. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Flow { + pub state: String, + nonce: String, + verifier: String, + /// Unix time it started; a confirmation needs a sign-in no older than this. + pub started: i64, + pub purpose: Purpose, +} + +/// Who signed in, from a verified ID token. +#[derive(Debug, Clone)] +pub struct Identity { + pub subject: String, + pub name: String, + /// Unix time the approver last authenticated with the provider. + pub auth_time: Option, +} + +pub struct Oidc { + config: WebConfig, + secret: String, + http: reqwest::Client, + client: tokio::sync::Mutex>, +} + +pub fn now() -> i64 { + std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map_or(0, |d| d.as_secs() as i64) +} + +impl Oidc { + pub fn new(config: WebConfig, secret: String) -> Result { + // Following redirects would let the provider's metadata send requests anywhere. + let http = reqwest::ClientBuilder::new() + .redirect(reqwest::redirect::Policy::none()) + .timeout(Duration::from_secs(10)) + .build()?; + Ok(Oidc { config, secret, http, client: tokio::sync::Mutex::new(None) }) + } + + /// The client, discovering the provider when it isn't known yet or is due for a refresh. A + /// failed refresh keeps using what was fetched before. + async fn client(&self) -> Result { + let mut cached = self.client.lock().await; + if let Some((fetched, client)) = &*cached + && fetched.elapsed() < METADATA_LIFETIME + { + return Ok(client.clone()); + } + + match self.discover().await { + Ok(client) => { + *cached = Some((Instant::now(), client.clone())); + Ok(client) + } + Err(error) => match &*cached { + Some((_, client)) => Ok(client.clone()), + None => Err(error.context("reaching the sign-in provider")), + }, + } + } + + async fn discover(&self) -> Result { + let issuer = IssuerUrl::new(self.config.issuer.clone())?; + let metadata = CoreProviderMetadata::discover_async(issuer, &self.http).await?; + let redirect = RedirectUrl::new(format!("{}/auth/callback", self.config.url.trim_end_matches('/')))?; + + Ok(Client::from_provider_metadata( + metadata, + ClientId::new(self.config.client_id.clone()), + Some(ClientSecret::new(self.secret.clone())), + ) + .set_redirect_uri(redirect)) + } + + /// Where to send the approver, and what to remember until they're back. + pub async fn begin(&self, purpose: Purpose) -> Result<(String, Flow)> { + let client = self.client().await?; + let (challenge, verifier) = PkceCodeChallenge::new_random_sha256(); + + let mut request = client + .authorize_url(CoreAuthenticationFlow::AuthorizationCode, CsrfToken::new_random, Nonce::new_random) + .add_scope(Scope::new("profile".into())) + .add_scope(Scope::new("groups".into())) + .set_pkce_challenge(challenge); + if matches!(purpose, Purpose::Confirm { .. }) { + request = request.set_max_age(Duration::ZERO); + } + let (url, state, nonce) = request.url(); + + let flow = Flow { + state: state.secret().clone(), + nonce: nonce.secret().clone(), + verifier: verifier.secret().clone(), + started: now(), + purpose, + }; + Ok((url.to_string(), flow)) + } + + /// Exchanges the code the provider sent back, and checks the ID token and group. + pub async fn finish(&self, flow: &Flow, code: String) -> Result { + let client = self.client().await?; + let response = client + .exchange_code(AuthorizationCode::new(code))? + .set_pkce_verifier(PkceCodeVerifier::new(flow.verifier.clone())) + .request_async(&self.http) + .await + .map_err(|e| anyhow!("exchanging the sign-in code: {e}"))?; + + let token = openidconnect::TokenResponse::id_token(&response).context("the provider sent no ID token")?; + let claims = token.claims(&client.id_token_verifier(), &Nonce::new(flow.nonce.clone()))?; + ensure!( + claims.additional_claims().groups.contains(&self.config.group), + "this account isn't in the {} group", + self.config.group + ); + + let subject = claims.subject().as_str().to_owned(); + let name = claims.preferred_username().map_or_else(|| subject.clone(), |n| n.as_str().to_owned()); + Ok(Identity { subject, name, auth_time: claims.auth_time().map(|t| t.timestamp()) }) + } +} + +/// Checks that a confirmation came from the signed-in approver, who authenticated after it +/// started. +pub fn confirmed(flow: &Flow, identity: &Identity, subject: &str) -> Result<()> { + ensure!(identity.subject == subject, "the passkey belongs to a different account"); + ensure!( + identity.auth_time.is_some_and(|t| t >= flow.started), + "the sign-in provider didn't ask for the passkey again" + ); + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + + fn flow(started: i64) -> Flow { + Flow { + state: "s".into(), + nonce: "n".into(), + verifier: "v".into(), + started, + purpose: Purpose::Confirm { id: "r".into(), decision: Decision::Once, shown: "h".into() }, + } + } + + fn identity(subject: &str, auth_time: Option) -> Identity { + Identity { subject: subject.into(), name: "dev".into(), auth_time } + } + + #[test] + fn confirmation_needs_a_fresh_sign_in_by_the_same_account() { + assert!(confirmed(&flow(100), &identity("a", Some(100)), "a").is_ok()); + assert!(confirmed(&flow(100), &identity("a", Some(130)), "a").is_ok()); + assert!(confirmed(&flow(100), &identity("a", Some(99)), "a").is_err()); + assert!(confirmed(&flow(100), &identity("a", None), "a").is_err()); + assert!(confirmed(&flow(100), &identity("b", Some(130)), "a").is_err()); + } +} diff --git a/src/web/history.rs b/src/web/history.rs new file mode 100644 index 0000000..c10d572 --- /dev/null +++ b/src/web/history.rs @@ -0,0 +1,281 @@ +//! The audit log gathered by request: what was asked, who approved it and how it ended. +use std::collections::HashMap; + +use crate::audit::{Event, Record}; +use crate::proto::ApprovedBy; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Outcome { + /// Waiting for an approver, or for its preparation. + Waiting, + /// Approved and not finished yet. + Running, + Succeeded, + /// Ran, and exited with a non-zero status. + ExitedWith(i32), + Failed, + Denied, + Expired, + Cancelled, + Invalid, +} + +impl Outcome { + pub fn name(&self) -> String { + match self { + Outcome::Waiting => "Waiting".into(), + Outcome::Running => "Running".into(), + Outcome::Succeeded => "Succeeded".into(), + Outcome::ExitedWith(status) => format!("Exit status {status}"), + Outcome::Failed => "Failed".into(), + Outcome::Denied => "Denied".into(), + Outcome::Expired => "Expired".into(), + Outcome::Cancelled => "Cancelled".into(), + Outcome::Invalid => "Invalid".into(), + } + } + + /// For styling: good, bad, or still going. + pub fn tone(&self) -> &'static str { + match self { + Outcome::Waiting | Outcome::Running => "active", + Outcome::Succeeded => "good", + Outcome::Expired | Outcome::Cancelled => "neutral", + _ => "bad", + } + } + + /// The filter value for this outcome. + pub fn key(&self) -> &'static str { + match self { + Outcome::Waiting | Outcome::Running => "active", + Outcome::Succeeded => "succeeded", + Outcome::ExitedWith(_) | Outcome::Failed | Outcome::Invalid => "failed", + Outcome::Denied => "denied", + Outcome::Expired | Outcome::Cancelled => "expired", + } + } +} + +/// Everything the log says about one request. +#[derive(Debug, Clone)] +pub struct History { + pub id: String, + pub time: String, + pub requester: String, + pub op: String, + pub summary: String, + pub label: Option, + pub outcome: Outcome, + /// Who approved it (the request itself, not a step before it), with the answer they gave. + pub approved_by: Option, + pub records: Vec, +} + +fn id_of(event: &Event) -> Option<&str> { + match event { + Event::Unknown { .. } => None, + Event::Invalid { id, .. } + | Event::Request { id, .. } + | Event::Prepared { id, .. } + | Event::Approved { id, .. } + | Event::Decision { id, .. } + | Event::Denied { id, .. } + | Event::Expired { id } + | Event::Disconnected { id } + | Event::Finished { id, .. } + | Event::Failed { id, .. } => Some(id), + } +} + +/// Groups records (oldest first) by request, newest request first. Connections from unknown +/// peers have no request and are returned separately. +pub fn gather(records: Vec) -> (Vec, Vec) { + let mut order: Vec = vec![]; + let mut by_id: HashMap> = HashMap::new(); + let mut unknown = vec![]; + + for record in records { + match id_of(&record.event) { + Some(id) => { + if !by_id.contains_key(id) { + order.push(id.to_owned()); + } + by_id.entry(id.to_owned()).or_default().push(record); + } + None => unknown.push(record), + } + } + + let histories = order.into_iter().rev().map(|id| summarize(id.clone(), by_id.remove(&id).unwrap())).collect(); + unknown.reverse(); + (histories, unknown) +} + +fn summarize(id: String, records: Vec) -> History { + let mut history = History { + id, + time: records[0].time.clone(), + requester: String::new(), + op: String::new(), + summary: String::new(), + label: None, + outcome: Outcome::Waiting, + approved_by: None, + records: vec![], + }; + let mut answer = None; + + for record in &records { + match &record.event { + Event::Request { requester, op, summary, label, .. } => { + history.requester = requester.clone(); + history.op = op.clone(); + history.summary = summary.clone(); + history.label = label.clone(); + } + Event::Invalid { requester, error, .. } => { + history.requester = requester.clone(); + history.summary = error.clone(); + history.outcome = Outcome::Invalid; + } + Event::Decision { decision, approver, .. } => answer = Some((decision.clone(), approver.clone())), + Event::Approved { by, approver, step: None, .. } => { + history.outcome = Outcome::Running; + history.approved_by = Some(match (by, approver, &answer) { + (ApprovedBy::Policy, _, _) => "policy".into(), + (ApprovedBy::Lease, _, _) => "a lease".into(), + (ApprovedBy::Approver, Some(approver), Some((decision, _))) => format!("{approver} ({decision})"), + (ApprovedBy::Approver, Some(approver), None) => approver.clone(), + (ApprovedBy::Approver, None, _) => "an approver".into(), + }); + } + Event::Denied { .. } => history.outcome = Outcome::Denied, + Event::Expired { .. } => history.outcome = Outcome::Expired, + Event::Disconnected { .. } => history.outcome = Outcome::Cancelled, + Event::Finished { exit: 0, .. } => history.outcome = Outcome::Succeeded, + Event::Finished { exit, .. } => history.outcome = Outcome::ExitedWith(*exit), + Event::Failed { .. } => history.outcome = Outcome::Failed, + Event::Unknown { .. } | Event::Prepared { .. } | Event::Approved { .. } => {} + } + } + + history.records = records; + history +} + +/// One event in a request's timeline: what happened, and any longer text to show with it. +pub fn describe(event: &Event) -> (String, Option) { + match event { + Event::Unknown { peer } => (format!("Refused a connection from {peer}"), None), + Event::Invalid { error, .. } => (format!("Invalid request: {error}"), None), + Event::Request { summary, detail, label, .. } => { + let mut text = format!("Asked: {summary}"); + if let Some(label) = label { + text += &format!(" (label: {label})"); + } + (text, Some(detail.clone()).filter(|d| !d.is_empty())) + } + Event::Prepared { detail, .. } => { + ("Prepared for approval".into(), Some(detail.clone()).filter(|d| !d.is_empty())) + } + Event::Approved { by, approver, step, .. } => { + let by = match (by, approver) { + (ApprovedBy::Policy, _) => "policy".to_owned(), + (ApprovedBy::Lease, _) => "a lease".to_owned(), + (ApprovedBy::Approver, Some(approver)) => approver.clone(), + (ApprovedBy::Approver, None) => "an approver".to_owned(), + }; + match step { + Some(step) => (format!("Use of the {step} approved by {by}"), None), + None => (format!("Approved by {by}"), None), + } + } + Event::Decision { decision, approver, .. } => (format!("{approver} answered {decision}"), None), + Event::Denied { reason, .. } => (format!("Refused: {reason}"), None), + Event::Expired { .. } => ("Expired without an answer".into(), None), + Event::Disconnected { .. } => ("Cancelled: the requester disconnected".into(), None), + Event::Finished { exit, seconds, .. } => { + (format!("Finished with exit status {exit} after {seconds:.1}s"), None) + } + Event::Failed { error, .. } => (format!("Failed: {error}"), None), + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn record(time: &str, event: Event) -> Record { + Record { time: time.into(), event } + } + + fn request(id: &str) -> Event { + Event::Request { + id: id.into(), + requester: "slop-cannon".into(), + op: "ssh".into(), + summary: format!("ssh {id}"), + detail: "Command: uptime".into(), + label: None, + } + } + + #[test] + fn gathers_requests_and_their_outcomes() { + let records = vec![ + record("1", request("a")), + record("2", request("b")), + record("3", Event::Unknown { peer: "vsock CID 9".into() }), + record( + "4", + Event::Decision { + id: "a".into(), + requester: "slop-cannon".into(), + summary: "ssh a".into(), + decision: "5m".into(), + approver: "dev (web)".into(), + }, + ), + record( + "5", + Event::Approved { + id: "a".into(), + by: ApprovedBy::Approver, + approver: Some("dev (web)".into()), + step: None, + }, + ), + record("6", Event::Finished { id: "a".into(), exit: 1, seconds: 0.5 }), + record("7", Event::Expired { id: "b".into() }), + record("8", request("c")), + record("9", Event::Approved { id: "c".into(), by: ApprovedBy::Lease, approver: None, step: None }), + ]; + + let (histories, unknown) = gather(records); + assert_eq!(unknown.len(), 1); + let ids: Vec<_> = histories.iter().map(|h| h.id.as_str()).collect(); + assert_eq!(ids, ["c", "b", "a"]); + + assert_eq!(histories[0].outcome, Outcome::Running); + assert_eq!(histories[0].approved_by.as_deref(), Some("a lease")); + assert_eq!(histories[1].outcome, Outcome::Expired); + assert_eq!(histories[2].outcome, Outcome::ExitedWith(1)); + assert_eq!(histories[2].approved_by.as_deref(), Some("dev (web) (5m)")); + assert_eq!(histories[2].records.len(), 4); + } + + #[test] + fn steps_before_the_request_dont_count_as_approving_it() { + let records = vec![ + record("1", request("a")), + record( + "2", + Event::Approved { id: "a".into(), by: ApprovedBy::Lease, approver: None, step: Some("builder".into()) }, + ), + ]; + let (histories, _) = gather(records); + assert_eq!(histories[0].outcome, Outcome::Waiting); + assert_eq!(histories[0].approved_by, None); + } +} diff --git a/src/web/mod.rs b/src/web/mod.rs new file mode 100644 index 0000000..40cf4eb --- /dev/null +++ b/src/web/mod.rs @@ -0,0 +1,521 @@ +//! The approvals web app: pending requests with full detail, answers, leases and the audit log, +//! for approvers signed in through an OpenID Connect provider, plus Web Push notifications. It +//! sits behind a reverse proxy, which is the only thing that should reach its listener. +mod auth; +mod history; +mod page; +mod push; + +use std::sync::Arc; + +use anyhow::{Context, Result}; +use axum::Router; +use axum::extract::{Path, Query, State}; +use axum::http::{HeaderMap, HeaderValue, StatusCode, header}; +use axum::response::{IntoResponse, Redirect, Response}; +use axum::routing::{get, post}; +use serde::{Deserialize, Serialize}; +use sha2::{Digest, Sha256}; +use tower_sessions::cookie::SameSite; +use tower_sessions::cookie::time::Duration; +use tower_sessions::{ExpiredDeletion, Expiry, Session, SessionManagerLayer}; +use tower_sessions_rusqlite_store::{RusqliteStore, tokio_rusqlite}; + +use crate::approve; +use crate::config::WebConfig; +use crate::queue::{Decision, PendingInfo}; +use crate::server::Broker; +use auth::{Flow, Oidc, Purpose}; +use history::History; +use push::{Push, Subscription}; + +struct Web { + broker: Arc, + /// The app's origin, which every POST must come from. + origin: String, + oidc: Oidc, + push: Arc, +} + +/// The signed-in approver, kept in the session. +#[derive(Debug, Clone, Serialize, Deserialize)] +struct User { + subject: String, + name: String, + /// Sent back with every POST. + csrf: String, +} + +const USER: &str = "user"; +const FLOWS: &str = "flows"; + +/// Sign-ins in progress per session, for several tabs or notifications at once. +const MAX_FLOWS: usize = 8; + +fn origin(url: &str) -> Result { + let url = url::Url::parse(url)?; + anyhow::ensure!(url.path() == "/" && url.query().is_none(), "the web app's URL must not have a path"); + Ok(url.origin().ascii_serialization()) +} + +pub async fn run(broker: Arc, config: WebConfig, secret: String) -> Result<()> { + let origin = origin(&config.url)?; + let issuer = url::Url::parse(&config.issuer)?.origin().ascii_serialization(); + // Sessions outlive the broker restarting, so signing in on a phone lasts. + let database = tokio_rusqlite::Connection::open(config.state_dir.join("sessions.sqlite")).await?; + let store = RusqliteStore::new(database); + store.migrate().await.context("setting up the sessions database")?; + tokio::spawn(store.clone().continuously_delete_expired(std::time::Duration::from_secs(3600))); + let push = Arc::new(Push::open(&config.state_dir, &config.url)?); + let listener = tokio::net::TcpListener::bind(config.listen).await.context("binding the web listener")?; + + let sessions = SessionManagerLayer::new(store) + .with_name("slop_session") + .with_secure(config.url.starts_with("https:")) + .with_same_site(SameSite::Lax) + .with_http_only(true) + .with_expiry(Expiry::OnInactivity(Duration::seconds(config.session as i64))); + + let web = Arc::new(Web { oidc: Oidc::new(config.clone(), secret)?, broker: broker.clone(), origin, push }); + tokio::spawn(web.push.clone().run(broker)); + + let app = Router::new() + .route("/", get(index)) + .route("/pending", get(pending_fragment)) + .route("/requests/{id}", get(request_page).post(answer)) + .route("/log", get(log_page)) + .route("/api/version", get(version)) + .route("/api/csrf", get(csrf)) + .route("/push/key", get(push_key)) + .route("/push/subscribe", post(subscribe)) + .route("/push/unsubscribe", post(unsubscribe)) + .route("/auth/login", get(login)) + .route("/auth/callback", get(callback)) + .route("/auth/logout", post(logout)) + .route("/signed-out", get(signed_out)) + .route("/app.js", get(|| async { page::asset("text/javascript", include_str!("assets/app.js")) })) + .route("/sw.js", get(|| async { page::asset("text/javascript", include_str!("assets/sw.js")) })) + .route("/style.css", get(|| async { page::asset("text/css", include_str!("assets/style.css")) })) + .route("/icon.svg", get(|| async { page::asset("image/svg+xml", include_str!("assets/icon.svg")) })) + .route( + "/manifest.webmanifest", + get(|| async { page::asset("application/manifest+json", include_str!("assets/manifest.webmanifest")) }), + ) + .layer(axum::middleware::map_response(move |response| security_headers(response, issuer.clone()))) + .layer(sessions) + .with_state(web); + + axum::serve(listener, app).await.context("serving the web app") +} + +async fn security_headers(mut response: Response, issuer: String) -> Response { + let headers = response.headers_mut(); + // Answers that need a passkey redirect a form submission to the sign-in provider. + let policy = format!( + "default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self'; connect-src 'self'; \ + manifest-src 'self'; worker-src 'self'; form-action 'self' {issuer}; frame-ancestors 'none'; base-uri 'none'" + ); + headers.insert(header::CONTENT_SECURITY_POLICY, HeaderValue::from_str(&policy).unwrap()); + headers.insert(header::X_CONTENT_TYPE_OPTIONS, HeaderValue::from_static("nosniff")); + headers.insert(header::REFERRER_POLICY, HeaderValue::from_static("same-origin")); + headers.entry(header::CACHE_CONTROL).or_insert(HeaderValue::from_static("no-store")); + response +} + +/// Something that went wrong, shown as a page. +struct Failure(StatusCode, String); + +impl IntoResponse for Failure { + fn into_response(self) -> Response { + (self.0, page::message("Something went wrong", &self.1)).into_response() + } +} + +impl From for Failure { + fn from(error: anyhow::Error) -> Failure { + Failure(StatusCode::INTERNAL_SERVER_ERROR, format!("{error:#}")) + } +} + +impl From for Failure { + fn from(error: tower_sessions::session::Error) -> Failure { + Failure(StatusCode::INTERNAL_SERVER_ERROR, format!("session: {error}")) + } +} + +fn failure(status: StatusCode, message: &str) -> Failure { + Failure(status, message.to_owned()) +} + +async fn user(session: &Session) -> Result, Failure> { + Ok(session.get::(USER).await?) +} + +/// The signed-in approver, or a redirect to sign in and come back to `here`. +async fn signed_in(session: &Session, here: &str) -> Result, Failure> { + Ok(match user(session).await? { + Some(user) => Ok(user), + None => Err(Redirect::to(&format!("/auth/login?next={}", urlencode(here))).into_response()), + }) +} + +/// The signed-in approver, for API calls, which can't follow a sign-in. +async fn api_user(session: &Session) -> Result { + user(session).await?.ok_or_else(|| failure(StatusCode::UNAUTHORIZED, "sign in first")) +} + +/// Checks a POST came from the app itself: the browser's `Origin` and the session's token. +fn check_post(web: &Web, headers: &HeaderMap, user: &User, token: Option<&str>) -> Result<(), Failure> { + let origin = headers.get(header::ORIGIN).and_then(|o| o.to_str().ok()); + let token = token.or_else(|| headers.get("x-csrf-token").and_then(|t| t.to_str().ok())); + if origin != Some(web.origin.as_str()) || token != Some(user.csrf.as_str()) { + return Err(failure(StatusCode::FORBIDDEN, "this form is out of date; reload the page and try again")); + } + Ok(()) +} + +fn urlencode(text: &str) -> String { + url::form_urlencoded::byte_serialize(text.as_bytes()).collect() +} + +/// A hash of what an approver was shown, so a confirmation only applies to what they saw. +fn fingerprint(entry: &PendingInfo) -> String { + let mut hash = Sha256::new(); + for part in [&entry.requester, &entry.op, &entry.summary, &entry.detail] { + hash.update(part.as_bytes()); + hash.update([0]); + } + hex::encode(hash.finalize()) +} + +fn approver(user: &User, passkey: bool) -> String { + if passkey { format!("{} (web, passkey)", user.name) } else { format!("{} (web)", user.name) } +} + +fn pending(web: &Web, id: &str) -> Option { + web.broker.queue.list().into_iter().find(|e| e.id == id) +} + +async fn index(State(web): State>, session: Session) -> Result { + let user = match signed_in(&session, "/").await? { + Ok(user) => user, + Err(redirect) => return Ok(redirect), + }; + + let entries = web.broker.queue.list(); + let leases = web.broker.queue.all_leases(); + Ok(page::index(&user.name, &user.csrf, &entries, &leases, web.broker.queue.version()).into_response()) +} + +async fn pending_fragment(State(web): State>, session: Session) -> Result { + let user = api_user(&session).await?; + let entries = web.broker.queue.list(); + let leases = web.broker.queue.all_leases(); + Ok(page::pending(&user.csrf, &entries, &leases).into_response()) +} + +async fn request_page( + State(web): State>, + session: Session, + Path(id): Path, +) -> Result { + let user = match signed_in(&session, &format!("/requests/{id}")).await? { + Ok(user) => user, + Err(redirect) => return Ok(redirect), + }; + // The log may be missing or unreadable; the request itself still shows. + let past = web.broker.audit.tail(LOG_RECORDS).ok().and_then(|records| { + let (histories, _) = history::gather(records); + histories.into_iter().find(|h| h.id == id) + }); + let current = pending(&web, &id); + Ok(page::request(&user.name, &user.csrf, &id, current.as_ref(), past.as_ref(), web.broker.queue.version()) + .into_response()) +} + +#[derive(Deserialize)] +struct AnswerForm { + decision: String, + csrf: Option, +} + +/// Records an answer from a form or the service worker. Approving a request that needs a passkey +/// sends the approver to sign in again first. +async fn answer( + State(web): State>, + session: Session, + headers: HeaderMap, + Path(id): Path, + axum::Form(form): axum::Form, +) -> Result { + let user = api_user(&session).await?; + check_post(&web, &headers, &user, form.csrf.as_deref())?; + // Scripts send the token as a header and want a status rather than a page. + let script = headers.contains_key("x-csrf-token"); + + let decision = Decision::parse(&form.decision).map_err(|e| failure(StatusCode::BAD_REQUEST, &e.to_string()))?; + let entry = pending(&web, &id).ok_or_else(|| failure(StatusCode::GONE, "this request is no longer pending"))?; + if !entry.offers.contains(&decision) { + return Err(failure(StatusCode::BAD_REQUEST, "that answer isn't offered for this request")); + } + + if entry.passkey && decision != Decision::Deny { + if script { + return Err(failure(StatusCode::FORBIDDEN, "this request needs a passkey; open it to approve")); + } + let purpose = Purpose::Confirm { id: id.clone(), decision, shown: fingerprint(&entry) }; + return start(&web, &session, purpose).await; + } + + approve::approve(&web.broker, &id, decision, &approver(&user, false), false) + .map_err(|e| failure(StatusCode::CONFLICT, &format!("{e:#}")))?; + Ok(if script { StatusCode::NO_CONTENT.into_response() } else { Redirect::to("/").into_response() }) +} + +/// Audit records the log page and request pages read. +const LOG_RECORDS: usize = 5000; + +/// Requests the log page lists at most. +const LOG_ROWS: usize = 300; + +async fn log_page( + State(web): State>, + session: Session, + Query(filters): Query, +) -> Result { + let user = match signed_in(&session, "/log").await? { + Ok(user) => user, + Err(redirect) => return Ok(redirect), + }; + + let (histories, refused) = history::gather(web.broker.audit.tail(LOG_RECORDS)?); + + let mut requesters: Vec = web.broker.config.requesters.keys().cloned().collect(); + let mut ops: Vec = histories.iter().map(|h| h.op.clone()).filter(|o| !o.is_empty()).collect(); + requesters.extend(histories.iter().map(|h| h.requester.clone()).filter(|r| !r.is_empty())); + for list in [&mut requesters, &mut ops] { + list.sort(); + list.dedup(); + } + + let matching: Vec = histories.into_iter().filter(|h| filters.matches(h)).collect(); + let view = page::LogView { + filters: &filters, + histories: &matching[..matching.len().min(LOG_ROWS)], + matched: matching.len(), + requesters: &requesters, + ops: &ops, + refused: &refused, + }; + Ok(page::log(&user.name, &user.csrf, &view).into_response()) +} + +async fn version(State(web): State>, session: Session) -> Result { + api_user(&session).await?; + Ok(axum::Json(serde_json::json!({ "version": web.broker.queue.version() })).into_response()) +} + +async fn csrf(session: Session) -> Result { + let user = api_user(&session).await?; + Ok(axum::Json(serde_json::json!({ "csrf": user.csrf })).into_response()) +} + +async fn push_key(State(web): State>, session: Session) -> Result { + api_user(&session).await?; + Ok(web.push.public_key().to_owned().into_response()) +} + +/// A browser's `PushSubscription`, as `toJSON()` gives it. +#[derive(Deserialize)] +struct BrowserSubscription { + endpoint: String, + keys: SubscriptionKeys, +} + +#[derive(Deserialize)] +struct SubscriptionKeys { + p256dh: String, + auth: String, +} + +async fn subscribe( + State(web): State>, + session: Session, + headers: HeaderMap, + axum::Json(subscription): axum::Json, +) -> Result { + let user = api_user(&session).await?; + check_post(&web, &headers, &user, None)?; + + let subscription = Subscription { + endpoint: subscription.endpoint, + p256dh: subscription.keys.p256dh, + auth: subscription.keys.auth, + subject: user.subject, + }; + let service = url::Url::parse(&subscription.endpoint).ok().and_then(|u| u.host_str().map(str::to_owned)); + let service = service.unwrap_or_default(); + if let Err(error) = web.push.subscribe(subscription) { + eprintln!("<4>refused a push subscription from {} at {service}: {error:#}", user.name); + return Err(Failure(StatusCode::BAD_REQUEST, format!("{error:#}"))); + } + + eprintln!("<6>{} subscribed a device to notifications through {service}", user.name); + Ok(StatusCode::NO_CONTENT.into_response()) +} + +#[derive(Deserialize)] +struct Unsubscription { + endpoint: String, +} + +async fn unsubscribe( + State(web): State>, + session: Session, + headers: HeaderMap, + axum::Json(request): axum::Json, +) -> Result { + let user = api_user(&session).await?; + check_post(&web, &headers, &user, None)?; + web.push.unsubscribe(&request.endpoint, &user.subject)?; + Ok(StatusCode::NO_CONTENT.into_response()) +} + +/// Sends the approver to the sign-in provider, remembering why. +async fn start(web: &Web, session: &Session, purpose: Purpose) -> Result { + let (url, flow) = web.oidc.begin(purpose).await?; + + let mut flows = session.get::>(FLOWS).await?.unwrap_or_default(); + flows.retain(|f| auth::now() - f.started < auth::FLOW_LIFETIME as i64); + if flows.len() >= MAX_FLOWS { + flows.remove(0); + } + flows.push(flow); + session.insert(FLOWS, flows).await?; + + Ok(Redirect::to(&url).into_response()) +} + +#[derive(Deserialize)] +struct LoginQuery { + next: Option, +} + +async fn login( + State(web): State>, + session: Session, + Query(query): Query, +) -> Result { + // Only paths on this site, never `//elsewhere`. + let next = query.next.filter(|n| n.starts_with('/') && !n.starts_with("//")).unwrap_or_else(|| "/".into()); + start(&web, &session, Purpose::SignIn { next }).await +} + +#[derive(Deserialize)] +struct CallbackQuery { + state: Option, + code: Option, + error: Option, + error_description: Option, +} + +async fn callback( + State(web): State>, + session: Session, + Query(query): Query, +) -> Result { + let mut flows = session.get::>(FLOWS).await?.unwrap_or_default(); + let position = flows + .iter() + .position(|f| Some(&f.state) == query.state.as_ref() && auth::now() - f.started < auth::FLOW_LIFETIME as i64) + .ok_or_else(|| failure(StatusCode::BAD_REQUEST, "this sign-in has expired; please try again"))?; + let flow = flows.remove(position); + session.insert(FLOWS, flows).await?; + + if let Some(error) = query.error { + let description = query.error_description.unwrap_or_default(); + return Err(Failure(StatusCode::FORBIDDEN, format!("the sign-in provider refused: {error} {description}"))); + } + let code = query.code.ok_or_else(|| failure(StatusCode::BAD_REQUEST, "the sign-in provider sent no code"))?; + let identity = web.oidc.finish(&flow, code).await.map_err(|e| Failure(StatusCode::FORBIDDEN, format!("{e:#}")))?; + + match flow.purpose { + Purpose::SignIn { next } => { + // A new session ID, so one planted before signing in is useless. + session.cycle_id().await?; + let csrf = hex::encode(rand::random::<[u8; 32]>()); + session.insert(USER, User { subject: identity.subject, name: identity.name, csrf }).await?; + Ok(Redirect::to(&next).into_response()) + } + Purpose::Confirm { ref id, decision, ref shown } => { + let user = api_user(&session).await?; + auth::confirmed(&flow, &identity, &user.subject) + .map_err(|e| Failure(StatusCode::FORBIDDEN, format!("{e:#}")))?; + + let entry = + pending(&web, id).ok_or_else(|| failure(StatusCode::GONE, "this request is no longer pending"))?; + if fingerprint(&entry) != *shown { + return Err(failure(StatusCode::CONFLICT, "this request changed since you answered it; look again")); + } + + approve::approve(&web.broker, id, decision, &approver(&user, true), true) + .map_err(|e| failure(StatusCode::CONFLICT, &format!("{e:#}")))?; + Ok(Redirect::to("/").into_response()) + } + } +} + +#[derive(Deserialize)] +struct LogoutForm { + csrf: Option, +} + +async fn logout( + State(web): State>, + session: Session, + headers: HeaderMap, + axum::Form(form): axum::Form, +) -> Result { + if let Some(user) = user(&session).await? { + check_post(&web, &headers, &user, form.csrf.as_deref())?; + } + session.flush().await?; + Ok(Redirect::to("/signed-out").into_response()) +} + +async fn signed_out() -> Response { + page::message("Signed out", "You're signed out of the approvals app.").into_response() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn origins() { + assert_eq!(origin("https://approve.example.org").unwrap(), "https://approve.example.org"); + assert_eq!(origin("http://localhost:8095/").unwrap(), "http://localhost:8095"); + assert!(origin("https://approve.example.org/app").is_err()); + } + + #[test] + fn fingerprints_cover_what_approvers_see() { + let entry = PendingInfo { + id: "a".into(), + requester: "slop-cannon".into(), + op: "deploy".into(), + summary: "deploy river".into(), + detail: "x".into(), + label: None, + sensitive: false, + passkey: true, + offers: vec![], + expires_in: 10, + }; + let changed = PendingInfo { detail: "y".into(), ..entry.clone() }; + let shifted = PendingInfo { summary: "deploy river\0x".into(), detail: String::new(), ..entry.clone() }; + assert_ne!(fingerprint(&entry), fingerprint(&changed)); + assert_ne!(fingerprint(&entry), fingerprint(&shifted)); + assert_eq!(fingerprint(&entry), fingerprint(&PendingInfo { expires_in: 3, ..entry.clone() })); + } +} diff --git a/src/web/page.rs b/src/web/page.rs new file mode 100644 index 0000000..8885c88 --- /dev/null +++ b/src/web/page.rs @@ -0,0 +1,242 @@ +//! The web app's pages, from the templates in `templates/`. Everything they show is escaped, and +//! passed through [`printable`] first (see `askama.toml`). +use std::fmt; + +use askama::Template; +use askama::filters::Escaper; +use axum::http::header; +use axum::response::{Html, IntoResponse, Response}; + +use super::history::{self, History}; +use crate::audit::{Record, short}; +use crate::ops::printable; +use crate::queue::{Decision, PendingInfo}; + +/// HTML escaping, after replacing what [`printable`] replaces. +#[derive(Debug, Clone, Copy)] +pub struct Printable; + +impl Escaper for Printable { + fn write_escaped_str(&self, dest: W, string: &str) -> fmt::Result { + askama::filters::Html.write_escaped_str(dest, &printable(string)) + } +} + +pub fn asset(content_type: &'static str, body: &'static str) -> Response { + ([(header::CONTENT_TYPE, content_type), (header::CACHE_CONTROL, "no-cache")], body).into_response() +} + +fn render(template: impl Template) -> Html { + // Only a failing `Display` makes rendering fail, and nothing the pages show has one. + Html(template.render().unwrap_or_else(|error| format!("rendering the page failed: {error}"))) +} + +/// Time left, like `4m 10s`. +fn left(seconds: &u64) -> String { + match *seconds { + s if s >= 3600 => format!("{}h {}m", s / 3600, s % 3600 / 60), + s if s >= 60 => format!("{}m {}s", s / 60, s % 60), + s => format!("{s}s"), + } +} + +fn is_deny(decision: &Decision) -> bool { + *decision == Decision::Deny +} + +/// An answer's button. +fn answer(decision: &Decision) -> String { + match decision { + Decision::Lease(_) => format!("For {}", decision.title()), + _ => decision.title(), + } +} + +fn describe(record: &Record) -> (String, Option) { + history::describe(&record.event) +} + +#[derive(Template)] +#[template(path = "message.html")] +struct Message<'a> { + title: &'a str, + text: &'a str, +} + +pub fn message(title: &str, text: &str) -> Html { + render(Message { title, text }) +} + +/// The pending requests and leases, which the page script swaps in when they change. +#[derive(Template)] +#[template(path = "pending.html")] +struct Pending<'a> { + csrf: &'a str, + entries: &'a [PendingInfo], + leases: &'a [(String, String, u64)], +} + +pub fn pending(csrf: &str, entries: &[PendingInfo], leases: &[(String, String, u64)]) -> Html { + render(Pending { csrf, entries, leases }) +} + +#[derive(Template)] +#[template(path = "index.html")] +struct Index<'a> { + name: &'a str, + csrf: &'a str, + entries: &'a [PendingInfo], + leases: &'a [(String, String, u64)], + version: u64, +} + +pub fn index( + name: &str, + csrf: &str, + entries: &[PendingInfo], + leases: &[(String, String, u64)], + version: u64, +) -> Html { + render(Index { name, csrf, entries, leases, version }) +} + +#[derive(Template)] +#[template(path = "request.html")] +struct Request<'a> { + name: &'a str, + csrf: &'a str, + heading: String, + entry: Option<&'a PendingInfo>, + past: Option<&'a History>, + version: u64, +} + +pub fn request( + name: &str, + csrf: &str, + id: &str, + entry: Option<&PendingInfo>, + past: Option<&History>, + version: u64, +) -> Html { + let heading = match (entry, past) { + (Some(entry), _) => entry.summary.clone(), + (None, Some(past)) if !past.summary.is_empty() => past.summary.clone(), + _ => format!("Request {}", short(id)), + }; + render(Request { name, csrf, heading, entry, past, version }) +} + +/// What the log page is filtered by. +#[derive(Debug, Default, serde::Deserialize)] +pub struct Filters { + #[serde(default)] + pub requester: String, + #[serde(default)] + pub op: String, + #[serde(default)] + pub outcome: String, + #[serde(default)] + pub text: String, +} + +impl Filters { + pub fn matches(&self, history: &History) -> bool { + let text = self.text.trim().to_lowercase(); + (self.requester.is_empty() || history.requester == self.requester) + && (self.op.is_empty() || history.op == self.op) + && (self.outcome.is_empty() || history.outcome.key() == self.outcome) + && (text.is_empty() + || history.id.starts_with(&text) + || history.summary.to_lowercase().contains(&text) + || history.label.as_deref().is_some_and(|l| l.to_lowercase().contains(&text))) + } +} + +pub struct LogView<'a> { + pub filters: &'a Filters, + pub histories: &'a [History], + /// How many matched before cutting the list short. + pub matched: usize, + pub requesters: &'a [String], + pub ops: &'a [String], + pub refused: &'a [Record], +} + +#[derive(Template)] +#[template(path = "log.html")] +struct Log<'a> { + name: &'a str, + csrf: &'a str, + filters: &'a Filters, + histories: &'a [History], + matched: usize, + requesters: Vec<(String, String)>, + ops: Vec<(String, String)>, + outcomes: Vec<(String, String)>, + refused: &'a [Record], +} + +pub fn log(name: &str, csrf: &str, view: &LogView) -> Html { + let pairs = |items: &[String]| items.iter().map(|i| (i.clone(), i.clone())).collect(); + let outcomes = [ + ("active", "Waiting or running"), + ("succeeded", "Succeeded"), + ("failed", "Failed"), + ("denied", "Denied"), + ("expired", "Expired or cancelled"), + ]; + + render(Log { + name, + csrf, + filters: view.filters, + histories: view.histories, + matched: view.matched, + requesters: pairs(view.requesters), + ops: pairs(view.ops), + outcomes: outcomes.iter().map(|(v, t)| (v.to_string(), t.to_string())).collect(), + refused: view.refused, + }) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn escapes_markup_and_disguises() { + let escape = |text: &str| { + let mut escaped = String::new(); + Printable.write_escaped_str(&mut escaped, text).unwrap(); + escaped + }; + assert_eq!(escape("'&'"), "<a href="x">'&'</a>"); + assert_eq!(escape("ok\u{202e}evil"), "ok\u{fffd}evil"); + } + + #[test] + fn cards_offer_each_answer() { + let entry = PendingInfo { + id: "abc".into(), + requester: "slop-cannon".into(), + op: "ssh".into(), + summary: "ssh river ".into(), + detail: "one\ntwo".into(), + label: Some(" + + +{% block header -%} +
+ + +
+{%- endblock %} +
+{% block main %}{% endblock %} +
+ + diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..da16411 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} +{% block title %}Approvals{% endblock %} +{% block main %} +

Pending requests

+ +
+{% include "pending.html" %} +
+{% endblock %} diff --git a/templates/log.html b/templates/log.html new file mode 100644 index 0000000..c11404c --- /dev/null +++ b/templates/log.html @@ -0,0 +1,32 @@ +{% extends "base.html" %} +{% import "macros.html" as m %} +{% block title %}Audit log{% endblock %} +{% block main %} +

Audit log

+
+{% call m::select("requester", "Requester", filters.requester, requesters) %}{% endcall %} +{% call m::select("op", "Operation", filters.op, ops) %}{% endcall %} +{% call m::select("outcome", "Outcome", filters.outcome, outcomes) %}{% endcall %} + + +Clear +
+{% if histories.is_empty() %} +

No requests match.

+{% else %} +
+{% for h in histories %} + + + +{% endfor %} +
TimeRequesterRequestOutcomeApproved by
{% call m::time(h.time) %}{% endcall %}{{ h.requester }}{% if h.summary.is_empty() %}Request {{ self::short(h.id) }}{% else %}{{ h.summary }}{% endif %} {{ h.op }} +{%- if let Some(label) = h.label %}
{{ label }}
{% endif %}
{% call m::outcome(h.outcome) %}{% endcall %}{% if let Some(by) = h.approved_by %}{{ by }}{% endif %}
+{% endif %} +{% if matched > histories.len() %} +

Showing the newest {{ histories.len() }} of {{ matched }} matching requests.

+{% endif %} +{% if !refused.is_empty() %} +
Refused connections ({{ refused.len() }}){% call m::timeline(refused) %}{% endcall %}
+{% endif %} +{% endblock %} diff --git a/templates/macros.html b/templates/macros.html new file mode 100644 index 0000000..bbca759 --- /dev/null +++ b/templates/macros.html @@ -0,0 +1,55 @@ +{# A padlock, marking what needs a passkey #} +{% macro lock() -%} + +{%- endmacro %} + +{% macro card(entry, csrf, open) %} +
+

{{ entry.summary }}

+

{{ entry.requester }} · {{ entry.op }} · expires in {{ self::left(entry.expires_in) }} +{%- if entry.passkey %} {% call lock() %}{% endcall %}Needs passkey{% endif %} +{%- if entry.sensitive %} Sensitive{% endif %}

+{% if let Some(label) = entry.label %} +

Label (agent-supplied): {{ label }}

+{% endif %} +{% let lines = entry.detail.lines().count() %} +{% if lines > 0 %} +Details ({{ lines }} line{% if lines != 1 %}s{% endif %})
{{ entry.detail }}
+{% endif %} +
+ +{% for decision in entry.offers %} +{% let deny = self::is_deny(decision) %} + +{% endfor %} +
+{% if entry.passkey %} +

Policy wants a fresh passkey for this one: approving sends you to sign in again. Denying doesn't.

+{% endif %} +
+{% endmacro %} + +{% macro time(rfc3339) -%} + +{%- endmacro %} + +{% macro outcome(outcome) -%} +{{ outcome.name() }} +{%- endmacro %} + +{% macro timeline(records) %} +
    +{% for record in records %} +{% let (text, detail) = self::describe(record) %} +
  1. {% call time(record.time) %}{% endcall %} {{ text }} +{%- if let Some(detail) = detail %}
    Details
    {{ detail }}
    {% endif %}
  2. +{% endfor %} +
+{% endmacro %} + +{% macro select(name, label, chosen, options) -%} + +{%- endmacro %} diff --git a/templates/message.html b/templates/message.html new file mode 100644 index 0000000..8612ff7 --- /dev/null +++ b/templates/message.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} +{% block title %}{{ title }}{% endblock %} +{% block header %}{% endblock %} +{% block main %} +

{{ title }}

+

{{ text }}

+

Back to the approvals

+{% endblock %} diff --git a/templates/pending.html b/templates/pending.html new file mode 100644 index 0000000..0e0f42c --- /dev/null +++ b/templates/pending.html @@ -0,0 +1,15 @@ +{%- import "macros.html" as m -%} +{% if entries.is_empty() %} +

Nothing is waiting for an answer.

+{% endif %} +{% for entry in entries %} +{% call m::card(entry, csrf, false) %}{% endcall %} +{% endfor %} +{% if !leases.is_empty() %} +

Active leases

+ +{% for (requester, scope, seconds) in leases %} + +{% endfor %} +
RequesterScopeLeft
{{ requester }}{{ scope }}{{ self::left(seconds) }}
+{% endif %} diff --git a/templates/request.html b/templates/request.html new file mode 100644 index 0000000..d0cc0f5 --- /dev/null +++ b/templates/request.html @@ -0,0 +1,20 @@ +{% extends "base.html" %} +{% import "macros.html" as m %} +{% block title %}Approval request{% endblock %} +{% block main %} +

{{ heading }}

+
+{% if let Some(entry) = entry %} +{% call m::card(entry, csrf, true) %}{% endcall %} +{% endif %} +{% if let Some(past) = past %} +{% if entry.is_none() %} +

{{ past.requester }} · {{ past.op }} · {% call m::outcome(past.outcome) %}{% endcall %}

+{% endif %} +

History

+{% call m::timeline(past.records.as_slice()) %}{% endcall %} +{% else if entry.is_none() %} +

The audit log has nothing about this request.

+{% endif %} +
+{% endblock %} diff --git a/tests/broker.rs b/tests/broker.rs index c9e076a..0295f07 100644 --- a/tests/broker.rs +++ b/tests/broker.rs @@ -211,7 +211,7 @@ async fn ask_waits_for_an_approver_and_leases_cover_repeats() { assert_eq!(listed[0].label.as_deref(), Some("test")); assert_eq!(listed[0].offers, [Decision::Once, Decision::Lease(300), Decision::Deny]); - slop_broker::approve::approve(&broker, &id, Decision::Lease(300), "test").unwrap(); + slop_broker::approve::approve(&broker, &id, Decision::Lease(300), "test", false).unwrap(); let mut output = String::new(); assert_eq!(client.next(&mut output).await, ServerMessage::Approved { by: ApprovedBy::Approver, stdin: true }); @@ -241,8 +241,11 @@ async fn denial_and_expiry() { let broker = broker(directory.path(), json!({ "ssh": { "action": "ask" } })); let mut client = Client::start(&broker, ssh(&["true"])).await; let id = pending_id(&mut client).await; - assert!(slop_broker::approve::approve(&broker, &id, Decision::Lease(300), "test").is_err(), "lease not offered"); - slop_broker::approve::approve(&broker, &id, Decision::Deny, "test").unwrap(); + assert!( + slop_broker::approve::approve(&broker, &id, Decision::Lease(300), "test", false).is_err(), + "lease not offered" + ); + slop_broker::approve::approve(&broker, &id, Decision::Deny, "test", false).unwrap(); assert!(matches!(client.next(&mut String::new()).await, ServerMessage::Denied(_))); let mut client = Client::start(&broker, ssh(&["true"])).await;