From 8e9d13dcd409211c6a796e414b63a6b7e8c5f9c2 Mon Sep 17 00:00:00 2001 From: Samuel Gomez Date: Tue, 17 Sep 2024 19:26:56 +0100 Subject: [PATCH 1/4] chore: migrate to new secret service impl --- Cargo.lock | 1493 +++++++++++++++++++++++----- Cargo.toml | 10 +- src/algebra/mod.rs | 2 + src/algebra/refresh.rs | 31 +- src/algebra/secrets.rs | 129 +++ src/service/configuration/mod.rs | 53 +- src/service/configuration/mod.rs-E | 98 -- src/service/mod.rs | 26 +- 8 files changed, 1441 insertions(+), 401 deletions(-) create mode 100644 src/algebra/secrets.rs delete mode 100644 src/service/configuration/mod.rs-E diff --git a/Cargo.lock b/Cargo.lock index ddbbc78..74d1b1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,22 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + [[package]] name = "aes" version = "0.8.4" @@ -72,27 +88,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] -name = "arc-swap" -version = "1.7.1" +name = "async-recursion" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" +checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] [[package]] -name = "async-lock" -version = "3.3.0" +name = "async-stream" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" dependencies = [ - "event-listener 4.0.3", - "event-listener-strategy", + "async-stream-impl", + "futures-core", "pin-project-lite", ] [[package]] -name = "async-recursion" -version = "1.1.1" +name = "async-stream-impl" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", @@ -116,12 +137,86 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" +[[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.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +[[package]] +name = "axum" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +dependencies = [ + "async-trait", + "axum-core", + "axum-macros", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.3.1", + "hyper-util", + "itoa", + "matchit 0.7.3", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper 1.0.1", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00c055ee2d014ae5981ce1016374e8213682aa14d9bf40e48ab48b5f3ef20eaa" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "backtrace" version = "0.3.71" @@ -132,11 +227,17 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.3", "object", "rustc-demangle", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.13.1" @@ -248,6 +349,30 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + [[package]] name = "chrono" version = "0.4.38" @@ -260,7 +385,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -271,36 +396,29 @@ checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ "crypto-common", "inout", + "zeroize", ] [[package]] -name = "combine" -version = "4.6.7" +name = "const-oid" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" -dependencies = [ - "bytes", - "futures-core", - "memchr", - "pin-project-lite", - "tokio", - "tokio-util", -] +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] -name = "concurrent-queue" -version = "2.5.0" +name = "convert_case" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" -dependencies = [ - "crossbeam-utils", -] +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "convert_case" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] [[package]] name = "cooked-waker" @@ -308,6 +426,16 @@ version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147be55d677052dabc6b22252d5dd0fd4c29c8c27aa4f2fbef0f94aa003b406f" +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.6" @@ -324,12 +452,12 @@ dependencies = [ ] [[package]] -name = "crossbeam-channel" -version = "0.5.13" +name = "crc32fast" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ - "crossbeam-utils", + "cfg-if", ] [[package]] @@ -347,6 +475,18 @@ version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +[[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", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -354,9 +494,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core", "typenum", ] +[[package]] +name = "ctor" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" +dependencies = [ + "quote", + "syn 2.0.66", +] + [[package]] name = "ctr" version = "0.9.2" @@ -466,7 +617,7 @@ dependencies = [ "futures", "libc", "log", - "parking_lot", + "parking_lot 0.12.2", "pin-project", "serde", "serde_json", @@ -503,6 +654,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + [[package]] name = "deranged" version = "0.3.11" @@ -529,7 +691,7 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "convert_case", + "convert_case 0.4.0", "proc-macro2", "quote", "rustc_version 0.4.0", @@ -549,6 +711,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", "subtle", ] @@ -577,12 +740,55 @@ dependencies = [ "syn 2.0.66", ] +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + [[package]] name = "either" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "pem-rfc7468", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + [[package]] name = "enum-as-inner" version = "0.4.0" @@ -631,38 +837,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "event-listener" -version = "4.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d9944b8ca13534cdfb2800775f8dd4902ff3fc75a50101466decadfdf322a24" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" -dependencies = [ - "event-listener 4.0.3", - "pin-project-lite", -] - [[package]] name = "fake" version = "2.9.2" @@ -674,24 +848,66 @@ dependencies = [ "dummy", "http 1.1.0", "rand", + "rand_core", "semver 1.0.23", "serde_json", "url-escape", "uuid", ] +[[package]] +name = "fastrand" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "finl_unicode" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" +[[package]] +name = "flate2" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +dependencies = [ + "crc32fast", + "miniz_oxide 0.8.0", +] + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[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.1" @@ -814,6 +1030,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -833,8 +1050,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -844,39 +1063,157 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] -name = "handlebars" -version = "4.5.0" +name = "google-cloud-auth" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faa67bab9ff362228eb3d00bd024a4965d8231bbb7921167f0cfa66c6626b225" +checksum = "1112c453c2e155b3e683204ffff52bcc6d6495d04b68d9e90cd24161270c5058" dependencies = [ - "log", - "pest", - "pest_derive", + "async-trait", + "base64 0.21.7", + "google-cloud-metadata", + "google-cloud-token", + "home", + "jsonwebtoken", + "reqwest", "serde", "serde_json", "thiserror", + "time", + "tokio", + "tracing", + "urlencoding", ] [[package]] -name = "handlebars" -version = "5.1.2" +name = "google-cloud-gax" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d08485b96a0e6393e9e4d1b8d48cf74ad6c063cd905eb33f42c1ce3f0377539b" +checksum = "9c3eaaad103912825594d674a4b1e556ccbb05a13a6cac17dcfd871997fb760a" dependencies = [ - "log", - "pest", - "pest_derive", - "serde", - "serde_json", + "google-cloud-token", + "http 1.1.0", "thiserror", + "tokio", + "tokio-retry", + "tonic", + "tower", + "tracing", ] [[package]] -name = "hashbrown" -version = "0.12.3" +name = "google-cloud-googleapis" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - +checksum = "0ae8ab26ef7c7c3f7dfb9cc3982293d031d8e78c85d00ddfb704b5c35aeff7c8" +dependencies = [ + "prost 0.13.2", + "prost-types", + "tonic", +] + +[[package]] +name = "google-cloud-kms" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cf74f589152d40619f70da94a052230dd69a7ca1eeb14fe5bd9f939d7946da" +dependencies = [ + "async-trait", + "google-cloud-auth", + "google-cloud-gax", + "google-cloud-googleapis", + "google-cloud-token", + "k256", + "prost-types", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "google-cloud-metadata" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f945a208886a13d07636f38fb978da371d0abc3e34bad338124b9f8c135a8f" +dependencies = [ + "reqwest", + "thiserror", + "tokio", +] + +[[package]] +name = "google-cloud-token" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f49c12ba8b21d128a2ce8585955246977fbce4415f680ebf9199b6f9d6d725f" +dependencies = [ + "async-trait", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "h2" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.1.0", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "handlebars" +version = "4.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faa67bab9ff362228eb3d00bd024a4965d8231bbb7921167f0cfa66c6626b225" +dependencies = [ + "log", + "pest", + "pest_derive", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "handlebars" +version = "5.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d08485b96a0e6393e9e4d1b8d48cf74ad6c063cd905eb33f42c1ce3f0377539b" +dependencies = [ + "log", + "pest", + "pest_derive", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.13.1" @@ -909,6 +1246,9 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] [[package]] name = "hmac" @@ -1049,9 +1389,11 @@ dependencies = [ "bytes", "futures-channel", "futures-util", + "h2", "http 1.1.0", "http-body 1.0.0", "httparse", + "httpdate", "itoa", "pin-project-lite", "smallvec", @@ -1061,18 +1403,48 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.26.0" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http 1.1.0", "hyper 1.3.1", "hyper-util", - "rustls 0.22.4", + "rustls 0.23.13", "rustls-pki-types", "tokio", - "tokio-rustls 0.25.0", + "tokio-rustls 0.26.0", + "tower-service", + "webpki-roots 0.26.1", +] + +[[package]] +name = "hyper-timeout" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" +dependencies = [ + "hyper 1.3.1", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper 1.3.1", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", "tower-service", ] @@ -1182,42 +1554,64 @@ dependencies = [ "generic-array", ] +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "integrationos-domain" -version = "4.1.6" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "341ed5f9799ddfee421304898675a41e7eb3c376df246556b44ccb374bf42979" +checksum = "4dfc17dbd5c722d9ebdf287446670cb617a27300fefd0e5558a5f3375a432e03" dependencies = [ "aes", "anyhow", "async-recursion", "async-trait", + "axum", "base64 0.21.7", "base64ct", "bson", + "chacha20poly1305", "chrono", + "crc32fast", "ctr", + "digest", "downcast-rs", "envconfig", "fake", "futures", + "google-cloud-kms", "handlebars 4.5.0", + "hex", + "hmac", "http 1.1.0", "http-serde-ext", "indexmap 2.2.6", "js-sandbox-ios", "jsonpath_lib", - "moka", "mongodb", + "napi", + "napi-derive", "openapiv3", + "percent-encoding", "pin-project", - "prost", + "prost 0.12.6", "rand", - "redis", "reqwest", + "secrecy", "semver 1.0.23", "serde", "serde_json", + "sha1", "sha2", "sha3", "strum", @@ -1239,7 +1633,7 @@ dependencies = [ "socket2 0.5.7", "widestring", "windows-sys 0.48.0", - "winreg 0.50.0", + "winreg", ] [[package]] @@ -1265,14 +1659,15 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sandbox-ios" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e3dd0f703d6d50aef7889fe55933fa3110e37d97ceeecab2c1c0a9de2f1eeac" +checksum = "00f29118a234aca68ae6ddd632ad92d51f10608a5cacc5fb0f08386c86bf5ea9" dependencies = [ "deno_core", "js-sandbox-macros", "serde", "serde_json", + "tracing", ] [[package]] @@ -1306,6 +1701,35 @@ dependencies = [ "serde_json", ] +[[package]] +name = "jsonwebtoken" +version = "9.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ae10193d25051e74945f1ea2d0b42e03cc3b890f7e4cc5faa44997d808193f" +dependencies = [ + "base64 0.21.7", + "js-sys", + "pem", + "ring", + "serde", + "serde_json", + "simple_asn1", +] + +[[package]] +name = "k256" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + [[package]] name = "keccak" version = "0.1.5" @@ -1323,9 +1747,19 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" + +[[package]] +name = "libloading" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +dependencies = [ + "cfg-if", + "windows-targets 0.52.6", +] [[package]] name = "linked-hash-map" @@ -1417,6 +1851,18 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + [[package]] name = "md-5" version = "0.10.6" @@ -1456,7 +1902,7 @@ dependencies = [ "ipnet", "metrics", "metrics-util", - "quanta 0.11.1", + "quanta", "thiserror", "tokio", "tracing", @@ -1484,7 +1930,7 @@ dependencies = [ "hashbrown 0.13.1", "metrics", "num_cpus", - "quanta 0.11.1", + "quanta", "sketches-ddsketch", ] @@ -1503,6 +1949,15 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "mio" version = "0.8.11" @@ -1514,30 +1969,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "moka" -version = "0.12.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e0d88686dc561d743b40de8269b26eaf0dc58781bde087b0984646602021d08" -dependencies = [ - "async-lock", - "async-trait", - "crossbeam-channel", - "crossbeam-epoch", - "crossbeam-utils", - "event-listener 5.3.0", - "futures-util", - "once_cell", - "parking_lot", - "quanta 0.12.3", - "rustc_version 0.4.0", - "smallvec", - "tagptr", - "thiserror", - "triomphe", - "uuid", -] - [[package]] name = "mongodb" version = "2.8.2" @@ -1585,6 +2016,74 @@ dependencies = [ "webpki-roots 0.25.4", ] +[[package]] +name = "napi" +version = "2.16.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04409e8c2d61995696e44d2181b79b68c1dd41f7e24a17cde60bbd9f54ddddef" +dependencies = [ + "bitflags 2.5.0", + "ctor", + "napi-derive", + "napi-sys", + "once_cell", +] + +[[package]] +name = "napi-derive" +version = "2.16.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17435f7a00bfdab20b0c27d9c56f58f6499e418252253081bfff448099da31d1" +dependencies = [ + "cfg-if", + "convert_case 0.6.0", + "napi-derive-backend", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "napi-derive-backend" +version = "1.0.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "967c485e00f0bf3b1bdbe510a38a4606919cf1d34d9a37ad41f25a81aa077abe" +dependencies = [ + "convert_case 0.6.0", + "once_cell", + "proc-macro2", + "quote", + "regex", + "semver 1.0.23", + "syn 2.0.66", +] + +[[package]] +name = "napi-sys" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427802e8ec3a734331fec1035594a210ce1ff4dc5bc1950530920ab717964ea3" +dependencies = [ + "libloading", +] + +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1660,6 +2159,9 @@ dependencies = [ "once_cell", "rand", "reqwest", + "reqwest-middleware", + "reqwest-retry", + "reqwest-tracing", "serde", "serde_json", "tokio", @@ -1685,6 +2187,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "openapiv3" version = "2.0.0" @@ -1696,6 +2204,50 @@ dependencies = [ "serde_json", ] +[[package]] +name = "openssl" +version = "0.10.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +dependencies = [ + "bitflags 2.5.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "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.66", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "outref" version = "0.1.0" @@ -1709,10 +2261,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] -name = "parking" -version = "2.2.0" +name = "parking_lot" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] [[package]] name = "parking_lot" @@ -1721,7 +2278,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" dependencies = [ "lock_api", - "parking_lot_core", + "parking_lot_core 0.9.10", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", ] [[package]] @@ -1732,9 +2303,9 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.5.1", "smallvec", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -1746,6 +2317,25 @@ dependencies = [ "digest", ] +[[package]] +name = "pem" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" +dependencies = [ + "base64 0.22.1", + "serde", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -1829,6 +2419,33 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + [[package]] name = "portable-atomic" version = "1.7.0" @@ -1920,7 +2537,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" dependencies = [ "bytes", - "prost-derive", + "prost-derive 0.12.6", +] + +[[package]] +name = "prost" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2ecbe40f08db5c006b5764a2645f7f3f141ce756412ac9e1dd6087e6d32995" +dependencies = [ + "bytes", + "prost-derive 0.13.2", ] [[package]] @@ -1937,31 +2564,38 @@ dependencies = [ ] [[package]] -name = "quanta" -version = "0.11.1" +name = "prost-derive" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" +checksum = "acf0c195eebb4af52c752bec4f52f645da98b6e92077a04110c7f349477ae5ac" dependencies = [ - "crossbeam-utils", - "libc", - "mach2", - "once_cell", - "raw-cpuid 10.7.0", - "wasi", - "web-sys", - "winapi", + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "prost-types" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60caa6738c7369b940c3d49246a8d1749323674c65cb13010134f5c9bad5b519" +dependencies = [ + "prost 0.13.2", ] [[package]] name = "quanta" -version = "0.12.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" +checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab" dependencies = [ "crossbeam-utils", "libc", + "mach2", "once_cell", - "raw-cpuid 11.0.2", + "raw-cpuid", "wasi", "web-sys", "winapi", @@ -1973,6 +2607,54 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quinn" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls 0.23.13", + "socket2 0.5.7", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" +dependencies = [ + "bytes", + "rand", + "ring", + "rustc-hash", + "rustls 0.23.13", + "slab", + "thiserror", + "tinyvec", + "tracing", +] + +[[package]] +name = "quinn-udp" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" +dependencies = [ + "libc", + "once_cell", + "socket2 0.5.7", + "tracing", + "windows-sys 0.59.0", +] + [[package]] name = "quote" version = "1.0.36" @@ -2028,36 +2710,12 @@ dependencies = [ ] [[package]] -name = "raw-cpuid" -version = "11.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e29830cbb1290e404f24c73af91c5d8d631ce7e128691e9477556b540cd01ecd" -dependencies = [ - "bitflags 2.5.0", -] - -[[package]] -name = "redis" -version = "0.23.3" +name = "redox_syscall" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f49cdc0bb3f412bf8e7d1bd90fe1d9eb10bc5c399ba90973c14662a27b3f8ba" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "arc-swap", - "async-trait", - "bytes", - "combine", - "futures", - "futures-util", - "itoa", - "percent-encoding", - "pin-project-lite", - "ryu", - "sha1_smol", - "socket2 0.4.10", - "tokio", - "tokio-retry", - "tokio-util", - "url", + "bitflags 1.3.2", ] [[package]] @@ -2115,43 +2773,102 @@ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" -version = "0.12.4" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ "base64 0.22.1", "bytes", + "encoding_rs", "futures-core", "futures-util", + "h2", "http 1.1.0", "http-body 1.0.0", "http-body-util", "hyper 1.3.1", "hyper-rustls", + "hyper-tls", "hyper-util", "ipnet", "js-sys", "log", "mime", + "native-tls", "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.22.4", + "quinn", + "rustls 0.23.13", "rustls-pemfile 2.1.2", "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 1.0.1", + "system-configuration", "tokio", - "tokio-rustls 0.25.0", + "tokio-native-tls", + "tokio-rustls 0.26.0", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", "webpki-roots 0.26.1", - "winreg 0.52.0", + "windows-registry", +] + +[[package]] +name = "reqwest-middleware" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562ceb5a604d3f7c885a792d42c199fd8af239d0a51b2fa6a78aafa092452b04" +dependencies = [ + "anyhow", + "async-trait", + "http 1.1.0", + "reqwest", + "serde", + "thiserror", + "tower-service", +] + +[[package]] +name = "reqwest-retry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a83df1aaec00176d0fabb65dea13f832d2a446ca99107afc17c5d2d4981221d0" +dependencies = [ + "anyhow", + "async-trait", + "futures", + "getrandom", + "http 1.1.0", + "hyper 1.3.1", + "parking_lot 0.11.2", + "reqwest", + "reqwest-middleware", + "retry-policies", + "tokio", + "tracing", + "wasm-timer", +] + +[[package]] +name = "reqwest-tracing" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfdd9bfa64c72233d8dd99ab7883efcdefe9e16d46488ecb9228b71a2e2ceb45" +dependencies = [ + "anyhow", + "async-trait", + "getrandom", + "http 1.1.0", + "matchit 0.8.4", + "reqwest", + "reqwest-middleware", + "tracing", ] [[package]] @@ -2164,6 +2881,25 @@ dependencies = [ "quick-error", ] +[[package]] +name = "retry-policies" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5875471e6cab2871bc150ecb8c727db5113c9338cc3354dc5ee3425b6aa40a1c" +dependencies = [ + "rand", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "ring" version = "0.17.8" @@ -2185,6 +2921,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustc_version" version = "0.2.3" @@ -2240,14 +2982,15 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.4" +version = "0.23.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" dependencies = [ "log", + "once_cell", "ring", "rustls-pki-types", - "rustls-webpki 0.102.4", + "rustls-webpki 0.102.8", "subtle", "zeroize", ] @@ -2289,9 +3032,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.4" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -2310,6 +3053,15 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +[[package]] +name = "schannel" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -2326,6 +3078,53 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "secrecy" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" +dependencies = [ + "serde", + "zeroize", +] + +[[package]] +name = "security-framework" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +dependencies = [ + "bitflags 2.5.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "0.9.0" @@ -2391,6 +3190,16 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" +dependencies = [ + "itoa", + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -2451,6 +3260,17 @@ dependencies = [ "digest", ] +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha1_smol" version = "1.0.0" @@ -2496,6 +3316,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + [[package]] name = "simd-abstraction" version = "0.7.1" @@ -2505,6 +3335,18 @@ dependencies = [ "outref", ] +[[package]] +name = "simple_asn1" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" +dependencies = [ + "num-bigint", + "num-traits", + "thiserror", + "time", +] + [[package]] name = "sketches-ddsketch" version = "0.2.2" @@ -2569,6 +3411,16 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -2655,10 +3507,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] -name = "tagptr" -version = "0.2.0" +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags 2.5.0", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] name = "take_mut" @@ -2672,6 +3548,19 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "tempfile" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +dependencies = [ + "cfg-if", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + [[package]] name = "thiserror" version = "1.0.61" @@ -2759,7 +3648,7 @@ dependencies = [ "libc", "mio", "num_cpus", - "parking_lot", + "parking_lot 0.12.2", "pin-project-lite", "signal-hook-registry", "socket2 0.5.7", @@ -2778,6 +3667,16 @@ dependencies = [ "syn 2.0.66", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-retry" version = "0.3.0" @@ -2801,15 +3700,26 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.22.4", + "rustls 0.23.13", "rustls-pki-types", "tokio", ] +[[package]] +name = "tokio-stream" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.11" @@ -2841,6 +3751,40 @@ dependencies = [ "winnow", ] +[[package]] +name = "tonic" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f6ba989e4b2c58ae83d862d3a3e27690b6e3ae630d0deb59f3697f32aa88ad" +dependencies = [ + "async-stream", + "async-trait", + "axum", + "base64 0.22.1", + "bytes", + "flate2", + "h2", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.3.1", + "hyper-timeout", + "hyper-util", + "percent-encoding", + "pin-project", + "prost 0.13.2", + "rustls-pemfile 2.1.2", + "socket2 0.5.7", + "tokio", + "tokio-rustls 0.26.0", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", + "webpki-roots 0.26.1", +] + [[package]] name = "tower" version = "0.4.13" @@ -2849,11 +3793,16 @@ checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", + "indexmap 1.9.3", "pin-project", "pin-project-lite", + "rand", + "slab", "tokio", + "tokio-util", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -2959,12 +3908,6 @@ dependencies = [ "tracing-log 0.2.0", ] -[[package]] -name = "triomphe" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" - [[package]] name = "trust-dns-proto" version = "0.21.2" @@ -3002,7 +3945,7 @@ dependencies = [ "lazy_static", "log", "lru-cache", - "parking_lot", + "parking_lot 0.12.2", "resolv-conf", "smallvec", "thiserror", @@ -3066,6 +4009,22 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "untrusted" version = "0.9.0" @@ -3093,6 +4052,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "uuid" version = "1.8.0" @@ -3124,6 +4089,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[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.4" @@ -3211,6 +4182,21 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +[[package]] +name = "wasm-timer" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" +dependencies = [ + "futures", + "js-sys", + "parking_lot 0.11.2", + "pin-utils", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "web-sys" version = "0.3.69" @@ -3282,7 +4268,37 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", ] [[package]] @@ -3300,7 +4316,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -3320,18 +4345,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -3342,9 +4367,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -3354,9 +4379,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -3366,15 +4391,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -3384,9 +4409,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -3396,9 +4421,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -3408,9 +4433,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -3420,9 +4445,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" @@ -3443,16 +4468,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "wyz" version = "0.5.1" diff --git a/Cargo.toml b/Cargo.toml index 8f7ea0a..96856ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,14 +14,20 @@ dotenvy = "0.15.7" envconfig = "0.10.0" futures = "0.3.30" handlebars = "5.1.1" -integrationos-domain = { version = "4.1.6", features = ["dummy"] } +integrationos-domain = { version = "7.0.0", features = ["dummy"] } metrics = "0.21.1" metrics-exporter-prometheus = "0.12.1" mongodb = "2.8.0" reqwest = { version = "0.12.3", features = [ "json", "rustls-tls", -], default-features = false } +] } +reqwest-middleware = { version = "0.3.3", features = [ + "json", + "rustls-tls", +] } +reqwest-retry = "0.6.1" +reqwest-tracing = "0.5.3" serde = { version = "1.0.196", features = ["derive"] } serde_json = "1.0.113" tokio = { version = "1.35.1", features = ["macros", "rt-multi-thread"] } diff --git a/src/algebra/mod.rs b/src/algebra/mod.rs index 5a2193f..c6b3037 100644 --- a/src/algebra/mod.rs +++ b/src/algebra/mod.rs @@ -1,9 +1,11 @@ mod metrics; mod parameter; mod refresh; +mod secrets; mod storage; pub use metrics::*; pub use parameter::*; pub use refresh::*; +pub use secrets::*; pub use storage::*; diff --git a/src/algebra/refresh.rs b/src/algebra/refresh.rs index 8410a73..bb40d9d 100644 --- a/src/algebra/refresh.rs +++ b/src/algebra/refresh.rs @@ -1,21 +1,19 @@ use crate::{ algebra::StorageExt, domain::{Refresh, Trigger, Unit}, - Metrics, ParameterExt, Refreshed, + Metrics, ParameterExt, Refreshed, SecretsClient, }; use chrono::{Duration, Utc}; use integrationos_domain::{ algebra::MongoStore, api_model_config::ContentType, - client::secrets_client::SecretsClient, connection_oauth_definition::{Computation, ConnectionOAuthDefinition, OAuthResponse}, error::IntegrationOSError as Error, - get_secret_request::GetSecretRequest, oauth_secret::OAuthSecret, ApplicationError, Connection, DefaultTemplate, InternalError, OAuth, TemplateExt, }; use mongodb::bson::{self, doc}; -use reqwest::Client; +use reqwest_middleware::ClientWithMiddleware; use serde_json::json; use std::sync::Arc; use tracing::warn; @@ -38,7 +36,7 @@ pub async fn refresh( connections_store: Arc>, secrets: Arc, oauths: Arc>, - client: Client, + client: ClientWithMiddleware, metrics: Arc, ) -> Result { let refresh_before = Utc::now(); @@ -102,7 +100,7 @@ pub async fn trigger( secrets: Arc, connections: Arc>, oauths: Arc>, - client: Client, + client: ClientWithMiddleware, ) -> Result { let template = DefaultTemplate::default(); @@ -135,15 +133,12 @@ pub async fn trigger( ))?; let secret: OAuthSecret = secrets - .get_secret::(&GetSecretRequest { - id: msg.connection().secrets_service_id.clone(), - buildable_id: msg.connection().ownership.client_id.clone(), - }) - .await - .map_err(|e| { - warn!("Failed to get secret: {}", e); - ApplicationError::not_found(format!("Failed to get secret: {}", e).as_str(), None) - })?; + .get_secret::( + &msg.connection().secrets_service_id, + &msg.connection().ownership.client_id, + &msg.connection().environment, + ) + .await?; let compute_payload = serde_json::to_value(&secret).map_err(|e| { warn!("Failed to serialize secret: {}", e); @@ -175,6 +170,7 @@ pub async fn trigger( let request = client .post(conn_oauth_definition.configuration.refresh.uri()) .headers(headers.unwrap_or_default()); + let request = match conn_oauth_definition.configuration.refresh.content { Some(ContentType::Json) => request.json(&body).query(&query), Some(ContentType::Form) => request.form(&body).query(&query), @@ -218,7 +214,8 @@ pub async fn trigger( let secret = secrets .create_secret( msg.connection().clone().ownership.client_id, - &oauth_secret.as_json(), + oauth_secret.as_json(), + msg.connection().environment, ) .await .map_err(|e| { @@ -240,7 +237,7 @@ pub async fn trigger( warn!("Failed to serialize oauth: {}", e); InternalError::serialize_error("Failed to serialize oauth", None) })?, - "secretsServiceId": secret.id, + "secretsServiceId": secret.id(), } }; diff --git a/src/algebra/secrets.rs b/src/algebra/secrets.rs new file mode 100644 index 0000000..143fb72 --- /dev/null +++ b/src/algebra/secrets.rs @@ -0,0 +1,129 @@ +use crate::RefreshConfig; +use integrationos_domain::{ + environment::Environment, event_access::EventAccess, IntegrationOSError, InternalError, + MongoStore, Secret, +}; +use mongodb::bson::doc; +use reqwest_middleware::ClientWithMiddleware; +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use std::sync::Arc; +use tracing::warn; + +const PRODUCTION_KEY: &str = "event_access::custom::live::default::event-inc::internal-ui"; +const TEST_KEY: &str = "event_access::custom::test::default::event-inc::internal-ui"; +const INTEGRATIONOS_SECRET_HEADER: &str = "X-INTEGRATIONOS-SECRET"; + +#[derive(Debug, Clone)] +pub struct SecretsClient { + get: String, + create: String, + client: ClientWithMiddleware, + event: Arc>, +} + +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct CreateSecretRequest { + secret: Value, +} + +impl SecretsClient { + pub fn new( + config: &RefreshConfig, + event: &Arc>, + client: ClientWithMiddleware, + ) -> Self { + Self { + get: config.get_secret().to_string(), + create: config.create_secret().to_string(), + client, + event: Arc::clone(event), + } + } + + pub async fn get_secret Deserialize<'a>>( + &self, + id: &str, + buildable_id: &str, + environment: &Environment, + ) -> Result { + let key = match environment { + Environment::Test | Environment::Development => TEST_KEY, + Environment::Live | Environment::Production => PRODUCTION_KEY, + }; + + let event = self + .event + .get_one(doc! { + "ownership.buildableId": buildable_id, + "key": key + }) + .await? + .ok_or(InternalError::key_not_found("Event access not found", None))?; + + let access_key = event.access_key.clone(); + + let uri = format!("{}/{}", self.get, id); + let response = self + .client + .get(&uri) + .header(INTEGRATIONOS_SECRET_HEADER, access_key) + .send() + .await + .map_err(|err| { + InternalError::io_err(&format!("Failed to send request: {err}"), None) + })?; + + let secret: Secret = response.json().await.map_err(|err| { + InternalError::serialize_error(&format!("Failed to deserialize response: {err}"), None) + })?; + + secret.decode() + } + + pub async fn create_secret Deserialize<'a>>( + &self, + buildable_id: String, + secret: T, + environment: Environment, + ) -> Result { + let payload = CreateSecretRequest { + secret: serde_json::to_value(&secret).map_err(|e| { + warn!("Failed to serialize secret: {}", e); + InternalError::serialize_error("Failed to serialize secret", None) + })?, + }; + + let key = match environment { + Environment::Test | Environment::Development => TEST_KEY, + Environment::Live | Environment::Production => PRODUCTION_KEY, + }; + + let event = self + .event + .get_one(doc! { + "ownership.buildableId": buildable_id, + "key": key + }) + .await? + .ok_or(InternalError::key_not_found("Event access not found", None))?; + + let access_key = event.access_key.clone(); + + let response = self + .client + .post(&self.create) + .json(&payload) + .header(INTEGRATIONOS_SECRET_HEADER, access_key) + .send() + .await + .map_err(|err| { + InternalError::io_err(&format!("Failed to send request: {err}"), None) + })?; + + response.json().await.map_err(|err| { + InternalError::serialize_error(&format!("Failed to deserialize response: {err}"), None) + }) + } +} diff --git a/src/service/configuration/mod.rs b/src/service/configuration/mod.rs index 50b00eb..4ac26da 100644 --- a/src/service/configuration/mod.rs +++ b/src/service/configuration/mod.rs @@ -2,7 +2,6 @@ use envconfig::Envconfig; use integrationos_domain::{ database::DatabaseConfig, environment::Environment, secrets::SecretsConfig, }; -use std::collections::HashMap; use std::fmt::Debug; #[derive(Clone, Envconfig)] @@ -19,6 +18,12 @@ pub struct RefreshConfig { timeout: u64, #[envconfig(from = "ENVIRONMENT", default = "test")] environment: Environment, + #[envconfig(from = "GET_SECRET_PATH", default = "http://localhost:3005/v1/secrets")] + get_secret: String, + #[envconfig(from = "CREATE_SECRET_PATH", default = "http://localhost:3005/v1/secrets")] + create_secret: String, + #[envconfig(from = "MAX_RETRIES", default = "3")] + max_retries: u32, } impl Debug for RefreshConfig { @@ -27,6 +32,9 @@ impl Debug for RefreshConfig { writeln!(f, "SLEEP_TIMER_IN_SECONDS: {}", self.sleep_timer)?; writeln!(f, "TIMEOUT: {}", self.timeout)?; writeln!(f, "ENVIRONMENT: {}", self.environment)?; + writeln!(f, "GET_SECRET_PATH: {}", self.get_secret)?; + writeln!(f, "CREATE_SECRET_PATH: {}", self.create_secret)?; + writeln!(f, "MAX_RETRIES: {}", self.max_retries)?; write!(f, "{}", self.database)?; write!(f, "{}", self.secrets_config) } @@ -56,43 +64,16 @@ impl RefreshConfig { pub fn environment(&self) -> Environment { self.environment } -} - -impl From> for RefreshConfig { - fn from(value: HashMap<&str, &str>) -> Self { - let refresh_before = value - .get("REFRESH_BEFORE_IN_MINUTES") - .and_then(|value| value.parse().ok()) - .unwrap_or(10); - let sleep_timer = value - .get("SLEEP_TIMER_IN_SECONDS") - .and_then(|value| value.parse().ok()) - .unwrap_or(20); + pub fn get_secret(&self) -> &str { + &self.get_secret + } - let owned = value - .iter() - .map(|(k, v)| (k.to_string(), v.to_string())) - .collect(); - let database = DatabaseConfig::init_from_hashmap(&owned).unwrap_or_default(); - let secrets_config = SecretsConfig::init_from_hashmap(&owned).unwrap_or_default(); - let timeout = value - .get("TIMEOUT") - .and_then(|value| value.parse().ok()) - .unwrap_or(30); - let environment = value - .get("ENVIRONMENT") - .unwrap_or(&"test") - .parse() - .expect("Failed to parse environment"); + pub fn create_secret(&self) -> &str { + &self.create_secret + } - Self { - refresh_before, - environment, - sleep_timer, - timeout, - database, - secrets_config, - } + pub fn max_retries(&self) -> u32 { + self.max_retries } } diff --git a/src/service/configuration/mod.rs-E b/src/service/configuration/mod.rs-E deleted file mode 100644 index dc765fb..0000000 --- a/src/service/configuration/mod.rs-E +++ /dev/null @@ -1,98 +0,0 @@ -use envconfig::Envconfig; -use integrationos_domain::{ - database::DatabaseConfig, environment::Environment, secrets::SecretsConfig, -}; -use std::collections::HashMap; -use std::fmt::Debug; - -#[derive(Clone, Envconfig)] -pub struct RefreshConfig { - #[envconfig(from = "REFRESH_BEFORE_IN_MINUTES", default = "10")] - refresh_before: i64, - #[envconfig(from = "SLEEP_TIMER_IN_SECONDS", default = "20")] - sleep_timer: u64, - #[envconfig(nested = true)] - database: DatabaseConfig, - #[envconfig(nested = true)] - secrets_config: SecretsConfig, - #[envconfig(from = "TIMEOUT", default = "30")] - timeout: u64, - #[envconfig(from = "ENVIRONMENT", default = "test")] - environment: Environment, -} - -impl Debug for RefreshConfig { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("OAuthConfig") - .field("refresh_before", &self.refresh_before) - .field("sleep_timer", &self.sleep_timer) - .field("timeout", &self.timeout) - .field("environment", &self.environment) - .finish() - } -} - -impl RefreshConfig { - pub fn refresh_before(&self) -> i64 { - self.refresh_before - } - - pub fn sleep_timer(&self) -> u64 { - self.sleep_timer - } - - pub fn database(&self) -> &DatabaseConfig { - &self.database - } - - pub fn secrets_config(&self) -> &SecretsConfig { - &self.secrets_config - } - - pub fn timeout(&self) -> u64 { - self.timeout - } - - pub fn environment(&self) -> Environment { - self.environment - } -} - -impl From> for RefreshConfig { - fn from(value: HashMap<&str, &str>) -> Self { - let refresh_before = value - .get("REFRESH_BEFORE_IN_MINUTES") - .and_then(|value| value.parse().ok()) - .unwrap_or(10); - - let sleep_timer = value - .get("SLEEP_TIMER_IN_SECONDS") - .and_then(|value| value.parse().ok()) - .unwrap_or(20); - - let owned = value - .iter() - .map(|(k, v)| (k.to_string(), v.to_string())) - .collect(); - let database = DatabaseConfig::init_from_hashmap(&owned).unwrap_or_default(); - let secrets_config = SecretsConfig::init_from_hashmap(&owned).unwrap_or_default(); - let timeout = value - .get("TIMEOUT") - .and_then(|value| value.parse().ok()) - .unwrap_or(30); - let environment = value - .get("ENVIRONMENT") - .unwrap_or(&"test") - .parse() - .expect("Failed to parse environment"); - - Self { - refresh_before, - environment, - sleep_timer, - timeout, - database, - secrets_config, - } - } -} diff --git a/src/service/mod.rs b/src/service/mod.rs index cef3d27..45184c0 100644 --- a/src/service/mod.rs +++ b/src/service/mod.rs @@ -2,22 +2,24 @@ mod configuration; pub use configuration::*; +use crate::{Metrics, SecretsClient}; use integrationos_domain::{ - algebra::MongoStore, client::secrets_client::SecretsClient, - connection_oauth_definition::ConnectionOAuthDefinition, error::IntegrationOSError as Error, - event_access::EventAccess, Connection, InternalError, Store, + algebra::MongoStore, connection_oauth_definition::ConnectionOAuthDefinition, + error::IntegrationOSError as Error, event_access::EventAccess, Connection, InternalError, + Store, }; use mongodb::options::FindOptions; use reqwest::Client; +use reqwest_middleware::{ClientBuilder, ClientWithMiddleware}; +use reqwest_retry::{policies::ExponentialBackoff, RetryTransientMiddleware}; +use reqwest_tracing::TracingMiddleware; use serde_json::Value; use std::{sync::Arc, time::Duration}; use tokio::time::timeout; -use crate::Metrics; - #[derive(Clone, Debug)] pub struct AppState { - client: Client, + client: ClientWithMiddleware, secrets: Arc, connections: Arc>, oauths: Arc>, @@ -27,10 +29,16 @@ pub struct AppState { impl AppState { pub async fn try_from(config: RefreshConfig) -> Result { + let retry_policy = + ExponentialBackoff::builder().build_with_max_retries(config.max_retries()); let client = Client::builder() .timeout(Duration::from_millis(config.timeout())) .build() .map_err(|e| InternalError::io_err(e.to_string().as_str(), None))?; + let client = ClientBuilder::new(client) + .with(RetryTransientMiddleware::new_with_policy(retry_policy)) + .with(TracingMiddleware::default()) + .build(); let mongo_client = mongodb::Client::with_uri_str(&config.database().control_db_url) .await .map_err(|e| InternalError::io_err(e.to_string().as_str(), None))?; @@ -58,7 +66,6 @@ impl AppState { .ok(); let database = mongo_client.database(config.database().control_db_name.as_ref()); - let secrets = SecretsClient::new(config.secrets_config())?; let oauths = MongoStore::::new( &database, &Store::ConnectionOAuthDefinitions, @@ -69,9 +76,10 @@ impl AppState { let oauths = Arc::new(oauths); let connections = Arc::new(connections); - let secrets = Arc::new(secrets); let event_access = Arc::new(event_access); let metrics = Arc::new(Metrics::new()?); + let secrets = SecretsClient::new(&config, &event_access, client.clone()); + let secrets = Arc::new(secrets); Ok(AppState { event_access, @@ -83,7 +91,7 @@ impl AppState { }) } - pub fn client(&self) -> &Client { + pub fn client(&self) -> &ClientWithMiddleware { &self.client } From ec651f78cb134c5a02a42d50d6500dca2eadf26e Mon Sep 17 00:00:00 2001 From: Samuel Gomez Date: Tue, 17 Sep 2024 20:22:48 +0100 Subject: [PATCH 2/4] format --- src/service/configuration/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/service/configuration/mod.rs b/src/service/configuration/mod.rs index 4ac26da..a406090 100644 --- a/src/service/configuration/mod.rs +++ b/src/service/configuration/mod.rs @@ -20,7 +20,10 @@ pub struct RefreshConfig { environment: Environment, #[envconfig(from = "GET_SECRET_PATH", default = "http://localhost:3005/v1/secrets")] get_secret: String, - #[envconfig(from = "CREATE_SECRET_PATH", default = "http://localhost:3005/v1/secrets")] + #[envconfig( + from = "CREATE_SECRET_PATH", + default = "http://localhost:3005/v1/secrets" + )] create_secret: String, #[envconfig(from = "MAX_RETRIES", default = "3")] max_retries: u32, From 82ade659ea013101bc672ac9e5d1de1a84654e69 Mon Sep 17 00:00:00 2001 From: Samuel Gomez Date: Tue, 17 Sep 2024 22:11:07 +0100 Subject: [PATCH 3/4] finish migration --- src/algebra/secrets.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/algebra/secrets.rs b/src/algebra/secrets.rs index 143fb72..49bb044 100644 --- a/src/algebra/secrets.rs +++ b/src/algebra/secrets.rs @@ -57,7 +57,8 @@ impl SecretsClient { .event .get_one(doc! { "ownership.buildableId": buildable_id, - "key": key + "key": key, + "deleted": false }) .await? .ok_or(InternalError::key_not_found("Event access not found", None))?; @@ -75,7 +76,9 @@ impl SecretsClient { InternalError::io_err(&format!("Failed to send request: {err}"), None) })?; - let secret: Secret = response.json().await.map_err(|err| { + let secret = response.json().await; + + let secret: Secret = secret.map_err(|err| { InternalError::serialize_error(&format!("Failed to deserialize response: {err}"), None) })?; From 9cb79caa107ea66a5f6f0559bfd704c40e52e7cf Mon Sep 17 00:00:00 2001 From: Samuel Gomez Date: Wed, 18 Sep 2024 16:55:31 +0100 Subject: [PATCH 4/4] Fixing timeout --- src/algebra/secrets.rs | 2 ++ src/service/mod.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/algebra/secrets.rs b/src/algebra/secrets.rs index 49bb044..cf3ea4c 100644 --- a/src/algebra/secrets.rs +++ b/src/algebra/secrets.rs @@ -79,6 +79,7 @@ impl SecretsClient { let secret = response.json().await; let secret: Secret = secret.map_err(|err| { + warn!("Failed to deserialize response: {err}"); InternalError::serialize_error(&format!("Failed to deserialize response: {err}"), None) })?; @@ -126,6 +127,7 @@ impl SecretsClient { })?; response.json().await.map_err(|err| { + warn!("Failed to deserialize response: {err}"); InternalError::serialize_error(&format!("Failed to deserialize response: {err}"), None) }) } diff --git a/src/service/mod.rs b/src/service/mod.rs index 45184c0..14ddcb3 100644 --- a/src/service/mod.rs +++ b/src/service/mod.rs @@ -32,7 +32,7 @@ impl AppState { let retry_policy = ExponentialBackoff::builder().build_with_max_retries(config.max_retries()); let client = Client::builder() - .timeout(Duration::from_millis(config.timeout())) + .timeout(Duration::from_secs(config.timeout())) .build() .map_err(|e| InternalError::io_err(e.to_string().as_str(), None))?; let client = ClientBuilder::new(client)