vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit 439ef44973205aaa7a306b35dd2040e8a6473eb0
parent c9ec389b244c98d5cc57852f29130923fe9d6ce6
Author: BlackDex <black.dex@gmail.com>
Date:   Fri,  4 Nov 2022 12:56:02 +0100

Update Rust version, deps and workflow

- Update Rust to v1.65.0
- Update dependencies
- Updated workflow files
- Added some extra clippy checks
- Fixed some clippy checks

Diffstat:
M.github/workflows/build.yml | 69++++++++++++++++++++++++++++++---------------------------------------
M.github/workflows/release.yml | 6++----
MCargo.lock | 126++++++++++++++++++++++++++++++++++++++++----------------------------------------
MCargo.toml | 16++++++++--------
Mdocker/Dockerfile.j2 | 10+++++-----
Mdocker/amd64/Dockerfile | 2+-
Mdocker/amd64/Dockerfile.alpine | 2+-
Mdocker/amd64/Dockerfile.buildx | 2+-
Mdocker/amd64/Dockerfile.buildx.alpine | 2+-
Mdocker/arm64/Dockerfile | 2+-
Mdocker/arm64/Dockerfile.alpine | 2+-
Mdocker/arm64/Dockerfile.buildx | 2+-
Mdocker/arm64/Dockerfile.buildx.alpine | 2+-
Mdocker/armv6/Dockerfile | 2+-
Mdocker/armv6/Dockerfile.alpine | 2+-
Mdocker/armv6/Dockerfile.buildx | 2+-
Mdocker/armv6/Dockerfile.buildx.alpine | 2+-
Mdocker/armv7/Dockerfile | 2+-
Mdocker/armv7/Dockerfile.alpine | 2+-
Mdocker/armv7/Dockerfile.buildx | 2+-
Mdocker/armv7/Dockerfile.buildx.alpine | 2+-
Mrust-toolchain | 2+-
Msrc/api/admin.rs | 4++--
Msrc/api/core/organizations.rs | 10+++++-----
Msrc/api/icons.rs | 2+-
Msrc/auth.rs | 4++--
Msrc/config.rs | 10+++++-----
Msrc/db/mod.rs | 4++--
Msrc/main.rs | 4++++
Msrc/util.rs | 2+-
30 files changed, 147 insertions(+), 154 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml @@ -48,30 +48,37 @@ jobs: run: sudo apt-get update && sudo apt-get install -y --no-install-recommends openssl sqlite build-essential libmariadb-dev-compat libpq-dev libssl-dev pkg-config # End Install dependencies + # Determine rust-toolchain version + - name: Init Variables + id: toolchain + shell: bash + if: ${{ matrix.channel == 'rust-toolchain' }} + run: | + RUST_TOOLCHAIN="$(cat rust-toolchain)" + echo "RUST_TOOLCHAIN=${RUST_TOOLCHAIN}" | tee -a "${GITHUB_OUTPUT}" + # End Determine rust-toolchain version # Uses the rust-toolchain file to determine version - name: "Install rust-toolchain version" - uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.6 + uses: dtolnay/rust-toolchain@55c7845fad90d0ae8b2e83715cb900e5e861e8cb # master @ 2022-10-25 - 21:40 GMT+2 if: ${{ matrix.channel == 'rust-toolchain' }} with: - profile: minimal + toolchain: "${{steps.toolchain.outputs.RUST_TOOLCHAIN}}" components: clippy, rustfmt # End Uses the rust-toolchain file to determine version # Install the MSRV channel to be used - name: "Install MSRV version" - uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.6 + uses: dtolnay/rust-toolchain@55c7845fad90d0ae8b2e83715cb900e5e861e8cb # master @ 2022-10-25 - 21:40 GMT+2 if: ${{ matrix.channel != 'rust-toolchain' }} with: - profile: minimal - override: true toolchain: ${{ matrix.version }} # End Install the MSRV channel to be used # Enable Rust Caching - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 + - uses: Swatinem/rust-cache@b5ec9edd911d3bf82c74038b0a28791e0aa24d6f # v2.0.2 # End Enable Rust Caching @@ -87,65 +94,51 @@ jobs: # First test all features together, afterwards test them separately. - name: "test features: sqlite,mysql,postgresql,enable_mimalloc" id: test_sqlite_mysql_postgresql_mimalloc - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 if: $${{ always() }} - with: - command: test - args: --release --features sqlite,mysql,postgresql,enable_mimalloc + run: | + cargo test --release --features sqlite,mysql,postgresql,enable_mimalloc - name: "test features: sqlite,mysql,postgresql" id: test_sqlite_mysql_postgresql - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 if: $${{ always() }} - with: - command: test - args: --release --features sqlite,mysql,postgresql + run: | + cargo test --release --features sqlite,mysql,postgresql - name: "test features: sqlite" id: test_sqlite - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 if: $${{ always() }} - with: - command: test - args: --release --features sqlite + run: | + cargo test --release --features sqlite - name: "test features: mysql" id: test_mysql - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 if: $${{ always() }} - with: - command: test - args: --release --features mysql + run: | + cargo test --release --features mysql - name: "test features: postgresql" id: test_postgresql - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 if: $${{ always() }} - with: - command: test - args: --release --features postgresql + run: | + cargo test --release --features postgresql # End Run cargo tests # Run cargo clippy, and fail on warnings (In release mode to speed up future builds) - name: "clippy features: sqlite,mysql,postgresql,enable_mimalloc" id: clippy - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 if: ${{ always() && matrix.channel == 'rust-toolchain' }} - with: - command: clippy - args: --release --features sqlite,mysql,postgresql,enable_mimalloc -- -D warnings + run: | + cargo clippy --release --features sqlite,mysql,postgresql,enable_mimalloc -- -D warnings # End Run cargo clippy # Run cargo fmt (Only run on rust-toolchain defined version) - name: "check formatting" id: formatting - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 if: ${{ always() && matrix.channel == 'rust-toolchain' }} - with: - command: fmt - args: --all -- --check + run: | + cargo fmt --all -- --check # End Run cargo fmt @@ -182,17 +175,15 @@ jobs: # Build the binary to upload to the artifacts - name: "build features: sqlite,mysql,postgresql" - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 if: ${{ matrix.channel == 'rust-toolchain' }} - with: - command: build - args: --release --features sqlite,mysql,postgresql + run: | + cargo build --release --features sqlite,mysql,postgresql # End Build the binary # Upload artifact to Github Actions - name: "Upload artifact" - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1 if: ${{ matrix.channel == 'rust-toolchain' }} with: name: vaultwarden diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml @@ -78,11 +78,9 @@ jobs: run: | # Check which main tag we are going to build determined by github.ref if [[ "${{ github.ref }}" == refs/tags/* ]]; then - echo "set-output name=DOCKER_TAG::${GITHUB_REF#refs/*/}" - echo "::set-output name=DOCKER_TAG::${GITHUB_REF#refs/*/}" + echo "DOCKER_TAG=${GITHUB_REF#refs/*/}" | tee -a "${GITHUB_OUTPUT}" elif [[ "${{ github.ref }}" == refs/heads/* ]]; then - echo "set-output name=DOCKER_TAG::testing" - echo "::set-output name=DOCKER_TAG::testing" + echo "DOCKER_TAG=testing" | tee -a "${GITHUB_OUTPUT}" fi # End Determine Docker Tag diff --git a/Cargo.lock b/Cargo.lock @@ -29,9 +29,9 @@ dependencies = [ [[package]] name = "aes" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe0133578c0986e1fe3dfcd4af1cc5b2dd6c3dbf534d69916ce16a2701d40ba" +checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" dependencies = [ "cfg-if", "cipher", @@ -283,9 +283,9 @@ checksum = "3a4f925191b4367301851c6d99b09890311d74b0d43f274c0b34c86d308a3663" [[package]] name = "cc" -version = "1.0.73" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "41ca34107f97baef6cfb231b32f36115781856b8f8208e8c580e0bcaea374842" [[package]] name = "cfg-if" @@ -308,9 +308,9 @@ dependencies = [ [[package]] name = "chrono-tz" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbc529705a6e0028189c83f0a5dd9fb214105116f7e3c0eeab7ff0369766b0d1" +checksum = "a87b30366b6766751277791b473b674f3bf7fb75696841c784a3eb7e7fbf44ee" dependencies = [ "chrono", "chrono-tz-build", @@ -384,9 +384,9 @@ dependencies = [ [[package]] name = "cookie_store" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d40c6a5300157c1143c9ea81ef0372b8d13344f9de3dee4d97b68ea50a070d6" +checksum = "bca9b3c618262fc0c85ecbc814c144e04be9c6eec08b315e7cd1cfbe0bb6ca84" dependencies = [ "cookie", "idna 0.3.0", @@ -484,9 +484,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" +checksum = "97abf9f0eca9e52b7f81b945524e76710e6cb2366aead23b7d4fbf72e281f888" dependencies = [ "cc", "cxxbridge-flags", @@ -496,9 +496,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" +checksum = "7cc32cc5fea1d894b77d269ddb9f192110069a8a9c1f1d441195fba90553dea3" dependencies = [ "cc", "codespan-reporting", @@ -511,15 +511,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" +checksum = "8ca220e4794c934dc6b1207c3b42856ad4c302f2df1712e9f8d2eec5afaacf1f" [[package]] name = "cxxbridge-macro" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" +checksum = "b846f081361125bfc8dc9d3940c84e1fd83ba54bbca7b17cd29483c828be0704" dependencies = [ "proc-macro2", "quote", @@ -696,9 +696,9 @@ dependencies = [ [[package]] name = "email_address" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1b32a7a2580c4473f10f66b512c34bdd7d33c5e3473227ca833abdb5afe4809" +checksum = "e2153bd83ebc09db15bcbdc3e2194d901804952e3dc96967e1cd3b0c5c32d112" dependencies = [ "serde", ] @@ -1110,9 +1110,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.20" +version = "0.14.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" dependencies = [ "bytes", "futures-channel", @@ -1147,9 +1147,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.51" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1245,9 +1245,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" +checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" [[package]] name = "itoa" @@ -1337,18 +1337,18 @@ checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] name = "libmimalloc-sys" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc093ab289b0bfda3aa1bdfab9c9542be29c7ef385cfcbe77f8c9813588eb48" +checksum = "c37567b180c1af25924b303ddf1ee4467653783440c62360beb2b322a4d93361" dependencies = [ "cc", ] [[package]] name = "libsqlite3-sys" -version = "0.25.1" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f0455f2c1bc9a7caa792907026e469c1d91761fb0ea37cbb16427c77280cf35" +checksum = "29f835d03d717946d28b1d1ed632eb6f0e24a299388ee623d0c23118d3e8a7fa" dependencies = [ "cc", "pkg-config", @@ -1472,9 +1472,9 @@ dependencies = [ [[package]] name = "mimalloc" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ce6a4b40d3bff9eb3ce9881ca0737a85072f9f975886082640cd46a75cdb35" +checksum = "b32d6a9ac92d0239d7bfa31137fb47634ac7272a3c11bcee91379ac100781670" dependencies = [ "libmimalloc-sys", ] @@ -1543,9 +1543,9 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" dependencies = [ "lazy_static", "libc", @@ -1646,9 +1646,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ "hermit-abi", "libc", @@ -1674,9 +1674,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] name = "opaque-debug" @@ -1718,9 +1718,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.22.0+1.1.1q" +version = "111.24.0+1.1.1s" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f31f0d509d1c1ae9cada2f9539ff8f37933831fd5098879e482aa687d659853" +checksum = "3498f259dab01178c6228c6b00dcef0ed2a2d5e20d648c017861227773ea4abd" dependencies = [ "cc", ] @@ -1823,9 +1823,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbc7bc69c062e492337d74d59b120c274fd3d261b6bf6d3207d499b4b379c41a" +checksum = "a528564cc62c19a7acac4d81e01f39e53e25e17b934878f4c6d25cc2836e62f8" dependencies = [ "thiserror", "ucd-trie", @@ -1833,9 +1833,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b75706b9642ebcb34dab3bc7750f811609a0eb1dd8b88c2d15bf628c1c65b2" +checksum = "d5fd9bc6500181952d34bd0b2b0163a54d794227b498be0b7afa7698d0a7b18f" dependencies = [ "pest", "pest_generator", @@ -1843,9 +1843,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f9272122f5979a6511a749af9db9bfc810393f63119970d7085fed1c4ea0db" +checksum = "d2610d5ac5156217b4ff8e46ddcef7cdf44b273da2ac5bca2ecbfa86a330e7c4" dependencies = [ "pest", "pest_meta", @@ -1856,9 +1856,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8717927f9b79515e565a64fe46c38b8cd0427e64c40680b14a7365ab09ac8d" +checksum = "824749bf7e21dd66b36fbe26b3f45c713879cccd4a009a917ab8e045ca8246fe" dependencies = [ "once_cell", "pest", @@ -1941,9 +1941,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "pq-sys" @@ -2120,18 +2120,18 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12a733f1746c929b4913fe48f8697fcf9c55e3304ba251a79ffb41adfeaf49c2" +checksum = "53b15debb4f9d60d767cd8ca9ef7abb2452922f3214671ff052defc7f3502c44" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5887de4a01acafd221861463be6113e6e87275e79804e56779f4cdc131c60368" +checksum = "abfa8511e9e94fd3de6585a3d3cd00e01ed556dc9814829280af0e8dc72a8f36" dependencies = [ "proc-macro2", "quote", @@ -2140,9 +2140,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" dependencies = [ "aho-corasick", "memchr", @@ -2160,9 +2160,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "remove_dir_all" @@ -2417,9 +2417,9 @@ dependencies = [ [[package]] name = "scoped-tls" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" [[package]] name = "scopeguard" @@ -2748,9 +2748,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fab5c8b9980850e06d92ddbe3ab839c062c801f3927c0fb8abd6fc8e918fbca" +checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" dependencies = [ "itoa", "libc", @@ -2768,9 +2768,9 @@ checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" [[package]] name = "time-macros" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bb801831d812c562ae7d2bfb531f26e66e4e1f6b17307ba4149c5064710e5b" +checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" dependencies = [ "time-core", ] @@ -3174,7 +3174,7 @@ dependencies = [ "chrono", "chrono-tz", "cookie", - "cookie_store 0.18.0", + "cookie_store 0.19.0", "ctrlc", "dashmap", "data-encoding", diff --git a/Cargo.toml b/Cargo.toml @@ -45,7 +45,7 @@ backtrace = "0.3.66" # Logging panics to logfile instead stderr only dotenvy = { version = "0.15.6", default-features = false } # Lazy initialization -once_cell = "1.15.0" +once_cell = "1.16.0" # Numerical libraries num-traits = "0.2.15" @@ -72,7 +72,7 @@ diesel = { version = "2.0.2", features = ["chrono", "r2d2"] } diesel_migrations = "2.0.0" # Bundled SQLite -libsqlite3-sys = { version = "0.25.1", features = ["bundled"], optional = true } +libsqlite3-sys = { version = "0.25.2", features = ["bundled"], optional = true } # Crypto-related libraries rand = { version = "0.8.5", features = ["small_rng"] } @@ -83,8 +83,8 @@ uuid = { version = "1.2.1", features = ["v4"] } # Date and time libraries chrono = { version = "0.4.22", features = ["clock", "serde"], default-features = false } -chrono-tz = "0.7.0" -time = "0.3.16" +chrono-tz = "0.8.0" +time = "0.3.17" # Job scheduler job_scheduler_ng = "2.0.2" @@ -110,7 +110,7 @@ url = "2.3.1" # Email librariese-Base, Update crates and small change. lettre = { version = "0.10.1", features = ["smtp-transport", "builder", "serde", "tokio1-native-tls", "hostname", "tracing", "tokio1"], default-features = false } percent-encoding = "2.2.0" # URL encoding library used for URL's in the emails -email_address = "0.2.3" +email_address = "0.2.4" # Template library handlebars = { version = "4.3.5", features = ["dir_source"] } @@ -120,14 +120,14 @@ reqwest = { version = "0.11.12", features = ["stream", "json", "gzip", "brotli", # For favicon extraction from main website html5gum = "0.5.2" -regex = { version = "1.6.0", features = ["std", "perf", "unicode-perl"], default-features = false } +regex = { version = "1.7.0", features = ["std", "perf", "unicode-perl"], default-features = false } data-url = "0.2.0" bytes = "1.2.1" cached = "0.40.0" # Used for custom short lived cookie jar during favicon extraction cookie = "0.16.1" -cookie_store = "0.18.0" +cookie_store = "0.19.0" # Used by U2F, JWT and Postgres openssl = "0.10.42" @@ -147,7 +147,7 @@ semver = "1.0.14" # Allow overriding the default memory allocator # Mainly used for the musl builds, since the default musl malloc is very slow -mimalloc = { version = "0.1.30", features = ["secure"], default-features = false, optional = true } +mimalloc = { version = "0.1.31", features = ["secure"], default-features = false, optional = true } [patch.crates-io] # Using a patched version of multer-rs (Used by Rocket) to fix attachment/send file uploads diff --git a/docker/Dockerfile.j2 b/docker/Dockerfile.j2 @@ -3,22 +3,22 @@ # This file was generated using a Jinja2 template. # Please make your changes in `Dockerfile.j2` and then `make` the individual Dockerfiles. -{% set build_stage_base_image = "rust:1.64-bullseye" %} +{% set build_stage_base_image = "rust:1.65-bullseye" %} {% if "alpine" in target_file %} {% if "amd64" in target_file %} -{% set build_stage_base_image = "blackdex/rust-musl:x86_64-musl-stable-1.64.0" %} +{% set build_stage_base_image = "blackdex/rust-musl:x86_64-musl-stable-1.65.0" %} {% set runtime_stage_base_image = "alpine:3.16" %} {% set package_arch_target = "x86_64-unknown-linux-musl" %} {% elif "armv7" in target_file %} -{% set build_stage_base_image = "blackdex/rust-musl:armv7-musleabihf-stable-1.64.0" %} +{% set build_stage_base_image = "blackdex/rust-musl:armv7-musleabihf-stable-1.65.0" %} {% set runtime_stage_base_image = "balenalib/armv7hf-alpine:3.16" %} {% set package_arch_target = "armv7-unknown-linux-musleabihf" %} {% elif "armv6" in target_file %} -{% set build_stage_base_image = "blackdex/rust-musl:arm-musleabi-stable-1.64.0" %} +{% set build_stage_base_image = "blackdex/rust-musl:arm-musleabi-stable-1.65.0" %} {% set runtime_stage_base_image = "balenalib/rpi-alpine:3.16" %} {% set package_arch_target = "arm-unknown-linux-musleabi" %} {% elif "arm64" in target_file %} -{% set build_stage_base_image = "blackdex/rust-musl:aarch64-musl-stable-1.64.0" %} +{% set build_stage_base_image = "blackdex/rust-musl:aarch64-musl-stable-1.65.0" %} {% set runtime_stage_base_image = "balenalib/aarch64-alpine:3.16" %} {% set package_arch_target = "aarch64-unknown-linux-musl" %} {% endif %} diff --git a/docker/amd64/Dockerfile b/docker/amd64/Dockerfile @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM rust:1.64-bullseye as build +FROM rust:1.65-bullseye as build diff --git a/docker/amd64/Dockerfile.alpine b/docker/amd64/Dockerfile.alpine @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM blackdex/rust-musl:x86_64-musl-stable-1.64.0 as build +FROM blackdex/rust-musl:x86_64-musl-stable-1.65.0 as build diff --git a/docker/amd64/Dockerfile.buildx b/docker/amd64/Dockerfile.buildx @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM rust:1.64-bullseye as build +FROM rust:1.65-bullseye as build diff --git a/docker/amd64/Dockerfile.buildx.alpine b/docker/amd64/Dockerfile.buildx.alpine @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM blackdex/rust-musl:x86_64-musl-stable-1.64.0 as build +FROM blackdex/rust-musl:x86_64-musl-stable-1.65.0 as build diff --git a/docker/arm64/Dockerfile b/docker/arm64/Dockerfile @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM rust:1.64-bullseye as build +FROM rust:1.65-bullseye as build diff --git a/docker/arm64/Dockerfile.alpine b/docker/arm64/Dockerfile.alpine @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM blackdex/rust-musl:aarch64-musl-stable-1.64.0 as build +FROM blackdex/rust-musl:aarch64-musl-stable-1.65.0 as build diff --git a/docker/arm64/Dockerfile.buildx b/docker/arm64/Dockerfile.buildx @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM rust:1.64-bullseye as build +FROM rust:1.65-bullseye as build diff --git a/docker/arm64/Dockerfile.buildx.alpine b/docker/arm64/Dockerfile.buildx.alpine @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM blackdex/rust-musl:aarch64-musl-stable-1.64.0 as build +FROM blackdex/rust-musl:aarch64-musl-stable-1.65.0 as build diff --git a/docker/armv6/Dockerfile b/docker/armv6/Dockerfile @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM rust:1.64-bullseye as build +FROM rust:1.65-bullseye as build diff --git a/docker/armv6/Dockerfile.alpine b/docker/armv6/Dockerfile.alpine @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM blackdex/rust-musl:arm-musleabi-stable-1.64.0 as build +FROM blackdex/rust-musl:arm-musleabi-stable-1.65.0 as build diff --git a/docker/armv6/Dockerfile.buildx b/docker/armv6/Dockerfile.buildx @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM rust:1.64-bullseye as build +FROM rust:1.65-bullseye as build diff --git a/docker/armv6/Dockerfile.buildx.alpine b/docker/armv6/Dockerfile.buildx.alpine @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM blackdex/rust-musl:arm-musleabi-stable-1.64.0 as build +FROM blackdex/rust-musl:arm-musleabi-stable-1.65.0 as build diff --git a/docker/armv7/Dockerfile b/docker/armv7/Dockerfile @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM rust:1.64-bullseye as build +FROM rust:1.65-bullseye as build diff --git a/docker/armv7/Dockerfile.alpine b/docker/armv7/Dockerfile.alpine @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM blackdex/rust-musl:armv7-musleabihf-stable-1.64.0 as build +FROM blackdex/rust-musl:armv7-musleabihf-stable-1.65.0 as build diff --git a/docker/armv7/Dockerfile.buildx b/docker/armv7/Dockerfile.buildx @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM rust:1.64-bullseye as build +FROM rust:1.65-bullseye as build diff --git a/docker/armv7/Dockerfile.buildx.alpine b/docker/armv7/Dockerfile.buildx.alpine @@ -27,7 +27,7 @@ FROM vaultwarden/web-vault@sha256:85f5e0eaea73dfa14cfbdc64676ebbdd7aba5483ee5c1735e5eb82bd55b105f8 as vault ########################## BUILD IMAGE ########################## -FROM blackdex/rust-musl:armv7-musleabihf-stable-1.64.0 as build +FROM blackdex/rust-musl:armv7-musleabihf-stable-1.65.0 as build diff --git a/rust-toolchain b/rust-toolchain @@ -1 +1 @@ -1.64.0 +1.65.0 diff --git a/src/api/admin.rs b/src/api/admin.rs @@ -554,9 +554,9 @@ async fn diagnostics(_token: AdminToken, ip_header: IpHeader, mut conn: DbConn) // Get current running versions let web_vault_version: WebVaultVersion = - match std::fs::read_to_string(&format!("{}/{}", CONFIG.web_vault_folder(), "vw-version.json")) { + match std::fs::read_to_string(format!("{}/{}", CONFIG.web_vault_folder(), "vw-version.json")) { Ok(s) => serde_json::from_str(&s)?, - _ => match std::fs::read_to_string(&format!("{}/{}", CONFIG.web_vault_folder(), "version.json")) { + _ => match std::fs::read_to_string(format!("{}/{}", CONFIG.web_vault_folder(), "version.json")) { Ok(s) => serde_json::from_str(&s)?, _ => WebVaultVersion { version: String::from("Version file missing"), diff --git a/src/api/core/organizations.rs b/src/api/core/organizations.rs @@ -733,7 +733,7 @@ async fn bulk_reinvite_user( let mut bulk_response = Vec::new(); for org_user_id in data.Ids { let err_msg = match _reinvite_user(&org_id, &org_user_id, &headers.user.email, &mut conn).await { - Ok(_) => String::from(""), + Ok(_) => String::new(), Err(e) => format!("{:?}", e), }; @@ -892,7 +892,7 @@ async fn bulk_confirm_invite( let org_user_id = invite["Id"].as_str().unwrap_or_default(); let user_key = invite["Key"].as_str().unwrap_or_default(); let err_msg = match _confirm_invite(&org_id, org_user_id, user_key, &headers, &mut conn).await { - Ok(_) => String::from(""), + Ok(_) => String::new(), Err(e) => format!("{:?}", e), }; @@ -1110,7 +1110,7 @@ async fn bulk_delete_user( let mut bulk_response = Vec::new(); for org_user_id in data.Ids { let err_msg = match _delete_user(&org_id, &org_user_id, &headers, &mut conn).await { - Ok(_) => String::from(""), + Ok(_) => String::new(), Err(e) => format!("{:?}", e), }; @@ -1587,7 +1587,7 @@ async fn bulk_revoke_organization_user( for org_user_id in org_users { let org_user_id = org_user_id.as_str().unwrap_or_default(); let err_msg = match _revoke_organization_user(&org_id, org_user_id, &headers, &mut conn).await { - Ok(_) => String::from(""), + Ok(_) => String::new(), Err(e) => format!("{:?}", e), }; @@ -1686,7 +1686,7 @@ async fn bulk_restore_organization_user( for org_user_id in org_users { let org_user_id = org_user_id.as_str().unwrap_or_default(); let err_msg = match _restore_organization_user(&org_id, org_user_id, &headers, &mut conn).await { - Ok(_) => String::from(""), + Ok(_) => String::new(), Err(e) => format!("{:?}", e), }; diff --git a/src/api/icons.rs b/src/api/icons.rs @@ -520,7 +520,7 @@ async fn get_icon_url(domain: &str) -> Result<IconUrlResult, Error> { // Create the iconlist let mut iconlist: Vec<Icon> = Vec::new(); - let mut referer = String::from(""); + let mut referer = String::new(); if let Ok(content) = resp { // Extract the URL from the respose in case redirects occured (like @ gitlab.com) diff --git a/src/auth.rs b/src/auth.rs @@ -25,13 +25,13 @@ static JWT_ADMIN_ISSUER: Lazy<String> = Lazy::new(|| format!("{}|admin", CONFIG. static JWT_SEND_ISSUER: Lazy<String> = Lazy::new(|| format!("{}|send", CONFIG.domain_origin())); static PRIVATE_RSA_KEY_VEC: Lazy<Vec<u8>> = Lazy::new(|| { - std::fs::read(&CONFIG.private_rsa_key()).unwrap_or_else(|e| panic!("Error loading private RSA Key.\n{}", e)) + std::fs::read(CONFIG.private_rsa_key()).unwrap_or_else(|e| panic!("Error loading private RSA Key.\n{}", e)) }); static PRIVATE_RSA_KEY: Lazy<EncodingKey> = Lazy::new(|| { EncodingKey::from_rsa_pem(&PRIVATE_RSA_KEY_VEC).unwrap_or_else(|e| panic!("Error decoding private RSA Key.\n{}", e)) }); static PUBLIC_RSA_KEY_VEC: Lazy<Vec<u8>> = Lazy::new(|| { - std::fs::read(&CONFIG.public_rsa_key()).unwrap_or_else(|e| panic!("Error loading public RSA Key.\n{}", e)) + std::fs::read(CONFIG.public_rsa_key()).unwrap_or_else(|e| panic!("Error loading public RSA Key.\n{}", e)) }); static PUBLIC_RSA_KEY: Lazy<DecodingKey> = Lazy::new(|| { DecodingKey::from_rsa_pem(&PUBLIC_RSA_KEY_VEC).unwrap_or_else(|e| panic!("Error decoding public RSA Key.\n{}", e)) diff --git a/src/config.rs b/src/config.rs @@ -425,10 +425,10 @@ make_config! { /// If signups require email verification, limit how many emails are automatically sent when login is attempted (0 means no limit) signups_verify_resend_limit: u32, true, def, 6; /// Email domain whitelist |> Allow signups only from this list of comma-separated domains, even when signups are otherwise disabled - signups_domains_whitelist: String, true, def, "".to_string(); + signups_domains_whitelist: String, true, def, String::new(); /// Org creation users |> Allow org creation only by this list of comma-separated user emails. /// Blank or 'all' means all users can create orgs; 'none' means no users can create orgs. - org_creation_users: String, true, def, "".to_string(); + org_creation_users: String, true, def, String::new(); /// Allow invitations |> Controls whether users can be invited by organization admins, even when signups are otherwise disabled invitations_allowed: bool, true, def, true; /// Invitation token expiration time (in hours) |> The number of hours after which an organization invite token, emergency access invite token, @@ -530,7 +530,7 @@ make_config! { database_max_conns: u32, false, def, 10; /// Database connection init |> SQL statements to run when creating a new database connection, mainly useful for connection-scoped pragmas. If empty, a database-specific default is used. - database_conn_init: String, false, def, "".to_string(); + database_conn_init: String, false, def, String::new(); /// Bypass admin page security (Know the risks!) |> Disables the Admin Token for the admin page so you may use your own auth in-front disable_admin_token: bool, true, def, false; @@ -796,7 +796,7 @@ fn generate_smtp_img_src(embed_images: bool, domain: &str) -> String { /// This will be used within icons.rs to call the external icon service. fn generate_icon_service_url(icon_service: &str) -> String { match icon_service { - "internal" => "".to_string(), + "internal" => String::new(), "bitwarden" => "https://icons.bitwarden.net/{}/icon.png".to_string(), "duckduckgo" => "https://icons.duckduckgo.com/ip3/{}.ico".to_string(), "google" => "https://www.google.com/s2/favicons?domain={}&sz=32".to_string(), @@ -810,7 +810,7 @@ fn generate_icon_service_csp(icon_service: &str, icon_service_url: &str) -> Stri // Everything up until the first '{' should be fixed and can be used as an CSP string. let csp_string = match icon_service_url.split_once('{') { Some((c, _)) => c.to_string(), - None => "".to_string(), + None => String::new(), }; // Because Google does a second redirect to there gstatic.com domain, we need to add an extra csp string. diff --git a/src/db/mod.rs b/src/db/mod.rs @@ -228,8 +228,8 @@ impl DbConnType { pub fn default_init_stmts(&self) -> String { match self { Self::sqlite => "PRAGMA busy_timeout = 5000; PRAGMA synchronous = NORMAL;".to_string(), - Self::mysql => "".to_string(), - Self::postgresql => "".to_string(), + Self::mysql => String::new(), + Self::postgresql => String::new(), } } } diff --git a/src/main.rs b/src/main.rs @@ -12,9 +12,13 @@ clippy::equatable_if_let, clippy::float_cmp_const, clippy::inefficient_to_string, + clippy::iter_on_empty_collections, + clippy::iter_on_single_items, clippy::linkedlist, clippy::macro_use_imports, clippy::manual_assert, + clippy::manual_instant_elapsed, + clippy::manual_string_new, clippy::match_wildcard_for_single_variants, clippy::mem_forget, clippy::string_add_assign, diff --git a/src/util.rs b/src/util.rs @@ -109,7 +109,7 @@ impl Cors { fn get_header(headers: &HeaderMap<'_>, name: &str) -> String { match headers.get_one(name) { Some(h) => h.to_string(), - _ => "".to_string(), + _ => String::new(), } }