diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 918c269..d09be56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,13 +15,11 @@ env: jobs: build: runs-on: ubuntu-latest - container: - image: xd009642/tarpaulin:develop-nightly - options: --security-opt seccomp=unconfined - steps: - name: 📁 Checkout uses: actions/checkout@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: ⚡ Cache uses: actions/cache@v3 @@ -34,36 +32,44 @@ jobs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - .cargo/ - target/ + target/ - name: 🔧 Install protoc - uses: arduino/setup-protoc@v1 + uses: arduino/setup-protoc@v1.1.2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: 🔨 Install tools run: | - apt update && apt install sudo - sudo apt install libssl-dev build-essential cmake pkg-config llvm-dev libclang-dev clang mosquitto-dev libmosquitto-dev libsqlite3-dev -y - + sudo apt update \ + && sudo apt install libssl-dev build-essential cmake pkg-config llvm-dev libclang-dev clang libmosquitto-dev libsqlite3-dev -y \ + && cargo install --locked cargo-audit || true \ + && cargo install cargo-tarpaulin + + - name: 🔐 Run audit + run: | + cargo audit + - name: 🔎 Run tests run: | - cargo +nightly tarpaulin --workspace --timeout 120 --out xml + cargo tarpaulin --workspace --timeout 120 --skip-clean --out xml - name: ☁ Codecov uses: codecov/codecov-action@v3 with: token: ${{secrets.CODECOV_TOKEN}} + verbose: true tag: needs: [build] runs-on: ubuntu-latest steps: - - name: Checkout + - name: 📁 Checkout uses: actions/checkout@v2 with: fetch-depth: '0' - - name: Pre release + - name: ⚙ Pre release if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop'}} uses: anothrNick/github-tag-action@v1 env: @@ -72,7 +78,7 @@ jobs: WITH_V: true PRERELEASE: true - - name: Patch release + - name: ⚙ Patch release if: ${{ github.ref == 'refs/heads/develop' }} uses: anothrNick/github-tag-action@v1 env: @@ -81,7 +87,7 @@ jobs: WITH_V: true PRERELEASE: true - - name: Minor release + - name: ⚙ Minor release if: ${{ github.ref == 'refs/heads/main' }} uses: anothrNick/github-tag-action@v1 env: diff --git a/.github/workflows/sec.yml b/.github/workflows/sec.yml index ee08c8f..f144a33 100644 --- a/.github/workflows/sec.yml +++ b/.github/workflows/sec.yml @@ -1,12 +1,25 @@ -name: Security audit +name: security-audit + on: schedule: - cron: '0 0 * * *' + jobs: audit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions-rs/audit-check@v1 + - name: 📁 Checkout + uses: actions/checkout@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + ref: main + + - name: 🧰 Install tools + run: | + sudo apt update \ + && sudo apt install libssl-dev build-essential cmake pkg-config llvm-dev libclang-dev clang libmosquitto-dev libsqlite3-dev -y + + - name: 🔐 Run audit + uses: actions-rs/audit-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 5ebbda6..95871cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,11 +4,11 @@ version = 3 [[package]] name = "actix-codec" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "617a8268e3537fe1d8c9ead925fca49ef6400927ee7bc26750e90ecee14ce4b8" +checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", "bytes", "futures-core", "futures-sink", @@ -36,9 +36,9 @@ dependencies = [ [[package]] name = "actix-http" -version = "3.5.1" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "129d4c88e98860e1758c5de288d1632b07970a16d59bdf7b8d66053d582bb71f" +checksum = "d223b13fd481fc0d1f83bb12659ae774d9e3601814c68a0bc539731698cca743" dependencies = [ "actix-codec", "actix-rt", @@ -46,7 +46,7 @@ dependencies = [ "actix-utils", "ahash", "base64 0.21.7", - "bitflags 2.4.2", + "bitflags 2.5.0", "brotli", "bytes", "bytestring", @@ -54,8 +54,8 @@ dependencies = [ "encoding_rs", "flate2", "futures-core", - "h2", - "http 0.2.11", + "h2 0.3.26", + "http 0.2.12", "httparse", "httpdate", "itoa", @@ -80,7 +80,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] @@ -90,7 +90,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d22475596539443685426b6bdadb926ad0ecaefdfc5fb05e5e3441f15463c511" dependencies = [ "bytestring", - "http 0.2.11", + "http 0.2.12", "regex", "serde", "tracing", @@ -118,7 +118,7 @@ dependencies = [ "futures-core", "futures-util", "mio", - "socket2 0.5.5", + "socket2 0.5.6", "tokio", "tracing", ] @@ -146,9 +146,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.4.1" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e43428f3bf11dee6d166b00ec2df4e3aa8cc1606aaa0b7433c146852e2f4e03b" +checksum = "43a6556ddebb638c2358714d853257ed226ece6023ef9364f23f0c70737ea984" dependencies = [ "actix-codec", "actix-http", @@ -179,7 +179,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "smallvec", - "socket2 0.5.5", + "socket2 0.5.6", "time", "url", ] @@ -193,7 +193,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] @@ -211,11 +211,22 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "getrandom", @@ -226,26 +237,13 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] -[[package]] -name = "alcoholic_jwt" -version = "4091.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb8a1270ac7729a671a2d0f7d959e6572330d4da9f6b797165f6b08244019b9e" -dependencies = [ - "base64 0.13.1", - "openssl", - "serde", - "serde_derive", - "serde_json", -] - [[package]] name = "alloc-no-stdlib" version = "2.0.4" @@ -263,15 +261,15 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "amq-protocol" -version = "7.1.2" +version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d40d8b2465c7959dd40cee32ba6ac334b5de57e9fca0cc756759894a4152a5d" +checksum = "f051d4d77904272e9be7e292607378dc9900d15b8d314bfd3ed4b82fdd84f125" dependencies = [ "amq-protocol-tcp", "amq-protocol-types", @@ -283,9 +281,9 @@ dependencies = [ [[package]] name = "amq-protocol-tcp" -version = "7.1.2" +version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cb2100adae7da61953a2c3a01935d86caae13329fadce3333f524d6d6ce12e2" +checksum = "4e3d51dd36e67d757c9ba80a7b2a2a2a69254c1dbe4d8c631824ec7f5b69f60e" dependencies = [ "amq-protocol-uri", "tcp-stream", @@ -294,9 +292,9 @@ dependencies = [ [[package]] name = "amq-protocol-types" -version = "7.1.2" +version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "156ff13c8a3ced600b4e54ed826a2ae6242b6069d00dd98466827cef07d3daff" +checksum = "0acdd47054ced8b9bc89ee0dbb42ccc8028de48d8658b24de4c255a226c9bfec" dependencies = [ "cookie-factory", "nom", @@ -306,9 +304,9 @@ dependencies = [ [[package]] name = "amq-protocol-uri" -version = "7.1.2" +version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "751bbd7d440576066233e740576f1b31fdc6ab86cfabfbd48c548de77eca73e4" +checksum = "f17881b7575dab3e71403f28a3e50b71f0d1bd026829abca3c48664522ce0df0" dependencies = [ "amq-protocol-types", "percent-encoding", @@ -332,15 +330,54 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" + +[[package]] +name = "asn1-rs" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ad1373757efa0f70ec53939aabc7152e1591cb485208052993070ac8d2429d" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7378575ff571966e99a744addeff0bff98b8ada0dedf1956d59e634db95eaac1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", + "synstructure", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", +] [[package]] name = "async-channel" @@ -355,28 +392,27 @@ dependencies = [ [[package]] name = "async-channel" -version = "2.1.1" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" +checksum = "136d4d23bcc79e27423727b36823d86233aad06dfea531837b038394d11e9928" dependencies = [ "concurrent-queue", - "event-listener 4.0.3", - "event-listener-strategy", + "event-listener 5.3.0", + "event-listener-strategy 0.5.1", "futures-core", "pin-project-lite", ] [[package]] name = "async-executor" -version = "1.8.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" +checksum = "b10202063978b3351199d68f8b22c4e47e4b1b822f8d43fd862d5ea8c006b29a" dependencies = [ - "async-lock 3.3.0", "async-task", "concurrent-queue", - "fastrand 2.0.1", - "futures-lite 2.2.0", + "fastrand 2.0.2", + "futures-lite 2.3.0", "slab", ] @@ -386,12 +422,12 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ - "async-channel 2.1.1", + "async-channel 2.2.1", "async-executor", - "async-io 2.3.0", + "async-io 2.3.2", "async-lock 3.3.0", "blocking", - "futures-lite 2.2.0", + "futures-lite 2.3.0", "once_cell", ] @@ -428,18 +464,18 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.0" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb41eb19024a91746eba0773aa5e16036045bbf45733766661099e182ea6a744" +checksum = "dcccb0f599cfa2f8ace422d3555572f47424da5648a4382a9dd0310ff8210884" dependencies = [ "async-lock 3.3.0", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite 2.2.0", + "futures-lite 2.3.0", "parking", - "polling 3.3.2", - "rustix 0.38.30", + "polling 3.7.0", + "rustix 0.38.34", "slab", "tracing", "windows-sys 0.52.0", @@ -461,7 +497,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" dependencies = [ "event-listener 4.0.3", - "event-listener-strategy", + "event-listener-strategy 0.4.0", "pin-project-lite", ] @@ -496,7 +532,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] @@ -507,13 +543,13 @@ checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] @@ -526,9 +562,10 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" name = "auth" version = "0.1.0" dependencies = [ - "alcoholic_jwt", "async-trait", "configs", + "jsonwebtoken", + "moka", "opentelemetry", "reqwest", "serde", @@ -539,15 +576,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "aws-config" -version = "1.1.4" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b30c39ebe61f75d1b3785362b1586b41991873c9ab3e317a9181c246fb71d82" +checksum = "b2a4707646259764ab59fd9a50e9de2e92c637b28b36285d6f6fa030e915fbd9" dependencies = [ "aws-credential-types", "aws-runtime", @@ -562,22 +599,23 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "fastrand 2.0.1", + "fastrand 2.0.2", "hex", - "http 0.2.11", - "hyper", + "http 0.2.12", + "hyper 0.14.28", "ring", "time", "tokio", "tracing", + "url", "zeroize", ] [[package]] name = "aws-credential-types" -version = "1.1.4" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33cc49dcdd31c8b6e79850a179af4c367669150c7ac0135f176c61bec81a70f7" +checksum = "e16838e6c9e12125face1c1eff1343c75e3ff540de98ff7ebd61874a89bcfeb9" dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api", @@ -585,11 +623,38 @@ dependencies = [ "zeroize", ] +[[package]] +name = "aws-lc-rs" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5509d663b2c00ee421bda8d6a24d6c42e15970957de1701b8df9f6fbe5707df1" +dependencies = [ + "aws-lc-sys", + "mirai-annotations", + "paste", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d5d317212c2a78d86ba6622e969413c38847b62f48111f8b763af3dac2f9840" +dependencies = [ + "bindgen", + "cc", + "cmake", + "dunce", + "fs_extra", + "libc", + "paste", +] + [[package]] name = "aws-runtime" -version = "1.1.4" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb031bff99877c26c28895766f7bb8484a05e24547e370768d6cc9db514662aa" +checksum = "f4963ac9ff2d33a4231b3806c1c69f578f221a9cabb89ad2bde62ce2b442c8a7" dependencies = [ "aws-credential-types", "aws-sigv4", @@ -599,20 +664,20 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "fastrand 2.0.1", - "http 0.2.11", - "http-body", + "fastrand 2.0.2", + "http 0.2.12", + "http-body 0.4.6", "percent-encoding", "pin-project-lite", "tracing", - "uuid 1.7.0", + "uuid 1.8.0", ] [[package]] name = "aws-sdk-secretsmanager" -version = "1.14.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a0b64e61e7d632d9df90a2e0f32630c68c24960cab1d27d848718180af883d3" +checksum = "c574fe1efe11d3faad58e9ffafb10c603ec85fc55e2a9140940ff8957671e14a" dependencies = [ "aws-credential-types", "aws-runtime", @@ -624,8 +689,8 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "fastrand 2.0.1", - "http 0.2.11", + "fastrand 2.0.2", + "http 0.2.12", "once_cell", "regex-lite", "tracing", @@ -633,9 +698,9 @@ dependencies = [ [[package]] name = "aws-sdk-sso" -version = "1.12.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f486420a66caad72635bc2ce0ff6581646e0d32df02aa39dc983bfe794955a5b" +checksum = "3d70fb493f4183f5102d8a8d0cc9b57aec29a762f55c0e7bf527e0f7177bb408" dependencies = [ "aws-credential-types", "aws-runtime", @@ -647,7 +712,7 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "http 0.2.11", + "http 0.2.12", "once_cell", "regex-lite", "tracing", @@ -655,9 +720,9 @@ dependencies = [ [[package]] name = "aws-sdk-ssooidc" -version = "1.12.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ddccf01d82fce9b4a15c8ae8608211ee7db8ed13a70b514bbfe41df3d24841" +checksum = "de3f37549b3e38b7ea5efd419d4d7add6ea1e55223506eb0b4fef9d25e7cc90d" dependencies = [ "aws-credential-types", "aws-runtime", @@ -669,7 +734,7 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "http 0.2.11", + "http 0.2.12", "once_cell", "regex-lite", "tracing", @@ -677,9 +742,9 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "1.12.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a591f8c7e6a621a501b2b5d2e88e1697fcb6274264523a6ad4d5959889a41ce" +checksum = "3b2ff219a5d4b795cd33251c19dbe9c4b401f2b2cbe513e07c76ada644eaf34e" dependencies = [ "aws-credential-types", "aws-runtime", @@ -692,7 +757,7 @@ dependencies = [ "aws-smithy-types", "aws-smithy-xml", "aws-types", - "http 0.2.11", + "http 0.2.12", "once_cell", "regex-lite", "tracing", @@ -700,9 +765,9 @@ dependencies = [ [[package]] name = "aws-sigv4" -version = "1.1.4" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c371c6b0ac54d4605eb6f016624fb5c7c2925d315fdf600ac1bf21b19d5f1742" +checksum = "58b56f1cbe6fd4d0c2573df72868f20ab1c125ca9c9dbce17927a463433a2e57" dependencies = [ "aws-credential-types", "aws-smithy-http", @@ -712,8 +777,8 @@ dependencies = [ "form_urlencoded", "hex", "hmac", - "http 0.2.11", - "http 1.0.0", + "http 0.2.12", + "http 1.1.0", "once_cell", "percent-encoding", "sha2", @@ -723,9 +788,9 @@ dependencies = [ [[package]] name = "aws-smithy-async" -version = "1.1.4" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ee2d09cce0ef3ae526679b522835d63e75fb427aca5413cd371e490d52dcc6" +checksum = "62220bc6e97f946ddd51b5f1361f78996e704677afc518a4ff66b7a72ea1378c" dependencies = [ "futures-util", "pin-project-lite", @@ -734,17 +799,17 @@ dependencies = [ [[package]] name = "aws-smithy-http" -version = "0.60.4" +version = "0.60.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dab56aea3cd9e1101a0a999447fb346afb680ab1406cebc44b32346e25b4117d" +checksum = "4a7de001a1b9a25601016d8057ea16e31a45fdca3751304c8edf4ad72e706c08" dependencies = [ "aws-smithy-runtime-api", "aws-smithy-types", "bytes", "bytes-utils", "futures-core", - "http 0.2.11", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "once_cell", "percent-encoding", "pin-project-lite", @@ -754,18 +819,18 @@ dependencies = [ [[package]] name = "aws-smithy-json" -version = "0.60.4" +version = "0.60.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3898ca6518f9215f62678870064398f00031912390efd03f1f6ef56d83aa8e" +checksum = "4683df9469ef09468dad3473d129960119a0d3593617542b7d52086c8486f2d6" dependencies = [ "aws-smithy-types", ] [[package]] name = "aws-smithy-query" -version = "0.60.4" +version = "0.60.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda4b1dfc9810e35fba8a620e900522cd1bd4f9578c446e82f49d1ce41d2e9f9" +checksum = "f2fbd61ceb3fe8a1cb7352e42689cec5335833cd9f94103a61e98f9bb61c64bb" dependencies = [ "aws-smithy-types", "urlencoding", @@ -773,39 +838,41 @@ dependencies = [ [[package]] name = "aws-smithy-runtime" -version = "1.1.4" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fafdab38f40ad7816e7da5dec279400dd505160780083759f01441af1bbb10ea" +checksum = "44e7945379821074549168917e89e60630647e186a69243248f08c6d168b975a" dependencies = [ "aws-smithy-async", "aws-smithy-http", "aws-smithy-runtime-api", "aws-smithy-types", "bytes", - "fastrand 2.0.1", - "h2", - "http 0.2.11", - "http-body", - "hyper", + "fastrand 2.0.2", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "http-body 1.0.0", + "hyper 0.14.28", "hyper-rustls", "once_cell", "pin-project-lite", "pin-utils", - "rustls", + "rustls 0.21.11", "tokio", "tracing", ] [[package]] name = "aws-smithy-runtime-api" -version = "1.1.4" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c18276dd28852f34b3bf501f4f3719781f4999a51c7bff1a5c6dc8c4529adc29" +checksum = "4cc56a5c96ec741de6c5e6bf1ce6948be969d6506dfa9c39cffc284e31e4979b" dependencies = [ "aws-smithy-async", "aws-smithy-types", "bytes", - "http 0.2.11", + "http 0.2.12", + "http 1.1.0", "pin-project-lite", "tokio", "tracing", @@ -814,16 +881,19 @@ dependencies = [ [[package]] name = "aws-smithy-types" -version = "1.1.4" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb3e134004170d3303718baa2a4eb4ca64ee0a1c0a7041dca31b38be0fb414f3" +checksum = "abe14dceea1e70101d38fbf2a99e6a34159477c0fb95e68e05c66bd7ae4c3729" dependencies = [ "base64-simd", "bytes", "bytes-utils", "futures-core", - "http 0.2.11", - "http-body", + "http 0.2.12", + "http 1.1.0", + "http-body 0.4.6", + "http-body 1.0.0", + "http-body-util", "itoa", "num-integer", "pin-project-lite", @@ -837,24 +907,24 @@ dependencies = [ [[package]] name = "aws-smithy-xml" -version = "0.60.4" +version = "0.60.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8604a11b25e9ecaf32f9aa56b9fe253c5e2f606a3477f0071e96d3155a5ed218" +checksum = "d123fbc2a4adc3c301652ba8e149bf4bc1d1725affb9784eb20c953ace06bf55" dependencies = [ "xmlparser", ] [[package]] name = "aws-types" -version = "1.1.4" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "789bbe008e65636fe1b6dbbb374c40c8960d1232b96af5ff4aec349f9c4accf4" +checksum = "5a43b56df2c529fe44cb4d92bd64d0479883fb9608ff62daede4df5405381814" dependencies = [ "aws-credential-types", "aws-smithy-async", "aws-smithy-runtime-api", "aws-smithy-types", - "http 0.2.11", + "http 0.2.12", "rustc_version", "tracing", ] @@ -870,9 +940,9 @@ dependencies = [ "bitflags 1.3.2", "bytes", "futures-util", - "http 0.2.11", - "http-body", - "hyper", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "itoa", "matchit", "memchr", @@ -896,8 +966,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 0.2.11", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "mime", "rustversion", "tower-layer", @@ -906,9 +976,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -921,15 +991,15 @@ dependencies = [ [[package]] name = "base64" -version = "0.13.1" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" -version = "0.21.7" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" [[package]] name = "base64-simd" @@ -941,6 +1011,35 @@ dependencies = [ "vsimd", ] +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.5.0", + "cexpr", + "clang-sys", + "itertools", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.60", + "which", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -949,9 +1048,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "block-buffer" @@ -977,21 +1076,21 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ - "async-channel 2.1.1", + "async-channel 2.2.1", "async-lock 3.3.0", "async-task", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-io", - "futures-lite 2.2.0", + "futures-lite 2.3.0", "piper", "tracing", ] [[package]] name = "brotli" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" +checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -1010,9 +1109,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byteorder" @@ -1022,9 +1121,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" dependencies = [ "serde", ] @@ -1059,12 +1158,22 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" dependencies = [ "jobserver", "libc", + "once_cell", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", ] [[package]] @@ -1075,14 +1184,14 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.33" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", - "windows-targets 0.52.0", + "windows-targets 0.52.5", ] [[package]] @@ -1095,6 +1204,17 @@ dependencies = [ "inout", ] +[[package]] +name = "clang-sys" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "cmake" version = "0.1.50" @@ -1104,6 +1224,18 @@ dependencies = [ "cc", ] +[[package]] +name = "cms" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b77c319abfd5219629c45c34c89ba945ed3c5e49fcde9d16b6c3885f118a730" +dependencies = [ + "const-oid", + "der", + "spki", + "x509-cert", +] + [[package]] name = "concurrent-queue" version = "2.4.0" @@ -1121,7 +1253,7 @@ version = "0.1.0" name = "configs-builder" version = "0.1.0" dependencies = [ - "base64 0.21.7", + "base64 0.22.0", "configs", "dotenvy", "logging", @@ -1130,6 +1262,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "convert_case" version = "0.4.0" @@ -1149,9 +1287,9 @@ dependencies = [ [[package]] name = "cookie-factory" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396de984970346b0d9e93d1415082923c679e5ae5c3ee3dcbd104f5610af126b" +checksum = "9885fa71e26b8ab7855e2ec7cae6e9b380edff76cd052e07c683a0319d51b3a2" [[package]] name = "core-foundation" @@ -1180,18 +1318,27 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" -version = "0.5.11" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ "crossbeam-utils", ] @@ -1212,13 +1359,53 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.60", +] + +[[package]] +name = "darling_macro" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.60", +] + +[[package]] +name = "data-encoding" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" + [[package]] name = "deadpool" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb84100978c1c7b37f09ed3ce3e5f843af02c2a2c431bae5b19230dad2c1b490" +checksum = "ff0fc28638c21092aba483136debc6e177fff3dace8c835d715866923b03323e" dependencies = [ - "async-trait", "deadpool-runtime", "num_cpus", "tokio", @@ -1226,9 +1413,9 @@ dependencies = [ [[package]] name = "deadpool-postgres" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda39fa1cfff190d8924d447ad04fd22772c250438ca5ce1dfb3c80621c05aaa" +checksum = "4aa08f5c838496cbabb672e3614534444145fc6632995f102e13d30a29a25a13" dependencies = [ "deadpool", "tokio", @@ -1247,9 +1434,9 @@ dependencies = [ [[package]] name = "deadpool-sqlite" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8010e36e12f3be22543a5e478b4af20aeead9a700dd69581a5e050a070fc22c" +checksum = "a849c6ac43afc930ff3f49904abb49642ae8be629b42586f0f7733424c766217" dependencies = [ "deadpool", "deadpool-sync", @@ -1265,6 +1452,44 @@ dependencies = [ "deadpool-runtime", ] +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "der_derive", + "flagset", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "der-parser" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cd0a5c643689626bec213c4d8bd4d96acc8ffdb4ad4bb6bc16abf27d5f4b553" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "der_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fe87ce4529967e0ba1dcf8450bab64d97dfd5010a6256187ffe2e43e6f0e049" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", +] + [[package]] name = "deranged" version = "0.3.11" @@ -1308,24 +1533,14 @@ dependencies = [ ] [[package]] -name = "dirs" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" +name = "displaydoc" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", + "proc-macro2", + "quote", + "syn 2.0.60", ] [[package]] @@ -1346,17 +1561,23 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + [[package]] name = "either" -version = "1.9.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "encoding_rs" -version = "0.8.33" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ "cfg-if", ] @@ -1394,6 +1615,17 @@ dependencies = [ "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" @@ -1404,6 +1636,16 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "event-listener-strategy" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332f51cb23d20b0de8458b86580878211da09bcd4503cb579c225b3d124cabb3" +dependencies = [ + "event-listener 5.3.0", + "pin-project-lite", +] + [[package]] name = "executor-trait" version = "2.1.0" @@ -1442,9 +1684,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "finl_unicode" @@ -1452,6 +1694,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" +[[package]] +name = "flagset" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb3aa5e95cf9aabc17f060cfa0ced7b83f042390760ca53bf09df9968acaa1" + [[package]] name = "flate2" version = "1.0.28" @@ -1462,24 +1710,14 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "flume" -version = "0.10.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" -dependencies = [ - "futures-core", - "futures-sink", - "pin-project", - "spin", -] - [[package]] name = "flume" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ + "futures-core", + "futures-sink", "spin", ] @@ -1519,6 +1757,12 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures" version = "0.3.30" @@ -1584,11 +1828,11 @@ dependencies = [ [[package]] name = "futures-lite" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-core", "futures-io", "parking", @@ -1603,7 +1847,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] @@ -1620,9 +1864,9 @@ checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-timer" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" @@ -1664,13 +1908,15 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -1687,17 +1933,36 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.24" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http 0.2.11", - "indexmap 2.1.0", + "http 1.1.0", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", @@ -1722,13 +1987,27 @@ dependencies = [ [[package]] name = "hashlink" -version = "0.8.4" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +checksum = "692eaaf7f7607518dd3cef090f1474b61edc5301d8012f09579920df68b725ee" dependencies = [ "hashbrown 0.14.3", ] +[[package]] +name = "health-http-server" +version = "0.1.0" +dependencies = [ + "actix-web", + "configs", + "health-readiness", + "http-components", + "opentelemetry", + "prometheus", + "thiserror", + "tracing", +] + [[package]] name = "health-readiness" version = "0.1.0" @@ -1743,9 +2022,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -1762,11 +2041,20 @@ dependencies = [ "digest", ] +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", @@ -1775,9 +2063,9 @@ dependencies = [ [[package]] name = "http" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -1791,7 +2079,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http 0.2.11", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes", + "futures-core", + "http 1.1.0", + "http-body 1.0.0", "pin-project-lite", ] @@ -1801,8 +2112,11 @@ version = "0.1.0" dependencies = [ "actix-cors", "actix-http", + "actix-service", "actix-web", + "async-trait", "auth", + "futures", "futures-util", "health-readiness", "opentelemetry", @@ -1857,20 +2171,40 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", - "http 0.2.11", - "http-body", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2 0.5.5", + "socket2 0.5.6", "tokio", "tower-service", "tracing", "want", ] +[[package]] +name = "hyper" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.4", + "http 1.1.0", + "http-body 1.0.0", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -1878,13 +2212,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http 0.2.11", - "hyper", + "http 0.2.12", + "hyper 0.14.28", "log", - "rustls", - "rustls-native-certs", + "rustls 0.21.11", + "rustls-native-certs 0.6.3", "tokio", - "tokio-rustls", + "tokio-rustls 0.24.1", ] [[package]] @@ -1893,7 +2227,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper", + "hyper 0.14.28", "pin-project-lite", "tokio", "tokio-io-timeout", @@ -1901,22 +2235,45 @@ dependencies = [ [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", - "hyper", + "http-body-util", + "hyper 1.3.1", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.3.1", + "pin-project-lite", + "socket2 0.5.6", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] name = "iana-time-zone" -version = "0.1.59" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1936,14 +2293,10 @@ dependencies = [ ] [[package]] -name = "idna" -version = "0.4.0" +name = "ident_case" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" @@ -1955,12 +2308,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "if_chain" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" - [[package]] name = "indexmap" version = "1.9.3" @@ -1973,9 +2320,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -2020,37 +2367,52 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "itertools" -version = "0.10.5" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] +[[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 = "kafka" version = "0.1.0" @@ -2072,16 +2434,16 @@ checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" [[package]] name = "lapin" -version = "2.3.1" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f3067a1fcfbc3fc46455809c023e69b8f6602463201010f4ae5a3b572adb9dc" +checksum = "be0454336697a39b3eb8d06339aa1b4da3cad94862fca62b0e32fd4b7f71b563" dependencies = [ "amq-protocol", "async-global-executor-trait", "async-reactor-trait", "async-trait", "executor-trait", - "flume 0.10.14", + "flume", "futures-core", "futures-io", "parking_lot", @@ -2098,28 +2460,33 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] -name = "libredox" -version = "0.0.1" +name = "libloading" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ - "bitflags 2.4.2", - "libc", - "redox_syscall", + "cfg-if", + "windows-targets 0.52.5", ] [[package]] name = "libsqlite3-sys" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f" dependencies = [ "pkg-config", "vcpkg", @@ -2127,9 +2494,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.15" +version = "1.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" +checksum = "5e143b5e666b2695d28f6bca6497720813f699c9602dd7f5cac91008b8ada7f9" dependencies = [ "cc", "libc", @@ -2178,9 +2545,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "logging" @@ -2212,9 +2579,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "messaging" @@ -2280,18 +2647,18 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "log", @@ -2299,6 +2666,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mirai-annotations" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" + [[package]] name = "mockall" version = "0.12.1" @@ -2323,7 +2696,31 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", +] + +[[package]] +name = "moka" +version = "0.12.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e0d88686dc561d743b40de8269b26eaf0dc58781bde087b0984646602021d08" +dependencies = [ + "async-lock 3.3.0", + "async-trait", + "crossbeam-channel", + "crossbeam-epoch", + "crossbeam-utils", + "event-listener 5.3.0", + "futures-util", + "once_cell", + "parking_lot", + "quanta", + "rustc_version", + "smallvec", + "tagptr", + "thiserror", + "triomphe", + "uuid 1.8.0", ] [[package]] @@ -2385,20 +2782,36 @@ dependencies = [ ] [[package]] -name = "num-integer" -version = "0.1.45" +name = "num-bigint" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ "num-traits", ] [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -2443,6 +2856,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "oid-registry" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c958dd45046245b9c3c2547369bb634eb461670b2e7e0de552905801a648d1d" +dependencies = [ + "asn1-rs", +] + [[package]] name = "once_cell" version = "1.19.0" @@ -2451,11 +2873,11 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.63" +version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", "foreign-types", "libc", @@ -2472,7 +2894,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] @@ -2483,9 +2905,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.99" +version = "0.9.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" dependencies = [ "cc", "libc", @@ -2495,13 +2917,12 @@ dependencies = [ [[package]] name = "opentelemetry" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e32339a5dc40459130b3bd269e9892439f55b33e772d2a9d402a789baaf4e8a" +checksum = "900d57987be3f2aeb70d385fff9b27fb74c5723cc9a52d904d4f9c807a0667bf" dependencies = [ "futures-core", "futures-sink", - "indexmap 2.1.0", "js-sys", "once_cell", "pin-project-lite", @@ -2511,13 +2932,13 @@ dependencies = [ [[package]] name = "opentelemetry-otlp" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f24cda83b20ed2433c68241f918d0f6fdec8b1d43b7a9590ab4420c5095ca930" +checksum = "1a016b8d9495c639af2145ac22387dcb88e44118e45320d9238fbf4e7889abcb" dependencies = [ "async-trait", "futures-core", - "http 0.2.11", + "http 0.2.12", "opentelemetry", "opentelemetry-proto", "opentelemetry-semantic-conventions", @@ -2530,9 +2951,9 @@ dependencies = [ [[package]] name = "opentelemetry-prometheus" -version = "0.14.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f8f082da115b0dcb250829e3ed0b8792b8f963a1ad42466e48422fbe6a079bd" +checksum = "30bbcf6341cab7e2193e5843f0ac36c446a5b3fccb28747afaeda17996dcd02e" dependencies = [ "once_cell", "opentelemetry", @@ -2543,9 +2964,9 @@ dependencies = [ [[package]] name = "opentelemetry-proto" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2e155ce5cc812ea3d1dffbd1539aed653de4bf4882d60e6e04dcf0901d674e1" +checksum = "3a8fddc9b68f5b80dae9d6f510b88e02396f006ad48cac349411fbecc80caae4" dependencies = [ "opentelemetry", "opentelemetry_sdk", @@ -2555,18 +2976,15 @@ dependencies = [ [[package]] name = "opentelemetry-semantic-conventions" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5774f1ef1f982ef2a447f6ee04ec383981a3ab99c8e77a1a7b30182e65bbc84" -dependencies = [ - "opentelemetry", -] +checksum = "f9ab5bd6c42fb9349dcf28af2ba9a0667f697f9bdcca045d39f2cec5543e2910" [[package]] name = "opentelemetry-stdout" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c13b2df4cd59c176099ac82806725ba340c8fa7b1a7004c0912daad30470f63e" +checksum = "4bdf28b381f23afcd150afc0b38a4183dd321fc96320c1554752b6b761648f78" dependencies = [ "async-trait", "chrono", @@ -2580,9 +2998,9 @@ dependencies = [ [[package]] name = "opentelemetry_sdk" -version = "0.21.2" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f16aec8a98a457a52664d69e0091bac3a0abd18ead9b641cb00202ba4e0efe4" +checksum = "9e90c7113be649e31e9a0f8b5ee24ed7a16923b322c3c5ab6367469c049d6b7e" dependencies = [ "async-trait", "crossbeam-channel", @@ -2600,12 +3018,6 @@ dependencies = [ "tokio-stream", ] -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - [[package]] name = "ordered-float" version = "4.2.0" @@ -2635,20 +3047,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] -name = "p12" -version = "0.6.3" +name = "p12-keystore" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4873306de53fe82e7e484df31e1e947d61514b6ea2ed6cd7b45d63006fd9224" +checksum = "fbd7792ed56836118732faffa19b8c2bb20d5f3ff8b403002cd817d6c4ffc96c" dependencies = [ "cbc", - "cipher", + "cms", + "der", "des", - "getrandom", + "hex", "hmac", - "lazy_static", + "pkcs12", + "pkcs5", + "rand", "rc2", "sha1", - "yasna", + "sha2", + "thiserror", + "x509-parser", ] [[package]] @@ -2712,6 +3129,35 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "pem" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" +dependencies = [ + "base64 0.22.0", + "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" @@ -2738,29 +3184,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -2775,7 +3221,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6cfae3ead413ca051a681152bd266438d3bfa301c9bdf836939a14c721bb2a21" dependencies = [ "doc-comment", - "flume 0.11.0", + "flume", "parking_lot", "tracing", ] @@ -2784,18 +3230,48 @@ dependencies = [ name = "piper" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +dependencies = [ + "atomic-waker", + "fastrand 2.0.2", + "futures-io", +] + +[[package]] +name = "pkcs12" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "695b3df3d3cc1015f12d70235e35b6b79befc5fa7a9b95b951eab1dd07c9efc2" +dependencies = [ + "cms", + "const-oid", + "der", + "digest", + "spki", + "x509-cert", + "zeroize", +] + +[[package]] +name = "pkcs5" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e847e2c91a18bfa887dd028ec33f2fe6f25db77db3619024764914affe8b69a6" dependencies = [ - "atomic-waker", - "fastrand 2.0.1", - "futures-io", + "aes", + "cbc", + "der", + "pbkdf2", + "scrypt", + "sha2", + "spki", ] [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "polling" @@ -2815,14 +3291,15 @@ dependencies = [ [[package]] name = "polling" -version = "3.3.2" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545c980a3880efd47b2e262f6a4bb6daad6555cf3367aa9c4e52895f69537a41" +checksum = "645493cf344456ef24219d02a768cf1fb92ddf8c92161679ae3d91b91a637be3" dependencies = [ "cfg-if", "concurrent-queue", + "hermit-abi", "pin-project-lite", - "rustix 0.38.30", + "rustix 0.38.34", "tracing", "windows-sys 0.52.0", ] @@ -2896,6 +3373,16 @@ dependencies = [ "termtree", ] +[[package]] +name = "prettyplease" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ac2cf0f2e4f42b49f5ffd07dae8d746508ef7526c13940e5f524012ae6c6550" +dependencies = [ + "proc-macro2", + "syn 2.0.60", +] + [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -2932,9 +3419,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] @@ -2956,9 +3443,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.9" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" dependencies = [ "bytes", "prost-derive", @@ -2966,15 +3453,15 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.11.9" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" dependencies = [ "anyhow", "itertools", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.60", ] [[package]] @@ -2983,11 +3470,26 @@ version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" +[[package]] +name = "quanta" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" +dependencies = [ + "crossbeam-utils", + "libc", + "once_cell", + "raw-cpuid", + "wasi", + "web-sys", + "winapi", +] + [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -3009,7 +3511,7 @@ dependencies = [ "tokio", "traces", "tracing", - "uuid 1.7.0", + "uuid 1.8.0", ] [[package]] @@ -3042,6 +3544,15 @@ dependencies = [ "getrandom", ] +[[package]] +name = "raw-cpuid" +version = "11.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d86a7c4638d42c44551f4791a20e687dbb4c3de1f33c43dd71e355cd429def1" +dependencies = [ + "bitflags 2.5.0", +] + [[package]] name = "rc2" version = "0.8.1" @@ -3101,22 +3612,11 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_users" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -3126,9 +3626,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -3143,26 +3643,28 @@ checksum = "30b661b2f27137bdbc16f00eda72866a92bb28af1753ffbd56744fb6e2e9cd8e" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" -version = "0.11.23" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" +checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" dependencies = [ - "base64 0.21.7", + "base64 0.22.0", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2", - "http 0.2.11", - "http-body", - "hyper", + "h2 0.4.4", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.3.1", "hyper-tls", + "hyper-util", "ipnet", "js-sys", "log", @@ -3171,9 +3673,11 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls-pemfile 2.1.2", "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", "system-configuration", "tokio", "tokio-native-tls", @@ -3187,25 +3691,26 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", "getrandom", "libc", "spin", "untrusted", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "rusqlite" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78046161564f5e7cd9008aff3b2990b3850dc8e0349119b98e8f251e099f24d" +checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "fallible-iterator 0.3.0", "fallible-streaming-iterator", "hashlink", @@ -3215,9 +3720,9 @@ dependencies = [ [[package]] name = "rust-embed" -version = "8.2.0" +version = "8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82c0bbc10308ed323529fd3c1dce8badda635aa319a5ff0e6466f33b8101e3f" +checksum = "fb78f46d0066053d16d4ca7b898e9343bc3530f71c61d5ad84cd404ada068745" dependencies = [ "rust-embed-impl", "rust-embed-utils", @@ -3226,23 +3731,22 @@ dependencies = [ [[package]] name = "rust-embed-impl" -version = "8.2.0" +version = "8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6227c01b1783cdfee1bcf844eb44594cd16ec71c35305bf1c9fb5aade2735e16" +checksum = "b91ac2a3c6c0520a3fb3dd89321177c3c692937c4eb21893378219da10c44fc8" dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "shellexpand", - "syn 2.0.48", + "syn 2.0.60", "walkdir", ] [[package]] name = "rust-embed-utils" -version = "8.2.0" +version = "8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb0a25bfbb2d4b4402179c2cf030387d9990857ce08a32592c6238db9fa8665" +checksum = "86f69089032567ffff4eada41c573fc43ff466c7db7c5688b2e7969584345581" dependencies = [ "sha2", "walkdir", @@ -3254,6 +3758,12 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.0" @@ -3263,6 +3773,15 @@ dependencies = [ "semver", ] +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] + [[package]] name = "rustix" version = "0.37.27" @@ -3279,11 +3798,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.30" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys 0.4.13", @@ -3292,26 +3811,56 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.10" +version = "0.21.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4" dependencies = [ "log", "ring", - "rustls-webpki", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring", + "rustls-pki-types", + "rustls-webpki 0.102.3", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls" +version = "0.23.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afabcee0551bd1aa3e18e5adbf2c0544722014b899adb31bd186ec638d3da97e" +dependencies = [ + "aws-lc-rs", + "log", + "once_cell", + "rustls-pki-types", + "rustls-webpki 0.102.3", + "subtle", + "zeroize", +] + [[package]] name = "rustls-connector" -version = "0.18.5" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25da151615461c7347114b1ad1a7458b4cdebc69cb220cd140cd5cb324b1dd37" +checksum = "727a826801254b6cfcd2508a0508c01b7c1bca21d3673e84d86da084781b83d5" dependencies = [ "log", - "rustls", - "rustls-native-certs", - "rustls-webpki", + "rustls 0.23.5", + "rustls-native-certs 0.7.0", + "rustls-pki-types", + "rustls-webpki 0.102.3", ] [[package]] @@ -3321,7 +3870,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" dependencies = [ "openssl-probe", - "rustls-pemfile", + "rustls-pemfile 1.0.4", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-native-certs" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" +dependencies = [ + "openssl-probe", + "rustls-pemfile 2.1.2", + "rustls-pki-types", "schannel", "security-framework", ] @@ -3335,6 +3897,22 @@ dependencies = [ "base64 0.21.7", ] +[[package]] +name = "rustls-pemfile" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +dependencies = [ + "base64 0.22.0", + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "beb461507cee2c2ff151784c52762cf4d9ff6a61f3e80968600ed24fa837fa54" + [[package]] name = "rustls-webpki" version = "0.101.7" @@ -3345,17 +3923,38 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustls-webpki" +version = "0.102.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" + +[[package]] +name = "salsa20" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] [[package]] name = "same-file" @@ -3381,6 +3980,17 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "scrypt" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" +dependencies = [ + "pbkdf2", + "salsa20", + "sha2", +] + [[package]] name = "sct" version = "0.7.1" @@ -3407,9 +4017,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -3420,9 +4030,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" dependencies = [ "core-foundation-sys", "libc", @@ -3430,35 +4040,35 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" -version = "1.0.196" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.198" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] name = "serde_json" -version = "1.0.112" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d1bd37ce2324cf3bf85e5a25f96eb4baf0d5aa6eba43e7ae8958870c4ec48ed" +checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" dependencies = [ "itoa", "ryu", @@ -3509,23 +4119,32 @@ dependencies = [ ] [[package]] -name = "shellexpand" -version = "3.1.0" +name = "shlex" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da03fa3b94cc19e3ebfc88c4229c49d8f08cdbd1228870a45f0ffdf84988e14b" -dependencies = [ - "dirs", -] +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] +[[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 = "siphasher" version = "0.3.11" @@ -3543,9 +4162,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" @@ -3559,12 +4178,12 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3576,6 +4195,16 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "sql-pool" version = "0.1.0" @@ -3599,6 +4228,12 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "subtle" version = "2.5.0" @@ -3618,9 +4253,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ "proc-macro2", "quote", @@ -3633,6 +4268,17 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -3654,28 +4300,33 @@ dependencies = [ "libc", ] +[[package]] +name = "tagptr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" + [[package]] name = "tcp-stream" -version = "0.26.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4da30af7998f51ee1aa48ab24276fe303a697b004e31ff542b192c088d5630a5" +checksum = "495b0abdce3dc1f8fd27240651c9e68890c14e9d9c61527b1ce44d8a5a7bd3d5" dependencies = [ "cfg-if", - "p12", + "p12-keystore", "rustls-connector", - "rustls-pemfile", + "rustls-pemfile 2.1.2", ] [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", - "fastrand 2.0.1", - "redox_syscall", - "rustix 0.38.30", + "fastrand 2.0.2", + "rustix 0.38.34", "windows-sys 0.52.0", ] @@ -3687,29 +4338,29 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -3717,12 +4368,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.31" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -3737,27 +4389,14 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] -[[package]] -name = "tiny-server" -version = "0.1.0" -dependencies = [ - "actix-web", - "configs", - "health-readiness", - "http-components", - "opentelemetry", - "prometheus", - "thiserror", - "tracing", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -3775,9 +4414,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -3786,7 +4425,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.5", + "socket2 0.5.6", "tokio-macros", "windows-sys 0.48.0", ] @@ -3809,7 +4448,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] @@ -3842,7 +4481,7 @@ dependencies = [ "postgres-protocol", "postgres-types", "rand", - "socket2 0.5.5", + "socket2 0.5.6", "tokio", "tokio-util", "whoami", @@ -3854,15 +4493,26 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls", + "rustls 0.21.11", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls 0.22.4", + "rustls-pki-types", "tokio", ] [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", "pin-project-lite", @@ -3895,36 +4545,36 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.6", "toml_datetime", "winnow", ] [[package]] name = "tonic" -version = "0.9.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" +checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" dependencies = [ "async-stream", "async-trait", "axum", "base64 0.21.7", "bytes", - "futures-core", - "futures-util", - "h2", - "http 0.2.11", - "http-body", - "hyper", + "flate2", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-timeout", "percent-encoding", "pin-project", "prost", - "rustls-native-certs", - "rustls-pemfile", + "rustls-native-certs 0.7.0", + "rustls-pemfile 2.1.2", + "rustls-pki-types", "tokio", - "tokio-rustls", + "tokio-rustls 0.25.0", "tokio-stream", "tower", "tower-layer", @@ -4000,7 +4650,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] @@ -4067,6 +4717,12 @@ 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 = "try-lock" version = "0.2.5" @@ -4102,9 +4758,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] @@ -4122,7 +4778,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna", "percent-encoding", ] @@ -4138,7 +4794,7 @@ version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "272ebdfbc99111033031d2f10e018836056e4d2c8e2acda76450ec7974269fa7" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.6", "serde", "serde_json", "utoipa-gen", @@ -4154,14 +4810,14 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] name = "utoipa-swagger-ui" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f839caa8e09dddc3ff1c3112a91ef7da0601075ba5025d9f33ae99c4cb9b6e51" +checksum = "0b39868d43c011961e04b41623e050aedf2cc93652562ff7935ce0f819aaf2da" dependencies = [ "actix-web", "mime_guess", @@ -4181,21 +4837,21 @@ checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom", ] [[package]] name = "validator" -version = "0.16.1" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b92f40481c04ff1f4f61f304d61793c7b56ff76ac1469f1beb199b1445b253bd" +checksum = "db79c75af171630a3148bd3e6d7c4f42b6a9a014c2945bc5ed0020cbb8d9478e" dependencies = [ - "idna 0.4.0", - "lazy_static", + "idna", + "once_cell", "regex", "serde", "serde_derive", @@ -4206,28 +4862,16 @@ dependencies = [ [[package]] name = "validator_derive" -version = "0.16.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc44ca3088bb3ba384d9aecf40c6a23a676ce23e09bdaca2073d99c207f864af" +checksum = "55591299b7007f551ed1eb79a684af7672c19c3193fb9e0a31936987bb2438ec" dependencies = [ - "if_chain", - "lazy_static", + "darling", + "once_cell", "proc-macro-error", "proc-macro2", "quote", - "regex", - "syn 1.0.109", - "validator_types", -] - -[[package]] -name = "validator_types" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111abfe30072511849c5910134e8baf8dc05de4c0e5903d681cbd5c9c4d611e3" -dependencies = [ - "proc-macro2", - "syn 1.0.109", + "syn 2.0.60", ] [[package]] @@ -4262,9 +4906,9 @@ checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -4285,11 +4929,17 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4297,24 +4947,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.40" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -4324,9 +4974,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4334,40 +4984,53 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", ] +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.34", +] + [[package]] name = "whoami" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" +checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" dependencies = [ - "wasm-bindgen", + "redox_syscall", + "wasite", "web-sys", ] @@ -4389,11 +5052,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -4408,7 +5071,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.5", ] [[package]] @@ -4426,7 +5089,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.5", ] [[package]] @@ -4446,17 +5109,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "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", ] [[package]] @@ -4467,9 +5131,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -4479,9 +5143,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -4491,9 +5155,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -4503,9 +5173,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -4515,9 +5185,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -4527,9 +5197,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -4539,40 +5209,62 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" -version = "0.5.35" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1931d78a9c73861da0134f453bb1f790ce49b2e30eba8410b4b79bac72b46a2d" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] [[package]] name = "winreg" -version = "0.50.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" dependencies = [ "cfg-if", "windows-sys 0.48.0", ] [[package]] -name = "xmlparser" -version = "0.13.6" +name = "x509-cert" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4" +checksum = "1301e935010a701ae5f8655edc0ad17c44bad3ac5ce8c39185f75453b720ae94" +dependencies = [ + "const-oid", + "der", + "spki", +] [[package]] -name = "yasna" -version = "0.5.2" +name = "x509-parser" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" +checksum = "fcbc162f30700d6f3f82a24bf7cc62ffe7caea42c0b2cba8bf7f3ae50cf51f69" +dependencies = [ + "asn1-rs", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "xmlparser" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4" [[package]] name = "zerocopy" @@ -4591,14 +5283,14 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "63381fa6624bf92130a6b87c0d07380116f80b565c42cf0d754136f0238359ef" [[package]] name = "zip" @@ -4614,27 +5306,27 @@ dependencies = [ [[package]] name = "zstd" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" +checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "7.0.0" +version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" +checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a" dependencies = [ "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" +version = "2.0.10+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index 9cb79b5..74e370d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,17 +7,27 @@ members = [ "messaging", "rabbitmq", "kafka", - "auth", - "health_readiness", "http_components", + "health_readiness", + "health_http_server", "http_server", - "tiny_server", "logging", "metrics", "migrator", "mqtt", - "otel", "secrets_manager", "sql_pool", "traces", -] \ No newline at end of file + "auth", +] + +[workspace.dependencies] +thiserror = { version = "1.0.59" } +serde = { version = "1.0.198" } +serde_json = { version = "1.0.116" } +tokio = { version = "1.37.0" } +async-trait = { version = "0.1.80" } +tracing = { version = "0.1.40" } +tonic = { version = "0.11" } +opentelemetry = { version = "0.22.0" } +opentelemetry_sdk = { version = "0.22.1" } \ No newline at end of file diff --git a/auth/Cargo.toml b/auth/Cargo.toml index 6490055..a208a53 100644 --- a/auth/Cargo.toml +++ b/auth/Cargo.toml @@ -6,11 +6,12 @@ edition = "2021" [dependencies] configs = { path = "../configs" } -serde = { version = "1.0.196", features = ["derive"] } -serde_json = { version = "1.0.112" } -tracing = { version = "0.1.40" } -async-trait = { version = "0.1.77" } -opentelemetry = { version = "0.21.0" } -alcoholic_jwt = { version = "4091.0.0 " } -tokio = { version = "1.35.1", features = ["sync"] } -reqwest = { version = "0.11.23", features = ["json"] } \ No newline at end of file +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } +tracing = { workspace = true } +async-trait = { workspace = true } +opentelemetry = { workspace = true } +tokio = { workspace = true, features = ["sync"] } +reqwest = { version = "0.12.3", features = ["json"] } +moka = { version = "0.12.7", features = ["future"] } +jsonwebtoken = { version = "9.3.0" } \ No newline at end of file diff --git a/auth/src/auth0.rs b/auth/src/auth0.rs new file mode 100644 index 0000000..b16f161 --- /dev/null +++ b/auth/src/auth0.rs @@ -0,0 +1,112 @@ +use super::{manager::JwtManager, types::TokenClaims}; +use async_trait::async_trait; +use configs::IdentityServerConfigs; +use jsonwebtoken::jwk::JwkSet; +use moka::future::{Cache, CacheBuilder}; +use opentelemetry::{ + global::{self, BoxedSpan, BoxedTracer}, + trace::{Span, Status, Tracer}, + Context, KeyValue, +}; +use std::{borrow::Cow, sync::Arc, time::Duration}; +use tracing::error; + +pub struct Auth0JwtManager { + jwks_cache: Cache, + jwt_cache: Cache, + tracer: BoxedTracer, + cfg: IdentityServerConfigs, +} + +impl Auth0JwtManager { + pub fn new(cfg: &IdentityServerConfigs) -> Arc { + Arc::new(Self { + jwks_cache: CacheBuilder::new(2) + .time_to_live(Duration::from_millis(86_400_000)) + .time_to_idle(Duration::from_millis(3_600_000)) + .build(), + jwt_cache: CacheBuilder::new(10_000) + .time_to_live(Duration::from_millis(86_400_000)) + .time_to_idle(Duration::from_millis(1_800_000)) + .build(), + tracer: global::tracer("auth0-jwt-manager"), + cfg: cfg.to_owned(), + }) + } +} + +#[async_trait] +impl JwtManager for Auth0JwtManager { + async fn verify(&self, ctx: &Context, token: &str) -> Result { + let mut span = self.tracer.start_with_context("authenticate", ctx); + + if let Some(cached_claim) = self.jwt_cache.get(token).await { + span.set_attribute(KeyValue::new("jwt-cached", true)); + span.set_status(Status::Ok); + return Ok(cached_claim); + }; + + span.set_attribute(KeyValue::new("jwt-cached", false)); + + let jwks: JwkSet = match self.jwks_cache.get("jwks").await { + Some(jwks) => { + span.set_attribute(KeyValue::new("jwks-cached", true)); + jwks + } + _ => { + span.set_attribute(KeyValue::new("jwks-cached", false)); + let jwks = self.get_jwks(&mut span).await?; + self.jwks_cache.insert("jwks".into(), jwks.clone()).await; + jwks + } + }; + + let decoded_token = + self.decode_token(token, &jwks, &self.cfg.audience, &self.cfg.issuer)?; + + span.set_status(Status::Ok); + + let claim = TokenClaims::from_auth0(&decoded_token.claims)?; + + self.jwt_cache.insert(token.into(), claim.clone()).await; + + Ok(claim) + } +} + +impl Auth0JwtManager { + async fn get_jwks(&self, span: &mut BoxedSpan) -> Result { + let res = match reqwest::get(&format!( + "https://{}/{}", + self.cfg.realm, ".well-known/jwks.json" + )) + .await + { + Err(err) => { + error!(error = err.to_string(), "error to get jwks from auth0 api"); + span.record_error(&err); + span.set_status(Status::Error { + description: Cow::from("error to get jwks from auth0 api"), + }); + Err(()) + } + Ok(r) => Ok(r), + }?; + + let val = match res.json::().await { + Err(err) => { + error!(error = err.to_string(), "error deserializing the jwks"); + span.record_error(&err); + span.set_status(Status::Error { + description: Cow::from("error deserializing the jwks"), + }); + Err(()) + } + Ok(v) => Ok(v), + }?; + + return Ok(val); + } +} + +impl TokenClaims {} diff --git a/auth/src/jwt_manager/auth0.rs b/auth/src/jwt_manager/auth0.rs deleted file mode 100644 index 0d2ca22..0000000 --- a/auth/src/jwt_manager/auth0.rs +++ /dev/null @@ -1,323 +0,0 @@ -use super::{manager::Session, JwtManager, TokenClaims}; -use alcoholic_jwt::{token_kid, validate, Validation, JWKS}; -use async_trait::async_trait; -use configs::Auth0Configs; -use opentelemetry::{ - global::{self, BoxedSpan, BoxedTracer}, - trace::{Span, Status, Tracer}, - Context, -}; -use serde_json::Value; -use std::{ - borrow::Cow, - sync::Arc, - time::{Duration, SystemTime}, -}; -use tokio::sync::Mutex; -use tracing::error; - -// 18000 seconds = 5 hours -const SECONDS_TO_ROTATE_JWK: u64 = 18000; - -pub struct Auth0JwtManager { - jwks: Mutex>, - jwks_retrieved_at: SystemTime, - tracer: BoxedTracer, - cfg: Auth0Configs, -} - -impl Auth0JwtManager { - pub fn new(cfg: &Auth0Configs) -> Arc { - Arc::new(Auth0JwtManager { - jwks: Mutex::new(None), - jwks_retrieved_at: SystemTime::now(), - tracer: global::tracer("auth0_middleware"), - cfg: cfg.to_owned(), - }) - } -} - -#[async_trait] -impl JwtManager for Auth0JwtManager { - async fn verify(&self, ctx: &Context, token: &str) -> Result { - let mut span = self.tracer.start_with_context("authenticate", ctx); - - let jwks = self.retrieve_jwks(&mut span).await?; - - let kid = match token_kid(&token) { - Ok(res) => { - if res.is_none() { - error!("token with no kid"); - span.set_status(Status::Error { - description: Cow::from("token with no kid"), - }); - return Err(()); - } - - Ok(res.unwrap()) - } - Err(err) => { - error!(error = err.to_string(), "error retrieving the token kid"); - span.record_error(&err); - span.set_status(Status::Error { - description: Cow::from("error retrieving the token kid"), - }); - Err(()) - } - }?; - - let validations = vec![ - Validation::NotExpired, - Validation::SubjectPresent, - Validation::Issuer(self.cfg.issuer.clone()), - Validation::Audience(self.cfg.audience.clone()), - ]; - - let jwk = match jwks.find(&kid) { - Some(jwk) => Ok(jwk), - _ => { - error!("specified jwk key was not founded in set"); - span.set_status(Status::Error { - description: Cow::from("specified jwk key was not founded in set"), - }); - Err(()) - } - }?; - - let claims = match validate(token, jwk, validations) { - Ok(res) => Ok(res.claims), - Err(err) => { - error!(error = err.to_string(), "invalid jwt token"); - span.record_error(&err); - span.set_status(Status::Error { - description: Cow::from("invalid jwt token"), - }); - Err(()) - } - }?; - - span.set_status(Status::Ok); - - Ok(TokenClaims { - iss: self.get_claim_as_string("iss", &claims, &mut span)?, - sub: self.get_claim_as_string("sub", &claims, &mut span)?, - aud: self.get_claim_as_vec("aud", &claims, &mut span)?, - iat: self.get_claim_as_u64("iat", &claims, &mut span)?, - exp: self.get_claim_as_u64("exp", &claims, &mut span)?, - scope: self.get_claim_as_string("scope", &claims, &mut span)?, - session: self.get_session_claim(&claims, &mut span)?, - }) - } -} - -impl Auth0JwtManager { - async fn retrieve_jwks(&self, span: &mut BoxedSpan) -> Result { - let mut jwks = self.jwks.lock().await; - - if jwks.is_none() { - let new = self.get_jwks(span).await?; - *jwks = Some(new.clone()); - return Ok(new); - } - - let duration = match SystemTime::now().duration_since(self.jwks_retrieved_at.clone()) { - Ok(d) => Ok(d), - Err(err) => { - error!( - error = err.to_string(), - "error comparing the jwks caching time" - ); - span.record_error(&err); - span.set_status(Status::Error { - description: Cow::from("error comparing the jwks caching time"), - }); - Err(()) - } - }?; - - if duration - .cmp(&Duration::new(SECONDS_TO_ROTATE_JWK, 0)) - .is_ge() - { - let new = self.get_jwks(span).await?; - *jwks = Some(new.clone()); - return Ok(new); - } - - Ok(jwks.clone().unwrap()) - } - - async fn get_jwks(&self, span: &mut BoxedSpan) -> Result { - let res = match reqwest::get(&format!( - "https://{}/{}", - self.cfg.domain, ".well-known/jwks.json" - )) - .await - { - Err(err) => { - error!(error = err.to_string(), "error to get jwks from auth0 api"); - span.record_error(&err); - span.set_status(Status::Error { - description: Cow::from("error to get jwks from auth0 api"), - }); - Err(()) - } - Ok(r) => Ok(r), - }?; - - let val = match res.json::().await { - Err(err) => { - error!(error = err.to_string(), "error deserializing the jwks"); - span.record_error(&err); - span.set_status(Status::Error { - description: Cow::from("error deserializing the jwks"), - }); - Err(()) - } - Ok(v) => Ok(v), - }?; - - return Ok(val); - } - - fn get_claim_as_string( - &self, - key: &str, - claims: &Value, - span: &mut BoxedSpan, - ) -> Result { - match claims.get(key) { - Some(fv) => match fv.as_str() { - Some(value) => Ok(value.to_owned()), - _ => { - error!(claim = key, "invalid jwt claim"); - span.set_status(Status::Error { - description: Cow::from("invalid jwt claim"), - }); - Err(()) - } - }, - _ => { - error!(claim = key, "invalid jwt claim"); - span.set_status(Status::Error { - description: Cow::from("invalid jwt claim"), - }); - Err(()) - } - } - } - - fn get_claim_as_u64(&self, key: &str, claims: &Value, span: &mut BoxedSpan) -> Result { - match claims.get(key) { - Some(fv) => match fv.as_u64() { - Some(value) => Ok(value), - _ => { - error!(claim = key, "invalid jwt claim"); - span.set_status(Status::Error { - description: Cow::from("invalid jwt claim"), - }); - Err(()) - } - }, - _ => { - error!(claim = key, "invalid jwt claim"); - span.set_status(Status::Error { - description: Cow::from("invalid jwt claim"), - }); - Err(()) - } - } - } - - fn get_claim_as_vec( - &self, - key: &str, - claims: &Value, - span: &mut BoxedSpan, - ) -> Result, ()> { - match claims.get(key) { - Some(fv) => match fv.as_array() { - Some(value) => Ok(value - .iter() - .map(|v| v.as_str().unwrap().to_owned()) - .collect::>()), - _ => { - error!(claim = key, "invalid jwt claim"); - span.set_status(Status::Error { - description: Cow::from("invalid jwt claim"), - }); - Err(()) - } - }, - _ => { - error!(claim = key, "invalid jwt claim"); - span.set_status(Status::Error { - description: Cow::from("invalid jwt claim"), - }); - Err(()) - } - } - } - - fn get_session_claim(&self, claims: &Value, span: &mut BoxedSpan) -> Result { - match claims.get("user_data") { - Some(fv) => match fv.as_object() { - Some(user_data) => match user_data.get("user_metadata") { - Some(uv) => match uv.as_object() { - Some(user_metadata) => { - let user_id = user_metadata.get("x1").unwrap().as_i64().unwrap(); - let user_uuid = user_metadata - .get("x2") - .unwrap() - .as_str() - .unwrap() - .to_owned(); - let company_id = user_metadata.get("y1").unwrap().as_i64().unwrap(); - let company_uuid = user_metadata - .get("y2") - .unwrap() - .as_str() - .unwrap() - .to_owned(); - - Ok(Session { - user_id, - user_uuid, - company_id, - company_uuid, - }) - } - _ => { - error!(claim = "user_metadata", "invalid jwt claim"); - span.set_status(Status::Error { - description: Cow::from("invalid jwt claim"), - }); - Err(()) - } - }, - _ => { - error!(claim = "user_metadata", "invalid jwt claim"); - span.set_status(Status::Error { - description: Cow::from("invalid jwt claim"), - }); - Err(()) - } - }, - _ => { - error!(claim = "user_data", "invalid jwt claim"); - span.set_status(Status::Error { - description: Cow::from("invalid jwt claim"), - }); - Err(()) - } - }, - _ => { - error!(claim = "user_data", "invalid jwt claim"); - span.set_status(Status::Error { - description: Cow::from("invalid jwt claim"), - }); - Err(()) - } - } - } -} diff --git a/auth/src/jwt_manager/manager.rs b/auth/src/jwt_manager/manager.rs deleted file mode 100644 index 7ba2036..0000000 --- a/auth/src/jwt_manager/manager.rs +++ /dev/null @@ -1,27 +0,0 @@ -use async_trait::async_trait; -use opentelemetry::Context; -use serde::{Deserialize, Serialize}; - -#[derive(Debug, Default, Serialize, Deserialize)] -pub struct Session { - pub user_id: i64, - pub user_uuid: String, - pub company_id: i64, - pub company_uuid: String, -} - -#[derive(Debug, Default, Serialize, Deserialize)] -pub struct TokenClaims { - pub iss: String, - pub sub: String, - pub aud: Vec, - pub iat: u64, - pub exp: u64, - pub scope: String, - pub session: Session, -} - -#[async_trait] -pub trait JwtManager: Send + Sync { - async fn verify(&self, ctx: &Context, token: &str) -> Result; -} diff --git a/auth/src/jwt_manager/mod.rs b/auth/src/jwt_manager/mod.rs deleted file mode 100644 index bfd2527..0000000 --- a/auth/src/jwt_manager/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub mod auth0; -mod manager; - -pub use manager::{JwtManager, TokenClaims}; diff --git a/auth/src/keycloak.rs b/auth/src/keycloak.rs new file mode 100644 index 0000000..f0fcf8a --- /dev/null +++ b/auth/src/keycloak.rs @@ -0,0 +1,111 @@ +use super::{manager::JwtManager, types::TokenClaims}; +use async_trait::async_trait; +use configs::IdentityServerConfigs; +use jsonwebtoken::jwk::JwkSet; +use moka::future::{Cache, CacheBuilder}; +use opentelemetry::{ + global::{self, BoxedSpan, BoxedTracer}, + trace::{Span, Status, Tracer}, + Context, KeyValue, +}; +use std::{borrow::Cow, sync::Arc, time::Duration}; +use tracing::error; + +pub struct KeycloakJwtManager { + jwks_cache: Cache, + jwt_cache: Cache, + tracer: BoxedTracer, + cfg: IdentityServerConfigs, +} + +impl KeycloakJwtManager { + pub fn new(cfg: &IdentityServerConfigs) -> Arc { + Arc::new(Self { + jwks_cache: CacheBuilder::new(2) + .time_to_live(Duration::from_millis(86_400_000)) + .time_to_idle(Duration::from_millis(3_600_000)) + .build(), + jwt_cache: CacheBuilder::new(10_000) + .time_to_live(Duration::from_millis(86_400_000)) + .time_to_idle(Duration::from_millis(1_800_000)) + .build(), + tracer: global::tracer("keycloak-jwt-manager"), + cfg: cfg.to_owned(), + }) + } +} + +#[async_trait] +impl JwtManager for KeycloakJwtManager { + async fn verify(&self, ctx: &Context, token: &str) -> Result { + let mut span = self.tracer.start_with_context("authenticate", ctx); + + if let Some(cached_claim) = self.jwt_cache.get(token).await { + span.set_attribute(KeyValue::new("jwt-cached", true)); + span.set_status(Status::Ok); + return Ok(cached_claim); + }; + + span.set_attribute(KeyValue::new("jwt-cached", false)); + + let jwks: JwkSet = match self.jwks_cache.get("jwks").await { + Some(jwks) => { + span.set_attribute(KeyValue::new("jwks-cached", true)); + jwks + } + _ => { + span.set_attribute(KeyValue::new("jwks-cached", false)); + let jwks = self.get_jwks(&mut span).await?; + self.jwks_cache.insert("jwks".into(), jwks.clone()).await; + jwks + } + }; + + let decoded_token = + self.decode_token(token, &jwks, &self.cfg.audience, &self.cfg.issuer)?; + + span.set_status(Status::Ok); + + let claim = TokenClaims::from_keycloak(&decoded_token.claims)?; + + self.jwt_cache.insert(token.into(), claim.clone()).await; + + Ok(claim) + } +} + +impl KeycloakJwtManager { + async fn get_jwks(&self, span: &mut BoxedSpan) -> Result { + // http://BASE_URL/realms/proteu/protocol/openid-connect/certs + let endpoint = format!( + "{}/realms/{}/protocol/openid-connect/certs", + self.cfg.url, self.cfg.realm, + ); + + let res = match reqwest::get(&endpoint).await { + Err(err) => { + error!(error = err.to_string(), "error to get jwks from auth0 api"); + span.record_error(&err); + span.set_status(Status::Error { + description: Cow::from("error to get jwks from auth0 api"), + }); + Err(()) + } + Ok(r) => Ok(r), + }?; + + let val = match res.json::().await { + Err(err) => { + error!(error = err.to_string(), "error deserializing the jwks"); + span.record_error(&err); + span.set_status(Status::Error { + description: Cow::from("error deserializing the jwks"), + }); + Err(()) + } + Ok(v) => Ok(v), + }?; + + return Ok(val); + } +} diff --git a/auth/src/lib.rs b/auth/src/lib.rs index 5d896e0..4ef948f 100644 --- a/auth/src/lib.rs +++ b/auth/src/lib.rs @@ -1,5 +1,5 @@ -pub mod jwt_manager; -mod scopes; -mod types; - -pub use scopes::{PlatformScopes, Scopes, UsersScopes}; +pub mod auth0; +pub mod keycloak; +pub mod manager; +pub mod rbac; +pub mod types; diff --git a/auth/src/manager.rs b/auth/src/manager.rs new file mode 100644 index 0000000..5529a13 --- /dev/null +++ b/auth/src/manager.rs @@ -0,0 +1,74 @@ +use crate::types::TokenClaims; +use async_trait::async_trait; +use jsonwebtoken::{ + decode, decode_header, + jwk::{AlgorithmParameters, JwkSet}, + Algorithm, DecodingKey, TokenData, Validation, +}; +use opentelemetry::Context; +use serde_json::Value; +use std::{collections::HashMap, str::FromStr}; +use tracing::error; + +#[async_trait] +pub trait JwtManager: Send + Sync { + async fn verify(&self, ctx: &Context, token: &str) -> Result; + + fn decode_token( + &self, + token: &str, + jwks: &JwkSet, + aud: &str, + iss: &str, + ) -> Result>, ()> { + let Ok(header) = decode_header(token) else { + error!("failed to decoded token header"); + return Err(()); + }; + + let Some(kid) = header.kid else { + error!("token header without kid"); + return Err(()); + }; + + let Some(jwk) = jwks.find(&kid) else { + error!("wasn't possible to find the same token kid into jwks"); + return Err(()); + }; + + let AlgorithmParameters::RSA(rsa) = &jwk.algorithm else { + error!("token hashed using other algorithm than RSA"); + return Err(()); + }; + + let Ok(decoding_key) = DecodingKey::from_rsa_components(&rsa.n, &rsa.e) else { + error!("failed to decode rsa components"); + return Err(()); + }; + + let Some(key_alg) = jwk.common.key_algorithm else { + error!("jwk with no key algorithm"); + return Err(()); + }; + + let Ok(alg) = Algorithm::from_str(key_alg.to_string().as_str()) else { + error!("algorithm provided by the JWK is not sported!"); + return Err(()); + }; + + let mut validation = Validation::new(alg); + + //Validation::SubjectPresent + validation.set_audience(&[aud]); + validation.set_issuer(&[iss]); + validation.validate_exp = true; + + match decode::>(token, &decoding_key, &validation) { + Ok(d) => Ok(d), + Err(err) => { + error!(error = err.to_string(), "token validation error"); + Err(()) + } + } + } +} diff --git a/auth/src/rbac.rs b/auth/src/rbac.rs new file mode 100644 index 0000000..dd618ae --- /dev/null +++ b/auth/src/rbac.rs @@ -0,0 +1,9 @@ +use crate::types::TokenClaims; + +pub fn is_allowed<'i>(claims: &'i TokenClaims, permission: &'i str) -> bool { + let Some(_) = claims.scopes.0.get(permission) else { + return false; + }; + + true +} diff --git a/auth/src/scopes.rs b/auth/src/scopes.rs deleted file mode 100644 index 3488f1b..0000000 --- a/auth/src/scopes.rs +++ /dev/null @@ -1,8 +0,0 @@ -pub enum UsersScopes {} - -pub enum PlatformScopes {} - -pub enum Scopes { - USER(UsersScopes), - PLATFORM(PlatformScopes), -} diff --git a/auth/src/types.rs b/auth/src/types.rs deleted file mode 100644 index 8b13789..0000000 --- a/auth/src/types.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/auth/src/types/custom_data.rs b/auth/src/types/custom_data.rs new file mode 100644 index 0000000..43b6499 --- /dev/null +++ b/auth/src/types/custom_data.rs @@ -0,0 +1,79 @@ +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use std::collections::HashMap; +use tracing::error; + +#[derive(Debug, Default, Serialize, Deserialize, Clone)] +pub struct CustomData { + #[serde(rename(serialize = "x1", deserialize = "x1"))] + pub user_id: i64, + + #[serde(rename(serialize = "x2", deserialize = "x2"))] + pub user_key: String, + + #[serde(rename(serialize = "y1", deserialize = "y1"))] + pub company_id: i64, + + #[serde(rename(serialize = "y2", deserialize = "y2"))] + pub company_key: String, +} + +impl CustomData { + pub fn from_auth0(claims: &HashMap) -> Result { + let Some(user_data) = claims.get("user_data") else { + error!(claim = "user_data", "invalid jwt claim"); + return Err(()); + }; + + let Some(user_metadata) = user_data.get("user_metadata") else { + error!(claim = "user_metadata", "invalid jwt claim"); + return Err(()); + }; + + let Some(x1) = user_metadata.get("x1") else { + error!(claim = "x1", "invalid jwt claim"); + return Err(()); + }; + + let Some(x2) = user_metadata.get("x2") else { + error!(claim = "x2", "invalid jwt claim"); + return Err(()); + }; + + let Some(y1) = user_metadata.get("y1") else { + error!(claim = "y1", "invalid jwt claim"); + return Err(()); + }; + + let Some(y2) = user_metadata.get("y2") else { + error!(claim = "y2", "invalid jwt claim"); + return Err(()); + }; + + Ok(Self { + user_id: x1.as_i64().unwrap(), + user_key: x2.as_str().unwrap().into(), + company_id: y1.as_i64().unwrap(), + company_key: y2.as_str().unwrap().into(), + }) + } + + pub fn from_keycloak(claims: &HashMap) -> Result { + let Some(user_data) = claims.get("user_data") else { + error!(claim = "user_data", "invalid jwt claim"); + return Err(()); + }; + + let Some(json) = user_data.as_str() else { + error!(claim = "user_data", "invalid jwt claim"); + return Err(()); + }; + + let Ok(custom) = serde_json::from_str::(json) else { + error!(claim = "user_data", "invalid jwt claim"); + return Err(()); + }; + + Ok(custom) + } +} diff --git a/auth/src/types/mod.rs b/auth/src/types/mod.rs new file mode 100644 index 0000000..fdb3997 --- /dev/null +++ b/auth/src/types/mod.rs @@ -0,0 +1,7 @@ +mod custom_data; +mod scopes; +mod token_claims; + +pub use custom_data::CustomData; +pub use scopes::Scopes; +pub use token_claims::TokenClaims; diff --git a/auth/src/types/permissions.rs b/auth/src/types/permissions.rs new file mode 100644 index 0000000..83af10c --- /dev/null +++ b/auth/src/types/permissions.rs @@ -0,0 +1,3 @@ +pub trait Permissions { + fn scope(&self) -> String; +} diff --git a/auth/src/types/scopes.rs b/auth/src/types/scopes.rs new file mode 100644 index 0000000..eb0e67d --- /dev/null +++ b/auth/src/types/scopes.rs @@ -0,0 +1,64 @@ +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use std::collections::{HashMap, HashSet}; +use tracing::error; + +#[derive(Debug, Default, Serialize, Deserialize, Clone)] +pub struct Scopes(pub HashSet); + +impl Scopes { + pub fn from_auth0(claims: &HashMap) -> Result { + let Some(v) = claims.get("scope") else { + error!(claim = "scope", "invalid jwt claim"); + return Err(()); + }; + + let Some(scopes) = v.as_str() else { + error!(claim = "scope", "invalid jwt claim"); + return Err(()); + }; + + let mut set = HashSet::new(); + + for scope in scopes.split_whitespace() { + set.insert(scope.into()); + } + + Ok(Self { 0: set }) + } + + pub fn from_keycloak(claims: &HashMap) -> Result { + let Some(access) = claims.get("resource_access") else { + error!(claim = "resource_access", "invalid jwt claim"); + return Err(()); + }; + + let Some(azp_v) = claims.get("azp") else { + error!(claim = "azp", "invalid jwt claim"); + return Err(()); + }; + + let Some(azp) = azp_v.as_str() else { + error!(claim = "azp", "invalid jwt claim"); + return Err(()); + }; + + let Some(resources) = access.get(azp) else { + error!(claim = azp, "invalid jwt claim"); + return Err(()); + }; + + let Some(roles) = resources.get("roles") else { + error!(claim = "roles", "invalid jwt claim"); + return Err(()); + }; + + let mut set = HashSet::new(); + + for role in roles.as_array().unwrap() { + set.insert(role.as_str().unwrap().into()); + } + + Ok(Self { 0: set }) + } +} diff --git a/auth/src/types/token_claims.rs b/auth/src/types/token_claims.rs new file mode 100644 index 0000000..731beb1 --- /dev/null +++ b/auth/src/types/token_claims.rs @@ -0,0 +1,91 @@ +use super::{CustomData, Scopes}; +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use std::collections::HashMap; +use tracing::error; + +#[derive(Debug, Default, Serialize, Deserialize, Clone)] +pub struct TokenClaims { + pub iss: String, + pub sub: String, + pub aud: Vec, + pub iat: u64, + pub exp: u64, + pub scopes: Scopes, + pub custom_data: CustomData, +} + +impl TokenClaims { + fn new( + claims: &HashMap, + scopes: Scopes, + custom_data: CustomData, + ) -> Result { + Ok(Self { + iss: get_claim_as_string("iss", claims)?, + sub: get_claim_as_string("sub", claims)?, + aud: get_claim_as_vec("aud", claims)?, + iat: get_claim_as_u64("iat", claims)?, + exp: get_claim_as_u64("exp", claims)?, + scopes, + custom_data, + }) + } + + pub fn from_auth0(claims: &HashMap) -> Result { + let scopes = Scopes::from_auth0(claims)?; + let custom_data = CustomData::from_auth0(claims)?; + TokenClaims::new(claims, scopes, custom_data) + } + + pub fn from_keycloak(claims: &HashMap) -> Result { + let scopes = Scopes::from_keycloak(claims)?; + let custom_data = CustomData::from_keycloak(claims)?; + TokenClaims::new(claims, scopes, custom_data) + } +} + +fn get_claim_as_string(key: &str, claims: &HashMap) -> Result { + let Some(fv) = claims.get(key) else { + error!(claim = key, "invalid jwt claim"); + return Err(()); + }; + + let Some(value) = fv.as_str() else { + error!(claim = key, "invalid jwt claim"); + return Err(()); + }; + + Ok(value.into()) +} + +fn get_claim_as_u64(key: &str, claims: &HashMap) -> Result { + let Some(fv) = claims.get(key) else { + error!(claim = key, "invalid jwt claim"); + return Err(()); + }; + + let Some(value) = fv.as_u64() else { + error!(claim = key, "invalid jwt claim"); + return Err(()); + }; + + Ok(value) +} + +fn get_claim_as_vec(key: &str, claims: &HashMap) -> Result, ()> { + let Some(fv) = claims.get(key) else { + error!(claim = key, "invalid jwt claim"); + return Err(()); + }; + + let Some(value) = fv.as_array() else { + error!(claim = key, "invalid jwt claim"); + return Err(()); + }; + + Ok(value + .iter() + .map(|v| v.as_str().unwrap().to_owned()) + .collect::>()) +} diff --git a/configs/src/configs.rs b/configs/src/configs.rs index 625cff4..95a767f 100644 --- a/configs/src/configs.rs +++ b/configs/src/configs.rs @@ -1,13 +1,13 @@ use crate::{ - kafka::KafkaConfigs, AppConfigs, Auth0Configs, AwsConfigs, DynamoConfigs, - HealthReadinessConfigs, MQTTConfigs, MetricConfigs, PostgresConfigs, RabbitMQConfigs, + kafka::KafkaConfigs, AppConfigs, AwsConfigs, DynamoConfigs, HealthReadinessConfigs, + IdentityServerConfigs, MQTTConfigs, MetricConfigs, PostgresConfigs, RabbitMQConfigs, SqliteConfigs, TraceConfigs, }; #[derive(Debug, Clone, Default)] pub struct Configs { pub app: AppConfigs, - pub auth0: Auth0Configs, + pub identity: IdentityServerConfigs, pub mqtt: MQTTConfigs, pub rabbitmq: RabbitMQConfigs, pub kafka: KafkaConfigs, diff --git a/configs/src/environment.rs b/configs/src/environment.rs index 788348e..ab88454 100644 --- a/configs/src/environment.rs +++ b/configs/src/environment.rs @@ -51,13 +51,4 @@ impl Environment { pub fn is_prod(&self) -> bool { self == &Environment::Prod } - - pub fn filename(&self) -> String { - match *self { - Environment::Local => ".env.local".into(), - Environment::Dev => ".env.develop".into(), - Environment::Staging => ".env.staging".into(), - Environment::Prod => ".env.prod".into(), - } - } } diff --git a/configs/src/auth0.rs b/configs/src/identity_server.rs similarity index 62% rename from configs/src/auth0.rs rename to configs/src/identity_server.rs index e8c34b5..533d16c 100644 --- a/configs/src/auth0.rs +++ b/configs/src/identity_server.rs @@ -1,7 +1,13 @@ #[derive(Debug, Clone)] -pub struct Auth0Configs { - //Default: "" - pub domain: String, +pub struct IdentityServerConfigs { + /// Identity Server URL + /// + /// Default: "" + pub url: String, + /// Identity Application Realm + /// + /// in Auth0 Realm is the same than Domain + pub realm: String, //Default: "" pub audience: String, //Default: "" @@ -14,10 +20,11 @@ pub struct Auth0Configs { pub grant_type: String, } -impl Default for Auth0Configs { +impl Default for IdentityServerConfigs { fn default() -> Self { Self { - domain: Default::default(), + url: Default::default(), + realm: Default::default(), audience: Default::default(), issuer: Default::default(), client_id: Default::default(), diff --git a/configs/src/lib.rs b/configs/src/lib.rs index e092a3e..cfaf361 100644 --- a/configs/src/lib.rs +++ b/configs/src/lib.rs @@ -1,10 +1,10 @@ mod app; -mod auth0; mod aws; mod configs; mod dynamo; mod environment; mod health_readiness; +mod identity_server; mod kafka; mod metrics; mod mqtt; @@ -15,12 +15,12 @@ mod sqlite; mod traces; pub use app::AppConfigs; -pub use auth0::Auth0Configs; pub use aws::AwsConfigs; pub use configs::{Configs, DynamicConfigs, Empty}; pub use dynamo::DynamoConfigs; pub use environment::Environment; pub use health_readiness::HealthReadinessConfigs; +pub use identity_server::IdentityServerConfigs; pub use kafka::KafkaConfigs; pub use metrics::{MetricConfigs, MetricExporterKind}; pub use mqtt::{MQTTBrokerKind, MQTTConfigs, MQTTTransport}; diff --git a/configs_builder/Cargo.toml b/configs_builder/Cargo.toml index b1602a7..00e1a29 100644 --- a/configs_builder/Cargo.toml +++ b/configs_builder/Cargo.toml @@ -8,7 +8,7 @@ configs = { path = "../configs" } secrets-manager = { path = "../secrets_manager" } logging = { path = "../logging" } +thiserror = { workspace = true } +tracing = { workspace = true } dotenvy = { version = "0.15.7" } -base64 = { version = "0.21.7" } -tracing = { version = "0.1.40" } -thiserror = { version = "1.0.56" } +base64 = { version = "0.22" } diff --git a/configs_builder/src/configs_builder.rs b/configs_builder/src/configs_builder.rs index fc46909..161aa23 100644 --- a/configs_builder/src/configs_builder.rs +++ b/configs_builder/src/configs_builder.rs @@ -1,24 +1,26 @@ use crate::{ env_keys::{ - APP_NAME_ENV_KEY, APP_PORT_ENV_KEY, AUTH0_AUDIENCE_ENV_KEY, AUTH0_CLIENT_ID_ENV_KEY, - AUTH0_CLIENT_SECRET_ENV_KEY, AUTH0_DOMAIN_ENV_KEY, AUTH0_GRANT_TYPE_ENV_KEY, - AUTH0_ISSUER_ENV_KEY, AWS_DEFAULT_REGION, AWS_IAM_ACCESS_KEY_ID, AWS_IAM_SECRET_ACCESS_KEY, - DYNAMO_ENDPOINT_ENV_KEY, DYNAMO_EXPIRE_ENV_KEY, DYNAMO_REGION_ENV_KEY, - DYNAMO_TABLE_ENV_KEY, ENABLE_HEALTH_READINESS_ENV_KEY, ENABLE_METRICS_ENV_KEY, - ENABLE_TRACES_ENV_KEY, HEALTH_READINESS_PORT_ENV_KEY, HOST_NAME_ENV_KEY, - KAFKA_HOST_ENV_KEY, KAFKA_PASSWORD_ENV_KEY, KAFKA_PORT_ENV_KEY, - KAFKA_SASL_MECHANISMS_ENV_KEY, KAFKA_SECURITY_PROTOCOL_ENV_KEY, KAFKA_TIMEOUT_ENV_KEY, - KAFKA_USER_ENV_KEY, LOG_LEVEL_ENV_KEY, METRIC_ACCESS_KEY_ENV_KEY, METRIC_EXPORTER_ENV_KEY, + APP_NAME_ENV_KEY, APP_PORT_ENV_KEY, AWS_DEFAULT_REGION, AWS_IAM_ACCESS_KEY_ID, + AWS_IAM_SECRET_ACCESS_KEY, DEV_ENV_FILE_NAME, DYNAMO_ENDPOINT_ENV_KEY, + DYNAMO_EXPIRE_ENV_KEY, DYNAMO_REGION_ENV_KEY, DYNAMO_TABLE_ENV_KEY, + ENABLE_HEALTH_READINESS_ENV_KEY, ENABLE_METRICS_ENV_KEY, ENABLE_TRACES_ENV_KEY, + HEALTH_READINESS_PORT_ENV_KEY, HOST_NAME_ENV_KEY, IDENTITY_SERVER_AUDIENCE_ENV_KEY, + IDENTITY_SERVER_CLIENT_ID_ENV_KEY, IDENTITY_SERVER_CLIENT_SECRET_ENV_KEY, + IDENTITY_SERVER_GRANT_TYPE_ENV_KEY, IDENTITY_SERVER_ISSUER_ENV_KEY, + IDENTITY_SERVER_REALM_ENV_KEY, IDENTITY_SERVER_URL_ENV_KEY, KAFKA_HOST_ENV_KEY, + KAFKA_PASSWORD_ENV_KEY, KAFKA_PORT_ENV_KEY, KAFKA_SASL_MECHANISMS_ENV_KEY, + KAFKA_SECURITY_PROTOCOL_ENV_KEY, KAFKA_TIMEOUT_ENV_KEY, KAFKA_USER_ENV_KEY, + LOCAL_ENV_FILE_NAME, LOG_LEVEL_ENV_KEY, METRIC_ACCESS_KEY_ENV_KEY, METRIC_EXPORTER_ENV_KEY, METRIC_EXPORT_RATE_BASE_ENV_KEY, METRIC_EXPORT_TIMEOUT_ENV_KEY, METRIC_HEADER_ACCESS_KEY_ENV_KEY, METRIC_HOST_ENV_KEY, METRIC_SERVICE_TYPE_ENV_KEY, MQTT_BROKER_KIND_ENV_KEY, MQTT_CA_CERT_PATH_ENV_KEY, MQTT_HOST_ENV_KEY, MQTT_PASSWORD_ENV_KEY, MQTT_PORT_ENV_KEY, MQTT_TRANSPORT_ENV_KEY, MQTT_USER_ENV_KEY, POSTGRES_DB_ENV_KEY, POSTGRES_HOST_ENV_KEY, POSTGRES_PASSWORD_ENV_KEY, - POSTGRES_PORT_ENV_KEY, POSTGRES_USER_ENV_KEY, RABBITMQ_HOST_ENV_KEY, + POSTGRES_PORT_ENV_KEY, POSTGRES_USER_ENV_KEY, PROD_FILE_NAME, RABBITMQ_HOST_ENV_KEY, RABBITMQ_PASSWORD_ENV_KEY, RABBITMQ_PORT_ENV_KEY, RABBITMQ_USER_ENV_KEY, RABBITMQ_VHOST_ENV_KEY, SECRET_KEY_ENV_KEY, SECRET_MANAGER_ENV_KEY, SECRET_PREFIX, - SQLITE_FILE_NAME_ENV_KEY, TRACE_ACCESS_KEY_ENV_KEY, TRACE_EXPORTER_ENV_KEY, - TRACE_EXPORT_RATE_BASE_ENV_KEY, TRACE_EXPORT_TIMEOUT_ENV_KEY, + SQLITE_FILE_NAME_ENV_KEY, STAGING_FILE_NAME, TRACE_ACCESS_KEY_ENV_KEY, + TRACE_EXPORTER_ENV_KEY, TRACE_EXPORT_RATE_BASE_ENV_KEY, TRACE_EXPORT_TIMEOUT_ENV_KEY, TRACE_HEADER_ACCESS_KEY_ENV_KEY, TRACE_HOST_ENV_KEY, TRACE_SERVICE_TYPE_ENV_KEY, }, errors::ConfigsError, @@ -33,8 +35,9 @@ use secrets_manager::{AWSSecretClientBuilder, FakeSecretClient, SecretClient}; use std::{env, str::FromStr, sync::Arc}; use tracing::error; +#[derive(Default)] pub struct ConfigBuilder { - client: Arc, + client: Option>, mqtt: bool, rabbitmq: bool, kafka: bool, @@ -50,20 +53,7 @@ pub struct ConfigBuilder { impl ConfigBuilder { pub fn new() -> ConfigBuilder { - ConfigBuilder { - client: Arc::new(FakeSecretClient::new()), - mqtt: false, - rabbitmq: false, - kafka: false, - postgres: false, - sqlite: false, - aws: false, - dynamo: false, - metric: false, - trace: false, - health: false, - identity: false, - } + ConfigBuilder::default() } pub fn mqtt(mut self) -> Self { @@ -116,7 +106,7 @@ impl ConfigBuilder { self } - pub fn identity(mut self) -> Self { + pub fn identity_server(mut self) -> Self { self.identity = true; self } @@ -126,7 +116,20 @@ impl ConfigBuilder { T: DynamicConfigs, { let env = Environment::from_rust_env(); - from_filename(format!("./{}", env.filename())).ok(); + match env { + Environment::Prod => { + from_filename(PROD_FILE_NAME).ok(); + } + Environment::Staging => { + from_filename(STAGING_FILE_NAME).ok(); + } + Environment::Dev => { + from_filename(DEV_ENV_FILE_NAME).ok(); + } + _ => { + from_filename(LOCAL_ENV_FILE_NAME).ok(); + } + } let mut cfg = Configs::::default(); self.fill_app(&mut cfg); @@ -138,40 +141,40 @@ impl ConfigBuilder { cfg.dynamic.load(); - self.get_secret_client(&cfg.app).await?; + self.client = self.get_secret_client(&cfg.app).await?; for (key, value) in env::vars() { - if self.identity && self.fill_identity(&mut cfg, &key, &value) { + if self.fill_identity_server(&mut cfg, &key, &value) { continue; }; - if self.mqtt && self.fill_mqtt(&mut cfg, &key, &value) { + if self.fill_mqtt(&mut cfg, &key, &value) { continue; }; - if self.rabbitmq && self.fill_rabbitmq(&mut cfg, &key, &value) { + if self.fill_rabbitmq(&mut cfg, &key, &value) { continue; }; - if self.kafka && self.fill_kafka(&mut cfg, &key, &value) { + if self.fill_kafka(&mut cfg, &key, &value) { continue; }; - if self.trace && self.fill_trace(&mut cfg, &key, &value) { + if self.fill_trace(&mut cfg, &key, &value) { continue; } - if self.metric && self.fill_metric(&mut cfg, &key, &value) { + if self.fill_metric(&mut cfg, &key, &value) { continue; } - if self.postgres && self.fill_postgres(&mut cfg, &key, &value) { + if self.fill_postgres(&mut cfg, &key, &value) { continue; }; - if self.dynamo && self.fill_dynamo(&mut cfg, &key, &value) { + if self.fill_dynamo(&mut cfg, &key, &value) { continue; }; - if self.aws && self.fill_aws(&mut cfg, &key, &value) { + if self.fill_aws(&mut cfg, &key, &value) { continue; }; - if self.health && self.fill_health_readiness(&mut cfg, &key, &value) { + if self.fill_health_readiness(&mut cfg, &key, &value) { continue; }; - if self.sqlite && self.fill_sqlite(&mut cfg, &key, &value) { + if self.fill_sqlite(&mut cfg, &key, &value) { continue; }; } @@ -181,10 +184,13 @@ impl ConfigBuilder { } impl ConfigBuilder { - async fn get_secret_client(&mut self, app_cfg: &AppConfigs) -> Result<(), ConfigsError> { + async fn get_secret_client( + &self, + app_cfg: &AppConfigs, + ) -> Result>, ConfigsError> { match app_cfg.secret_manager { SecretsManagerKind::None => { - return Ok(()); + return Ok(Some(Arc::new(FakeSecretClient::new()))); } SecretsManagerKind::AWSSecretManager => { @@ -194,10 +200,7 @@ impl ConfigBuilder { .build() .await { - Ok(c) => { - self.client = Arc::new(c); - Ok(()) - } + Ok(c) => Ok(Some(Arc::new(c))), Err(err) => { error!(error = err.to_string(), "error to create aws secret client"); Err(ConfigsError::SecretLoadingError(err.to_string())) @@ -222,7 +225,7 @@ impl ConfigBuilder { .parse() .unwrap_or_default(); let log_level = env::var(LOG_LEVEL_ENV_KEY).unwrap_or("debug".into()); - let secret_manager = env::var(SECRET_MANAGER_ENV_KEY).unwrap_or("NONE".into()); + let secret_manager = env::var(SECRET_MANAGER_ENV_KEY).unwrap_or("None".into()); cfg.app = AppConfigs { enable_external_creates_logging: false, @@ -246,37 +249,37 @@ impl ConfigBuilder { T: DynamicConfigs, { match key.into().as_str() { - ENABLE_METRICS_ENV_KEY => { + ENABLE_METRICS_ENV_KEY if self.metric => { cfg.metric.enable = self.get_from_secret(value.into(), false); true } - METRIC_EXPORTER_ENV_KEY => { + METRIC_EXPORTER_ENV_KEY if self.metric => { cfg.metric.exporter = self.get_from_secret(value.into(), MetricExporterKind::Stdout); true } - METRIC_HOST_ENV_KEY => { + METRIC_HOST_ENV_KEY if self.metric => { cfg.metric.host = self.get_from_secret(value.into(), "localhost".into()); true } - METRIC_HEADER_ACCESS_KEY_ENV_KEY => { + METRIC_HEADER_ACCESS_KEY_ENV_KEY if self.metric => { cfg.metric.header_access_key = self.get_from_secret(value.into(), "api-key".into()); true } - METRIC_ACCESS_KEY_ENV_KEY => { + METRIC_ACCESS_KEY_ENV_KEY if self.metric => { cfg.metric.access_key = self.get_from_secret(value.into(), "key".into()); true } - METRIC_SERVICE_TYPE_ENV_KEY => { + METRIC_SERVICE_TYPE_ENV_KEY if self.metric => { cfg.metric.service_type = self.get_from_secret(value.into(), "service".into()); true } - METRIC_EXPORT_TIMEOUT_ENV_KEY => { + METRIC_EXPORT_TIMEOUT_ENV_KEY if self.metric => { let k: String = value.into(); cfg.metric.export_timeout = self.get_from_secret(k.clone(), 30); true } - METRIC_EXPORT_RATE_BASE_ENV_KEY => { + METRIC_EXPORT_RATE_BASE_ENV_KEY if self.metric => { cfg.metric.export_rate_base = self.get_from_secret(value.into(), 0.8); true } @@ -294,36 +297,36 @@ impl ConfigBuilder { T: DynamicConfigs, { match key.into().as_str() { - ENABLE_TRACES_ENV_KEY => { + ENABLE_TRACES_ENV_KEY if self.trace => { cfg.trace.enable = self.get_from_secret(value.into(), false); true } - TRACE_EXPORTER_ENV_KEY => { + TRACE_EXPORTER_ENV_KEY if self.trace => { cfg.trace.exporter = self.get_from_secret(value.into(), TraceExporterKind::Stdout); true } - TRACE_HOST_ENV_KEY => { + TRACE_HOST_ENV_KEY if self.trace => { cfg.trace.host = self.get_from_secret(value.into(), "localhost".into()); true } - TRACE_HEADER_ACCESS_KEY_ENV_KEY => { + TRACE_HEADER_ACCESS_KEY_ENV_KEY if self.trace => { cfg.trace.header_access_key = self.get_from_secret(value.into(), "api-key".into()); true } - TRACE_ACCESS_KEY_ENV_KEY => { + TRACE_ACCESS_KEY_ENV_KEY if self.trace => { cfg.trace.access_key = self.get_from_secret(value.into(), "key".into()); true } - TRACE_SERVICE_TYPE_ENV_KEY => { + TRACE_SERVICE_TYPE_ENV_KEY if self.trace => { cfg.trace.service_type = self.get_from_secret(value.into(), "service".into()); true } - TRACE_EXPORT_TIMEOUT_ENV_KEY => { + TRACE_EXPORT_TIMEOUT_ENV_KEY if self.trace => { let k: String = value.into(); cfg.trace.export_timeout = self.get_from_secret(k.clone(), 30); true } - TRACE_EXPORT_RATE_BASE_ENV_KEY => { + TRACE_EXPORT_RATE_BASE_ENV_KEY if self.trace => { cfg.trace.export_rate_base = self.get_from_secret(value.into(), 0.8); true } @@ -331,7 +334,7 @@ impl ConfigBuilder { } } - fn fill_identity( + fn fill_identity_server( &self, cfg: &mut Configs, key: impl Into, @@ -341,29 +344,33 @@ impl ConfigBuilder { T: DynamicConfigs, { match key.into().as_str() { - AUTH0_DOMAIN_ENV_KEY => { - cfg.auth0.domain = self.get_from_secret(value.into(), "localhost".into()); + IDENTITY_SERVER_URL_ENV_KEY if self.identity => { + cfg.identity.url = self.get_from_secret(value.into(), "http://localhost".into()); + true + } + IDENTITY_SERVER_REALM_ENV_KEY if self.identity => { + cfg.identity.realm = self.get_from_secret(value.into(), "localhost".into()); true } - AUTH0_AUDIENCE_ENV_KEY => { - cfg.auth0.audience = self.get_from_secret(value.into(), "localhost".into()); + IDENTITY_SERVER_AUDIENCE_ENV_KEY if self.identity => { + cfg.identity.audience = self.get_from_secret(value.into(), "audience".into()); true } - AUTH0_ISSUER_ENV_KEY => { - cfg.auth0.issuer = self.get_from_secret(value.into(), "localhost".into()); + IDENTITY_SERVER_ISSUER_ENV_KEY if self.identity => { + cfg.identity.issuer = self.get_from_secret(value.into(), "issuer".into()); true } - AUTH0_GRANT_TYPE_ENV_KEY => { - cfg.auth0.grant_type = + IDENTITY_SERVER_GRANT_TYPE_ENV_KEY if self.identity => { + cfg.identity.grant_type = self.get_from_secret(value.into(), "client_credentials".into()); true } - AUTH0_CLIENT_ID_ENV_KEY => { - cfg.auth0.client_id = self.get_from_secret(value.into(), "".into()); + IDENTITY_SERVER_CLIENT_ID_ENV_KEY if self.identity => { + cfg.identity.client_id = self.get_from_secret(value.into(), "".into()); true } - AUTH0_CLIENT_SECRET_ENV_KEY => { - cfg.auth0.client_secret = self.get_from_secret(value.into(), "".into()); + IDENTITY_SERVER_CLIENT_SECRET_ENV_KEY if self.identity => { + cfg.identity.client_secret = self.get_from_secret(value.into(), "".into()); true } _ => false, @@ -380,33 +387,33 @@ impl ConfigBuilder { T: DynamicConfigs, { match key.into().as_str() { - MQTT_BROKER_KIND_ENV_KEY => { + MQTT_BROKER_KIND_ENV_KEY if self.mqtt => { let kind = self.get_from_secret::(value.into(), "SELF_HOSTED".into()); cfg.mqtt.broker_kind = MQTTBrokerKind::from(&kind); true } - MQTT_HOST_ENV_KEY => { + MQTT_HOST_ENV_KEY if self.mqtt => { cfg.mqtt.host = self.get_from_secret(value.into(), "localhost".into()); true } - MQTT_TRANSPORT_ENV_KEY => { + MQTT_TRANSPORT_ENV_KEY if self.mqtt => { let transport = self.get_from_secret::(value.into(), "tcp".into()); cfg.mqtt.transport = MQTTTransport::from(&transport); true } - MQTT_PORT_ENV_KEY => { + MQTT_PORT_ENV_KEY if self.mqtt => { cfg.mqtt.port = self.get_from_secret(value.into(), 1883); true } - MQTT_USER_ENV_KEY => { + MQTT_USER_ENV_KEY if self.mqtt => { cfg.mqtt.user = self.get_from_secret(value.into(), "mqtt".into()); true } - MQTT_PASSWORD_ENV_KEY => { + MQTT_PASSWORD_ENV_KEY if self.mqtt => { cfg.mqtt.password = self.get_from_secret(value.into(), "password".into()); true } - MQTT_CA_CERT_PATH_ENV_KEY => { + MQTT_CA_CERT_PATH_ENV_KEY if self.mqtt => { cfg.mqtt.root_ca_path = self.get_from_secret(value.into(), "".into()); true } @@ -424,23 +431,23 @@ impl ConfigBuilder { T: DynamicConfigs, { match key.into().as_str() { - RABBITMQ_HOST_ENV_KEY => { + RABBITMQ_HOST_ENV_KEY if self.rabbitmq => { cfg.rabbitmq.host = self.get_from_secret(value.into(), "localhost".into()); true } - RABBITMQ_PORT_ENV_KEY => { + RABBITMQ_PORT_ENV_KEY if self.rabbitmq => { cfg.rabbitmq.port = self.get_from_secret(value.into(), 5672); true } - RABBITMQ_USER_ENV_KEY => { + RABBITMQ_USER_ENV_KEY if self.rabbitmq => { cfg.rabbitmq.user = self.get_from_secret(value.into(), "guest".into()); true } - RABBITMQ_PASSWORD_ENV_KEY => { + RABBITMQ_PASSWORD_ENV_KEY if self.rabbitmq => { cfg.rabbitmq.password = self.get_from_secret(value.into(), "guest".into()); true } - RABBITMQ_VHOST_ENV_KEY => { + RABBITMQ_VHOST_ENV_KEY if self.rabbitmq => { cfg.rabbitmq.vhost = self.get_from_secret(value.into(), "".into()); true } @@ -458,31 +465,31 @@ impl ConfigBuilder { T: DynamicConfigs, { match key.into().as_str() { - KAFKA_HOST_ENV_KEY => { + KAFKA_HOST_ENV_KEY if self.kafka => { cfg.kafka.host = self.get_from_secret(value.into(), "localhost".into()); true } - KAFKA_PORT_ENV_KEY => { + KAFKA_PORT_ENV_KEY if self.kafka => { cfg.kafka.port = self.get_from_secret(value.into(), 9094); true } - KAFKA_TIMEOUT_ENV_KEY => { + KAFKA_TIMEOUT_ENV_KEY if self.kafka => { cfg.kafka.timeout = self.get_from_secret(value.into(), 6000); true } - KAFKA_SECURITY_PROTOCOL_ENV_KEY => { + KAFKA_SECURITY_PROTOCOL_ENV_KEY if self.kafka => { cfg.kafka.security_protocol = self.get_from_secret(value.into(), "SASL_SSL".into()); true } - KAFKA_SASL_MECHANISMS_ENV_KEY => { + KAFKA_SASL_MECHANISMS_ENV_KEY if self.kafka => { cfg.kafka.sasl_mechanisms = self.get_from_secret(value.into(), "PLAIN".into()); true } - KAFKA_USER_ENV_KEY => { + KAFKA_USER_ENV_KEY if self.kafka => { cfg.kafka.user = self.get_from_secret(value.into(), "user".into()); true } - KAFKA_PASSWORD_ENV_KEY => { + KAFKA_PASSWORD_ENV_KEY if self.kafka => { cfg.kafka.password = self.get_from_secret(value.into(), "password".into()); true } @@ -500,23 +507,23 @@ impl ConfigBuilder { T: DynamicConfigs, { match key.into().as_str() { - POSTGRES_HOST_ENV_KEY => { + POSTGRES_HOST_ENV_KEY if self.postgres => { cfg.postgres.host = self.get_from_secret(value.into(), "localhost".into()); true } - POSTGRES_USER_ENV_KEY => { + POSTGRES_USER_ENV_KEY if self.postgres => { cfg.postgres.user = self.get_from_secret(value.into(), "postgres".into()); true } - POSTGRES_PASSWORD_ENV_KEY => { + POSTGRES_PASSWORD_ENV_KEY if self.postgres => { cfg.postgres.password = self.get_from_secret(value.into(), "postgres".into()); true } - POSTGRES_PORT_ENV_KEY => { + POSTGRES_PORT_ENV_KEY if self.postgres => { cfg.postgres.port = self.get_from_secret(value.into(), 5432); true } - POSTGRES_DB_ENV_KEY => { + POSTGRES_DB_ENV_KEY if self.postgres => { cfg.postgres.db = self.get_from_secret(value.into(), "hdr".into()); true } @@ -534,19 +541,19 @@ impl ConfigBuilder { T: DynamicConfigs, { match key.into().as_str() { - DYNAMO_ENDPOINT_ENV_KEY => { + DYNAMO_ENDPOINT_ENV_KEY if self.dynamo => { cfg.dynamo.endpoint = self.get_from_secret(value.into(), "localhost".into()); true } - DYNAMO_TABLE_ENV_KEY => { + DYNAMO_TABLE_ENV_KEY if self.dynamo => { cfg.dynamo.table = self.get_from_secret(value.into(), "table".into()); true } - DYNAMO_REGION_ENV_KEY => { + DYNAMO_REGION_ENV_KEY if self.dynamo => { cfg.dynamo.region = self.get_from_secret(value.into(), AWS_DEFAULT_REGION.into()); true } - DYNAMO_EXPIRE_ENV_KEY => { + DYNAMO_EXPIRE_ENV_KEY if self.dynamo => { cfg.dynamo.expire = self.get_from_secret(value.into(), 31536000); true } @@ -564,11 +571,11 @@ impl ConfigBuilder { T: DynamicConfigs, { match key.into().as_str() { - AWS_IAM_ACCESS_KEY_ID => { + AWS_IAM_ACCESS_KEY_ID if self.aws => { cfg.aws.access_key_id = Some(self.get_from_secret(value.into(), "key".into())); true } - AWS_IAM_SECRET_ACCESS_KEY => { + AWS_IAM_SECRET_ACCESS_KEY if self.aws => { cfg.aws.secret_access_key = Some(self.get_from_secret(value.into(), "secret".into())); true @@ -587,11 +594,11 @@ impl ConfigBuilder { T: DynamicConfigs, { match key.into().as_str() { - HEALTH_READINESS_PORT_ENV_KEY => { + HEALTH_READINESS_PORT_ENV_KEY if self.health => { cfg.health_readiness.port = self.get_from_secret(value.into(), 8888); true } - ENABLE_HEALTH_READINESS_ENV_KEY => { + ENABLE_HEALTH_READINESS_ENV_KEY if self.health => { cfg.health_readiness.enable = self.get_from_secret(value.into(), false); true } @@ -609,15 +616,15 @@ impl ConfigBuilder { T: DynamicConfigs, { match key.into().as_str() { - SQLITE_FILE_NAME_ENV_KEY => { + SQLITE_FILE_NAME_ENV_KEY if self.sqlite => { cfg.sqlite.file = self.get_from_secret(value.into(), "local.db".into()); true } - "SQLITE_USER" => { + "SQLITE_USER" if self.sqlite => { cfg.sqlite.user = self.get_from_secret(value.into(), "user".into()); true } - "SQLITE_PASSWORD" => { + "SQLITE_PASSWORD" if self.sqlite => { cfg.sqlite.password = self.get_from_secret(value.into(), "password".into()); true } @@ -627,21 +634,21 @@ impl ConfigBuilder { } impl ConfigBuilder { - fn get_from_secret(&self, value: String, default: T) -> T + fn get_from_secret(&self, key: String, default: T) -> T where T: FromStr, { - if !value.starts_with(SECRET_PREFIX) { - return value.parse().unwrap_or(default); + if !key.starts_with(SECRET_PREFIX) { + return key.parse().unwrap_or(default); } - let Ok(secret) = self.client.clone().get_by_key(&value) else { - error!(secret_key = value, "secret key was not found"); + let Ok(v) = self.client.clone().unwrap().get_by_key(&key) else { + error!(key = key, "secret key was not found"); return default; }; - secret.parse().unwrap_or_else(|_| { - error!(secret_key = value, secret = secret, "parse went wrong"); + v.parse().unwrap_or_else(|_| { + error!(key = key, value = v, "parse went wrong"); return default; }) } diff --git a/configs_builder/src/env_keys.rs b/configs_builder/src/env_keys.rs index d98fa03..51ed466 100644 --- a/configs_builder/src/env_keys.rs +++ b/configs_builder/src/env_keys.rs @@ -1,3 +1,8 @@ +pub const LOCAL_ENV_FILE_NAME: &str = "./.env.local"; +pub const DEV_ENV_FILE_NAME: &str = "./.env.develop"; +pub const STAGING_FILE_NAME: &str = "./.env.staging"; +pub const PROD_FILE_NAME: &str = "./.env.prod"; + pub const SECRET_PREFIX: &str = "!"; pub const SECRET_PREFIX_TO_DECODE: &str = "!!"; @@ -10,12 +15,13 @@ pub const HOST_NAME_ENV_KEY: &str = "HOST_NAME"; pub const APP_PORT_ENV_KEY: &str = "APP_PORT"; pub const LOG_LEVEL_ENV_KEY: &str = "LOG_LEVEL"; -pub const AUTH0_DOMAIN_ENV_KEY: &str = "AUTH0_DOMAIN"; -pub const AUTH0_AUDIENCE_ENV_KEY: &str = "AUTH0_AUDIENCE"; -pub const AUTH0_ISSUER_ENV_KEY: &str = "AUTH0_ISSUER"; -pub const AUTH0_GRANT_TYPE_ENV_KEY: &str = "AUTH0_GRANT_TYPE"; -pub const AUTH0_CLIENT_ID_ENV_KEY: &str = "AUTH0_CLIENT_ID"; -pub const AUTH0_CLIENT_SECRET_ENV_KEY: &str = "AUTH0_CLIENT_SECRET"; +pub const IDENTITY_SERVER_URL_ENV_KEY: &str = "IDENTITY_SERVER_URL"; +pub const IDENTITY_SERVER_REALM_ENV_KEY: &str = "IDENTITY_SERVER_REALM"; +pub const IDENTITY_SERVER_AUDIENCE_ENV_KEY: &str = "IDENTITY_SERVER_AUDIENCE"; +pub const IDENTITY_SERVER_ISSUER_ENV_KEY: &str = "IDENTITY_SERVER_ISSUER"; +pub const IDENTITY_SERVER_GRANT_TYPE_ENV_KEY: &str = "IDENTITY_SERVER_GRANT_TYPE"; +pub const IDENTITY_SERVER_CLIENT_ID_ENV_KEY: &str = "IDENTITY_SERVER_CLIENT_ID"; +pub const IDENTITY_SERVER_CLIENT_SECRET_ENV_KEY: &str = "IDENTITY_SERVER_CLIENT_SECRET"; pub const MQTT_BROKER_KIND_ENV_KEY: &str = "MQTT_BROKER_KIND"; pub const MQTT_HOST_ENV_KEY: &str = "MQTT_HOST"; diff --git a/tiny_server/Cargo.toml b/health_http_server/Cargo.toml similarity index 67% rename from tiny_server/Cargo.toml rename to health_http_server/Cargo.toml index 1fec540..f681d6f 100644 --- a/tiny_server/Cargo.toml +++ b/health_http_server/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tiny-server" +name = "health-http-server" version = "0.1.0" edition = "2021" @@ -11,10 +11,10 @@ configs = { path = '../configs' } http-components = { path = '../http_components', features = ["metrics", "health"]} health-readiness = { path = '../health_readiness' } -thiserror = { version = "1.0.56" } -actix-web = { version = "4.4.1" } -tracing = { version = "0.1.40" } -opentelemetry = { version = "0.21.0" } +thiserror = { workspace = true } +tracing = { workspace = true } +opentelemetry = { workspace = true } +actix-web = { version = "4.5.1" } prometheus = { version = "0.13.3", optional = true } diff --git a/tiny_server/README.md b/health_http_server/README.md similarity index 100% rename from tiny_server/README.md rename to health_http_server/README.md diff --git a/tiny_server/src/errors/mod.rs b/health_http_server/src/errors/mod.rs similarity index 100% rename from tiny_server/src/errors/mod.rs rename to health_http_server/src/errors/mod.rs diff --git a/tiny_server/src/errors/server.rs b/health_http_server/src/errors/server.rs similarity index 100% rename from tiny_server/src/errors/server.rs rename to health_http_server/src/errors/server.rs diff --git a/tiny_server/src/lib.rs b/health_http_server/src/lib.rs similarity index 100% rename from tiny_server/src/lib.rs rename to health_http_server/src/lib.rs diff --git a/tiny_server/src/server/mod.rs b/health_http_server/src/server/mod.rs similarity index 100% rename from tiny_server/src/server/mod.rs rename to health_http_server/src/server/mod.rs diff --git a/tiny_server/src/server/server.rs b/health_http_server/src/server/server.rs similarity index 95% rename from tiny_server/src/server/server.rs rename to health_http_server/src/server/server.rs index 851e1fb..c39287e 100644 --- a/tiny_server/src/server/server.rs +++ b/health_http_server/src/server/server.rs @@ -14,10 +14,11 @@ use opentelemetry::global; #[cfg(feature = "prometheus")] use prometheus::Registry; use std::{sync::Arc, time::Duration}; -use tracing::error; +use tracing::{error, info}; pub struct TinyHTTPServer { addr: String, + enabled: bool, services: Vec>, health_check: Option>, #[cfg(feature = "prometheus")] @@ -31,6 +32,7 @@ impl TinyHTTPServer { { TinyHTTPServer { addr: cfg.health_readiness.health_readiness_addr(), + enabled: cfg.health_readiness.enable, services: vec![], health_check: None, #[cfg(feature = "prometheus")] @@ -57,6 +59,11 @@ impl TinyHTTPServer { } pub async fn start(&self) -> Result<(), HTTPServerError> { + if !self.enabled { + info!("skipping health http server!"); + return Ok(()); + } + match ActixHttpServer::new({ let health_check_service = match self.health_check.clone() { Some(check) => check, diff --git a/health_readiness/Cargo.toml b/health_readiness/Cargo.toml index da153c0..75e272c 100644 --- a/health_readiness/Cargo.toml +++ b/health_readiness/Cargo.toml @@ -9,16 +9,16 @@ rabbitmq = ["dep:lapin"] postgres = ["dep:deadpool-postgres"] [dependencies] -async-trait = { version = "0.1.77" } -tracing = { version = "0.1.40" } -thiserror = { version = "1.0.56" } +async-trait = { workspace = true } +tracing = { workspace = true } +thiserror = { workspace = true } # mqtt -paho-mqtt = { version = "0.12.1", optional = true } +paho-mqtt = { version = "0.12.3", optional = true } # rabbitmq -lapin = { version = "2.3.1", optional = true } +lapin = { version = "2.3.3", optional = true } # postgres -deadpool-postgres = { version = "0.12.1", optional = true } +deadpool-postgres = { version = "0.13.0", optional = true } diff --git a/http_components/Cargo.toml b/http_components/Cargo.toml index 29176bb..541065f 100644 --- a/http_components/Cargo.toml +++ b/http_components/Cargo.toml @@ -12,20 +12,24 @@ validator = ["dep:validator"] health = ["dep:health-readiness"] [dependencies] -actix-web = { version = "4.4.1" } -actix-http = { version = "3.5.1" } +actix-web = { version = "4.5.1" } +actix-http = { version = "3.6.0" } actix-cors = { version = "0.7.0" } -serde = { version = "1.0.196", features = ["derive"] } -serde_json = { version = "1.0.94" } -tracing = { version = "0.1.40" } futures-util = { version = "0.3.30" } -opentelemetry = { version = "0.21.0" } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } +tracing = { workspace = true } +opentelemetry = { workspace = true } +async-trait = { workspace = true } + +actix-service = "2.0.2" +futures = "0.3.30" # openapi utoipa = { version = "4.2.0", optional = true } # validator -validator = { version = "0.16.1", features = ["derive"], optional = true } +validator = { version = "0.18.1", features = ["derive"], optional = true } # auth auth = { path = "../auth", optional = true } @@ -34,8 +38,8 @@ auth = { path = "../auth", optional = true } otel = { path = "../otel", optional = true } # metrics -opentelemetry-semantic-conventions = { version = "0.13.0", optional = true } -opentelemetry-prometheus = { version = "0.14.1", optional = true } +opentelemetry-semantic-conventions = { version = "0.14", optional = true } +opentelemetry-prometheus = { version = "0.15", optional = true } prometheus = { version = "0.13.3", optional = true } # health diff --git a/http_components/src/extra/mod.rs b/http_components/src/extra/mod.rs new file mode 100644 index 0000000..95bccd5 --- /dev/null +++ b/http_components/src/extra/mod.rs @@ -0,0 +1,2 @@ +#[cfg(feature = "validator")] +pub mod validate; diff --git a/http_components/src/validate/validate.rs b/http_components/src/extra/validate.rs similarity index 65% rename from http_components/src/validate/validate.rs rename to http_components/src/extra/validate.rs index 176456e..0eaf487 100644 --- a/http_components/src/validate/validate.rs +++ b/http_components/src/extra/validate.rs @@ -71,3 +71,57 @@ fn _flatten_errors( }) .collect::>() } + +#[cfg(test)] +mod tests { + use super::*; + use actix_http::StatusCode; + use serde_json::{json, Value}; + use validator::Validate; + + #[derive(Validate)] + struct TestStruct { + #[validate(length(min = 1))] + name: String, + #[validate(range(min = 18, max = 120))] + age: u8, + } + + #[test] + fn test_body_validator_ok() { + let ctx = Context::new(); + + let body = TestStruct { + name: "John Doe".to_owned(), + age: 25, + }; + + let result = body_validator(&ctx, &body); + + assert!(result.is_ok()); + } + + #[test] + fn test_body_validator_err() { + let ctx = Context::new(); + + let body = TestStruct { + name: "".to_owned(), + age: 150, + }; + + let result = body_validator(&ctx, &body); + + assert!(result.is_err()); + + let error = result.unwrap_err(); + assert_eq!(error.status_code, StatusCode::BAD_REQUEST.as_u16()); + assert_eq!(error.message, "unformatted body"); + + let details = error.details; + assert!(details.is_object()); + + let details_map = details.as_object().unwrap(); + assert_eq!(details_map.len(), 2); + } +} diff --git a/http_components/src/extractors/jwt.rs b/http_components/src/extractors/jwt.rs index 5161a53..62df276 100644 --- a/http_components/src/extractors/jwt.rs +++ b/http_components/src/extractors/jwt.rs @@ -1,10 +1,10 @@ use crate::middlewares::otel::HTTPExtractor; use crate::viewmodels::HTTPError; -use actix_web::error::{ErrorInternalServerError, ErrorUnauthorized}; +use actix_web::error::ErrorUnauthorized; use actix_web::web::Data; use actix_web::{dev::Payload, Error as ActixWebError}; use actix_web::{http, FromRequest, HttpRequest}; -use auth::jwt_manager::{JwtManager, TokenClaims}; +use auth::{manager::JwtManager, types::TokenClaims}; use opentelemetry::global; use std::future::Future; use std::pin::Pin; @@ -23,35 +23,49 @@ impl FromRequest for JwtAuthenticateExtractor { propagator.extract(&HTTPExtractor::new(req.headers())) }); - let token = req - .headers() - .get(http::header::AUTHORIZATION) - .map(|h| h.to_str().unwrap().split_at(7).1.to_string()); - - let Some(token) = token else { - return Box::pin(async move { - return Err(ErrorUnauthorized( - HTTPError::unauthorized("unauthorized", "you are not logged in, please provide token")), - ); - }); + let token = match req.headers().get(http::header::AUTHORIZATION) { + Some(header_value) => match header_value.to_str() { + Ok(value) => match value.strip_prefix("Bearer ") { + Some(t) => t.to_owned(), + None => { + return unauthorized_pined("you are not logged in, please provide a token"); + } + }, + Err(_) => { + return unauthorized_pined("you are not logged in, please provide a token"); + } + }, + None => { + return unauthorized_pined("you are not logged in, please provide a token"); + } }; - let Some(jwt_manager) = req.app_data::>>() else { - return Box::pin(async move { - return Err(ErrorInternalServerError( - HTTPError::internal_server_error("jwt manager internal error", "no jwt manager was provided")), - ); - }); + let jwt_manager = match req.app_data::>>() { + Some(jm) => jm.clone(), + None => return unauthorized_pined("no jwt manager was provided"), }; - let jwt_manager = jwt_manager.clone(); - Box::pin(async move { let Ok(claims) = jwt_manager.verify(&ctx, &token).await else { - return Err(ErrorUnauthorized(HTTPError::unauthorized("unauthorized", "invalid token"))); + return unauthorized("invalid token"); }; Ok(JwtAuthenticateExtractor { claims }) }) } } + +fn unauthorized(details: &str) -> Result { + Err(ErrorUnauthorized(HTTPError::unauthorized( + "unauthorized", + details, + ))) +} + +fn unauthorized_pined( + details: &'static str, +) -> Pin>>> { + Box::pin(async move { + return unauthorized(details); + }) +} diff --git a/http_components/src/handlers/health.rs b/http_components/src/handlers/health.rs index e8f1ee4..518a4f4 100644 --- a/http_components/src/handlers/health.rs +++ b/http_components/src/handlers/health.rs @@ -1,11 +1,10 @@ use crate::viewmodels::HTTPError; use actix_web::{error::HttpError, get, web, HttpResponse}; use health_readiness::HealthReadinessService; -use std::sync::Arc; #[get("/health")] pub async fn health_handler( - service: web::Data>, + service: web::Data, ) -> Result { match service.validate().await { Ok(_) => Ok(HttpResponse::Ok().finish()), diff --git a/http_components/src/lib.rs b/http_components/src/lib.rs index 77ea32f..3456471 100644 --- a/http_components/src/lib.rs +++ b/http_components/src/lib.rs @@ -1,10 +1,10 @@ use actix_web::web::ServiceConfig; use std::sync::Mutex; +pub mod extra; pub mod extractors; pub mod handlers; pub mod middlewares; -pub mod validate; pub mod viewmodels; pub struct CustomServiceConfigure { diff --git a/http_components/src/middlewares/authentication.rs b/http_components/src/middlewares/authentication.rs new file mode 100644 index 0000000..3f669fd --- /dev/null +++ b/http_components/src/middlewares/authentication.rs @@ -0,0 +1,114 @@ +use super::otel::HTTPExtractor; +use crate::viewmodels::HTTPError; +use actix_service::{Service, Transform}; +use actix_web::web::Data; +use actix_web::{dev::ServiceRequest, dev::ServiceResponse, Error}; +use actix_web::{http, HttpMessage}; +use auth::manager::JwtManager; +use futures::future::{ok, Ready}; +use futures::Future; +use opentelemetry::global; +use std::pin::Pin; +use std::rc::Rc; +use std::task::{Context, Poll}; + +#[derive(Clone, Default)] +pub struct AuthenticationMiddleware; + +impl Transform for AuthenticationMiddleware +where + S: Service, Error = Error> + 'static, + S::Future: 'static, + B: 'static, +{ + type Response = ServiceResponse; + type Error = Error; + type Transform = AuthenticationMiddlewareService; + type InitError = (); + type Future = Ready>; + + fn new_transform(&self, service: S) -> Self::Future { + ok(AuthenticationMiddlewareService { + service: Rc::new(service), + }) + } +} + +pub struct AuthenticationMiddlewareService { + service: Rc, +} + +impl Service for AuthenticationMiddlewareService +where + S: Service, Error = Error> + 'static, + S::Future: 'static, + B: 'static, +{ + type Response = ServiceResponse; + type Error = Error; + type Future = Pin>>>; + + fn poll_ready(&self, ctx: &mut Context<'_>) -> Poll> { + self.service.poll_ready(ctx) + } + + fn call(&self, req: ServiceRequest) -> Self::Future { + let ctx = global::get_text_map_propagator(|propagator| { + propagator.extract(&HTTPExtractor::new(req.headers())) + }); + + let Some(jwt_manager) = req.app_data::>() else { + return Box::pin(async move { + return Err(actix_web::error::ErrorInternalServerError( + HTTPError::internal_server_error( + "bad middleware configuration", + "missing middleware manager", + ), + )); + }); + }; + + let service = Rc::clone(&self.service); + let manager = jwt_manager.clone(); + + let token = match req.headers().get(http::header::AUTHORIZATION) { + Some(header_value) => match header_value.to_str() { + Ok(value) => match value.strip_prefix("Bearer ") { + Some(t) => t.to_owned(), + None => { + return unauthorized_pined("you are not logged in, please provide a token"); + } + }, + Err(_) => { + return unauthorized_pined("you are not logged in, please provide a token"); + } + }, + None => { + return unauthorized_pined("you are not logged in, please provide a token"); + } + }; + + Box::pin(async move { + let Ok(claims) = manager.verify(&ctx, &token).await else { + return Err(actix_web::error::ErrorUnauthorized( + HTTPError::unauthorized("unauthorized", "unauthorized"), + )); + }; + + req.extensions_mut().insert(claims); + + let res = service.call(req).await?; + Ok(res) + }) + } +} + +fn unauthorized_pined( + details: &'static str, +) -> Pin, actix_web::error::Error>>>> { + Box::pin(async move { + return Err(actix_web::error::ErrorUnauthorized( + HTTPError::unauthorized("unauthorized", details), + )); + }) +} diff --git a/http_components/src/middlewares/mod.rs b/http_components/src/middlewares/mod.rs index c2c1c39..8dab48b 100644 --- a/http_components/src/middlewares/mod.rs +++ b/http_components/src/middlewares/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "auth")] +pub mod authentication; pub mod cors; pub mod deserializer; pub mod headers; diff --git a/http_components/src/middlewares/otel/attributes.rs b/http_components/src/middlewares/otel/attributes.rs index a9eb0a6..a18c9b8 100644 --- a/http_components/src/middlewares/otel/attributes.rs +++ b/http_components/src/middlewares/otel/attributes.rs @@ -58,23 +58,23 @@ pub(super) fn trace_attributes_from_request( let mut attributes = Vec::with_capacity(11); attributes.push(KeyValue::new::( - HTTP_REQUEST_METHOD, + HTTP_REQUEST_METHOD.into(), http_method_str(req.method()), )); attributes.push(KeyValue::new::( - NETWORK_PROTOCOL_VERSION, + NETWORK_PROTOCOL_VERSION.into(), http_flavor(req.version()), )); attributes.push(KeyValue::new::( - HOST_NAME, + HOST_NAME.into(), conn_info.host().to_string().into(), )); attributes.push(KeyValue::new::( - HTTP_ROUTE, + HTTP_ROUTE.into(), http_route.to_owned().into(), )); attributes.push(KeyValue::new::( - URL_SCHEME, + URL_SCHEME.into(), http_scheme(conn_info.scheme()), )); @@ -92,12 +92,12 @@ pub(super) fn trace_attributes_from_request( .and_then(|port| port.parse::().ok()) { if port != 80 && port != 443 { - attributes.push(KeyValue::new::(SERVER_PORT, port.into())); + attributes.push(KeyValue::new::(SERVER_PORT.into(), port.into())); } } if let Some(path) = req.uri().path_and_query() { attributes.push(KeyValue::new::( - URL_PATH, + URL_PATH.into(), path.as_str().to_string().into(), )); } @@ -107,14 +107,14 @@ pub(super) fn trace_attributes_from_request( .and_then(|s| s.to_str().ok()) { attributes.push(KeyValue::new::( - USER_AGENT_ORIGINAL, + USER_AGENT_ORIGINAL.into(), user_agent.to_string().into(), )); } let remote_addr = conn_info.realip_remote_addr(); if let Some(remote) = remote_addr { attributes.push(KeyValue::new::( - CLIENT_ADDRESS, + CLIENT_ADDRESS.into(), remote.to_string().into(), )); } @@ -133,6 +133,7 @@ pub(super) fn metrics_attributes_from_request( http_target: &str, ) -> Vec { let conn_info = req.connection_info(); + let host = conn_info.host().to_owned(); let mut attributes = Vec::with_capacity(11); attributes.push(KeyValue::new::( @@ -143,25 +144,30 @@ pub(super) fn metrics_attributes_from_request( NETWORK_PROTOCOL_VERSION.into(), http_flavor(req.version()), )); - attributes.push(HOST_NAME.string(conn_info.host().to_string())); - attributes.push(URL_PATH.string(http_target.to_owned())); + attributes.push(KeyValue::new::( + HOST_NAME.into(), + host.clone().into(), + )); + attributes.push(KeyValue::new::( + URL_PATH.into(), + http_target.to_owned().into(), + )); attributes.push(KeyValue::new::( URL_SCHEME.into(), http_scheme(conn_info.scheme()), )); let server_name = req.app_config().host(); - if server_name != conn_info.host() { + if !server_name.eq(&host) { attributes.push(HTTP_SERVER_NAME.string(server_name.to_string())); } - if let Some(port) = conn_info - .host() - .split_terminator(':') - .nth(1) - .and_then(|port| port.parse().ok()) - { - attributes.push(SERVER_PORT.i64(port)) - } + + if let Some(port) = host.split_terminator(':').nth(1) { + attributes.push(KeyValue::new::( + SERVER_PORT.into(), + port.to_string().into(), + )) + }; let remote_addr = conn_info.realip_remote_addr(); if let Some(peer_addr) = req.peer_addr().map(|socket| socket.ip().to_string()) { diff --git a/http_components/src/middlewares/otel/http_metrics.rs b/http_components/src/middlewares/otel/http_metrics.rs index 61b6c8b..f6f35c5 100644 --- a/http_components/src/middlewares/otel/http_metrics.rs +++ b/http_components/src/middlewares/otel/http_metrics.rs @@ -3,8 +3,8 @@ use super::attributes::metrics_attributes_from_request; use actix_web::dev; use futures_util::future::{self, FutureExt as _, LocalBoxFuture}; -use opentelemetry::global; use opentelemetry::metrics::{Counter, Histogram, Meter, Unit, UpDownCounter}; +use opentelemetry::{global, Key, KeyValue, Value}; use std::{sync::Arc, time::SystemTime}; // Follows the experimental semantic conventions for HTTP metrics: @@ -47,58 +47,6 @@ impl Metrics { } } -/// Request metrics tracking -/// -/// # Examples -/// -/// ```no_run -/// use actix_web::{dev, http, web, App, HttpRequest, HttpServer}; -/// use http_components::{ -/// middlewares::otel::{ -/// HTTPOtelMetrics, -/// }, -/// handlers::PrometheusMetricsHandler -/// }; -/// use opentelemetry::{ -/// global, -/// sdk::{ -/// export::metrics::aggregation, -/// metrics::{controllers, processors, selectors}, -/// propagation::TraceContextPropagator, -/// }, -/// }; -/// -/// # #[cfg(feature = "metrics-prometheus")] -/// #[actix_web::main] -/// async fn main() -> std::io::Result<()> { -/// // Request metrics middleware -/// let meter = global::meter("actix_web"); -/// let request_metrics = RequestMetricsBuilder::new().build(meter); -/// -/// // Prometheus request metrics handler -/// let controller = controllers::basic( -/// processors::factory( -/// selectors::simple::histogram([1.0, 2.0, 5.0, 10.0, 20.0, 50.0]), -/// aggregation::cumulative_temporality_selector(), -/// ) -/// .with_memory(true), -/// ) -/// .build(); -/// let exporter = opentelemetry_prometheus::exporter(controller).init(); -/// let metrics_handler = PrometheusMetricsHandler::new(exporter); -/// -/// // Run actix server, metrics are now available at http://localhost:8080/metrics -/// HttpServer::new(move || { -/// App::new() -/// .wrap(HTTPOtelMetrics::new()) -/// .wrap(request_metrics.clone()) -/// .route("/metrics", web::get().to(metrics_handler.clone())) -/// }) -/// .bind("localhost:8080")? -/// .run() -/// .await -/// } -/// ``` #[derive(Clone, Debug)] pub struct HTTPOtelMetrics { metrics: Arc, @@ -177,9 +125,10 @@ where // Ignore actix errors for metrics match res { Ok(success) => { - attributes.push( - HTTP_RESPONSE_STATUS_CODE.string(success.status().as_str().to_owned()), - ); + attributes.push(KeyValue::new::( + HTTP_RESPONSE_STATUS_CODE.into(), + success.status().as_str().to_owned().into(), + )); metrics.http_server_duration.record( timer @@ -194,10 +143,14 @@ where Ok(success) } Err(err) => { - attributes.push( - HTTP_RESPONSE_STATUS_CODE - .string(err.as_response_error().status_code().as_str().to_owned()), - ); + attributes.push(KeyValue::new::( + HTTP_RESPONSE_STATUS_CODE.into(), + err.as_response_error() + .status_code() + .as_str() + .to_owned() + .into(), + )); metrics.http_requests.add(1, &attributes); diff --git a/http_components/src/validate/mod.rs b/http_components/src/validate/mod.rs deleted file mode 100644 index e85f712..0000000 --- a/http_components/src/validate/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[cfg(feature = "validator")] -mod validate; - -#[cfg(feature = "validator")] -pub use validate::body_validator; diff --git a/http_components/src/viewmodels/mod.rs b/http_components/src/viewmodels/mod.rs index 0af566d..7cba0aa 100644 --- a/http_components/src/viewmodels/mod.rs +++ b/http_components/src/viewmodels/mod.rs @@ -1,3 +1,5 @@ mod error; +mod pagination; pub use error::HTTPError; +pub use pagination::Pagination; diff --git a/http_components/src/viewmodels/pagination.rs b/http_components/src/viewmodels/pagination.rs new file mode 100644 index 0000000..b22270f --- /dev/null +++ b/http_components/src/viewmodels/pagination.rs @@ -0,0 +1,4 @@ +pub struct Pagination { + pub limit: i32, + pub offset: i32, +} diff --git a/http_server/Cargo.toml b/http_server/Cargo.toml index 16cc8ff..22279c0 100644 --- a/http_server/Cargo.toml +++ b/http_server/Cargo.toml @@ -8,17 +8,17 @@ openapi = ["dep:utoipa", "dep:utoipa-swagger-ui"] [dependencies] configs = { path = '../configs' } -http-components = { path = '../http_components', features = ["tracing", "metrics", "validator", "openapi", "auth"] } +http-components = { path = '../http_components', features = ["tracing", "metrics", "openapi", "health"] } health-readiness = { path = '../health_readiness' } auth = { path = "../auth" } -thiserror = { version = "1.0.56" } -actix-web = { version = "4.4.1" } -serde = { version = "1.0.196", features = ["derive"] } -serde_json = { version = "1.0.112" } -tracing = { version = "0.1.40" } -opentelemetry = { version = "0.21.0" } +actix-web = { version = "4.5.1" } +thiserror = { workspace = true } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } +tracing = { workspace = true } +opentelemetry = { workspace = true } # Swagger -utoipa = { version = "4.1.0", features = ["actix_extras"], optional = true } -utoipa-swagger-ui = { version = "5.0.0", features = ["actix-web"], optional = true } +utoipa = { version = "4.2.0", features = ["actix_extras"], optional = true } +utoipa-swagger-ui = { version = "6.0.0", features = ["actix-web"], optional = true } diff --git a/http_server/src/server/server.rs b/http_server/src/server/server.rs index 5c9eeed..9fc0e7d 100644 --- a/http_server/src/server/server.rs +++ b/http_server/src/server/server.rs @@ -1,33 +1,33 @@ use crate::errors::HTTPServerError; use actix_web::{ http::KeepAlive, - middleware as actix_middleware, + middleware::{self as actix_middleware, Logger}, web::{self, Data}, App, HttpServer as ActixHttpServer, }; -use auth::jwt_manager::JwtManager; use configs::AppConfigs; use health_readiness::{HealthReadinessService, HealthReadinessServiceImpl}; use http_components::{ handlers::health_handler, - middlewares, - middlewares::otel::{HTTPOtelMetrics, HTTPOtelTracing}, + middlewares::{ + self, + otel::{HTTPOtelMetrics, HTTPOtelTracing}, + }, CustomServiceConfigure, }; use opentelemetry::global; use std::{sync::Arc, time::Duration}; use tracing::error; -#[cfg(openapi)] +#[cfg(feature = "openapi")] use utoipa::openapi::OpenApi; -#[cfg(openapi)] +#[cfg(feature = "openapi")] use utoipa_swagger_ui::SwaggerUi; pub struct HTTPServer { addr: String, services: Vec>, - #[cfg(openapi)] + #[cfg(feature = "openapi")] openapi: Option, - jwt_manager: Option>, health_check: Option>, } @@ -36,9 +36,8 @@ impl HTTPServer { HTTPServer { addr: cfg.app_addr(), services: vec![], - #[cfg(openapi)] + #[cfg(feature = "openapi")] openapi: None, - jwt_manager: None, health_check: None, } } @@ -50,12 +49,7 @@ impl HTTPServer { self } - pub fn jwt_manager(mut self, manager: Arc) -> Self { - self.jwt_manager = Some(manager); - self - } - - #[cfg(openapi)] + #[cfg(feature = "openapi")] pub fn openapi(mut self, openapi: &OpenApi) -> Self { self.openapi = Some(openapi.to_owned()); self @@ -68,10 +62,9 @@ impl HTTPServer { pub async fn start(&self) -> Result<(), HTTPServerError> { ActixHttpServer::new({ - #[cfg(openapi)] + #[cfg(feature = "openapi")] let openapi = self.openapi.clone(); - let jwt_manager = self.jwt_manager.clone(); let health_check_service = match self.health_check.clone() { Some(check) => check, _ => Arc::new(HealthReadinessServiceImpl::default()), @@ -87,15 +80,10 @@ impl HTTPServer { .wrap(HTTPOtelTracing::new()) .wrap(HTTPOtelMetrics::new()) .app_data(middlewares::deserializer::handler()) - .app_data(Data::>::new( + .app_data(Data::::from( health_check_service.clone(), - )); - - if let Some(jwt_manager) = jwt_manager.clone() { - app = app.app_data::>>( - Data::>::new(jwt_manager.clone()), - ); - } + )) + .service(health_handler); let services = services.clone(); app = app.configure(move |config| { @@ -106,7 +94,7 @@ impl HTTPServer { } }); - #[cfg(openapi)] + #[cfg(feature = "openapi")] if openapi.is_some() { app = app.service( SwaggerUi::new("/docs/{_:.*}") @@ -114,9 +102,8 @@ impl HTTPServer { ); } - app.service(health_handler) - .default_service(web::to(middlewares::not_found::not_found)) - .wrap(actix_middleware::Logger::default()) + app.default_service(web::to(middlewares::not_found::not_found)) + .wrap(Logger::default()) } }) .shutdown_timeout(60) diff --git a/kafka/Cargo.toml b/kafka/Cargo.toml index fe5cc4f..6630656 100644 --- a/kafka/Cargo.toml +++ b/kafka/Cargo.toml @@ -8,7 +8,7 @@ configs = { path = "../configs" } messaging = { path = "../messaging" } rdkafka = { version = "0.36.2" } -async-trait = { version = "0.1.77" } -opentelemetry = { version = "0.21.0" } -tracing = { version = "0.1.40" } -tokio = { version = "1.35.1", features = ["default"] } +async-trait = { workspace = true } +opentelemetry = { workspace = true } +tracing = { workspace = true } +tokio = { workspace = true, features = ["default"] } diff --git a/logging/Cargo.toml b/logging/Cargo.toml index a5e380f..f018408 100644 --- a/logging/Cargo.toml +++ b/logging/Cargo.toml @@ -9,5 +9,5 @@ configs = { path = "../configs" } tracing-bunyan-formatter = { version = "0.3.9" } tracing-subscriber = { version = "0.3.18" } tracing-log = { version = "0.2.0" } -tracing = { version = "0.1.40" } -thiserror = { version = "1.0.56" } \ No newline at end of file +tracing = { workspace = true } +thiserror = { workspace = true } \ No newline at end of file diff --git a/logging/src/logger.rs b/logging/src/logger.rs index c887f34..a510bd7 100644 --- a/logging/src/logger.rs +++ b/logging/src/logger.rs @@ -30,19 +30,17 @@ pub fn setup(cfg: &AppConfigs) -> Result<(), LoggingError> { if !cfg.enable_external_creates_logging { target_filters = Targets::new() .with_default(level_filter) - .with_target("lapin::channels", LevelFilter::WARN) - .with_target("tower::buffer::worker", LevelFilter::WARN) - .with_target("h2::client", LevelFilter::WARN) - .with_target("h2::codec::framed_read", LevelFilter::WARN) - .with_target("h2::codec::framed_write", LevelFilter::WARN) - .with_target("h2::proto::settings", LevelFilter::WARN) - .with_target("hyper::client::connect::dns", LevelFilter::WARN) - .with_target("hyper::client::connect::http", LevelFilter::WARN) - .with_target("rustls::client::hs", LevelFilter::WARN) - .with_target("rustls::anchors", LevelFilter::WARN) - .with_target("rustls::client::tls13", LevelFilter::WARN) - .with_target("paho_mqtt::async_client", LevelFilter::WARN) - .with_target("c_trace", LevelFilter::WARN); + .with_target("lapin", LevelFilter::WARN) + .with_target("tower", LevelFilter::WARN) + .with_target("h2", LevelFilter::WARN) + .with_target("hyper", LevelFilter::WARN) + .with_target("rustls", LevelFilter::WARN) + .with_target("paho_mqtt", LevelFilter::WARN) + .with_target("c_trace", LevelFilter::WARN) + .with_target("aws_smithy_runtime", LevelFilter::WARN) + .with_target("aws_config", LevelFilter::WARN) + .with_target("aws_sdk_secretsmanager", LevelFilter::WARN) + .with_target("log", LevelFilter::WARN); } let mut fmt_pretty: Option>> = None; diff --git a/messaging/Cargo.toml b/messaging/Cargo.toml index c7f8bef..6aeffd6 100644 --- a/messaging/Cargo.toml +++ b/messaging/Cargo.toml @@ -7,12 +7,12 @@ edition = "2021" mocks = ["dep:mockall"] [dependencies] -opentelemetry = { version = "0.21.0" } -async-trait = { version = "0.1.77" } -thiserror = { version = "1.0.56" } +opentelemetry = { workspace = true } +async-trait = { workspace = true } +thiserror = { workspace = true } # mock -mockall = { version = "0.12.0", optional = true } +mockall = { version = "0.12.1", optional = true } [dev-dependencies] -mockall = { version = "0.12.0" } +mockall = { version = "0.12.1" } diff --git a/metrics/Cargo.toml b/metrics/Cargo.toml index 03bea49..097044e 100644 --- a/metrics/Cargo.toml +++ b/metrics/Cargo.toml @@ -11,19 +11,19 @@ stdout = ["dep:opentelemetry-stdout", "dep:tokio"] [dependencies] configs = { path = "../configs" } -opentelemetry = { version = "0.21.0", features = ["metrics"] } -opentelemetry_sdk = { version = "0.21.2", features = ["metrics", "rt-tokio"] } -tracing = { version = "0.1.40" } -thiserror = { version = "1.0.56" } +opentelemetry = { workspace = true, features = ["metrics"] } +opentelemetry_sdk = { workspace = true, features = ["metrics", "rt-tokio"] } +tracing = { workspace = true } +thiserror = { workspace = true } # OTLP Featue -tonic = { version = "0.9.2", features = ["tls"], optional = true } -tokio = { version = "1.35.1", features = ["default"], optional = true } -opentelemetry-otlp = { version = "0.14.0", features = ["tonic", "metrics", "grpc-tonic" , "tls", "tls-roots"], optional = true } +tonic = { workspace = true, features = ["tls"], optional = true } +tokio = { workspace = true, features = ["default"], optional = true } +opentelemetry-otlp = { version = "0.15", features = ["metrics", "prost", "grpc-tonic", "gzip-tonic","tls", "tls-roots"], optional = true } # Prometheus Feature prometheus = { version = "0.13.3" } -opentelemetry-prometheus = { version = "0.14.1", optional = true } +opentelemetry-prometheus = { version = "0.15", optional = true } # Stdout -opentelemetry-stdout = { version = "0.2.0", features = ["metrics"], optional = true } \ No newline at end of file +opentelemetry-stdout = { version = "0.3", features = ["metrics"], optional = true } \ No newline at end of file diff --git a/metrics/src/exporters/otlp.rs b/metrics/src/exporters/otlp.rs index 1a86763..068ba8f 100644 --- a/metrics/src/exporters/otlp.rs +++ b/metrics/src/exporters/otlp.rs @@ -3,12 +3,12 @@ use crate::errors::MetricsError; use configs::{Configs, DynamicConfigs}; use opentelemetry::KeyValue; use opentelemetry_otlp::{Protocol, WithExportConfig}; -use opentelemetry_sdk::{metrics::MeterProvider, runtime, Resource}; +use opentelemetry_sdk::{metrics::SdkMeterProvider, runtime, Resource}; use std::time::Duration; use tonic::metadata::{Ascii, MetadataKey, MetadataMap}; use tracing::error; -pub fn install(cfg: &Configs) -> Result +pub fn install(cfg: &Configs) -> Result where T: DynamicConfigs, { diff --git a/metrics/src/exporters/prom.rs b/metrics/src/exporters/prom.rs index a31bac9..38771a2 100644 --- a/metrics/src/exporters/prom.rs +++ b/metrics/src/exporters/prom.rs @@ -1,13 +1,16 @@ use configs::{Configs, DynamicConfigs}; use opentelemetry::KeyValue; -use opentelemetry_sdk::{metrics::MeterProvider, Resource}; +use opentelemetry_sdk::{ + metrics::{MeterProviderBuilder, SdkMeterProvider}, + Resource, +}; use prometheus::Registry; use std::sync::Arc; use tracing::error; use crate::errors::MetricsError; -pub fn install(cfg: &Configs) -> Result<(MeterProvider, Arc), MetricsError> +pub fn install(cfg: &Configs) -> Result<(SdkMeterProvider, Arc), MetricsError> where T: DynamicConfigs, { @@ -24,7 +27,7 @@ where } }?; - let provider = MeterProvider::builder() + let provider = MeterProviderBuilder::default() .with_resource(Resource::new(vec![ KeyValue::new("service.name", cfg.app.name.clone()), KeyValue::new("service.type", cfg.metric.service_type.clone()), diff --git a/metrics/src/exporters/stdout.rs b/metrics/src/exporters/stdout.rs index 9d86f16..9a6ec74 100644 --- a/metrics/src/exporters/stdout.rs +++ b/metrics/src/exporters/stdout.rs @@ -1,13 +1,13 @@ use crate::errors::MetricsError; use opentelemetry_sdk::{ - metrics::{MeterProvider, PeriodicReader}, + metrics::{MeterProviderBuilder, PeriodicReader, SdkMeterProvider}, runtime, }; -pub fn install() -> Result { +pub fn install() -> Result { let exporter = opentelemetry_stdout::MetricsExporter::default(); let reader = PeriodicReader::builder(exporter, runtime::Tokio).build(); - Ok(MeterProvider::builder().with_reader(reader).build()) + Ok(MeterProviderBuilder::default().with_reader(reader).build()) } diff --git a/metrics/src/provider.rs b/metrics/src/provider.rs index 5403ed2..0033a9d 100644 --- a/metrics/src/provider.rs +++ b/metrics/src/provider.rs @@ -4,10 +4,10 @@ use prometheus::Registry; use std::sync::Arc; use tracing::{debug, error}; -#[cfg(all(feature = "otlp", feature = "prometheus", feature = "stdout"))] +#[cfg(any(feature = "otlp", feature = "prometheus", feature = "stdout"))] use crate::exporters; -#[cfg(all(feature = "otlp", feature = "prometheus", feature = "stdout"))] +#[cfg(any(feature = "otlp", feature = "prometheus", feature = "stdout"))] use opentelemetry::global; pub fn init(cfg: &Configs) -> Result>, MetricsError> diff --git a/migrator/Cargo.toml b/migrator/Cargo.toml index dac8e53..5650162 100644 --- a/migrator/Cargo.toml +++ b/migrator/Cargo.toml @@ -11,9 +11,9 @@ sqlite = ["dep:deadpool-sqlite"] configs = { path = "../configs" } logging = { path = "../logging" } -async-trait = { version = "0.1.77" } -tracing = { version = "0.1.40" } -thiserror = { version = "1.0.56" } +async-trait = { workspace = true } +tracing = { workspace = true } +thiserror = { workspace = true } -deadpool-postgres = { version = "0.12.1", optional = true } -deadpool-sqlite = { version = "0.7.0", optional = true } \ No newline at end of file +deadpool-postgres = { version = "0.13.0", optional = true } +deadpool-sqlite = { version = "0.8.0", optional = true } \ No newline at end of file diff --git a/migrator/src/lib.rs b/migrator/src/lib.rs index 64ff91d..c9d20a3 100644 --- a/migrator/src/lib.rs +++ b/migrator/src/lib.rs @@ -1,4 +1,5 @@ pub mod errors; + #[cfg(feature = "postgres")] mod postgres; mod service; @@ -7,6 +8,7 @@ mod sqlite; #[cfg(feature = "postgres")] pub use postgres::PostgresDriver; +pub use service::MigrationMode; pub use service::Migrator; #[cfg(feature = "sqlite")] pub use sqlite::SqliteDriver; diff --git a/migrator/src/postgres.rs b/migrator/src/postgres.rs index 57bab0e..532d1c3 100644 --- a/migrator/src/postgres.rs +++ b/migrator/src/postgres.rs @@ -85,7 +85,7 @@ impl MigratorDriver for PostgresDriver { let conn = self.get_conn().await?; - let dirs = self.read_dir_sorted(migrations_path)?; + let dirs = self.read_dir_sorted_for_up(migrations_path)?; self.begin(&conn).await?; @@ -158,9 +158,85 @@ impl MigratorDriver for PostgresDriver { async fn down( &self, - _path: Option<&str>, + path: Option<&str>, _migration: Option<&str>, ) -> Result<(), MigrationError> { + let mut migrations_path = "./bins/migrations/sql/"; + + if path.is_some() { + migrations_path = path.unwrap(); + } + + let conn = self.get_conn().await?; + + let dirs = self.read_dir_sorted_for_down(migrations_path)?; + + self.begin(&conn).await?; + + for dir in dirs { + let (file_name, file_path) = dir; + + if self.migrate_executed_already(&conn, &file_name).await? { + continue; + } + + let query = match fs::read_to_string(file_path) { + Ok(q) => Ok(q), + Err(err) => { + error!(error = err.to_string(), "error to read migration file"); + self.rollback(&conn).await?; + Err(MigrationError::InternalError {}) + } + }?; + + match conn.batch_execute(&query).await { + Err(err) => { + if err.code().unwrap_or(&SqlState::SYNTAX_ERROR) == &SqlState::DUPLICATE_TABLE { + warn!( + error = err.to_string(), + "there is a table with the same name" + ); + return Ok(()); + } + + error!(error = err.to_string(), "error to execute migrate query"); + self.rollback(&conn).await?; + Err(MigrationError::MigrateQueryErr {}) + } + _ => Ok(()), + }?; + + let statement = match conn + .prepare("INSERT INTO migrations (migrate) values ($1)") + .await + { + Err(err) => { + error!( + error = err.to_string(), + migrate = file_name, + "error to execute prepare insert in migrations table" + ); + self.rollback(&conn).await?; + Err(MigrationError::PrepareStatementErr {}) + } + Ok(s) => Ok(s), + }?; + + match conn.query(&statement, &[&file_name]).await { + Err(err) => { + error!( + error = err.to_string(), + "error to inset migrate in migrations table" + ); + self.rollback(&conn).await?; + Err(MigrationError::InsertErr {}) + } + _ => Ok(()), + }?; + } + + self.commit(&conn).await?; + Ok(()) } } @@ -209,7 +285,7 @@ impl PostgresDriver { } } - fn read_dir_sorted(&self, path: &str) -> Result, MigrationError> { + fn read_dir_sorted_for_up(&self, path: &str) -> Result, MigrationError> { let dirs = match fs::read_dir(path) { Ok(d) => Ok(d), Err(err) => { @@ -234,6 +310,34 @@ impl PostgresDriver { Ok(migrations) } + fn read_dir_sorted_for_down( + &self, + path: &str, + ) -> Result, MigrationError> { + let dirs = match fs::read_dir(path) { + Ok(d) => Ok(d), + Err(err) => { + error!(error = err.to_string(), "error reading the migration path"); + Err(MigrationError::InternalError {}) + } + }?; + + let mut migrations: Vec<(String, PathBuf)> = dirs + .map(|d| { + let dir = d.unwrap(); + ( + dir.file_name().into_string().unwrap_or_default(), + dir.path(), + ) + }) + .filter(|f| f.0.contains("down") && f.0.contains(".sql")) + .collect(); + + migrations.sort_by_key(|v| v.0.clone()); + + Ok(migrations) + } + async fn migrate_executed_already( &self, conn: &Object, diff --git a/migrator/src/service.rs b/migrator/src/service.rs index 57b7565..b9c89c9 100644 --- a/migrator/src/service.rs +++ b/migrator/src/service.rs @@ -10,6 +10,13 @@ pub trait MigratorDriver { -> Result<(), MigrationError>; } +#[derive(Default)] +pub enum MigrationMode { + #[default] + Up, + Down, +} + pub struct Migrator { driver: Arc, } @@ -23,16 +30,15 @@ impl Migrator { impl Migrator { pub async fn exec( &self, - mode: &str, + mode: &MigrationMode, path: Option<&str>, migration: Option<&str>, ) -> Result<(), MigrationError> { self.driver.migration_table().await?; match match mode { - "up" => self.driver.up(path, migration).await, - "down" => self.driver.down(path, migration).await, - _ => Err(MigrationError::InvalidArgumentErr(mode.to_owned())), + MigrationMode::Up => self.driver.up(path, migration).await, + MigrationMode::Down => self.driver.down(path, migration).await, } { Err(e) => Err(e), _ => Ok(()), @@ -46,7 +52,7 @@ impl Migrator { path: Option<&str>, migration: Option<&str>, ) -> Result<(), MigrationError> { - self.exec(&"up".to_owned(), path, migration).await + self.exec(&MigrationMode::Up, path, migration).await } pub async fn exec_down( @@ -54,6 +60,6 @@ impl Migrator { path: Option<&str>, migration: Option<&str>, ) -> Result<(), MigrationError> { - self.exec(&"down".to_owned(), path, migration).await + self.exec(&MigrationMode::Down, path, migration).await } } diff --git a/mqtt/Cargo.toml b/mqtt/Cargo.toml index 68d28e7..f0a3a4e 100644 --- a/mqtt/Cargo.toml +++ b/mqtt/Cargo.toml @@ -11,21 +11,21 @@ configs = { path = "../configs" } traces = { path = "../traces" } messaging = { path = "../messaging" } -opentelemetry = { version = "0.21.0" } -tracing = { version = "0.1.40" } -async-trait = { version = "0.1.77" } -bytes = { version = "1.5.0", features = ["serde"] } +opentelemetry = { workspace = true } +tracing = { workspace = true } +async-trait = { workspace = true } +bytes = { version = "1.6.0", features = ["serde"] } paho-mqtt = { version = "0.12.3" } -serde = { version = "1.0.196", features = ["derive"] } -serde_json = { version = "1.0.112" } -futures-util = { version = "0.3.26" } -thiserror = { version = "1.0.56" } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } +futures-util = { version = "0.3.30" } +thiserror = { workspace = true } # Used only with feature mock -mockall = { version = "0.12.0", optional = true } +mockall = { version = "0.12.1", optional = true } [dev-dependencies] messaging = { path = "../messaging", features = ["mocks"] } -mockall = { version = "0.12.0" } -tokio = { version = "1.35.1" } \ No newline at end of file +mockall = { version = "0.12.1" } +tokio = { workspace = true } \ No newline at end of file diff --git a/otel/Cargo.toml b/otel/Cargo.toml index e3e72dc..3c4bd98 100644 --- a/otel/Cargo.toml +++ b/otel/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2021" [dependencies] -opentelemetry = { version = "0.21.0" } \ No newline at end of file +opentelemetry = { workspace = true } \ No newline at end of file diff --git a/rabbitmq/Cargo.toml b/rabbitmq/Cargo.toml index f086346..9810c6c 100644 --- a/rabbitmq/Cargo.toml +++ b/rabbitmq/Cargo.toml @@ -8,16 +8,16 @@ configs = { path = "../configs" } messaging = { path = "../messaging" } traces = { path = "../traces" } -lapin = { version = "2.3.1" } -opentelemetry = { version = "0.21.0" } -uuid = { version = "1.7.0", features = ["v4"] } -async-trait = { version = "0.1.77" } -tracing = { version = "0.1.40" } -serde_json = { version = "1.0.112" } -serde = { version = "1.0.196", features = ["derive"] } -tokio = { version = "1.35.1", features = ["default"] } +lapin = { version = "2.3.3" } +opentelemetry = { workspace = true } +uuid = { version = "1.8.0", features = ["v4"] } +async-trait = { workspace = true } +tracing = { workspace = true } +serde_json = { workspace = true } +serde = { workspace = true, features = ["derive"] } +tokio = { workspace = true, features = ["default"] } futures-util = { version = "0.3.30"} -thiserror = { version = "1.0.56" } +thiserror = { workspace = true } [dev-dependencies] -mockall = { version = "0.12.0" } +mockall = { version = "0.12.1" } diff --git a/secrets_manager/Cargo.toml b/secrets_manager/Cargo.toml index 6962414..8eeac76 100644 --- a/secrets_manager/Cargo.toml +++ b/secrets_manager/Cargo.toml @@ -7,16 +7,16 @@ edition = "2021" mocks = ["dep:mockall"] [dependencies] -async-trait = { version = "0.1.77" } -tracing = { version = "0.1.40" } -aws-config = { version = "1.1.3" } -aws-sdk-secretsmanager = { version = "1.13.0" } -serde_json = { version = "1.0.112" } -thiserror = { version = "1.0.56" } +async-trait = { workspace = true } +tracing = { workspace = true } +aws-config = { version = "1.2.0" } +aws-sdk-secretsmanager = { version = "1.22.0" } +serde_json = { workspace = true } +thiserror = { workspace = true } # Used only with feature mock -mockall = { version = "0.12.0", optional = true } +mockall = { version = "0.12.1", optional = true } [dev-dependencies] -mockall = { version = "0.12.0" } -tokio = { version = "1.35.1", features = ["macros"] } +mockall = { version = "0.12.1" } +tokio = { workspace = true, features = ["macros"] } diff --git a/sql_pool/Cargo.toml b/sql_pool/Cargo.toml index e3c43cf..491130b 100644 --- a/sql_pool/Cargo.toml +++ b/sql_pool/Cargo.toml @@ -10,12 +10,12 @@ sqlite = ["dep:deadpool-sqlite"] [dependencies] configs = { path = "../configs" } -tracing = { version = "0.1.40" } -thiserror = { version = "1.0.56" } +tracing = { workspace = true } +thiserror = { workspace = true } # PostgreSQL dep -deadpool-postgres = { version = "0.12.1", optional = true } +deadpool-postgres = { version = "0.13.0", optional = true } tokio-postgres = { version = "0.7.10", features = ["with-chrono-0_4", "with-uuid-0_8"], optional = true } # SQLite dep -deadpool-sqlite = { version = "0.7.0", optional = true } \ No newline at end of file +deadpool-sqlite = { version = "0.8.0", optional = true } \ No newline at end of file diff --git a/traces/Cargo.toml b/traces/Cargo.toml index 17fc8cd..ebe4e51 100644 --- a/traces/Cargo.toml +++ b/traces/Cargo.toml @@ -10,14 +10,14 @@ stdout = ["dep:opentelemetry-stdout"] [dependencies] configs = { path = "../configs" } -opentelemetry = { version = "0.21.0" } -opentelemetry_sdk = { version = "0.21.2", features = ["rt-tokio"]} -tracing = { version = "0.1.40" } -thiserror = { version = "1.0.56" } -serde = { version = "1.0.196", features = ["derive"] } -tonic = { version = "0.9.2", features = ["tls"] } -tokio = { version = "1.35.1", features = ["default"] } +opentelemetry = { workspace = true } +opentelemetry_sdk = { workspace = true, features = ["rt-tokio"]} +tracing = { workspace = true } +thiserror = { workspace = true } +serde = { workspace = true, features = ["derive"] } +tonic = { workspace = true, features = ["tls"] } +tokio = { workspace = true, features = ["default"] } -opentelemetry-otlp = { version = "0.14.0", features = ["tonic", "tls", "tls-roots"], optional = true } +opentelemetry-otlp = { version = "0.15", features = ["tonic", "tls", "tls-roots"], optional = true } -opentelemetry-stdout = { version = "0.2.0", features = ["trace"], optional = true } \ No newline at end of file +opentelemetry-stdout = { version = "0.3", features = ["trace"], optional = true } \ No newline at end of file diff --git a/traces/src/exporters/otlp_grpc.rs b/traces/src/exporters/otlp_grpc.rs index 62926ff..5e76672 100644 --- a/traces/src/exporters/otlp_grpc.rs +++ b/traces/src/exporters/otlp_grpc.rs @@ -1,9 +1,9 @@ use crate::errors::TracesError; use configs::{Configs, DynamicConfigs}; -use opentelemetry::global; +use opentelemetry::{global, propagation::TextMapCompositePropagator}; use opentelemetry_otlp::{Protocol, WithExportConfig}; use opentelemetry_sdk::{ - propagation::{BaggagePropagator, TextMapCompositePropagator, TraceContextPropagator}, + propagation::{BaggagePropagator, TraceContextPropagator}, runtime, trace::Config, }; diff --git a/traces/src/exporters/stdout.rs b/traces/src/exporters/stdout.rs index 84d8e2c..614122a 100644 --- a/traces/src/exporters/stdout.rs +++ b/traces/src/exporters/stdout.rs @@ -1,7 +1,7 @@ use crate::errors::TracesError; -use opentelemetry::global; +use opentelemetry::{global, propagation::TextMapCompositePropagator}; use opentelemetry_sdk::{ - propagation::{BaggagePropagator, TextMapCompositePropagator, TraceContextPropagator}, + propagation::{BaggagePropagator, TraceContextPropagator}, trace::{Config, TracerProvider}, }; use tracing::debug; diff --git a/traces/src/provider.rs b/traces/src/provider.rs index 5a462e5..c3e130c 100644 --- a/traces/src/provider.rs +++ b/traces/src/provider.rs @@ -8,7 +8,7 @@ use opentelemetry_sdk::{ use std::vec; use tracing::{debug, error}; -#[cfg(all(feature = "otlp", feature = "stdout"))] +#[cfg(any(feature = "otlp", feature = "stdout"))] use crate::exporters; pub fn init(cfg: &Configs) -> Result<(), TracesError>