From a41625e886e85c0594541c28ee67dddbc9a0c968 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 09:44:58 -0400 Subject: [PATCH 01/77] [deps]: Update gh minor (#1010) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build-android.yml | 4 ++-- .github/workflows/build-cli.yml | 12 ++++++------ .github/workflows/build-cpp.yml | 2 +- .github/workflows/build-dotnet.yml | 2 +- .github/workflows/build-napi.yml | 2 +- .github/workflows/build-python-wheels.yml | 8 ++++---- .github/workflows/build-rust-cross-platform.yml | 2 +- .github/workflows/build-wasm.yml | 2 +- .github/workflows/generate_schemas.yml | 16 ++++++++-------- .github/workflows/lint.yml | 2 +- .github/workflows/publish-java.yml | 2 +- .github/workflows/publish-python.yml | 2 +- .github/workflows/publish-ruby.yml | 2 +- .github/workflows/scan.yml | 2 +- 14 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index 9de6883f5..909e689c4 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -46,7 +46,7 @@ jobs: run: cross build -p bitwarden-uniffi --release --target=${{ matrix.settings.target }} - name: Upload artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: android-${{ matrix.settings.target }} path: ./target/${{ matrix.settings.target }}/release/libbitwarden_uniffi.so @@ -102,7 +102,7 @@ jobs: run: ./build-schemas.sh - name: Setup gradle - uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 + uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4.0.1 - name: Publish run: ./gradlew sdk:publish diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 6dd683142..7620ced50 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -123,7 +123,7 @@ jobs: run: 7z a ./bws-${{ matrix.settings.target }}-%_PACKAGE_VERSION%.zip ./target/${{ matrix.settings.target }}/release/bws.exe - name: Upload artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip path: ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip @@ -233,7 +233,7 @@ jobs: xcrun notarytool submit ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip --keychain-profile "notarytool-profile" --wait - name: Upload artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip path: ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip @@ -292,7 +292,7 @@ jobs: run: zip -j ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip ./target/${{ matrix.settings.target }}/release/bws - name: Upload artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip path: ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip @@ -397,7 +397,7 @@ jobs: xcrun notarytool submit ./bws-macos-universal-${{ env._PACKAGE_VERSION }}.zip --keychain-profile "notarytool-profile" --wait - name: Upload artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: bws-macos-universal-${{ env._PACKAGE_VERSION }}.zip path: ./bws-macos-universal-${{ env._PACKAGE_VERSION }}.zip @@ -432,7 +432,7 @@ jobs: sed -i.bak 's/\$NAME\$/Bitwarden Secrets Manager CLI/g' THIRDPARTY.html - name: Upload artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: THIRDPARTY.html path: ./crates/bws/THIRDPARTY.html @@ -464,7 +464,7 @@ jobs: mv $OUT_DIR/manpages . - name: Upload artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: manpages path: ./manpages/* diff --git a/.github/workflows/build-cpp.yml b/.github/workflows/build-cpp.yml index d26d22254..e95e6cbf2 100644 --- a/.github/workflows/build-cpp.yml +++ b/.github/workflows/build-cpp.yml @@ -159,7 +159,7 @@ jobs: cp libBitwardenClient.* artifacts - name: Upload C++ package for ${{ matrix.settings.target }} - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: libbitwarden_cpp-${{ matrix.settings.target }} path: languages/cpp/build/artifacts diff --git a/.github/workflows/build-dotnet.yml b/.github/workflows/build-dotnet.yml index cd6441d77..97d43dfbe 100644 --- a/.github/workflows/build-dotnet.yml +++ b/.github/workflows/build-dotnet.yml @@ -92,7 +92,7 @@ jobs: working-directory: languages/csharp/Bitwarden.Sdk - name: Upload NuGet package - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: Bitwarden.Sdk.${{ needs.version.outputs.version }}.nupkg path: | diff --git a/.github/workflows/build-napi.yml b/.github/workflows/build-napi.yml index 5ad1ebd54..e950b5e7a 100644 --- a/.github/workflows/build-napi.yml +++ b/.github/workflows/build-napi.yml @@ -84,7 +84,7 @@ jobs: run: ${{ matrix.settings.build }} - name: Upload artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: sdk-bitwarden-napi-${{ matrix.settings.target }} path: ${{ github.workspace }}/crates/bitwarden-napi/sdk-napi.*.node diff --git a/.github/workflows/build-python-wheels.yml b/.github/workflows/build-python-wheels.yml index 0f9e2d8bf..943177d69 100644 --- a/.github/workflows/build-python-wheels.yml +++ b/.github/workflows/build-python-wheels.yml @@ -89,7 +89,7 @@ jobs: - name: Build wheels if: ${{ matrix.settings.target != 'x86_64-unknown-linux-gnu' }} - uses: PyO3/maturin-action@52b28abb0c6729beb388babfc348bf6ff5aaff31 # v1.42.2 + uses: PyO3/maturin-action@2c5c1560848aaa364c3545136054932db5fa27b7 # v1.44.0 with: target: ${{ matrix.settings.target }} args: --release --find-interpreter --sdist @@ -99,7 +99,7 @@ jobs: - name: Build wheels (Linux - x86_64) if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }} - uses: PyO3/maturin-action@52b28abb0c6729beb388babfc348bf6ff5aaff31 # v1.42.2 + uses: PyO3/maturin-action@2c5c1560848aaa364c3545136054932db5fa27b7 # v1.44.0 with: target: ${{ matrix.settings.target }} args: --release --find-interpreter --sdist @@ -109,14 +109,14 @@ jobs: working-directory: ${{ github.workspace }}/languages/python - name: Upload wheels - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: bitwarden_sdk-${{ env._PACKAGE_VERSION }}-${{ matrix.settings.target }} path: ${{ github.workspace }}/target/wheels/bitwarden_sdk*.whl - name: Upload sdists if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }} # we only need one sdist - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: bitwarden_sdk-${{ env._PACKAGE_VERSION }}-sdist path: ${{ github.workspace }}/target/wheels/bitwarden_sdk-*.tar.gz diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index 92ed526f2..31347a9a9 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -70,7 +70,7 @@ jobs: run: cargo build -p bitwarden-c --target ${{ matrix.settings.target }} --release - name: Upload Artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: libbitwarden_c_files-${{ matrix.settings.target }} path: | diff --git a/.github/workflows/build-wasm.yml b/.github/workflows/build-wasm.yml index 62be51d79..c2c79d3ad 100644 --- a/.github/workflows/build-wasm.yml +++ b/.github/workflows/build-wasm.yml @@ -52,7 +52,7 @@ jobs: run: ./build.sh -r - name: Upload artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: sdk-bitwarden-wasm path: ${{ github.workspace }}/languages/js/wasm/* diff --git a/.github/workflows/generate_schemas.yml b/.github/workflows/generate_schemas.yml index 87f4dd988..9f3e6743c 100644 --- a/.github/workflows/generate_schemas.yml +++ b/.github/workflows/generate_schemas.yml @@ -43,55 +43,55 @@ jobs: run: npm run schemas - name: Upload ts schemas artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: schemas.ts path: ${{ github.workspace }}/languages/js/sdk-client/src/schemas.ts if-no-files-found: error - name: Upload c# schemas artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: schemas.cs path: ${{ github.workspace }}/languages/csharp/Bitwarden.Sdk/schemas.cs if-no-files-found: error - name: Upload python schemas artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: schemas.py path: ${{ github.workspace }}/languages/python/bitwarden_sdk/schemas.py if-no-files-found: error - name: Upload ruby schemas artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: schemas.rb path: ${{ github.workspace }}/languages/ruby/bitwarden_sdk_secrets/lib/schemas.rb if-no-files-found: error - name: Upload json schemas artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: sdk-schemas-json path: ${{ github.workspace }}/support/schemas/* if-no-files-found: error - name: Upload Go schemas artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: schemas.go path: ${{ github.workspace }}/languages/go/schema.go - name: Upload java schemas artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: sdk-schemas-java path: ${{ github.workspace }}/languages/java/src/main/java/com/bitwarden/sdk/schema/* if-no-files-found: error - name: Upload cpp schemas artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: sdk-schemas-cpp path: ${{ github.workspace }}/languages/cpp/include/schemas.hpp diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 761c564cd..686b5775a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -45,7 +45,7 @@ jobs: RUSTFLAGS: "-D warnings" - name: Upload Clippy results to GitHub - uses: github/codeql-action/upload-sarif@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # v3.26.5 + uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 with: sarif_file: clippy_result.sarif diff --git a/.github/workflows/publish-java.yml b/.github/workflows/publish-java.yml index c50080728..fdf0be986 100644 --- a/.github/workflows/publish-java.yml +++ b/.github/workflows/publish-java.yml @@ -70,7 +70,7 @@ jobs: java-version: 17 - name: Setup Gradle - uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 + uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4.0.1 - name: Publish package to GitHub Packages if: ${{ inputs.release_type != 'Dry Run' }} diff --git a/.github/workflows/publish-python.yml b/.github/workflows/publish-python.yml index 343fadd8a..3a9c08aac 100644 --- a/.github/workflows/publish-python.yml +++ b/.github/workflows/publish-python.yml @@ -42,7 +42,7 @@ jobs: needs: setup steps: - name: Install Python - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 + uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 with: python-version: "3.9" diff --git a/.github/workflows/publish-ruby.yml b/.github/workflows/publish-ruby.yml index 6dd3e4064..9e2fc6d93 100644 --- a/.github/workflows/publish-ruby.yml +++ b/.github/workflows/publish-ruby.yml @@ -44,7 +44,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Set up Ruby - uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0 + uses: ruby/setup-ruby@52753b7da854d5c07df37391a986c76ab4615999 # v1.191.0 with: ruby-version: 3.2 diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml index 2df3b61b7..ae4a1913d 100644 --- a/.github/workflows/scan.yml +++ b/.github/workflows/scan.yml @@ -46,7 +46,7 @@ jobs: --output-path . ${{ env.INCREMENTAL }} - name: Upload Checkmarx results to GitHub - uses: github/codeql-action/upload-sarif@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # v3.26.5 + uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 with: sarif_file: cx_result.sarif From 7ee604f9a01cb6d3c4ea18d7048151ff4ececfbe Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:23:22 -0400 Subject: [PATCH 02/77] [deps]: Update sonarsource/sonarcloud-github-action action to v3 (#1012) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml index ae4a1913d..5595316de 100644 --- a/.github/workflows/scan.yml +++ b/.github/workflows/scan.yml @@ -66,7 +66,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: Scan with SonarCloud - uses: sonarsource/sonarcloud-github-action@e44258b109568baa0df60ed515909fc6c72cba92 # v2.3.0 + uses: sonarsource/sonarcloud-github-action@eb211723266fe8e83102bac7361f0a05c3ac1d1b # v3.0.0 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 80a7d84d2f6fd1679af8d2522e5c33d0f7a901f2 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Thu, 5 Sep 2024 12:01:04 +0200 Subject: [PATCH 03/77] Add explicit error about invalid private key (#1020) Add an explicit error about private key being invalid. --- .../bitwarden-core/src/auth/auth_request.rs | 6 +++-- .../src/client/encryption_settings.rs | 22 ++++++++++++++++--- crates/bitwarden-core/src/client/internal.rs | 18 ++++++++------- crates/bitwarden-core/src/error.rs | 7 ++++++ .../src/mobile/client_crypto.rs | 7 ++++-- crates/bitwarden-core/src/mobile/crypto.rs | 7 ++++-- crates/bitwarden-uniffi/src/crypto.rs | 17 ++++++++++---- 7 files changed, 63 insertions(+), 21 deletions(-) diff --git a/crates/bitwarden-core/src/auth/auth_request.rs b/crates/bitwarden-core/src/auth/auth_request.rs index dc9be1b90..1d6ce1802 100644 --- a/crates/bitwarden-core/src/auth/auth_request.rs +++ b/crates/bitwarden-core/src/auth/auth_request.rs @@ -6,6 +6,8 @@ use bitwarden_crypto::{ #[cfg(feature = "internal")] use bitwarden_crypto::{EncString, KeyDecryptable, SymmetricCryptoKey}; +#[cfg(feature = "internal")] +use crate::client::encryption_settings::EncryptionSettingsError; use crate::{error::Error, Client}; #[cfg_attr(feature = "uniffi", derive(uniffi::Record))] @@ -49,7 +51,7 @@ pub(crate) fn new_auth_request(email: &str) -> Result Result { +) -> Result { let key = AsymmetricCryptoKey::from_der(&STANDARD.decode(private_key)?)?; let mut key: Vec = user_key.decrypt_with_key(&key)?; @@ -62,7 +64,7 @@ pub(crate) fn auth_request_decrypt_master_key( private_key: String, master_key: AsymmetricEncString, user_key: EncString, -) -> Result { +) -> Result { use bitwarden_crypto::MasterKey; let key = AsymmetricCryptoKey::from_der(&STANDARD.decode(private_key)?)?; diff --git a/crates/bitwarden-core/src/client/encryption_settings.rs b/crates/bitwarden-core/src/client/encryption_settings.rs index 828a97139..41bd07dcf 100644 --- a/crates/bitwarden-core/src/client/encryption_settings.rs +++ b/crates/bitwarden-core/src/client/encryption_settings.rs @@ -3,11 +3,24 @@ use std::collections::HashMap; use bitwarden_crypto::{AsymmetricCryptoKey, CryptoError, KeyContainer, SymmetricCryptoKey}; #[cfg(feature = "internal")] use bitwarden_crypto::{AsymmetricEncString, EncString, MasterKey}; +use thiserror::Error; use uuid::Uuid; #[cfg(feature = "internal")] use crate::error::Result; +#[derive(Debug, Error)] +pub enum EncryptionSettingsError { + #[error("Cryptography error, {0}")] + Crypto(#[from] bitwarden_crypto::CryptoError), + + #[error(transparent)] + InvalidBase64(#[from] base64::DecodeError), + + #[error("Invalid private key")] + InvalidPrivateKey, +} + #[derive(Clone)] pub struct EncryptionSettings { user_key: SymmetricCryptoKey, @@ -28,7 +41,7 @@ impl EncryptionSettings { master_key: MasterKey, user_key: EncString, private_key: EncString, - ) -> Result { + ) -> Result { // Decrypt the user key let user_key = master_key.decrypt_user_key(user_key)?; Self::new_decrypted_key(user_key, private_key) @@ -42,12 +55,15 @@ impl EncryptionSettings { pub(crate) fn new_decrypted_key( user_key: SymmetricCryptoKey, private_key: EncString, - ) -> Result { + ) -> Result { use bitwarden_crypto::KeyDecryptable; let private_key = { let dec: Vec = private_key.decrypt_with_key(&user_key)?; - Some(AsymmetricCryptoKey::from_der(&dec)?) + Some( + AsymmetricCryptoKey::from_der(&dec) + .map_err(|_| EncryptionSettingsError::InvalidPrivateKey)?, + ) }; Ok(EncryptionSettings { diff --git a/crates/bitwarden-core/src/client/internal.rs b/crates/bitwarden-core/src/client/internal.rs index 199e35459..76951969c 100644 --- a/crates/bitwarden-core/src/client/internal.rs +++ b/crates/bitwarden-core/src/client/internal.rs @@ -9,16 +9,18 @@ use uuid::Uuid; #[cfg(feature = "secrets")] use super::login_method::ServiceAccountLoginMethod; -use super::{encryption_settings::EncryptionSettings, login_method::LoginMethod}; -#[cfg(feature = "internal")] -use super::{flags::Flags, login_method::UserLoginMethod}; -#[cfg(feature = "internal")] -use crate::error::Error; use crate::{ auth::renew::renew_token, + client::{encryption_settings::EncryptionSettings, login_method::LoginMethod}, error::{Result, VaultLocked}, DeviceType, }; +#[cfg(feature = "internal")] +use crate::{ + client::encryption_settings::EncryptionSettingsError, + client::{flags::Flags, login_method::UserLoginMethod}, + error::Error, +}; #[derive(Debug, Clone)] pub struct ApiConfigurations { @@ -179,7 +181,7 @@ impl InternalClient { master_key: MasterKey, user_key: EncString, private_key: EncString, - ) -> Result<()> { + ) -> Result<(), EncryptionSettingsError> { *self .encryption_settings .write() @@ -197,7 +199,7 @@ impl InternalClient { &self, user_key: SymmetricCryptoKey, private_key: EncString, - ) -> Result<()> { + ) -> Result<(), EncryptionSettingsError> { *self .encryption_settings .write() @@ -214,7 +216,7 @@ impl InternalClient { pin_key: PinKey, pin_protected_user_key: EncString, private_key: EncString, - ) -> Result<()> { + ) -> Result<(), EncryptionSettingsError> { let decrypted_user_key = pin_key.decrypt_user_key(pin_protected_user_key)?; self.initialize_user_crypto_decrypted_key(decrypted_user_key, private_key) } diff --git a/crates/bitwarden-core/src/error.rs b/crates/bitwarden-core/src/error.rs index 300aba452..697ca6c99 100644 --- a/crates/bitwarden-core/src/error.rs +++ b/crates/bitwarden-core/src/error.rs @@ -9,6 +9,9 @@ use reqwest::StatusCode; use thiserror::Error; use validator::ValidationErrors; +#[cfg(feature = "internal")] +use crate::client::encryption_settings::EncryptionSettingsError; + #[derive(Debug, Error)] pub enum Error { #[error(transparent)] @@ -56,6 +59,10 @@ pub enum Error { #[error("Internal error: {0}")] Internal(Cow<'static, str>), + + #[cfg(feature = "internal")] + #[error(transparent)] + EncryptionSettings(#[from] EncryptionSettingsError), } impl From for Error { diff --git a/crates/bitwarden-core/src/mobile/client_crypto.rs b/crates/bitwarden-core/src/mobile/client_crypto.rs index 293b8f9b3..4c9a4c6a4 100644 --- a/crates/bitwarden-core/src/mobile/client_crypto.rs +++ b/crates/bitwarden-core/src/mobile/client_crypto.rs @@ -2,7 +2,7 @@ use bitwarden_crypto::{AsymmetricEncString, EncString}; use super::crypto::{derive_key_connector, DeriveKeyConnectorRequest}; -use crate::Client; +use crate::{client::encryption_settings::EncryptionSettingsError, Client}; #[cfg(feature = "internal")] use crate::{ error::Result, @@ -18,7 +18,10 @@ pub struct ClientCrypto<'a> { } impl<'a> ClientCrypto<'a> { - pub async fn initialize_user_crypto(&self, req: InitUserCryptoRequest) -> Result<()> { + pub async fn initialize_user_crypto( + &self, + req: InitUserCryptoRequest, + ) -> Result<(), EncryptionSettingsError> { initialize_user_crypto(self.client, req).await } diff --git a/crates/bitwarden-core/src/mobile/crypto.rs b/crates/bitwarden-core/src/mobile/crypto.rs index 15ddeb9b7..a9fde51df 100644 --- a/crates/bitwarden-core/src/mobile/crypto.rs +++ b/crates/bitwarden-core/src/mobile/crypto.rs @@ -8,7 +8,7 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::{ - client::{LoginMethod, UserLoginMethod}, + client::{encryption_settings::EncryptionSettingsError, LoginMethod, UserLoginMethod}, error::{Error, Result}, Client, }; @@ -86,7 +86,10 @@ pub enum AuthRequestMethod { }, } -pub async fn initialize_user_crypto(client: &Client, req: InitUserCryptoRequest) -> Result<()> { +pub async fn initialize_user_crypto( + client: &Client, + req: InitUserCryptoRequest, +) -> Result<(), EncryptionSettingsError> { use bitwarden_crypto::{DeviceKey, PinKey}; use crate::auth::{auth_request_decrypt_master_key, auth_request_decrypt_user_key}; diff --git a/crates/bitwarden-uniffi/src/crypto.rs b/crates/bitwarden-uniffi/src/crypto.rs index 8a089404a..37d14c896 100644 --- a/crates/bitwarden-uniffi/src/crypto.rs +++ b/crates/bitwarden-uniffi/src/crypto.rs @@ -1,8 +1,11 @@ use std::sync::Arc; -use bitwarden::mobile::crypto::{ - DeriveKeyConnectorRequest, DerivePinKeyResponse, InitOrgCryptoRequest, InitUserCryptoRequest, - UpdatePasswordResponse, +use bitwarden::{ + mobile::crypto::{ + DeriveKeyConnectorRequest, DerivePinKeyResponse, InitOrgCryptoRequest, + InitUserCryptoRequest, UpdatePasswordResponse, + }, + Error, }; use bitwarden_crypto::{AsymmetricEncString, EncString}; @@ -16,7 +19,13 @@ impl ClientCrypto { /// Initialization method for the user crypto. Needs to be called before any other crypto /// operations. pub async fn initialize_user_crypto(&self, req: InitUserCryptoRequest) -> Result<()> { - Ok(self.0 .0.crypto().initialize_user_crypto(req).await?) + Ok(self + .0 + .0 + .crypto() + .initialize_user_crypto(req) + .await + .map_err(Error::EncryptionSettings)?) } /// Initialization method for the organization crypto. Needs to be called after From 3930d5e50140daadc790a794b2371b11cdee02be Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Thu, 5 Sep 2024 07:08:14 -0400 Subject: [PATCH 04/77] BRE-289 - Fix Publish Python SDK workflow (#1018) --- .github/workflows/publish-python.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-python.yml b/.github/workflows/publish-python.yml index 3a9c08aac..ef30d6598 100644 --- a/.github/workflows/publish-python.yml +++ b/.github/workflows/publish-python.yml @@ -27,7 +27,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Branch check - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} run: | if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then echo "===================================" @@ -50,12 +50,12 @@ jobs: run: pip install twine - name: Download artifacts - uses: bitwarden/gh-actions/download-artifacts@main + uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6 with: workflow: build-python-wheels.yml path: ${{ github.workspace }}/target/wheels/dist workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} name: bitwarden_sdk(.*) name_is_regexp: true @@ -83,7 +83,7 @@ jobs: run: twine check dist/* - name: Publish - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} working-directory: ${{ github.workspace }}/target/wheels env: TWINE_USERNAME: __token__ @@ -91,7 +91,7 @@ jobs: run: twine upload --repository pypi dist/* - name: Dry Run - Publish - if: ${{ github.event.inputs.release_type == 'Dry Run' }} + if: ${{ inputs.release_type == 'Dry Run' }} working-directory: ${{ github.workspace }}/target/wheels env: TWINE_USERNAME: __token__ From 4c651b7831c85527f51eb1d57a53117e6b09db88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ch=C4=99ci=C5=84ski?= Date: Thu, 5 Sep 2024 15:25:54 +0200 Subject: [PATCH 05/77] Fix swift release (#1022) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking ## 📔 Objective Fix SWIFT release commit SHA and artifact upload to GitHub release. ## 📸 Screenshots ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .github/workflows/release-swift.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index dcae5b5d2..bb64dc944 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -82,7 +82,7 @@ jobs: - name: Set SHA id: set-sha run: | - echo "sha=$(${{ steps.download-artifact.outputs.artifact-build-commit }})" >> $GITHUB_OUTPUT + echo "sha=${{ steps.download-artifact.outputs.artifact-build-commit }}" >> $GITHUB_OUTPUT echo "short_sha=$(echo ${{ steps.download-artifact.outputs.artifact-build-commit }} | cut -c1-7)" >> $GITHUB_OUTPUT - name: Set release name @@ -243,5 +243,5 @@ jobs: draft: false repo: sdk-swift owner: bitwarden - artifacts: "BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework" + artifacts: "BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework.zip" prerelease: ${{ inputs.pre-release }} From 3065a03c8703c6c6f6f743a1ef37f3526c2d404d Mon Sep 17 00:00:00 2001 From: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com> Date: Thu, 5 Sep 2024 09:34:44 -0400 Subject: [PATCH 06/77] Bump version to 1.0.0 (#1023) ## Type of change - [ ] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [X] Other ## Objective Automated go-sdk version bump to 1.0.0 --- languages/go/.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/go/.version b/languages/go/.version index 6da28dde7..afaf360d3 100644 --- a/languages/go/.version +++ b/languages/go/.version @@ -1 +1 @@ -0.1.1 \ No newline at end of file +1.0.0 \ No newline at end of file From 6d4f952b7ab63cd67f3933f1c42bf6acae222890 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Thu, 5 Sep 2024 18:47:09 +0200 Subject: [PATCH 07/77] Temporarily disable private key validation (#1024) --- .../src/client/encryption_settings.rs | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/crates/bitwarden-core/src/client/encryption_settings.rs b/crates/bitwarden-core/src/client/encryption_settings.rs index 41bd07dcf..0df1bd90b 100644 --- a/crates/bitwarden-core/src/client/encryption_settings.rs +++ b/crates/bitwarden-core/src/client/encryption_settings.rs @@ -57,13 +57,23 @@ impl EncryptionSettings { private_key: EncString, ) -> Result { use bitwarden_crypto::KeyDecryptable; + use log::warn; let private_key = { let dec: Vec = private_key.decrypt_with_key(&user_key)?; - Some( - AsymmetricCryptoKey::from_der(&dec) - .map_err(|_| EncryptionSettingsError::InvalidPrivateKey)?, - ) + + // FIXME: [PM-11690] - Temporarily ignore invalid private keys until we have a recovery + // process in place. + AsymmetricCryptoKey::from_der(&dec) + .map_err(|_| { + warn!("Invalid private key"); + }) + .ok() + + // Some( + // AsymmetricCryptoKey::from_der(&dec) + // .map_err(|_| EncryptionSettingsError::InvalidPrivateKey)?, + // ) }; Ok(EncryptionSettings { @@ -93,12 +103,17 @@ impl EncryptionSettings { use crate::VaultLocked; - let private_key = self.private_key.as_ref().ok_or(VaultLocked)?; - // Make sure we only keep the keys given in the arguments and not any of the previous // ones, which might be from organizations that the user is no longer a part of anymore self.org_keys.clear(); + // FIXME: [PM-11690] - Early abort to handle private key being corrupt + if org_enc_keys.is_empty() { + return Ok(self); + } + + let private_key = self.private_key.as_ref().ok_or(VaultLocked)?; + // Decrypt the org keys with the private key for (org_id, org_enc_key) in org_enc_keys { let mut dec: Vec = org_enc_key.decrypt_with_key(private_key)?; From 4238faf6ce9cf6608ca43069e6218b31cb7a4551 Mon Sep 17 00:00:00 2001 From: Colton Hurst Date: Thu, 5 Sep 2024 20:54:59 -0400 Subject: [PATCH 08/77] [SM-1431] Update rustls-platform-verifier (#1017) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/SM-1431 ## 📔 Objective Follow-up to: https://github.com/bitwarden/sdk/pull/990 ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- Cargo.lock | 2 -- crates/bitwarden-core/Cargo.toml | 10 ++-------- crates/bitwarden-core/src/client/client.rs | 4 ++-- crates/bitwarden-uniffi/Cargo.toml | 2 +- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 885aad0cb..9becb26f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1999,7 +1999,6 @@ dependencies = [ "hyper", "hyper-util", "rustls", - "rustls-native-certs", "rustls-pki-types", "tokio", "tokio-rustls", @@ -3191,7 +3190,6 @@ dependencies = [ "pin-project-lite", "quinn", "rustls", - "rustls-native-certs", "rustls-pemfile", "rustls-pki-types", "serde", diff --git a/crates/bitwarden-core/Cargo.toml b/crates/bitwarden-core/Cargo.toml index bb7a9b15e..7059e26c3 100644 --- a/crates/bitwarden-core/Cargo.toml +++ b/crates/bitwarden-core/Cargo.toml @@ -54,19 +54,13 @@ validator = { version = "0.18.1", features = ["derive"] } zeroize = { version = ">=1.7.0, <2.0", features = ["derive", "aarch64"] } zxcvbn = { version = ">=3.0.1, <4.0", optional = true } -[target.'cfg(all(not(target_arch="wasm32"), not(windows)))'.dependencies] +[target.'cfg(not(target_arch="wasm32"))'.dependencies] # By default, we use rustls as the TLS stack and rust-platform-verifier to support user-installed root certificates # The only exception is WASM, as it just uses the browsers/node fetch reqwest = { version = ">=0.12.5, <0.13", features = [ "rustls-tls-manual-roots", ], default-features = false } -rustls-platform-verifier = "0.3.3" - -[target.'cfg(windows)'.dependencies] -# We are having issues with rustls-platform-verifier on Windows GitHub runners -reqwest = { version = ">=0.12.5, <0.13", features = [ - "rustls-tls-native-roots", -], default-features = false } +rustls-platform-verifier = "0.3.4" [dev-dependencies] bitwarden-crypto = { workspace = true } diff --git a/crates/bitwarden-core/src/client/client.rs b/crates/bitwarden-core/src/client/client.rs index 5f73fcd8a..b9bf4c516 100644 --- a/crates/bitwarden-core/src/client/client.rs +++ b/crates/bitwarden-core/src/client/client.rs @@ -25,7 +25,7 @@ impl Client { #[allow(unused_mut)] let mut client_builder = reqwest::Client::builder(); - #[cfg(all(not(target_arch = "wasm32"), not(windows)))] + #[cfg(not(target_arch = "wasm32"))] { client_builder = client_builder.use_preconfigured_tls(rustls_platform_verifier::tls_config()); @@ -86,7 +86,7 @@ impl Client { #[cfg(test)] mod tests { - #[cfg(all(not(target_arch = "wasm32"), not(windows)))] + #[cfg(not(target_arch = "wasm32"))] #[test] fn test_reqwest_rustls_platform_verifier_are_compatible() { // rustls-platform-verifier is generating a rustls::ClientConfig, diff --git a/crates/bitwarden-uniffi/Cargo.toml b/crates/bitwarden-uniffi/Cargo.toml index 414948d4d..5737d3559 100644 --- a/crates/bitwarden-uniffi/Cargo.toml +++ b/crates/bitwarden-uniffi/Cargo.toml @@ -44,7 +44,7 @@ android_logger = "0.14" # The use of rustls-platform-verifier requires some extra support to communicate with the Android platform jni = ">=0.19, <0.20" libloading = ">=0.8.1, <0.9" -rustls-platform-verifier = "0.3.3" +rustls-platform-verifier = "0.3.4" [target.'cfg(target_os = "ios")'.dependencies] oslog = "0.2.0" From fdb4308408151defad693bff3253f536baf9da5e Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 6 Sep 2024 10:13:00 +0200 Subject: [PATCH 09/77] Exclude bitwarden-napo from tests (#1025) Napi broke tests for some reason, this seems unrelated to the code changes as I now get the same error on older branches. I believe this is related to the recent runner image update on github. --- .github/workflows/rust-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust-test.yml b/.github/workflows/rust-test.yml index 514e2a310..8d8b136b2 100644 --- a/.github/workflows/rust-test.yml +++ b/.github/workflows/rust-test.yml @@ -47,7 +47,8 @@ jobs: uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - name: Test - run: cargo test --all-features + # Termporarily exclude NAPI due to a test error on windows + run: cargo test --workspace --exclude bitwarden-napi --all-features coverage: name: Coverage From 59cee6ee206ff97a58b0102195c0b0a81e6bf67d Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 6 Sep 2024 12:17:19 +0200 Subject: [PATCH 10/77] Add explicit error for no private key (#1026) Follow up to #1024, which improves the error message when missing a private key. --- .../src/client/encryption_settings.rs | 16 ++++++++++++---- crates/bitwarden-core/src/client/internal.rs | 2 +- .../bitwarden-core/src/mobile/client_crypto.rs | 5 ++++- crates/bitwarden-core/src/mobile/crypto.rs | 5 ++++- crates/bitwarden-uniffi/src/crypto.rs | 8 +++++++- crates/bitwarden-vault/src/sync.rs | 5 ++++- 6 files changed, 32 insertions(+), 9 deletions(-) diff --git a/crates/bitwarden-core/src/client/encryption_settings.rs b/crates/bitwarden-core/src/client/encryption_settings.rs index 0df1bd90b..9d9549021 100644 --- a/crates/bitwarden-core/src/client/encryption_settings.rs +++ b/crates/bitwarden-core/src/client/encryption_settings.rs @@ -8,6 +8,7 @@ use uuid::Uuid; #[cfg(feature = "internal")] use crate::error::Result; +use crate::VaultLocked; #[derive(Debug, Error)] pub enum EncryptionSettingsError { @@ -17,8 +18,14 @@ pub enum EncryptionSettingsError { #[error(transparent)] InvalidBase64(#[from] base64::DecodeError), + #[error(transparent)] + VaultLocked(#[from] VaultLocked), + #[error("Invalid private key")] InvalidPrivateKey, + + #[error("Missing private key")] + MissingPrivateKey, } #[derive(Clone)] @@ -98,11 +105,9 @@ impl EncryptionSettings { pub(crate) fn set_org_keys( &mut self, org_enc_keys: Vec<(Uuid, AsymmetricEncString)>, - ) -> Result<&Self> { + ) -> Result<&Self, EncryptionSettingsError> { use bitwarden_crypto::KeyDecryptable; - use crate::VaultLocked; - // Make sure we only keep the keys given in the arguments and not any of the previous // ones, which might be from organizations that the user is no longer a part of anymore self.org_keys.clear(); @@ -112,7 +117,10 @@ impl EncryptionSettings { return Ok(self); } - let private_key = self.private_key.as_ref().ok_or(VaultLocked)?; + let private_key = self + .private_key + .as_ref() + .ok_or(EncryptionSettingsError::MissingPrivateKey)?; // Decrypt the org keys with the private key for (org_id, org_enc_key) in org_enc_keys { diff --git a/crates/bitwarden-core/src/client/internal.rs b/crates/bitwarden-core/src/client/internal.rs index 76951969c..d64ac75be 100644 --- a/crates/bitwarden-core/src/client/internal.rs +++ b/crates/bitwarden-core/src/client/internal.rs @@ -234,7 +234,7 @@ impl InternalClient { pub fn initialize_org_crypto( &self, org_keys: Vec<(Uuid, AsymmetricEncString)>, - ) -> Result> { + ) -> Result, EncryptionSettingsError> { let mut guard = self .encryption_settings .write() diff --git a/crates/bitwarden-core/src/mobile/client_crypto.rs b/crates/bitwarden-core/src/mobile/client_crypto.rs index 4c9a4c6a4..0175f2712 100644 --- a/crates/bitwarden-core/src/mobile/client_crypto.rs +++ b/crates/bitwarden-core/src/mobile/client_crypto.rs @@ -25,7 +25,10 @@ impl<'a> ClientCrypto<'a> { initialize_user_crypto(self.client, req).await } - pub async fn initialize_org_crypto(&self, req: InitOrgCryptoRequest) -> Result<()> { + pub async fn initialize_org_crypto( + &self, + req: InitOrgCryptoRequest, + ) -> Result<(), EncryptionSettingsError> { initialize_org_crypto(self.client, req).await } diff --git a/crates/bitwarden-core/src/mobile/crypto.rs b/crates/bitwarden-core/src/mobile/crypto.rs index a9fde51df..2aae903c5 100644 --- a/crates/bitwarden-core/src/mobile/crypto.rs +++ b/crates/bitwarden-core/src/mobile/crypto.rs @@ -190,7 +190,10 @@ pub struct InitOrgCryptoRequest { pub organization_keys: HashMap, } -pub async fn initialize_org_crypto(client: &Client, req: InitOrgCryptoRequest) -> Result<()> { +pub async fn initialize_org_crypto( + client: &Client, + req: InitOrgCryptoRequest, +) -> Result<(), EncryptionSettingsError> { let organization_keys = req.organization_keys.into_iter().collect(); client.internal.initialize_org_crypto(organization_keys)?; Ok(()) diff --git a/crates/bitwarden-uniffi/src/crypto.rs b/crates/bitwarden-uniffi/src/crypto.rs index 37d14c896..608698fc6 100644 --- a/crates/bitwarden-uniffi/src/crypto.rs +++ b/crates/bitwarden-uniffi/src/crypto.rs @@ -31,7 +31,13 @@ impl ClientCrypto { /// Initialization method for the organization crypto. Needs to be called after /// `initialize_user_crypto` but before any other crypto operations. pub async fn initialize_org_crypto(&self, req: InitOrgCryptoRequest) -> Result<()> { - Ok(self.0 .0.crypto().initialize_org_crypto(req).await?) + Ok(self + .0 + .0 + .crypto() + .initialize_org_crypto(req) + .await + .map_err(Error::EncryptionSettings)?) } /// Get the uses's decrypted encryption key. Note: It's very important diff --git a/crates/bitwarden-vault/src/sync.rs b/crates/bitwarden-vault/src/sync.rs index 6b4845d35..be4c3b169 100644 --- a/crates/bitwarden-vault/src/sync.rs +++ b/crates/bitwarden-vault/src/sync.rs @@ -44,7 +44,10 @@ pub(crate) async fn sync(client: &Client, input: &SyncRequest) -> Result Date: Fri, 6 Sep 2024 15:22:16 +0200 Subject: [PATCH 11/77] Remove screenshot from pull request template (#1027) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking ## 📔 Objective We almost never use the screenshot field, removing it since adding it should be less effort. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .github/PULL_REQUEST_TEMPLATE.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index a5e6b294d..e43ad29df 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,10 +6,6 @@ -## 📸 Screenshots - - - ## ⏰ Reminders before review - Contributor guidelines followed From 625314d05c7337a7b8021937c4a4b17cc12e31c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ch=C4=99ci=C5=84ski?= Date: Fri, 6 Sep 2024 15:26:16 +0200 Subject: [PATCH 12/77] Add workflow_dispatch trigger to build-swift workflow (#1029) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking ## 📔 Objective Add workflow_dispatch trigger to build-swift workflow. ## 📸 Screenshots ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .github/workflows/build-swift.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index b37c62811..867f03dda 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -7,6 +7,7 @@ on: - "rc" - "hotfix-rc" - "main" + workflow_dispatch: jobs: version: From 82065b15c3a3cac1913e3394ae0e14b21d538440 Mon Sep 17 00:00:00 2001 From: tangowithfoxtrot <5676771+tangowithfoxtrot@users.noreply.github.com> Date: Fri, 6 Sep 2024 12:57:45 -0700 Subject: [PATCH 13/77] SM-1404 review and update ruby sdk (#998) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/SM-1404 ## 📔 Objective Update the Ruby wrapper to use bindings that are consistent. This will be a breaking change, as it does the following: - replaces `access_token_login()` with `auth.login_access_token()` to be more consistent with the newer auth method we use in the base SDK. - Refactors secret and project clients. - `secrets_client` -> `secrets` - `project_client` -> `projects` - reorders the `create()` and `update()` args for secrets and projects, with arguments that are most consistently required between methods (eg. `organization_id`) first. - `secrets_client.create(key, note, organization_id, value, project_ids)` -> `secrets.create(organization_id, key, value, note, project_ids)` - `secrets_client.update(id, key, note, organization_id, value, project_ids)` -> `secrets.create(organization_id, id, key, value, note, project_ids)` - `project_client.create(name, organization_id)` -> `projects.create(organization_id, name)` - `project_client.update(id, name, organization_id)` -> `projects.update(organization_id, id, name)` This change also exposes `secrets.sync()`. Because this change refactored the aforementioned methods, updating the Ruby typedefs (`.rbs` files) was also required. I wrote a script to generate the typedefs using the `rbs` CLI. We have an [internal ticket](https://bitwarden.atlassian.net/browse/SM-1426) to add explicit types to the rbs files in the future. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --------- Co-authored-by: Colton Hurst Co-authored-by: Colton Hurst --- languages/ruby/README.md | 34 +++++++++------- .../ruby/bitwarden_sdk_secrets/lib/auth.rb | 16 ++++++++ .../lib/bitwarden-sdk-secrets.rb | 14 +++---- .../lib/extended_schemas/schemas.rb | 18 ++++++++- .../bitwarden_sdk_secrets/lib/projects.rb | 8 ++-- .../ruby/bitwarden_sdk_secrets/lib/secrets.rb | 22 +++++++++-- .../ruby/bitwarden_sdk_secrets/sig/auth.rbs | 9 +++++ .../sig/bitwarden-sdk-secrets.rbs | 39 +++++++++++++++++++ .../sig/bitwarden-sdk.rbs | 13 ------- .../sig/bitwarden_error.rbs | 5 +++ .../sig/bitwarden_lib.rbs | 7 ++++ .../sig/bitwarden_settings.rbs | 8 ---- .../sig/command_runner.rbs | 14 +++++-- .../bitwarden_sdk_secrets/sig/projects.rbs | 25 ++++++++++++ .../sig/projects_client.rbs | 17 -------- .../ruby/bitwarden_sdk_secrets/sig/sdk.rbs | 3 -- .../bitwarden_sdk_secrets/sig/secrets.rbs | 29 ++++++++++++++ .../sig/secrets_client.rbs | 18 --------- .../bitwarden_sdk_secrets/sig/version.rbs | 3 ++ languages/ruby/examples/example.rb | 32 +++++++++------ languages/ruby/gen_ruby_typedefs.sh | 26 +++++++++++++ 21 files changed, 255 insertions(+), 105 deletions(-) create mode 100644 languages/ruby/bitwarden_sdk_secrets/lib/auth.rb create mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/auth.rbs create mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/bitwarden-sdk-secrets.rbs delete mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/bitwarden-sdk.rbs create mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_error.rbs create mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_lib.rbs delete mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_settings.rbs create mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/projects.rbs delete mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/projects_client.rbs delete mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/sdk.rbs create mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/secrets.rbs delete mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/secrets_client.rbs create mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/version.rbs create mode 100755 languages/ruby/gen_ruby_typedefs.sh diff --git a/languages/ruby/README.md b/languages/ruby/README.md index a02b1b53e..790008b38 100644 --- a/languages/ruby/README.md +++ b/languages/ruby/README.md @@ -9,7 +9,7 @@ Requirements: Ruby >= 3.0 Install gem: `gem install bitwarden-sdk-secrets` -Import it: require 'bitwarden-sdk-secrets' +Import it: `require 'bitwarden-sdk-secrets'` ## Usage @@ -28,7 +28,7 @@ bitwarden_settings = BitwardenSDK::BitwardenSettings.new( # By passing these setting you can initialize BitwardenClient bw_client = BitwardenSDK::BitwardenClient.new(bitwarden_settings) -response = bw_client.access_token_login(token) +response = bw_client.auth.login_access_token(token, state_file) puts response ``` @@ -38,25 +38,25 @@ After successful authorization you can interact with client to manage your proje # CREATE project project_name = 'Test project 1' -response = bw_client.project_client.create_project(project_name, organization_id) +response = bw_client.projects.create(organization_id, project_name) puts response project_id = response['id'] # GET project -response = bw_client.project_client.get(project_id) +response = bw_client.projects.get(project_id) puts response # LIST projects -response = bw_client.project_client.list_projects(organization_id) +response = bw_client.projects.list(organization_id) puts response # UPDATE projects name = 'Updated test project 1' -response = bw_client.project_client.update_project(project_id, name, organization_id) +response = bw_client.projects.update(organization_id, project_id, name) puts response # DELETE project -response = bw_client.project_client.delete_projects([project_id]) +response = bw_client.projects.delete_projects([project_id]) puts response ``` @@ -67,30 +67,38 @@ Similarly, you interact with secrets: key = 'AWS-SES' note = 'Private account' value = '8t27.dfj;' -response = bw_client.secrets_client.create(key, note, organization_id, [project_id], value) +response = bw_client.secrets.create(organization_id, key, value, note, [project_id]) puts response secret_id = response['id'] # GET secret -response = bw_client.secrets_client.get(secret_id) +response = bw_client.secrets.get(secret_id) puts response # GET secret by ids -response = bw_client.secrets_client.get_by_ids([secret_id]) +response = bw_client.secrets.get_by_ids([secret_id]) puts response # LIST secrets -response = bw_client.secrets_client.list(organization_id) +response = bw_client.secrets.list(organization_id) +puts response + +# SYNC secrets +response = bw_client.secrets.sync(organization_id, nil) +last_synced_date = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%S.%6NZ') +puts response + +response = bw_client.secrets.sync(organization_id, last_synced_date) puts response # UPDATE secret note = 'updated password' value = '7I.ert10AjK' -response = bw_client.secrets_client.update(secret_id, key, note,organization_id, [project_id], value) +response = bw_client.secrets.update(organization_id, secret_id, key, value, note, [project_id]) puts response # DELETE secret -response = bw_client.secrets_client.delete_secret([secret_id]) +response = bw_client.secrets.delete([secret_id]) puts response ``` diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/auth.rb b/languages/ruby/bitwarden_sdk_secrets/lib/auth.rb new file mode 100644 index 000000000..481f30257 --- /dev/null +++ b/languages/ruby/bitwarden_sdk_secrets/lib/auth.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true +require_relative 'bitwarden_error' + +module BitwardenSDKSecrets + class AuthClient + def initialize(command_runner) + @command_runner = command_runner + end + + def login_access_token(access_token, state_file = nil) + access_token_request = AccessTokenLoginRequest.new(access_token: access_token, state_file: state_file) + @command_runner.run(SelectiveCommand.new(login_access_token: access_token_request)) + nil + end + end +end diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/bitwarden-sdk-secrets.rb b/languages/ruby/bitwarden_sdk_secrets/lib/bitwarden-sdk-secrets.rb index 15cd115d1..4cd1c2597 100644 --- a/languages/ruby/bitwarden_sdk_secrets/lib/bitwarden-sdk-secrets.rb +++ b/languages/ruby/bitwarden_sdk_secrets/lib/bitwarden-sdk-secrets.rb @@ -10,6 +10,7 @@ require_relative 'bitwarden_error' require_relative 'projects' require_relative 'secrets' +require_relative 'auth' module BitwardenSDKSecrets class BitwardenSettings @@ -26,7 +27,7 @@ def initialize(api_url, identity_url) end class BitwardenClient - attr_reader :bitwarden, :project_client, :secrets_client + attr_reader :bitwarden, :projects, :secrets, :auth def initialize(bitwarden_settings) client_settings = ClientSettings.new( @@ -39,14 +40,9 @@ def initialize(bitwarden_settings) @bitwarden = BitwardenLib @handle = @bitwarden.init(client_settings.to_dynamic.compact.to_json) @command_runner = CommandRunner.new(@bitwarden, @handle) - @project_client = ProjectsClient.new(@command_runner) - @secrets_client = SecretsClient.new(@command_runner) - end - - def access_token_login(access_token, state_file = nil) - access_token_request = AccessTokenLoginRequest.new(access_token: access_token, state_file: state_file) - @command_runner.run(SelectiveCommand.new(access_token_login: access_token_request)) - nil + @projects = ProjectsClient.new(@command_runner) + @secrets = SecretsClient.new(@command_runner) + @auth = AuthClient.new(@command_runner) end def free_mem diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/extended_schemas/schemas.rb b/languages/ruby/bitwarden_sdk_secrets/lib/extended_schemas/schemas.rb index e2352237f..bcdfa5e5f 100644 --- a/languages/ruby/bitwarden_sdk_secrets/lib/extended_schemas/schemas.rb +++ b/languages/ruby/bitwarden_sdk_secrets/lib/extended_schemas/schemas.rb @@ -3,23 +3,25 @@ module BitwardenSDKSecrets class SelectiveCommand < Command attribute :password_login, PasswordLoginRequest.optional.default(nil) attribute :api_key_login, APIKeyLoginRequest.optional.default(nil) - attribute :access_token_login, AccessTokenLoginRequest.optional.default(nil) + attribute :login_access_token, AccessTokenLoginRequest.optional.default(nil) attribute :get_user_api_key, SecretVerificationRequest.optional.default(nil) attribute :fingerprint, FingerprintRequest.optional.default(nil) attribute :sync, SyncRequest.optional.default(nil) attribute :secrets, SecretsCommand.optional.default(nil) attribute :projects, ProjectsCommand.optional.default(nil) + attribute :generators, GeneratorsCommand.optional.default(nil) def to_dynamic { "passwordLogin" => password_login&.to_dynamic, "apiKeyLogin" => api_key_login&.to_dynamic, - "accessTokenLogin" => access_token_login&.to_dynamic, + "loginAccessToken" => login_access_token&.to_dynamic, "getUserApiKey" => get_user_api_key&.to_dynamic, "fingerprint" => fingerprint&.to_dynamic, "sync" => sync&.to_dynamic, "secrets" => secrets&.to_dynamic, "projects" => projects&.to_dynamic, + "generators" => generators&.to_dynamic, }.compact end end @@ -49,6 +51,7 @@ class SelectiveSecretsCommand < SecretsCommand attribute :list, SecretIdentifiersRequest.optional.default(nil) attribute :update, SecretPutRequest.optional.default(nil) attribute :delete, SecretsDeleteRequest.optional.default(nil) + attribute :sync, SecretsSyncRequest.optional.default(nil) def to_dynamic { @@ -58,7 +61,18 @@ def to_dynamic "list" => list&.to_dynamic, "update" => update&.to_dynamic, "delete" => delete&.to_dynamic, + "sync" => sync&.to_dynamic, }.compact end end + + class SelectiveGeneratorsCommand < GeneratorsCommand + attribute :generate_password, PasswordGeneratorRequest.optional.default(nil) + + def to_dynamic + { + "generate_password" => generate_password&.to_dynamic, + }.compact + end + end end diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/projects.rb b/languages/ruby/bitwarden_sdk_secrets/lib/projects.rb index 957a7d31d..bf4e903ca 100644 --- a/languages/ruby/bitwarden_sdk_secrets/lib/projects.rb +++ b/languages/ruby/bitwarden_sdk_secrets/lib/projects.rb @@ -8,7 +8,7 @@ def initialize(command_runner) @command_runner = command_runner end - def create_project(project_name, organization_id) + def create(organization_id, project_name) project_create_request = ProjectCreateRequest.new( project_create_request_name: project_name, organization_id: organization_id @@ -43,7 +43,7 @@ def get(project_id) error_response(projects_response) end - def list_projects(organization_id) + def list(organization_id) project_list_request = ProjectsListRequest.new(organization_id: organization_id) command = create_command(list: project_list_request) response = parse_response(command) @@ -58,7 +58,7 @@ def list_projects(organization_id) error_response(projects_response) end - def update_project(id, project_put_request_name, organization_id) + def update(organization_id, id, project_put_request_name) project_put_request = ProjectPutRequest.new( id: id, project_put_request_name: project_put_request_name, @@ -79,7 +79,7 @@ def update_project(id, project_put_request_name, organization_id) error_response(projects_response) end - def delete_projects(ids) + def delete(ids) project_delete_request = ProjectsDeleteRequest.new(ids: ids) command = create_command(delete: project_delete_request) response = parse_response(command) diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/secrets.rb b/languages/ruby/bitwarden_sdk_secrets/lib/secrets.rb index 709d8f8b1..5dda98830 100644 --- a/languages/ruby/bitwarden_sdk_secrets/lib/secrets.rb +++ b/languages/ruby/bitwarden_sdk_secrets/lib/secrets.rb @@ -36,7 +36,23 @@ def get_by_ids(ids) error_response(secrets_response) end - def create(key, note, organization_id, project_ids, value) + def sync(organization_id, last_synced_date) + command = create_command( + sync: SecretsSyncRequest.new(organization_id: organization_id, last_synced_date: last_synced_date) + ) + response = run_command(command) + + secrets_response = ResponseForSecretsSyncResponse.from_json!(response).to_dynamic + + if secrets_response.key?('success') && secrets_response['success'] == true && + secrets_response.key?('data') + return secrets_response['data'] + end + + error_response(secrets_response) + end + + def create(organization_id, key, value, note, project_ids) command = create_command( create: SecretCreateRequest.new( key: key, note: note, organization_id: organization_id, project_ids: project_ids, value: value @@ -68,7 +84,7 @@ def list(organization_id) error_response(secrets_response) end - def update(id, key, note, organization_id, project_ids, value) + def update(organization_id, id, key, value, note, project_ids) command = create_command( update: SecretPutRequest.new( id: id, key: key, note: note, organization_id: organization_id, project_ids: project_ids, value: value @@ -86,7 +102,7 @@ def update(id, key, note, organization_id, project_ids, value) error_response(secrets_response) end - def delete_secret(ids) + def delete(ids) command = create_command(delete: SecretsDeleteRequest.new(ids: ids)) response = run_command(command) diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/auth.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/auth.rbs new file mode 100644 index 000000000..4e75cf4c4 --- /dev/null +++ b/languages/ruby/bitwarden_sdk_secrets/sig/auth.rbs @@ -0,0 +1,9 @@ +module BitwardenSDKSecrets + class AuthClient + @command_runner: untyped + + def initialize: (untyped command_runner) -> void + + def login_access_token: (untyped access_token, ?untyped? state_file) -> nil + end +end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden-sdk-secrets.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden-sdk-secrets.rbs new file mode 100644 index 000000000..ffca59e61 --- /dev/null +++ b/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden-sdk-secrets.rbs @@ -0,0 +1,39 @@ +module BitwardenSDKSecrets + class BitwardenSettings + @api_url: untyped + + @identity_url: untyped + + attr_accessor api_url: untyped + + attr_accessor identity_url: untyped + + def initialize: (untyped api_url, untyped identity_url) -> void + end + + class BitwardenClient + @bitwarden: untyped + + @handle: untyped + + @command_runner: untyped + + @projects: untyped + + @secrets: untyped + + @auth: untyped + + attr_reader bitwarden: untyped + + attr_reader projects: untyped + + attr_reader secrets: untyped + + attr_reader auth: untyped + + def initialize: (untyped bitwarden_settings) -> void + + def free_mem: () -> untyped + end +end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden-sdk.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden-sdk.rbs deleted file mode 100644 index 3f6a73f6a..000000000 --- a/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden-sdk.rbs +++ /dev/null @@ -1,13 +0,0 @@ -require_relative '../lib/schemas' - -class BitwardenClient - @command_runner: CommandRunner - - attr_reader bitwarden: Module - attr_reader project_client: ProjectsClient - attr_reader secrets_client: SecretsClient - - def initialize: (BitwardenSettings) -> void - def access_token_login: (String) -> JSON - def free_mem: () -> nil -end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_error.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_error.rbs new file mode 100644 index 000000000..99c60f48d --- /dev/null +++ b/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_error.rbs @@ -0,0 +1,5 @@ +module BitwardenSDKSecrets + class BitwardenError < StandardError + def initialize: (?::String message) -> void + end +end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_lib.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_lib.rbs new file mode 100644 index 000000000..6038fbf03 --- /dev/null +++ b/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_lib.rbs @@ -0,0 +1,7 @@ +module BitwardenSDKSecrets + module BitwardenLib + extend FFI::Library + + def self.mac_with_intel?: () -> untyped + end +end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_settings.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_settings.rbs deleted file mode 100644 index 154ee16e5..000000000 --- a/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_settings.rbs +++ /dev/null @@ -1,8 +0,0 @@ -require_relative '../lib/schemas' - -class BitwardenSettings - attr_accessor api_url: String - attr_accessor identity_url: String - - def initialize: (String, String) -> void -end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/command_runner.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/command_runner.rbs index 7a7a17dd9..483679076 100644 --- a/languages/ruby/bitwarden_sdk_secrets/sig/command_runner.rbs +++ b/languages/ruby/bitwarden_sdk_secrets/sig/command_runner.rbs @@ -1,4 +1,12 @@ -class CommandRunner - @bitwarden_sdk: Module - def run: -> String +module BitwardenSDKSecrets + class CommandRunner + @bitwarden_sdk: untyped + + @handle: untyped + + def initialize: (untyped bitwarden_sdk, untyped handle) -> void + + # @param [Dry-Struct] cmd + def run: (untyped cmd) -> untyped + end end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/projects.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/projects.rbs new file mode 100644 index 000000000..e68df3d59 --- /dev/null +++ b/languages/ruby/bitwarden_sdk_secrets/sig/projects.rbs @@ -0,0 +1,25 @@ +module BitwardenSDKSecrets + class ProjectsClient + @command_runner: untyped + + def initialize: (untyped command_runner) -> void + + def create: (untyped organization_id, untyped project_name) -> untyped + + def get: (untyped project_id) -> untyped + + def list: (untyped organization_id) -> untyped + + def update: (untyped organization_id, untyped id, untyped project_put_request_name) -> untyped + + def delete: (untyped ids) -> untyped + + private + + def error_response: (untyped response) -> untyped + + def create_command: (untyped commands) -> untyped + + def parse_response: (untyped command) -> untyped + end +end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/projects_client.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/projects_client.rbs deleted file mode 100644 index 00c9e578d..000000000 --- a/languages/ruby/bitwarden_sdk_secrets/sig/projects_client.rbs +++ /dev/null @@ -1,17 +0,0 @@ -require_once '../lib/extended_schemas/schemas.rbs' -require_once '../schemas.rbs' - -class ProjectsClient - @command_runner: CommandRunner - def initialize: (command_runner: CommandRunner) -> void - def create_project: (project_name: String, organization_id: String) -> ProjectsResponse - def get: (project_id: String) -> ProjectsResponse - def list_projects: (organization_id: String) -> Array(DatumElement) - def update_project: (id: String, project_put_request_name: String, organization_id: String) -> ProjectsResponse - def delete_projects: (ids: Array[String]) -> Array(ProjectDeleteResponse) - - private - - def create_command: (SelectiveProjectsCommand) -> SelectiveCommand - def parse_response: (ResponseForProjectResponse) -> ResponseForProjectResponse -end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/sdk.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/sdk.rbs deleted file mode 100644 index 260fa1420..000000000 --- a/languages/ruby/bitwarden_sdk_secrets/sig/sdk.rbs +++ /dev/null @@ -1,3 +0,0 @@ -module BitwardenSDK - VERSION: String -end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/secrets.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/secrets.rbs new file mode 100644 index 000000000..8590fd82b --- /dev/null +++ b/languages/ruby/bitwarden_sdk_secrets/sig/secrets.rbs @@ -0,0 +1,29 @@ +module BitwardenSDKSecrets + class SecretsClient + @command_runner: untyped + + def initialize: (untyped command_runner) -> void + + def get: (untyped id) -> untyped + + def get_by_ids: (untyped ids) -> untyped + + def sync: (untyped organization_id, untyped last_synced_date) -> untyped + + def create: (untyped organization_id, untyped key, untyped value, untyped note, untyped project_ids) -> untyped + + def list: (untyped organization_id) -> untyped + + def update: (untyped organization_id, untyped id, untyped key, untyped value, untyped note, untyped project_ids) -> untyped + + def delete: (untyped ids) -> untyped + + private + + def error_response: (untyped response) -> (untyped | nil | untyped) + + def create_command: (untyped commands) -> untyped + + def run_command: (untyped command) -> untyped + end +end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/secrets_client.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/secrets_client.rbs deleted file mode 100644 index ccebcecd8..000000000 --- a/languages/ruby/bitwarden_sdk_secrets/sig/secrets_client.rbs +++ /dev/null @@ -1,18 +0,0 @@ -require_once '../lib/extended_schemas/schemas.rbs' -require_once '../schemas.rbs' - -class SecretsClient - # @command_runner: CommandRunner - def initialize: (command_runner: CommandRunner) -> void - def get: (id: String) -> SecretResponse - def get_by_ids: (ids: Array[String]) -> Array(SecretIdentifierResponse) - def create: (key: String, note: String, organization_id: String, project_ids: Array[String], value: String) -> SecretResponse - def list: (organization_id: String) -> Array(SecretIdentifierResponse) - def update: (id: String, key: String, note: String, organization_id: String, project_ids: Array[String], value: String) -> SecretResponse - def delete_secret: (ids: Array[String]) -> Array(SecretDeleteResponse) - - private - - def create_command: (SelectiveSecretsCommand) -> SelectiveCommand - def parse_response: (SelectiveSecretCommand) -> ResponseForSecretResponse -end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/version.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/version.rbs new file mode 100644 index 000000000..869b679db --- /dev/null +++ b/languages/ruby/bitwarden_sdk_secrets/sig/version.rbs @@ -0,0 +1,3 @@ +module BitwardenSDKSecrets + VERSION: "0.2.0" +end diff --git a/languages/ruby/examples/example.rb b/languages/ruby/examples/example.rb index 475e52089..29a686708 100644 --- a/languages/ruby/examples/example.rb +++ b/languages/ruby/examples/example.rb @@ -12,58 +12,66 @@ bitwarden_settings = BitwardenSDKSecrets::BitwardenSettings.new(api_url, identity_url) bw_client = BitwardenSDKSecrets::BitwardenClient.new(bitwarden_settings) -response = bw_client.access_token_login(token, state_file) +response = bw_client.auth.login_access_token(token, state_file) puts response # CREATE project project_name = 'Test project 1' -response = bw_client.project_client.create_project(project_name, organization_id) +response = bw_client.projects.create(organization_id, project_name) puts response project_id = response['id'] # GET project -response = bw_client.project_client.get(project_id) +response = bw_client.projects.get(project_id) puts response # LIST projects -response = bw_client.project_client.list_projects(organization_id) +response = bw_client.projects.list(organization_id) puts response # UPDATE projects name = 'Updated test project 1' -response = bw_client.project_client.update_project(project_id, name, organization_id) +response = bw_client.projects.update(organization_id, project_id, name) puts response # CREATE secret key = 'AWS-SES' note = 'Private account' value = '8t27.dfj;' -response = bw_client.secrets_client.create(key, note, organization_id, [project_id], value) +response = bw_client.secrets.create(organization_id, key, value, note, [project_id]) puts response secret_id = response['id'] # GET secret -response = bw_client.secrets_client.get(secret_id) +response = bw_client.secrets.get(secret_id) puts response # GET secret by ids -response = bw_client.secrets_client.get_by_ids([secret_id]) +response = bw_client.secrets.get_by_ids([secret_id]) puts response # LIST secrets -response = bw_client.secrets_client.list(organization_id) +response = bw_client.secrets.list(organization_id) +puts response + +# SYNC secrets +response = bw_client.secrets.sync(organization_id, nil) +last_synced_date = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%S.%6NZ') +puts response + +response = bw_client.secrets.sync(organization_id, last_synced_date) puts response # UPDATE secret note = 'updated password' value = '7I.ert10AjK' -response = bw_client.secrets_client.update(secret_id, key, note,organization_id, [project_id], value) +response = bw_client.secrets.update(organization_id, secret_id, key, value, note, [project_id]) puts response # DELETE secret -response = bw_client.secrets_client.delete_secret([secret_id]) +response = bw_client.secrets.delete([secret_id]) puts response # DELETE project -response = bw_client.project_client.delete_projects([project_id]) +response = bw_client.projects.delete([project_id]) puts response diff --git a/languages/ruby/gen_ruby_typedefs.sh b/languages/ruby/gen_ruby_typedefs.sh new file mode 100755 index 000000000..acd2bcc3c --- /dev/null +++ b/languages/ruby/gen_ruby_typedefs.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# shellcheck disable=SC3044,SC3020 + +# bail if rbs is not installed +if ! command -v rbs &>/dev/null; then + echo "rbs could not be found" + exit +fi + +# use consistent repository root to avoid relative paths +REPO_ROOT="$(git rev-parse --show-toplevel)" +pushd "$REPO_ROOT"/languages/ruby || exit + +# delete existing typedefs +rm -rf bitwarden_sdk_secrets/sig/* +mkdir -p bitwarden_sdk_secrets/sig + +# generate typedefs +RUBY_LIB_FILES="$(find bitwarden_sdk_secrets/lib -name "*.rb")" + +for file in $RUBY_LIB_FILES; do + rbs prototype rb "$file" >bitwarden_sdk_secrets/sig/"$(basename "$file" .rb).rbs" + rm -f bitwarden_sdk_secrets/sig/schemas.rbs +done + +popd || exit From 3f376b53ec66a9f53aaa01bb61672c68ae36d461 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Mon, 9 Sep 2024 10:53:54 +0200 Subject: [PATCH 14/77] Tweak secrets manager export of password generator (#1021) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking ## 📔 Objective - Change generators export to not live under `secrets_manager` namespace. - Since we now provide a `client_generators` we can stop exporting the generators. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .../bitwarden-generators/src/client_generator.rs | 5 +++-- crates/bitwarden-generators/src/lib.rs | 16 ++++++++-------- crates/bitwarden-generators/src/passphrase.rs | 2 +- crates/bitwarden-generators/src/password.rs | 2 +- crates/bitwarden-generators/src/username.rs | 2 +- crates/bitwarden-json/src/client.rs | 9 +++++---- crates/bitwarden-json/src/command.rs | 2 +- crates/bitwarden/CHANGELOG.md | 1 + crates/bitwarden/src/lib.rs | 12 ++++++------ 9 files changed, 27 insertions(+), 24 deletions(-) diff --git a/crates/bitwarden-generators/src/client_generator.rs b/crates/bitwarden-generators/src/client_generator.rs index e5bad6f29..d2e2b7483 100644 --- a/crates/bitwarden-generators/src/client_generator.rs +++ b/crates/bitwarden-generators/src/client_generator.rs @@ -1,8 +1,9 @@ use bitwarden_core::Client; use crate::{ - passphrase, password, username, PassphraseError, PassphraseGeneratorRequest, PasswordError, - PasswordGeneratorRequest, UsernameError, UsernameGeneratorRequest, + passphrase::passphrase, password::password, username::username, PassphraseError, + PassphraseGeneratorRequest, PasswordError, PasswordGeneratorRequest, UsernameError, + UsernameGeneratorRequest, }; pub struct ClientGenerator<'a> { diff --git a/crates/bitwarden-generators/src/lib.rs b/crates/bitwarden-generators/src/lib.rs index 0ebd20295..6455a759a 100644 --- a/crates/bitwarden-generators/src/lib.rs +++ b/crates/bitwarden-generators/src/lib.rs @@ -1,13 +1,13 @@ -mod passphrase; -pub use passphrase::{passphrase, PassphraseError, PassphraseGeneratorRequest}; -mod password; -mod util; -pub use password::{password, PasswordError, PasswordGeneratorRequest}; -mod username; -pub use username::{username, ForwarderServiceType, UsernameError, UsernameGeneratorRequest}; mod client_generator; -pub use client_generator::{ClientGenerator, ClientGeneratorExt}; mod username_forwarders; +pub use client_generator::{ClientGenerator, ClientGeneratorExt}; +pub(crate) mod passphrase; +pub use passphrase::{PassphraseError, PassphraseGeneratorRequest}; +pub(crate) mod password; +pub use password::{PasswordError, PasswordGeneratorRequest}; +pub(crate) mod username; +pub use username::{ForwarderServiceType, UsernameError, UsernameGeneratorRequest}; +mod util; #[cfg(feature = "uniffi")] uniffi::setup_scaffolding!(); diff --git a/crates/bitwarden-generators/src/passphrase.rs b/crates/bitwarden-generators/src/passphrase.rs index 94b2c0acd..1fb83422e 100644 --- a/crates/bitwarden-generators/src/passphrase.rs +++ b/crates/bitwarden-generators/src/passphrase.rs @@ -77,7 +77,7 @@ impl PassphraseGeneratorRequest { } /// Implementation of the random passphrase generator. -pub fn passphrase(request: PassphraseGeneratorRequest) -> Result { +pub(crate) fn passphrase(request: PassphraseGeneratorRequest) -> Result { let options = request.validate_options()?; Ok(passphrase_with_rng(rand::thread_rng(), options)) } diff --git a/crates/bitwarden-generators/src/password.rs b/crates/bitwarden-generators/src/password.rs index 6121c7597..9821f8bbe 100644 --- a/crates/bitwarden-generators/src/password.rs +++ b/crates/bitwarden-generators/src/password.rs @@ -219,7 +219,7 @@ impl PasswordGeneratorRequest { } /// Implementation of the random password generator. -pub fn password(input: PasswordGeneratorRequest) -> Result { +pub(crate) fn password(input: PasswordGeneratorRequest) -> Result { let options = input.validate_options()?; Ok(password_with_rng(rand::thread_rng(), options)) } diff --git a/crates/bitwarden-generators/src/username.rs b/crates/bitwarden-generators/src/username.rs index 830cb5b04..0140f77fb 100644 --- a/crates/bitwarden-generators/src/username.rs +++ b/crates/bitwarden-generators/src/username.rs @@ -131,7 +131,7 @@ impl ForwarderServiceType { /// /// Note: The HTTP client is passed in as a required parameter for convenience, /// as some username generators require making API calls. -pub async fn username( +pub(crate) async fn username( input: UsernameGeneratorRequest, http: &reqwest::Client, ) -> Result { diff --git a/crates/bitwarden-json/src/client.rs b/crates/bitwarden-json/src/client.rs index 50e46f6ce..dc84c559d 100644 --- a/crates/bitwarden-json/src/client.rs +++ b/crates/bitwarden-json/src/client.rs @@ -1,10 +1,11 @@ -#[cfg(feature = "secrets")] -use bitwarden::secrets_manager::{ - generators::ClientGeneratorExt, ClientProjectsExt, ClientSecretsExt, -}; #[cfg(feature = "internal")] use bitwarden::vault::ClientVaultExt; use bitwarden::ClientSettings; +#[cfg(feature = "secrets")] +use bitwarden::{ + generators::ClientGeneratorExt, + secrets_manager::{ClientProjectsExt, ClientSecretsExt}, +}; #[cfg(feature = "secrets")] use crate::command::{GeneratorsCommand, ProjectsCommand, SecretsCommand}; diff --git a/crates/bitwarden-json/src/command.rs b/crates/bitwarden-json/src/command.rs index 29dc79538..7483b90cf 100644 --- a/crates/bitwarden-json/src/command.rs +++ b/crates/bitwarden-json/src/command.rs @@ -1,8 +1,8 @@ #[cfg(feature = "secrets")] use bitwarden::{ auth::login::AccessTokenLoginRequest, + generators::PasswordGeneratorRequest, secrets_manager::{ - generators::PasswordGeneratorRequest, projects::{ ProjectCreateRequest, ProjectGetRequest, ProjectPutRequest, ProjectsDeleteRequest, ProjectsListRequest, diff --git a/crates/bitwarden/CHANGELOG.md b/crates/bitwarden/CHANGELOG.md index 689b58e72..5d3eefa95 100644 --- a/crates/bitwarden/CHANGELOG.md +++ b/crates/bitwarden/CHANGELOG.md @@ -10,6 +10,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Added - Support for secrets sync (#678) +- Password generator (#986) ### Changed diff --git a/crates/bitwarden/src/lib.rs b/crates/bitwarden/src/lib.rs index b8d8a0bda..c87693ce7 100644 --- a/crates/bitwarden/src/lib.rs +++ b/crates/bitwarden/src/lib.rs @@ -87,13 +87,13 @@ pub mod internal { #[cfg(feature = "internal")] pub use internal::*; +// Re-export generators used for secrets-manager, internal flag already exports all generators +#[cfg(all(feature = "secrets", not(feature = "internal")))] +pub mod generators { + pub use bitwarden_generators::{ClientGeneratorExt, PasswordError, PasswordGeneratorRequest}; +} + #[cfg(feature = "secrets")] pub mod secrets_manager { pub use bitwarden_sm::*; - - pub mod generators { - pub use bitwarden_generators::{ - password, ClientGeneratorExt, PasswordError, PasswordGeneratorRequest, - }; - } } From 05b2620893e6dee8af1b1a96909420f951c5ec31 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:09:27 +0200 Subject: [PATCH 15/77] [deps]: Lock file maintenance (#1030) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Update | Change | |---|---| | lockFileMaintenance | All locks refreshed | 🔧 This Pull Request updates lock files to use the latest dependency versions. --- ### Configuration 📅 **Schedule**: Branch creation - "every 2nd week starting on the 2 week of the year before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. đŸ‘ģ **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/bitwarden/sdk). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 132 +++++++++++----------- languages/js/sdk-client/package-lock.json | 12 +- package-lock.json | 44 ++++---- 3 files changed, 91 insertions(+), 97 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9becb26f1..e9c74e8a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -142,9 +142,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" [[package]] name = "arc-swap" @@ -231,9 +231,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" dependencies = [ "proc-macro2", "quote", @@ -273,12 +273,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -431,7 +425,7 @@ dependencies = [ name = "bitwarden-core" version = "0.5.0" dependencies = [ - "base64 0.22.1", + "base64", "bitwarden-api-api", "bitwarden-api-identity", "bitwarden-crypto", @@ -466,7 +460,7 @@ version = "0.5.0" dependencies = [ "aes", "argon2", - "base64 0.22.1", + "base64", "cbc", "criterion", "generic-array", @@ -495,7 +489,7 @@ dependencies = [ name = "bitwarden-exporters" version = "0.5.0" dependencies = [ - "base64 0.22.1", + "base64", "bitwarden-core", "bitwarden-crypto", "bitwarden-vault", @@ -514,7 +508,7 @@ name = "bitwarden-fido" version = "0.5.0" dependencies = [ "async-trait", - "base64 0.22.1", + "base64", "bitwarden-core", "bitwarden-crypto", "bitwarden-vault", @@ -589,7 +583,7 @@ dependencies = [ name = "bitwarden-send" version = "0.5.0" dependencies = [ - "base64 0.22.1", + "base64", "bitwarden-api-api", "bitwarden-core", "bitwarden-crypto", @@ -651,7 +645,7 @@ dependencies = [ name = "bitwarden-vault" version = "0.5.0" dependencies = [ - "base64 0.22.1", + "base64", "bitwarden-api-api", "bitwarden-core", "bitwarden-crypto", @@ -779,9 +773,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773d90827bc3feecfb67fab12e24de0749aad83c74b9504ecde46237b5cd24e2" +checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" [[package]] name = "byteorder" @@ -850,9 +844,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.15" +version = "1.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" +checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" dependencies = [ "shlex", ] @@ -924,9 +918,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.16" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" +checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" dependencies = [ "clap_builder", "clap_derive", @@ -934,9 +928,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" dependencies = [ "anstream", "anstyle", @@ -946,9 +940,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.24" +version = "4.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7db6eca8c205649e8d3ccd05aa5042b1800a784e56bc7c43524fde8abbfa9b" +checksum = "205d5ef6d485fa47606b98b0ddc4ead26eb850aaa86abfb562a94fb3280ecba0" dependencies = [ "clap", ] @@ -1134,9 +1128,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -1784,9 +1778,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" +checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" dependencies = [ "aho-corasick", "bstr", @@ -1990,9 +1984,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http", @@ -2127,9 +2121,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" [[package]] name = "is-terminal" @@ -2821,7 +2815,7 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016" dependencies = [ - "base64 0.22.1", + "base64", "indexmap 2.5.0", "quick-xml", "serde", @@ -2830,9 +2824,9 @@ dependencies = [ [[package]] name = "plotters" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" +checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" dependencies = [ "num-traits", "plotters-backend", @@ -2843,15 +2837,15 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" +checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" [[package]] name = "plotters-svg" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" +checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" dependencies = [ "plotters-backend", ] @@ -3009,9 +3003,9 @@ dependencies = [ [[package]] name = "quinn" -version = "0.11.3" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b22d8e7369034b9a7132bc2008cac12f2013c8132b45e0554e6e20e2617f2156" +checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" dependencies = [ "bytes", "pin-project-lite", @@ -3027,9 +3021,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.11.6" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba92fb39ec7ad06ca2582c0ca834dfeadcaf06ddfc8e635c80aa7e1c05315fdd" +checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" dependencies = [ "bytes", "rand", @@ -3044,15 +3038,15 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bffec3605b73c6f1754535084a85229fa8a30f86014e6c81aeec4abb68b0285" +checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" dependencies = [ "libc", "once_cell", "socket2", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3169,7 +3163,7 @@ version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "futures-core", "futures-util", @@ -3280,9 +3274,9 @@ checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" [[package]] name = "rustix" -version = "0.38.35" +version = "0.38.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85d50532239da68e9addb745ba38ff4612a242c1c7ceea689c4bc7c2f43c36f" +checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" dependencies = [ "bitflags 2.6.0", "errno", @@ -3324,7 +3318,7 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ - "base64 0.22.1", + "base64", "rustls-pki-types", ] @@ -3395,11 +3389,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3524,18 +3518,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", @@ -3555,9 +3549,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "indexmap 2.5.0", "itoa", @@ -3615,7 +3609,7 @@ version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" dependencies = [ - "base64 0.22.1", + "base64", "chrono", "hex", "indexmap 1.9.3", @@ -3859,9 +3853,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "supports-color" -version = "3.0.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9829b314621dfc575df4e409e79f9d6a66a3bd707ab73f23cb4aa3a854ac854f" +checksum = "8775305acf21c96926c900ad056abeef436701108518cf890020387236ac5a77" dependencies = [ "is_ci", ] @@ -4070,9 +4064,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -4867,13 +4861,13 @@ checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" [[package]] name = "wiremock" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a59f8ae78a4737fb724f20106fb35ccb7cfe61ff335665d3042b3aa98e34717" +checksum = "7fff469918e7ca034884c7fd8f93fe27bacb7fcb599fd879df6c7b429a29b646" dependencies = [ "assert-json-diff", "async-trait", - "base64 0.21.7", + "base64", "deadpool", "futures", "http", diff --git a/languages/js/sdk-client/package-lock.json b/languages/js/sdk-client/package-lock.json index eb2b74671..7a9fe313a 100644 --- a/languages/js/sdk-client/package-lock.json +++ b/languages/js/sdk-client/package-lock.json @@ -41,9 +41,9 @@ } }, "node_modules/@types/node": { - "version": "20.16.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.3.tgz", - "integrity": "sha512-/wdGiWRkMOm53gAsSyFMXFZHbVg7C6CbkrzHNpaHoYfsUWPg7m6ZRKtvQjgvQ9i8WT540a3ydRlRQbxjY30XxQ==", + "version": "20.16.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.5.tgz", + "integrity": "sha512-VwYCweNo3ERajwy0IUlqqcyZ8/A7Zwa9ZP3MnENWcB11AejO+tLy3pu850goUW2FC/IJMdZUfKpX/yxL1gymCA==", "dev": true, "license": "MIT", "dependencies": { @@ -220,9 +220,9 @@ } }, "node_modules/lru-cache": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.0.tgz", - "integrity": "sha512-Qv32eSV1RSCfhY3fpPE2GNZ8jgM9X7rdAfemLWqTUxwiyIC4jJ6Sy0fZ8H+oLWevO6i4/bizg7c8d8i6bxrzbA==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.1.tgz", + "integrity": "sha512-CgeuL5uom6j/ZVrg7G/+1IXqRY8JXX4Hghfy5YE0EhoYQWvndP1kufu58cmZLNIDKnRhZrXfdS9urVWx98AipQ==", "dev": true, "license": "ISC", "engines": { diff --git a/package-lock.json b/package-lock.json index bb89e32d2..08ad37f65 100644 --- a/package-lock.json +++ b/package-lock.json @@ -370,9 +370,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.5.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.2.tgz", - "integrity": "sha512-acJsPTEqYqulZS/Yp/S3GgeE6GZ0qYODUR8aVr/DkhHQ8l9nd4j5x1/ZJy9/gHrRlFMqkO6i0I3E27Alu4jjPg==", + "version": "22.5.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", + "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==", "dev": true, "license": "MIT", "peer": true, @@ -407,9 +407,9 @@ } }, "node_modules/acorn-walk": { - "version": "8.3.3", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.3.tgz", - "integrity": "sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==", + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", "dev": true, "license": "MIT", "dependencies": { @@ -876,13 +876,13 @@ } }, "node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, "license": "MIT", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -1029,9 +1029,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", - "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", "dev": true, "funding": [ { @@ -1402,9 +1402,9 @@ } }, "node_modules/lru-cache": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.0.tgz", - "integrity": "sha512-Qv32eSV1RSCfhY3fpPE2GNZ8jgM9X7rdAfemLWqTUxwiyIC4jJ6Sy0fZ8H+oLWevO6i4/bizg7c8d8i6bxrzbA==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.1.tgz", + "integrity": "sha512-CgeuL5uom6j/ZVrg7G/+1IXqRY8JXX4Hghfy5YE0EhoYQWvndP1kufu58cmZLNIDKnRhZrXfdS9urVWx98AipQ==", "dev": true, "license": "ISC", "engines": { @@ -1485,9 +1485,9 @@ } }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true, "license": "MIT" }, @@ -2370,9 +2370,9 @@ } }, "node_modules/yaml": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz", - "integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz", + "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==", "dev": true, "license": "ISC", "bin": { From c0859c4e256460896dff2dfe7572328fb39831c5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 23:51:45 +0200 Subject: [PATCH 16/77] [deps]: Update rust Docker tag to v1.81 (#948) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | rust | stage | minor | `1.76` -> `1.81` | | rust | final | minor | `1.76` -> `1.81` | --- ### Configuration 📅 **Schedule**: Branch creation - "every 2nd week starting on the 2 week of the year before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/bitwarden/sdk). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- crates/bws/Dockerfile | 2 +- crates/memory-testing/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bws/Dockerfile b/crates/bws/Dockerfile index 1f3542e52..07f9f3a79 100644 --- a/crates/bws/Dockerfile +++ b/crates/bws/Dockerfile @@ -1,7 +1,7 @@ ############################################### # Build stage # ############################################### -FROM --platform=$BUILDPLATFORM rust:1.76 AS build +FROM --platform=$BUILDPLATFORM rust:1.81 AS build # Docker buildx supplies the value for this arg ARG TARGETPLATFORM diff --git a/crates/memory-testing/Dockerfile b/crates/memory-testing/Dockerfile index 3804f59e0..3df22466d 100644 --- a/crates/memory-testing/Dockerfile +++ b/crates/memory-testing/Dockerfile @@ -1,7 +1,7 @@ ############################################### # Build stage # ############################################### -FROM rust:1.76 AS build +FROM rust:1.81 AS build WORKDIR /app From c04b9a0e950fc79bd14464156030a169f0db14ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ch=C4=99ci=C5=84ski?= Date: Tue, 10 Sep 2024 16:04:36 +0200 Subject: [PATCH 17/77] [BRE-296] Fix release-swift workflow (#1035) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/BRE-296 ## 📔 Objective Fix `release-swift.yml` workflow ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .github/workflows/build-swift.yml | 7 +++++++ .github/workflows/release-swift.yml | 22 +++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 867f03dda..4192662bf 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -68,6 +68,13 @@ jobs: path: languages/swift/BitwardenFFI.xcframework if-no-files-found: error + - name: Upload BitwardenSdk sources + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: BitwardenSdk-${{ env._VERSION }}-${{ steps.build.outputs.short-sha }}-sources + path: languages/swift/Sources/BitwardenSdk + if-no-files-found: error + trigger-swift-release: name: Trigger Swift release if: github.ref == 'refs/heads/main' diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index bb64dc944..a9ab213a6 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -63,7 +63,7 @@ jobs: -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ /repos/$OWNER/$REPO/actions/workflows/build-swift.yml/runs \ - | jq -r ".workflow_runs[] | select(.head_branch == \"$BRANCH\") | .id") + | jq -r "[.workflow_runs[] | select(.head_branch == \"$BRANCH\").id ] | first") else RUN_ID=${{ inputs.build-run-id }} fi @@ -111,6 +111,7 @@ jobs: _PRE_RELEASE: ${{ inputs.pre-release }} _RELEASE_NAME: ${{ needs.validate.outputs.release_name }} _SWIFT_CHECKSUM: ${{ needs.validate.outputs.swift_checksum }} + _BUILD_RUN_ID: ${{ needs.validate.outputs.run_id }} steps: - name: Checkout SDK repo uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 @@ -163,6 +164,16 @@ jobs: git config --local user.email "${{ env._BOT_EMAIL }}" git config --local user.name "${{ env._BOT_NAME }}" + - name: Download BitwardenSdk sources artifact + uses: bitwarden/gh-actions/download-artifacts@main + id: download-artifact + with: + workflow: build-swift.yml + workflow_conclusion: success + artifacts: "BitwardenSdk-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}-sources" + run_id: ${{ env._BUILD_RUN_ID }} + path: sdk/languages/swift/Sources/BitwardenSdk + - name: Install Swift formatter run: | git clone https://github.com/nicklockwood/SwiftFormat @@ -181,11 +192,16 @@ jobs: # Run swiftformat swiftformat sdk/languages/swift/Package.swift + find sdk/languages/swift/Sources/ -name ".gitignore" -exec rm -f {} \; + + rm -rf sdk-swift/Sources + rm -rf sdk-swift/Tests + # Copy files to local sdk-swift repo path cp --verbose -rf sdk/languages/swift/README.md sdk-swift/README.md cp --verbose -rf sdk/languages/swift/Package.swift sdk-swift/Package.swift - cp --verbose -rf sdk/languages/swift/Sources sdk-swift/Sources - cp --verbose -rf sdk/languages/swift/Tests sdk-swift/Tests + cp --verbose -rf sdk/languages/swift/Sources sdk-swift + cp --verbose -rf sdk/languages/swift/Tests sdk-swift - name: Push changes working-directory: sdk-swift From b00d33767a9a14c2093875f9d2c6afb79e6b4316 Mon Sep 17 00:00:00 2001 From: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com> Date: Thu, 12 Sep 2024 13:53:49 -0500 Subject: [PATCH 18/77] [SM-1384] Fix panic on re-registering logger | WASM (#935) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/SM-1384 ## 📔 Objective When creating multiple WASM clients, a panic occurs `failed to initialize logger: SetLoggerError())`. Looks to be the same thing we fixed: https://github.com/bitwarden/sdk/pull/181 https://github.com/bitwarden/sdk/pull/676 ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- crates/bitwarden-wasm/src/client.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/bitwarden-wasm/src/client.rs b/crates/bitwarden-wasm/src/client.rs index bca8c2383..e130705c1 100644 --- a/crates/bitwarden-wasm/src/client.rs +++ b/crates/bitwarden-wasm/src/client.rs @@ -4,7 +4,7 @@ use std::rc::Rc; use argon2::{Algorithm, Argon2, Params, Version}; use bitwarden_json::client::Client as JsonClient; use js_sys::Promise; -use log::Level; +use log::{set_max_level, Level}; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::future_to_promise; @@ -37,10 +37,9 @@ impl BitwardenClient { #[wasm_bindgen(constructor)] pub fn new(settings_input: Option, log_level: Option) -> Self { console_error_panic_hook::set_once(); - if let Err(e) = - console_log::init_with_level(convert_level(log_level.unwrap_or(LogLevel::Info))) - { - panic!("failed to initialize logger: {:?}", e); + let log_level = convert_level(log_level.unwrap_or(LogLevel::Info)); + if let Err(_e) = console_log::init_with_level(log_level) { + set_max_level(log_level.to_level_filter()) } Self(Rc::new(bitwarden_json::client::Client::new(settings_input))) From bb1f5a6e9e32f3a80cd2b70737f6199ed4661a63 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 10:39:28 +0200 Subject: [PATCH 19/77] [deps]: Lock file maintenance (#1051) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Update | Change | |---|---| | lockFileMaintenance | All locks refreshed | 🔧 This Pull Request updates lock files to use the latest dependency versions. --- ### Configuration 📅 **Schedule**: Branch creation - "every 2nd week starting on the 2 week of the year before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. đŸ‘ģ **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/bitwarden/sdk). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 72 +++++++++++------------ languages/js/sdk-client/package-lock.json | 12 ++-- package-lock.json | 12 ++-- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e9c74e8a6..57aa79565 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -142,9 +142,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.87" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "arc-swap" @@ -844,9 +844,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.18" +version = "1.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" +checksum = "2d74707dde2ba56f86ae90effb3b43ddd369504387e718014de010cec7959800" dependencies = [ "shlex", ] @@ -2001,9 +2001,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" dependencies = [ "bytes", "futures-channel", @@ -2367,9 +2367,9 @@ dependencies = [ [[package]] name = "napi" -version = "2.16.9" +version = "2.16.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1277600d452e570cc83cf5f4e8efb389cc21e5cbefadcfba7239f4551e2e3e99" +checksum = "04409e8c2d61995696e44d2181b79b68c1dd41f7e24a17cde60bbd9f54ddddef" dependencies = [ "bitflags 2.6.0", "ctor", @@ -2387,9 +2387,9 @@ checksum = "e1c0f5d67ee408a4685b61f5ab7e58605c8ae3f2b4189f0127d804ff13d5560a" [[package]] name = "napi-derive" -version = "2.16.11" +version = "2.16.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "150d87c4440b9f4815cb454918db498b5aae9a57aa743d20783fe75381181d01" +checksum = "17435f7a00bfdab20b0c27d9c56f58f6499e418252253081bfff448099da31d1" dependencies = [ "cfg-if", "convert_case", @@ -2401,9 +2401,9 @@ dependencies = [ [[package]] name = "napi-derive-backend" -version = "1.0.73" +version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cd81b794fc1d6051acf8c4f3cb4f82833b0621272a232b4ff0cf3df1dbddb61" +checksum = "967c485e00f0bf3b1bdbe510a38a4606919cf1d34d9a37ad41f25a81aa077abe" dependencies = [ "convert_case", "once_cell", @@ -2535,9 +2535,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "33ea5043e58958ee56f3e15a90aee535795cd7dfd319846288d93c5b57d85cbe" [[package]] name = "onig" @@ -2920,9 +2920,9 @@ source = "git+https://github.com/bitwarden/passkey-rs?rev=ae08e2cb7dd3d44d915cae [[package]] name = "pyo3" -version = "0.22.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "831e8e819a138c36e212f3af3fd9eeffed6bf1510a805af35b0edee5ffa59433" +checksum = "15ee168e30649f7f234c3d49ef5a7a6cbf5134289bc46c29ff3155fa3221c225" dependencies = [ "cfg-if", "indoc", @@ -2938,9 +2938,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.22.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e8730e591b14492a8945cdff32f089250b05f5accecf74aeddf9e8272ce1fa8" +checksum = "e61cef80755fe9e46bb8a0b8f20752ca7676dcc07a5277d8b7768c6172e529b3" dependencies = [ "once_cell", "target-lexicon", @@ -2948,9 +2948,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.22.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e97e919d2df92eb88ca80a037969f44e5e70356559654962cbb3316d00300c6" +checksum = "67ce096073ec5405f5ee2b8b31f03a68e02aa10d5d4f565eca04acc41931fa1c" dependencies = [ "libc", "pyo3-build-config", @@ -2969,9 +2969,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.22.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb57983022ad41f9e683a599f2fd13c3664d7063a3ac5714cae4b7bee7d3f206" +checksum = "2440c6d12bc8f3ae39f1e775266fa5122fd0c8891ce7520fa6048e683ad3de28" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -2981,9 +2981,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.22.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec480c0c51ddec81019531705acac51bcdbeae563557c982aa8263bb96880372" +checksum = "1be962f0e06da8f8465729ea2cb71a416d2257dff56cbe40a70d3e62a93ae5d1" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -3110,9 +3110,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" dependencies = [ "bitflags 2.6.0", ] @@ -3274,9 +3274,9 @@ checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" [[package]] name = "rustix" -version = "0.38.36" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags 2.6.0", "errno", @@ -3287,9 +3287,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.12" +version = "0.23.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" dependencies = [ "once_cell", "ring", @@ -3357,9 +3357,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" [[package]] name = "rustls-webpki" -version = "0.102.7" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84678086bd54edf2b415183ed7a94d0efb049f1b646a33e22a36f3794be6ae56" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -4215,9 +4215,9 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" @@ -4230,9 +4230,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-width" diff --git a/languages/js/sdk-client/package-lock.json b/languages/js/sdk-client/package-lock.json index 7a9fe313a..e81afb713 100644 --- a/languages/js/sdk-client/package-lock.json +++ b/languages/js/sdk-client/package-lock.json @@ -51,9 +51,9 @@ } }, "node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "dev": true, "license": "MIT", "engines": { @@ -450,9 +450,9 @@ } }, "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/package-lock.json b/package-lock.json index 08ad37f65..859e169ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -70,9 +70,9 @@ } }, "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "dev": true, "license": "MIT", "engines": { @@ -370,9 +370,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.5.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", - "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==", + "version": "22.5.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.5.tgz", + "integrity": "sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==", "dev": true, "license": "MIT", "peer": true, From 4717353c71b9b1e12b9bd6bfe12117e01b7a3ae9 Mon Sep 17 00:00:00 2001 From: Colton Hurst Date: Mon, 16 Sep 2024 10:59:56 -0400 Subject: [PATCH 20/77] [SM-1401] Update the Java SDK (#1005) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/SM-1401 ## 📔 Objective Update the Java SDK for Secrets Manager. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- languages/java/README.md | 30 +++++++++++-- languages/java/build.gradle | 1 + languages/java/example/Example.java | 41 +++++++++++++----- .../java/com/bitwarden/sdk/AuthClient.java | 32 ++++++++++++++ .../com/bitwarden/sdk/BitwardenClient.java | 26 ++++------- .../sdk/BitwardenClientException.java | 4 ++ .../com/bitwarden/sdk/ProjectsClient.java | 2 +- .../java/com/bitwarden/sdk/SecretsClient.java | 43 +++++++++++++++++-- 8 files changed, 143 insertions(+), 36 deletions(-) create mode 100644 languages/java/src/main/java/com/bitwarden/sdk/AuthClient.java diff --git a/languages/java/README.md b/languages/java/README.md index 02cbc4aaf..b4db4475e 100644 --- a/languages/java/README.md +++ b/languages/java/README.md @@ -13,12 +13,19 @@ Review the help documentation on [Access Tokens] ```java import com.bitwarden.sdk.*; +import com.bitwarden.sdk.schema.*; + +import java.lang.System; +import java.util.UUID; +import java.time.OffsetDateTime; + +String stateFile = System.getenv("STATE_FILE"); BitwardenSettings bitwardenSettings = new BitwardenSettings(); bitwardenSettings.setApiUrl("https://api.bitwarden.com"); bitwardenSettings.setIdentityUrl("https://identity.bitwarden.com"); BitwardenClient bitwardenClient = new BitwardenClient(bitwardenSettings); -bitwardenClient.accessTokenLogin(""); +bitwardenClient.auth().loginAccessToken("", stateFile); ``` ### Create new project @@ -44,7 +51,7 @@ var projectsResponse = bitwardenClient.projects().list(organizationId); ### Update project ```java -var projectResponse = bitwardenClient.projects().update(projectId, organizationId, "TestProjectUpdated"); +var projectResponse = bitwardenClient.projects().update(organizationId, projectId, "TestProjectUpdated"); ``` ### Add new secret @@ -53,7 +60,7 @@ var projectResponse = bitwardenClient.projects().update(projectId, organizationI String key = "key"; String value = "value"; String note = "note"; -var secretResponse = bitwardenClient.secrets().create(key, value, note, organizationId, new UUID[]{projectId}); +var secretResponse = bitwardenClient.secrets().create(organizationId, key, value, note, new UUID[]{projectId}); UUID secretId = secretResponse.getID(); ``` @@ -63,10 +70,19 @@ UUID secretId = secretResponse.getID(); var secretResponse = bitwardenClient.secrets().get(secretId); ``` +### Get secrets by ids + +```java +SecretsResponse secretsByIds = bitwardenClient.secrets().getByIds(new UUID[]{secretId}); +for (SecretResponse sr : secretsByIds.getData()) { + System.out.println(sr.getKey()); +} +``` + ### Update secret ```java -var secretResponse = bitwardenClient.secrets().update(secretId, key2, value2, note2, organizationId, new UUID[]{projectId}); +var secretResponse = bitwardenClient.secrets().update(organizationId, secretId, key2, value2, note2, new UUID[]{projectId}); ``` ### List secrets @@ -75,6 +91,12 @@ var secretResponse = bitwardenClient.secrets().update(secretId, key2, value2, no var secretIdentifiersResponse = bitwardenClient.secrets().list(organizationId); ``` +### Secrets sync +```java +SecretsSyncResponse syncResponse = bitwardenClient.secrets().sync(organizationId, OffsetDateTime.now()); +System.out.println("Has changes: " + syncResponse.getHasChanges()); +``` + ### Delete secret or project ```java diff --git a/languages/java/build.gradle b/languages/java/build.gradle index 2363d3a32..6f24369d7 100644 --- a/languages/java/build.gradle +++ b/languages/java/build.gradle @@ -74,6 +74,7 @@ tasks.withType(JavaCompile) { tasks.withType(Javadoc) { options.encoding = 'UTF-8' + failOnError = false } java { diff --git a/languages/java/example/Example.java b/languages/java/example/Example.java index 2460d76b5..cc34c2a29 100644 --- a/languages/java/example/Example.java +++ b/languages/java/example/Example.java @@ -1,5 +1,6 @@ import java.lang.System; import java.util.UUID; +import java.time.OffsetDateTime; import com.bitwarden.sdk.*; import com.bitwarden.sdk.schema.*; @@ -13,8 +14,10 @@ public static void main(String[] args) { String accessToken = System.getenv("ACCESS_TOKEN"); UUID organizationId = UUID.fromString(System.getenv("ORGANIZATION_ID")); + String apiUrl = System.getenv("API_URL"); String identityUrl = System.getenv("IDENTITY_URL"); + String stateFile = System.getenv("STATE_FILE"); // Configuring the URLS is optional, remove them to use the default values BitwardenSettings bitwardenSettings = new BitwardenSettings(); @@ -22,31 +25,49 @@ public static void main(String[] args) { bitwardenSettings.setIdentityUrl(identityUrl); try (BitwardenClient client = new BitwardenClient(bitwardenSettings)) { - client.accessTokenLogin(accessToken); + client.auth().loginAccessToken(accessToken, stateFile); - ProjectResponse project = client.projects().create(organizationId, "Test Project"); - System.out.println("Project id: " + project.getID()); + ProjectResponse project = client.projects().create(organizationId, "Test Project from Java SDK"); + System.out.println("Project CREATE, id: " + project.getID()); project = client.projects().get(project.getID()); + System.out.println("Project GET, id: " + project.getID()); ProjectsResponse projects = client.projects().list(organizationId); - System.out.println("Projects count: " + projects.getData().length); + System.out.println("Projects LIST, count: " + projects.getData().length); - client.projects().update(project.getID(), organizationId, "Updated Test Project"); + client.projects().update(organizationId, project.getID(), "Updated Test Project"); + project = client.projects().get(project.getID()); + System.out.println("Project UPDATE, new name: " + project.getName()); - SecretResponse secret = client.secrets().create("Secret Key", "Secret Value", "Secret Note", - organizationId, new UUID[]{project.getID()}); - System.out.println("Secret id: " + secret.getID()); + SecretResponse secret = client.secrets().create(organizationId, "Secret Key", "Secret Value", "Secret Note", new UUID[]{project.getID()}); + System.out.println("Secret CREATE, id: " + secret.getID()); secret = client.secrets().get(secret.getID()); + System.out.println("Secret GET, id: " + secret.getID()); SecretIdentifiersResponse secrets = client.secrets().list(organizationId); - System.out.println("Secrets count: " + secrets.getData().length); + System.out.println("Secrets LIST, count: " + secrets.getData().length); + + client.secrets().update(organizationId, secret.getID(), "Updated Key", "Updated Value", "Updated Note", new UUID[]{project.getID()}); + secret = client.secrets().get(secret.getID()); + System.out.println("Secret UPDATE, new key: " + secret.getKey()); + + SecretsResponse secretsByIds = client.secrets().getByIds(new UUID[]{secret.getID()}); + System.out.println("Getting secrets by ids, here are the keys of the retrieved secrets..."); + for (SecretResponse sr : secretsByIds.getData()) { + System.out.println(" " + sr.getKey()); + } - client.secrets().update(secret.getID(), "Updated Key", "Updated Value", "Updated Noye", organizationId, new UUID[]{project.getID()}); + SecretsSyncResponse syncResponse = client.secrets().sync(organizationId, OffsetDateTime.now()); + System.out.println("Running a secrets sync request based on the current time..."); + System.out.println("Has changes: " + syncResponse.getHasChanges()); + System.out.println("Deleting the created secret and project..."); client.secrets().delete(new UUID[]{secret.getID()}); client.projects().delete(new UUID[]{project.getID()}); + + System.out.println("Execution complete."); } } } diff --git a/languages/java/src/main/java/com/bitwarden/sdk/AuthClient.java b/languages/java/src/main/java/com/bitwarden/sdk/AuthClient.java new file mode 100644 index 000000000..b4c26eb75 --- /dev/null +++ b/languages/java/src/main/java/com/bitwarden/sdk/AuthClient.java @@ -0,0 +1,32 @@ +package com.bitwarden.sdk; + +import com.bitwarden.sdk.schema.*; + +import java.util.function.Function; + +public class AuthClient { + + private final CommandRunner commandRunner; + + AuthClient(CommandRunner commandRunner) { + this.commandRunner = commandRunner; + } + + public APIKeyLoginResponse loginAccessToken(String accessToken, String stateFile) { + Command command = new Command(); + AccessTokenLoginRequest accessTokenLoginRequest = new AccessTokenLoginRequest(); + accessTokenLoginRequest.setAccessToken(accessToken); + accessTokenLoginRequest.setStateFile(stateFile); + + command.setLoginAccessToken(accessTokenLoginRequest); + + ResponseForAPIKeyLoginResponse response = commandRunner.runCommand(command, + BitwardenClient.throwingFunctionWrapper(Converter::ResponseForAPIKeyLoginResponseFromJsonString)); + + if (response == null || !response.getSuccess()) { + throw new BitwardenClientException(response != null ? response.getErrorMessage() : "Login failed"); + } + + return response.getData(); + } +} diff --git a/languages/java/src/main/java/com/bitwarden/sdk/BitwardenClient.java b/languages/java/src/main/java/com/bitwarden/sdk/BitwardenClient.java index 9e1948184..bed29982d 100644 --- a/languages/java/src/main/java/com/bitwarden/sdk/BitwardenClient.java +++ b/languages/java/src/main/java/com/bitwarden/sdk/BitwardenClient.java @@ -21,6 +21,8 @@ public class BitwardenClient implements AutoCloseable { private final SecretsClient secrets; + private final AuthClient auth; + public BitwardenClient(BitwardenSettings bitwardenSettings) { ClientSettings clientSettings = new ClientSettings(); clientSettings.setAPIURL(bitwardenSettings.getApiUrl()); @@ -39,36 +41,20 @@ public BitwardenClient(BitwardenSettings bitwardenSettings) { commandRunner = new CommandRunner(library, client); projects = new ProjectsClient(commandRunner); secrets = new SecretsClient(commandRunner); + auth = new AuthClient(commandRunner); isClientOpen = true; } static Function throwingFunctionWrapper(ThrowingFunction throwingFunction) { - return i -> { try { return throwingFunction.accept(i); } catch (Exception ex) { - throw new BitwardenClientException("Response deserialization failed"); + throw new BitwardenClientException("Response failed", ex); } }; } - public APIKeyLoginResponse accessTokenLogin(String accessToken) { - Command command = new Command(); - AccessTokenLoginRequest accessTokenLoginRequest = new AccessTokenLoginRequest(); - accessTokenLoginRequest.setAccessToken(accessToken); - command.setAccessTokenLogin(accessTokenLoginRequest); - - ResponseForAPIKeyLoginResponse response = commandRunner.runCommand(command, - throwingFunctionWrapper(Converter::ResponseForAPIKeyLoginResponseFromJsonString)); - - if (response == null || !response.getSuccess()) { - throw new BitwardenClientException(response != null ? response.getErrorMessage() : "Login failed"); - } - - return response.getData(); - } - public ProjectsClient projects() { return projects; } @@ -77,6 +63,10 @@ public SecretsClient secrets() { return secrets; } + public AuthClient auth() { + return auth; + } + @Override public void close() { if (isClientOpen) { diff --git a/languages/java/src/main/java/com/bitwarden/sdk/BitwardenClientException.java b/languages/java/src/main/java/com/bitwarden/sdk/BitwardenClientException.java index 7b6025be8..e1bc9d477 100644 --- a/languages/java/src/main/java/com/bitwarden/sdk/BitwardenClientException.java +++ b/languages/java/src/main/java/com/bitwarden/sdk/BitwardenClientException.java @@ -5,4 +5,8 @@ public class BitwardenClientException extends RuntimeException { public BitwardenClientException(String message) { super(message); } + + public BitwardenClientException(String message, Exception ex) { + super(message, ex); + } } diff --git a/languages/java/src/main/java/com/bitwarden/sdk/ProjectsClient.java b/languages/java/src/main/java/com/bitwarden/sdk/ProjectsClient.java index 73b87440c..eb96b8286 100644 --- a/languages/java/src/main/java/com/bitwarden/sdk/ProjectsClient.java +++ b/languages/java/src/main/java/com/bitwarden/sdk/ProjectsClient.java @@ -49,7 +49,7 @@ public ProjectResponse create(UUID organizationId, String name) { return response.getData(); } - public ProjectResponse update(UUID id, UUID organizationId, String name) { + public ProjectResponse update(UUID organizationId, UUID id, String name) { Command command = new Command(); ProjectsCommand projectsCommand = new ProjectsCommand(); ProjectPutRequest projectPutRequest = new ProjectPutRequest(); diff --git a/languages/java/src/main/java/com/bitwarden/sdk/SecretsClient.java b/languages/java/src/main/java/com/bitwarden/sdk/SecretsClient.java index f1a97fdc7..63324449f 100644 --- a/languages/java/src/main/java/com/bitwarden/sdk/SecretsClient.java +++ b/languages/java/src/main/java/com/bitwarden/sdk/SecretsClient.java @@ -3,6 +3,7 @@ import com.bitwarden.sdk.schema.*; import java.util.UUID; +import java.time.OffsetDateTime; public class SecretsClient { @@ -30,7 +31,7 @@ public SecretResponse get(UUID id) { return response.getData(); } - public SecretResponse create(String key, String value, String note, UUID organizationId, UUID[] projectIds) { + public SecretResponse create(UUID organizationId, String key, String value, String note, UUID[] projectIds) { Command command = new Command(); SecretsCommand secretsCommand = new SecretsCommand(); SecretCreateRequest secretCreateRequest = new SecretCreateRequest(); @@ -52,8 +53,7 @@ public SecretResponse create(String key, String value, String note, UUID organiz return response.getData(); } - public SecretResponse update(UUID id, String key, String value, String note, UUID organizationId, - UUID[] projectIds) { + public SecretResponse update(UUID organizationId, UUID id, String key, String value, String note, UUID[] projectIds) { Command command = new Command(); SecretsCommand secretsCommand = new SecretsCommand(); SecretPutRequest secretPutRequest = new SecretPutRequest(); @@ -112,4 +112,41 @@ public SecretIdentifiersResponse list(UUID organizationId) { return response.getData(); } + + public SecretsResponse getByIds(UUID[] ids) { + Command command = new Command(); + SecretsCommand secretsCommand = new SecretsCommand(); + SecretsGetRequest secretsGetRequest = new SecretsGetRequest(); + secretsGetRequest.setIDS(ids); + secretsCommand.setGetByIDS(secretsGetRequest); + command.setSecrets(secretsCommand); + + ResponseForSecretsResponse response = commandRunner.runCommand(command, + BitwardenClient.throwingFunctionWrapper(Converter::ResponseForSecretsResponseFromJsonString)); + + if (response == null || !response.getSuccess()) { + throw new BitwardenClientException(response != null ? response.getErrorMessage() : "Secret(s) not found"); + } + + return response.getData(); + } + + public SecretsSyncResponse sync(UUID organizationId, OffsetDateTime lastSyncedDate) { + Command command = new Command(); + SecretsCommand secretsCommand = new SecretsCommand(); + SecretsSyncRequest secretsSyncRequest = new SecretsSyncRequest(); + secretsSyncRequest.setOrganizationID(organizationId); + secretsSyncRequest.setLastSyncedDate(lastSyncedDate); + secretsCommand.setSync(secretsSyncRequest); + command.setSecrets(secretsCommand); + + ResponseForSecretsSyncResponse response = commandRunner.runCommand(command, + BitwardenClient.throwingFunctionWrapper(Converter::ResponseForSecretsSyncResponseFromJsonString)); + + if (response == null || !response.getSuccess()) { + throw new BitwardenClientException(response != null ? response.getErrorMessage() : "Secrets sync failed"); + } + + return response.getData(); + } } From 7e46d9dd104be9ac5c6d549240f78596aa433b39 Mon Sep 17 00:00:00 2001 From: tangowithfoxtrot <5676771+tangowithfoxtrot@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:04:43 -0700 Subject: [PATCH 21/77] [SM-1434] - Dynamically-linked bitwarden-c not working for older supported OS versions (#1034) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [//]: # (https://bitwarden.atlassian.net/browse/SM-1434) ## 📔 Objective The bitwarden-c lib is dynamically-linked with the version of GCC/Clang that is installed on the GitHub runner. Using newer runners will result in errors like this, for those that are running older, but still-supported versions of macOS: ``` object file (/Users/user/go/pkg/mod/github.com/bitwarden/sdk-go@v1.0.0/internal/cinterface/lib/darwin-x64/libbitwarden_c.a[216](8912af01511d326c-sha256-x86_64-macosx.o)) was built for newer 'macOS' version (14.2) than being linked (14.0) ``` This PR uses `MACOSX_DEPLOYMENT_TARGET` to support older versions of macOS. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .github/workflows/build-rust-cross-platform.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index 31347a9a9..a8c626d2c 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -26,6 +26,9 @@ jobs: target: x86_64-pc-windows-msvc - os: windows-2022 target: x86_64-pc-windows-gnu + # caution: updating the linux runner OS version for GNU + # targets will likely break libbitwarden_c for older OS versions. + # prefer using oldest supported runner for for these targets - os: ubuntu-22.04 target: x86_64-unknown-linux-gnu - os: ubuntu-22.04 @@ -67,6 +70,7 @@ jobs: if: ${{ !contains(matrix.settings.target, 'musl') }} env: RUSTFLAGS: "-D warnings" + MACOSX_DEPLOYMENT_TARGET: "10.14" # allows using new macos runner versions while still supporting older systems run: cargo build -p bitwarden-c --target ${{ matrix.settings.target }} --release - name: Upload Artifact From d23ec731d1aa5e63ddcf7decbac6ef20107c508a Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Mon, 16 Sep 2024 16:29:41 -0400 Subject: [PATCH 22/77] BRE-314 - Fix Universal CLI Build (#1052) --- .github/workflows/build-cli.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 7620ced50..a54a669bb 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -74,7 +74,7 @@ jobs: - name: Build env: TARGET: ${{ matrix.settings.target }} - run: cargo build ${{ matrix.features }} -p bws --release --target=${{ matrix.settings.target }} + run: cargo build -p bws --release --target=${{ matrix.settings.target }} - name: Login to Azure if: ${{ needs.setup.outputs.sign == 'true' }} @@ -164,7 +164,7 @@ jobs: - name: Build env: TARGET: ${{ matrix.settings.target }} - run: cargo build ${{ matrix.features }} -p bws --release --target=${{ matrix.settings.target }} + run: cargo build -p bws --release --target=${{ matrix.settings.target }} - name: Login to Azure uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 @@ -286,7 +286,7 @@ jobs: - name: Build env: TARGET: ${{ matrix.settings.target }} - run: cargo zigbuild ${{ matrix.features }} -p bws --release --target=${{ matrix.settings.target }} + run: cargo zigbuild -p bws --release --target=${{ matrix.settings.target }} - name: Zip linux run: zip -j ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip ./target/${{ matrix.settings.target }}/release/bws @@ -375,7 +375,7 @@ jobs: - name: Sign binary env: MACOS_CERTIFICATE_NAME: ${{ steps.retrieve-secrets-macos.outputs.macos-bws-certificate-name }} - run: codesign --sign "$MACOS_CERTIFICATE_NAME" --verbose=3 --force --options=runtime --timestamp ./bws-aarch64-apple-darwin/bws + run: codesign --sign "$MACOS_CERTIFICATE_NAME" --verbose=3 --force --options=runtime --timestamp ./bws-macos-universal/bws - name: Notarize app env: @@ -389,7 +389,7 @@ jobs: xcrun notarytool store-credentials "notarytool-profile" --apple-id "$MACOS_NOTARIZATION_APPLE_ID" --team-id "$MACOS_NOTARIZATION_TEAM_ID" --password "$MACOS_NOTARIZATION_PWD" echo "Creating notarization archive" - zip -j ./bws-macos-universal-${{ env._PACKAGE_VERSION }}.zip ./bws-aarch64-apple-darwin/bws + zip -j ./bws-macos-universal-${{ env._PACKAGE_VERSION }}.zip ./bws-macos-universal/bws codesign --sign "$MACOS_CERTIFICATE_NAME" --verbose=3 --force --options=runtime --timestamp ./bws-macos-universal-${{ env._PACKAGE_VERSION }}.zip From c57e3a7d4b25c05cd7b68cf515520dbaf24b3dbe Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Tue, 17 Sep 2024 13:39:26 +0200 Subject: [PATCH 23/77] [PM-12023] Enforce hmac when mac key is present (#1041) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/issues/PM-12023 (https://bitwarden.atlassian.net/issues/PM-4185) ## 📔 Objective Prevent downgrading of encstring types to hmac-less by enforcing hmac when the symmetric key used has a mac key. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --------- Co-authored-by: Oscar Hinton --- .../src/enc_string/symmetric.rs | 26 ++++++++++++++++++- crates/bitwarden-crypto/src/error.rs | 2 ++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/crates/bitwarden-crypto/src/enc_string/symmetric.rs b/crates/bitwarden-crypto/src/enc_string/symmetric.rs index eb1220e29..1fc9b3a9d 100644 --- a/crates/bitwarden-crypto/src/enc_string/symmetric.rs +++ b/crates/bitwarden-crypto/src/enc_string/symmetric.rs @@ -237,6 +237,10 @@ impl KeyDecryptable> for EncString { fn decrypt_with_key(&self, key: &SymmetricCryptoKey) -> Result> { match self { EncString::AesCbc256_B64 { iv, data } => { + if key.mac_key.is_some() { + return Err(CryptoError::MacNotProvided); + } + let dec = crate::aes::decrypt_aes256(iv, data.clone(), &key.key)?; Ok(dec) } @@ -296,7 +300,9 @@ mod tests { use schemars::schema_for; use super::EncString; - use crate::{derive_symmetric_key, KeyDecryptable, KeyEncryptable, SymmetricCryptoKey}; + use crate::{ + derive_symmetric_key, CryptoError, KeyDecryptable, KeyEncryptable, SymmetricCryptoKey, + }; #[test] fn test_enc_string_roundtrip() { @@ -418,6 +424,24 @@ mod tests { assert_eq!(dec_str, "EncryptMe!"); } + #[test] + fn test_decrypt_downgrade_encstring_prevention() { + // Simulate a potential downgrade attack by removing the mac portion of the `EncString` and + // attempt to decrypt it using a `SymmetricCryptoKey` with a mac key. + let key = "hvBMMb1t79YssFZkpetYsM3deyVuQv4r88Uj9gvYe0+G8EwxvW3v1iywVmSl61iwzd17JW5C/ivzxSP2C9h7Tw==".to_string(); + let key = SymmetricCryptoKey::try_from(key).unwrap(); + + // A "downgraded" `EncString` from `EncString::AesCbc256_HmacSha256_B64` (2) to + // `EncString::AesCbc256_B64` (0), with the mac portion removed. + // + let enc_str = "0.NQfjHLr6za7VQVAbrpL81w==|wfrjmyJ0bfwkQlySrhw8dA=="; + let enc_string: EncString = enc_str.parse().unwrap(); + assert_eq!(enc_string.enc_type(), 0); + + let result: Result = enc_string.decrypt_with_key(&key); + assert!(matches!(result, Err(CryptoError::MacNotProvided))); + } + #[test] fn test_decrypt_cbc128_hmac() { let key = "Gt1aZ8kTTgkF80bLtb7LiMZBcxEA2FA5mbvV4x7K208=".to_string(); diff --git a/crates/bitwarden-crypto/src/error.rs b/crates/bitwarden-crypto/src/error.rs index 2fc4d2591..cd2ef9ac0 100644 --- a/crates/bitwarden-crypto/src/error.rs +++ b/crates/bitwarden-crypto/src/error.rs @@ -11,6 +11,8 @@ pub enum CryptoError { InvalidKey, #[error("The cipher's MAC doesn't match the expected value")] InvalidMac, + #[error("The key provided expects mac protected encstrings, but the mac is missing")] + MacNotProvided, #[error("Error while decrypting EncString")] KeyDecrypt, #[error("The cipher key has an invalid length")] From 74a9e30dbf35cbfc4d1d6b88847504d789d8431e Mon Sep 17 00:00:00 2001 From: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com> Date: Tue, 17 Sep 2024 09:27:57 -0600 Subject: [PATCH 24/77] Bump version to 1.0.0 (#1054) ## Type of change - [ ] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [X] Other ## Objective Automated ruby-sdk version bump to 1.0.0 --- languages/ruby/bitwarden_sdk_secrets/lib/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/version.rb b/languages/ruby/bitwarden_sdk_secrets/lib/version.rb index 3103642a1..39b47b47b 100644 --- a/languages/ruby/bitwarden_sdk_secrets/lib/version.rb +++ b/languages/ruby/bitwarden_sdk_secrets/lib/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module BitwardenSDKSecrets - VERSION = '0.2.0' + VERSION = '1.0.0' end From fb2053d2529e896f3d4d5f4852f855b1f7256bef Mon Sep 17 00:00:00 2001 From: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:01:32 -0600 Subject: [PATCH 25/77] Bump version to 1.0.0 (#1056) ## Type of change - [ ] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [X] Other ## Objective Automated bitwarden version bump to 1.0.0 --- Cargo.lock | 24 ++++++++++++------------ Cargo.toml | 26 +++++++++++++------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 57aa79565..e2ad1f04f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -360,7 +360,7 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitwarden" -version = "0.5.0" +version = "1.0.0" dependencies = [ "bitwarden-api-api", "bitwarden-api-identity", @@ -378,7 +378,7 @@ dependencies = [ [[package]] name = "bitwarden-api-api" -version = "0.5.0" +version = "1.0.0" dependencies = [ "reqwest", "serde", @@ -391,7 +391,7 @@ dependencies = [ [[package]] name = "bitwarden-api-identity" -version = "0.5.0" +version = "1.0.0" dependencies = [ "reqwest", "serde", @@ -413,7 +413,7 @@ dependencies = [ [[package]] name = "bitwarden-cli" -version = "0.5.0" +version = "1.0.0" dependencies = [ "clap", "color-eyre", @@ -423,7 +423,7 @@ dependencies = [ [[package]] name = "bitwarden-core" -version = "0.5.0" +version = "1.0.0" dependencies = [ "base64", "bitwarden-api-api", @@ -456,7 +456,7 @@ dependencies = [ [[package]] name = "bitwarden-crypto" -version = "0.5.0" +version = "1.0.0" dependencies = [ "aes", "argon2", @@ -487,7 +487,7 @@ dependencies = [ [[package]] name = "bitwarden-exporters" -version = "0.5.0" +version = "1.0.0" dependencies = [ "base64", "bitwarden-core", @@ -505,7 +505,7 @@ dependencies = [ [[package]] name = "bitwarden-fido" -version = "0.5.0" +version = "1.0.0" dependencies = [ "async-trait", "base64", @@ -529,7 +529,7 @@ dependencies = [ [[package]] name = "bitwarden-generators" -version = "0.5.0" +version = "1.0.0" dependencies = [ "bitwarden-core", "bitwarden-crypto", @@ -581,7 +581,7 @@ dependencies = [ [[package]] name = "bitwarden-send" -version = "0.5.0" +version = "1.0.0" dependencies = [ "base64", "bitwarden-api-api", @@ -599,7 +599,7 @@ dependencies = [ [[package]] name = "bitwarden-sm" -version = "0.5.0" +version = "1.0.0" dependencies = [ "bitwarden-api-api", "bitwarden-core", @@ -643,7 +643,7 @@ dependencies = [ [[package]] name = "bitwarden-vault" -version = "0.5.0" +version = "1.0.0" dependencies = [ "base64", "bitwarden-api-api", diff --git a/Cargo.toml b/Cargo.toml index d64aa04fc..7d452869c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ members = ["crates/*"] # Global settings for all crates should be defined here [workspace.package] # Update using `cargo set-version -p bitwarden ` -version = "0.5.0" +version = "1.0.0" authors = ["Bitwarden Inc"] edition = "2021" # Note: Changing rust-version should be considered a breaking change @@ -17,18 +17,18 @@ keywords = ["bitwarden"] # Define dependencies that are expected to be consistent across all crates [workspace.dependencies] -bitwarden = { path = "crates/bitwarden", version = "=0.5.0" } -bitwarden-api-api = { path = "crates/bitwarden-api-api", version = "=0.5.0" } -bitwarden-api-identity = { path = "crates/bitwarden-api-identity", version = "=0.5.0" } -bitwarden-cli = { path = "crates/bitwarden-cli", version = "=0.5.0" } -bitwarden-core = { path = "crates/bitwarden-core", version = "=0.5.0" } -bitwarden-crypto = { path = "crates/bitwarden-crypto", version = "=0.5.0" } -bitwarden-exporters = { path = "crates/bitwarden-exporters", version = "=0.5.0" } -bitwarden-fido = { path = "crates/bitwarden-fido", version = "=0.5.0" } -bitwarden-generators = { path = "crates/bitwarden-generators", version = "=0.5.0" } -bitwarden-send = { path = "crates/bitwarden-send", version = "=0.5.0" } -bitwarden-sm = { path = "crates/bitwarden-sm", version = "=0.5.0" } -bitwarden-vault = { path = "crates/bitwarden-vault", version = "=0.5.0" } +bitwarden = { path = "crates/bitwarden", version = "=1.0.0" } +bitwarden-api-api = { path = "crates/bitwarden-api-api", version = "=1.0.0" } +bitwarden-api-identity = { path = "crates/bitwarden-api-identity", version = "=1.0.0" } +bitwarden-cli = { path = "crates/bitwarden-cli", version = "=1.0.0" } +bitwarden-core = { path = "crates/bitwarden-core", version = "=1.0.0" } +bitwarden-crypto = { path = "crates/bitwarden-crypto", version = "=1.0.0" } +bitwarden-exporters = { path = "crates/bitwarden-exporters", version = "=1.0.0" } +bitwarden-fido = { path = "crates/bitwarden-fido", version = "=1.0.0" } +bitwarden-generators = { path = "crates/bitwarden-generators", version = "=1.0.0" } +bitwarden-send = { path = "crates/bitwarden-send", version = "=1.0.0" } +bitwarden-sm = { path = "crates/bitwarden-sm", version = "=1.0.0" } +bitwarden-vault = { path = "crates/bitwarden-vault", version = "=1.0.0" } [workspace.lints.clippy] unused_async = "deny" From c3b8c8dc3fb23ffd47c590611d04a55b3a29190e Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Tue, 17 Sep 2024 12:44:24 -0400 Subject: [PATCH 26/77] BRE-330 - Update CODEOWNERS for automation users (#1060) --- .github/CODEOWNERS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6bb362e8c..10c8bdeb8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -11,3 +11,8 @@ # Secrets Manager team crates/bitwarden-sm @bitwarden/team-secrets-manager-dev crates/bws @bitwarden/team-secrets-manager-dev + +# BRE Automation +crates/bws/Cargo.toml @bitwarden/team-secrets-manager-dev @bitwarden/automation-users +crates/bws/scripts/install.ps1 @bitwarden/team-secrets-manager-dev @bitwarden/automation-users +crates/bws/scripts/install.sh @bitwarden/team-secrets-manager-dev @bitwarden/automation-users From 3de7906cff98b9c8d5c0b8cc4fc2e40d1a447172 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Tue, 17 Sep 2024 12:48:24 -0400 Subject: [PATCH 27/77] BRE-330 - Update Rust crate workflows (#1057) --- .github/workflows/build-cli-docker.yml | 6 ++--- .github/workflows/build-rust-crates.yml | 11 +++----- .github/workflows/publish-rust-crates.yml | 33 +++++++---------------- .github/workflows/rust-test.yml | 4 +-- .github/workflows/version-bump.yml | 6 ++--- 5 files changed, 20 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build-cli-docker.yml b/.github/workflows/build-cli-docker.yml index 8302529c8..a54086b9b 100644 --- a/.github/workflows/build-cli-docker.yml +++ b/.github/workflows/build-cli-docker.yml @@ -23,7 +23,7 @@ jobs: - name: Check Branch to Publish env: - PUBLISH_BRANCHES: "master,rc,hotfix-rc" + PUBLISH_BRANCHES: "main,rc,hotfix-rc" id: publish-branch-check run: | REF=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} @@ -77,7 +77,7 @@ jobs: run: | REF=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} IMAGE_TAG=$(echo "${REF}" | sed "s#/#-#g") # slash safe branch name - if [[ "${IMAGE_TAG}" == "master" ]]; then + if [[ "${IMAGE_TAG}" == "main" ]]; then IMAGE_TAG=dev elif [[ ("${IMAGE_TAG}" == "rc") || ("${IMAGE_TAG}" == "hotfix-rc") ]]; then IMAGE_TAG=rc @@ -124,7 +124,7 @@ jobs: steps: - name: Check if any job failed if: | - github.ref == 'refs/heads/master' + github.ref == 'refs/heads/main' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix-rc' env: diff --git a/.github/workflows/build-rust-crates.yml b/.github/workflows/build-rust-crates.yml index 068bb9bbd..b7d0832fb 100644 --- a/.github/workflows/build-rust-crates.yml +++ b/.github/workflows/build-rust-crates.yml @@ -7,8 +7,6 @@ on: push: branches: - "main" - - "rc" - - "hotfix-rc" env: CARGO_TERM_COLOR: always @@ -17,7 +15,7 @@ jobs: build: name: Building ${{matrix.package}} for - ${{ matrix.os }} - runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }} + runs-on: ${{ matrix.os || 'ubuntu-latest' }} strategy: fail-fast: false @@ -42,7 +40,6 @@ jobs: uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable with: toolchain: stable - targets: ${{ matrix.settings.target }} - name: Cache cargo registry uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 @@ -61,9 +58,8 @@ jobs: release-dry-run: name: Release dry-run runs-on: ubuntu-latest - if: ${{ github.ref == 'refs/head/main' || github.ref == 'refs/head/rc' || github.ref == 'refs/head/hotfix-rc' }} - needs: - - build + if: ${{ github.ref == 'refs/head/main' }} + needs: build steps: - name: Checkout uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 @@ -72,7 +68,6 @@ jobs: uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable with: toolchain: stable - targets: ${{ matrix.settings.target }} - name: Cache cargo registry uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 diff --git a/.github/workflows/publish-rust-crates.yml b/.github/workflows/publish-rust-crates.yml index 3931e9e2a..bdb39d9b7 100644 --- a/.github/workflows/publish-rust-crates.yml +++ b/.github/workflows/publish-rust-crates.yml @@ -15,37 +15,24 @@ on: - Redeploy - Dry Run -defaults: - run: - shell: bash - jobs: - setup: - name: Setup + publish: + name: Publish runs-on: ubuntu-22.04 steps: - - name: Checkout repo + - name: Checkout uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Branch check - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} run: | - if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then echo "===================================" - echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" + echo "[!] Can only release from the 'main' branch" echo "===================================" exit 1 fi - publish: - name: Publish - runs-on: ubuntu-latest - needs: - - setup - steps: - - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - name: Login to Azure uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 with: @@ -70,7 +57,7 @@ jobs: run: cargo install cargo-release - name: Create GitHub deployment - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 id: deployment with: @@ -81,14 +68,14 @@ jobs: task: release - name: Cargo release - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} env: PUBLISH_GRACE_SLEEP: 10 CARGO_REGISTRY_TOKEN: ${{ steps.retrieve-secrets.outputs.cratesio-api-token }} run: cargo-release release publish --exclude bw --exclude bws --execute --no-confirm - name: Update deployment status to Success - if: ${{ github.event.inputs.release_type != 'Dry Run' && success() }} + if: ${{ inputs.release_type != 'Dry Run' && success() }} uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 with: token: "${{ secrets.GITHUB_TOKEN }}" @@ -96,7 +83,7 @@ jobs: deployment-id: ${{ steps.deployment.outputs.deployment_id }} - name: Update deployment status to Failure - if: ${{ github.event.inputs.release_type != 'Dry Run' && failure() }} + if: ${{ inputs.release_type != 'Dry Run' && failure() }} uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 with: token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/rust-test.yml b/.github/workflows/rust-test.yml index 8d8b136b2..3d9ed6f00 100644 --- a/.github/workflows/rust-test.yml +++ b/.github/workflows/rust-test.yml @@ -5,8 +5,6 @@ on: push: branches: - "main" - - "rc" - - "hotfix-rc" pull_request: env: @@ -23,7 +21,7 @@ jobs: - run: exit 0 test: - name: ${{ matrix.os }} / ${{matrix.target || 'default' }} + name: ${{ matrix.os }} / default runs-on: ${{ matrix.os || 'ubuntu-22.04' }} diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index 3536c96ce..8357d49bd 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -1,6 +1,6 @@ --- name: Version Bump -run-name: Version Bump - v${{ inputs.version_number }} +run-name: Version Bump - ${{ inputs.project }} - v${{ inputs.version_number }} on: workflow_dispatch: @@ -25,7 +25,7 @@ on: required: true cut_rc_branch: description: "Cut RC branch?" - default: true + default: false type: boolean jobs: @@ -198,7 +198,7 @@ jobs: env: GH_TOKEN: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }} PR_BRANCH: ${{ steps.create-branch.outputs.name }} - TITLE: "Bump version to ${{ inputs.version_number }}" + TITLE: "Bump ${{ inputs.project }} version to ${{ inputs.version_number }}" run: | PR_URL=$(gh pr create --title "$TITLE" \ --base "main" \ From e535cc29175e70d2d31a03c50ac79c075682e7a5 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Tue, 17 Sep 2024 12:50:12 -0400 Subject: [PATCH 28/77] BRE-328 - Simplify logic and apply linting suggestions in Publish Ruby workflow (#1055) --- .github/workflows/publish-ruby.yml | 33 ++++++++++++------------------ 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/.github/workflows/publish-ruby.yml b/.github/workflows/publish-ruby.yml index 9e2fc6d93..8df5dd390 100644 --- a/.github/workflows/publish-ruby.yml +++ b/.github/workflows/publish-ruby.yml @@ -18,31 +18,23 @@ permissions: id-token: write jobs: - setup: - name: Setup + publish_ruby: + name: Publish Ruby runs-on: ubuntu-22.04 steps: - - name: Checkout repo + - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - + - name: Branch check - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} run: | - if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then echo "===================================" - echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" + echo "[!] Can only release from the 'main' branch" echo "===================================" exit 1 fi - publish_ruby: - name: Publish Ruby - runs-on: ubuntu-22.04 - needs: setup - steps: - - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - name: Set up Ruby uses: ruby/setup-ruby@52753b7da854d5c07df37391a986c76ab4615999 # v1.191.0 with: @@ -54,7 +46,7 @@ jobs: workflow: generate_schemas.yml path: languages/ruby/bitwarden_sdk_secrets/lib workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: main artifacts: schemas.rb - name: Download x86_64-apple-darwin artifact @@ -63,7 +55,7 @@ jobs: workflow: build-rust-cross-platform.yml path: temp/macos-x64 workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: main artifacts: libbitwarden_c_files-x86_64-apple-darwin - name: Download aarch64-apple-darwin artifact @@ -71,7 +63,7 @@ jobs: with: workflow: build-rust-cross-platform.yml workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: main artifacts: libbitwarden_c_files-aarch64-apple-darwin path: temp/macos-arm64 @@ -80,7 +72,7 @@ jobs: with: workflow: build-rust-cross-platform.yml workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: main artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu path: temp/linux-x64 @@ -89,7 +81,7 @@ jobs: with: workflow: build-rust-cross-platform.yml workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: main artifacts: libbitwarden_c_files-x86_64-pc-windows-msvc path: temp/windows-x64 @@ -128,6 +120,7 @@ jobs: working-directory: languages/ruby/bitwarden_sdk_secrets - name: Push gem to Rubygems + if: ${{ inputs.release_type != 'Dry Run' }} run: | mkdir -p $HOME/.gem touch $HOME/.gem/credentials From 1309527074f926a7c5792d3a354b2f1be238c28a Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:32:16 -0400 Subject: [PATCH 29/77] BRE-330 - Update CODEOWNERS for Version Bumps (#1062) --- .github/CODEOWNERS | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 10c8bdeb8..e4fbb97b9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -12,7 +12,7 @@ crates/bitwarden-sm @bitwarden/team-secrets-manager-dev crates/bws @bitwarden/team-secrets-manager-dev -# BRE Automation -crates/bws/Cargo.toml @bitwarden/team-secrets-manager-dev @bitwarden/automation-users -crates/bws/scripts/install.ps1 @bitwarden/team-secrets-manager-dev @bitwarden/automation-users -crates/bws/scripts/install.sh @bitwarden/team-secrets-manager-dev @bitwarden/automation-users +# BRE Automations +crates/bws/Cargo.toml +crates/bws/scripts/install.ps1 +crates/bws/scripts/install.sh From f89ffb0b9cdda567ef71fb1c20727a44102bd0fc Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Wed, 18 Sep 2024 08:10:43 -0400 Subject: [PATCH 30/77] Update CLI workflows to be able to release from main branch (#1063) --- .github/workflows/build-cli-docker.yml | 20 +++------------ .github/workflows/build-cli.yml | 16 +++++------- .github/workflows/publish-ruby.yml | 2 +- .github/workflows/release-cli.yml | 35 ++++++++------------------ 4 files changed, 20 insertions(+), 53 deletions(-) diff --git a/.github/workflows/build-cli-docker.yml b/.github/workflows/build-cli-docker.yml index a54086b9b..eaf2299ff 100644 --- a/.github/workflows/build-cli-docker.yml +++ b/.github/workflows/build-cli-docker.yml @@ -5,8 +5,6 @@ on: push: branches: - "main" - - "rc" - - "hotfix-rc" workflow_dispatch: pull_request: @@ -22,15 +20,9 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Check Branch to Publish - env: - PUBLISH_BRANCHES: "main,rc,hotfix-rc" id: publish-branch-check run: | - REF=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} - - IFS="," read -a publish_branches <<< $PUBLISH_BRANCHES - - if [[ "${publish_branches[*]}" =~ "${REF}" ]]; then + if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then echo "is_publish_branch=true" >> $GITHUB_ENV else echo "is_publish_branch=false" >> $GITHUB_ENV @@ -79,8 +71,6 @@ jobs: IMAGE_TAG=$(echo "${REF}" | sed "s#/#-#g") # slash safe branch name if [[ "${IMAGE_TAG}" == "main" ]]; then IMAGE_TAG=dev - elif [[ ("${IMAGE_TAG}" == "rc") || ("${IMAGE_TAG}" == "hotfix-rc") ]]; then - IMAGE_TAG=rc fi echo "image_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT @@ -89,9 +79,8 @@ jobs: id: tag-list env: IMAGE_TAG: ${{ steps.tag.outputs.image_tag }} - IS_PUBLISH_BRANCH: ${{ env.is_publish_branch }} run: | - if [[ ("${IMAGE_TAG}" == "dev" || "${IMAGE_TAG}" == "rc") && "${IS_PUBLISH_BRANCH}" == "true" ]]; then + if [[ "${IMAGE_TAG}" == "dev" ]]; then echo "tags=$_AZ_REGISTRY/bws:${IMAGE_TAG},bitwarden/bws:${IMAGE_TAG}" >> $GITHUB_OUTPUT else echo "tags=$_AZ_REGISTRY/bws:${IMAGE_TAG}" >> $GITHUB_OUTPUT @@ -123,10 +112,7 @@ jobs: needs: build-docker steps: - name: Check if any job failed - if: | - github.ref == 'refs/heads/main' - || github.ref == 'refs/heads/rc' - || github.ref == 'refs/heads/hotfix-rc' + if: github.ref == 'refs/heads/main' env: BUILD_DOCKER_STATUS: ${{ needs.build-docker.result }} run: | diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index a54a669bb..355575716 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -6,8 +6,6 @@ on: push: branches: - "main" - - "rc" - - "hotfix-rc" workflow_dispatch: defaults: @@ -132,8 +130,7 @@ jobs: build-macos: name: Building CLI for - ${{ matrix.settings.os }} - ${{ matrix.settings.target }} runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }} - needs: - - setup + needs: setup env: _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} strategy: @@ -242,8 +239,7 @@ jobs: build-linux: name: Building CLI for - ${{ matrix.settings.os }} - ${{ matrix.settings.target }} runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }} - needs: - - setup + needs: setup env: _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} strategy: @@ -271,7 +267,8 @@ jobs: toolchain: stable targets: ${{ matrix.settings.target }} - - uses: goto-bus-stop/setup-zig@7ab2955eb728f5440978d5824358023be3a2802d # v2.2.0 + - name: Set up Zig + uses: goto-bus-stop/setup-zig@7ab2955eb728f5440978d5824358023be3a2802d # v2.2.0 with: version: 0.12.0 @@ -325,7 +322,7 @@ jobs: unzip bws-x86_64-apple-darwin-${{ env._PACKAGE_VERSION }}.zip -d ./bws-x86_64-apple-darwin unzip bws-aarch64-apple-darwin-${{ env._PACKAGE_VERSION }}.zip -d ./bws-aarch64-apple-darwin - - name: lipo create universal package + - name: Create universal package with lipo run: | mkdir ./bws-macos-universal @@ -441,8 +438,7 @@ jobs: manpages: name: Generate manpages runs-on: ubuntu-22.04 - needs: - - setup + needs: setup steps: - name: Checkout repo uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 diff --git a/.github/workflows/publish-ruby.yml b/.github/workflows/publish-ruby.yml index 8df5dd390..a2390953e 100644 --- a/.github/workflows/publish-ruby.yml +++ b/.github/workflows/publish-ruby.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - + - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} run: | diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 009dc9359..80c09142e 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -14,10 +14,6 @@ on: - Release - Dry Run -defaults: - run: - shell: bash - env: _AZ_REGISTRY: bitwardenprod.azurecr.io @@ -32,11 +28,11 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Branch check - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} run: | - if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc-cli" ]]; then + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then echo "===================================" - echo "[!] Can only release from the 'rc' or 'hotfix-rc-cli' branches" + echo "[!] Can only release from the 'main' branch" echo "===================================" exit 1 fi @@ -48,7 +44,7 @@ jobs: echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Create GitHub deployment - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 id: deployment with: @@ -59,7 +55,6 @@ jobs: task: release - name: Download all Release artifacts - if: ${{ github.event.inputs.release_type != 'Dry Run' }} uses: bitwarden/gh-actions/download-artifacts@main with: workflow: build-cli.yml @@ -67,15 +62,6 @@ jobs: workflow_conclusion: success branch: ${{ github.ref_name }} - - name: Dry Run - Download all artifacts - if: ${{ github.event.inputs.release_type == 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-cli.yml - path: packages - workflow_conclusion: success - branch: main - - name: Get checksum files uses: bitwarden/gh-actions/get-checksum@main with: @@ -83,7 +69,7 @@ jobs: file_path: "packages/bws-sha256-checksums-${{ steps.version.outputs.version }}.txt" - name: Create release - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 env: PKG_VERSION: ${{ steps.version.outputs.version }} @@ -105,7 +91,7 @@ jobs: draft: true - name: Update deployment status to Success - if: ${{ github.event.inputs.release_type != 'Dry Run' && success() }} + if: ${{ inputs.release_type != 'Dry Run' && success() }} uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 with: token: "${{ secrets.GITHUB_TOKEN }}" @@ -113,7 +99,7 @@ jobs: deployment-id: ${{ steps.deployment.outputs.deployment_id }} - name: Update deployment status to Failure - if: ${{ github.event.inputs.release_type != 'Dry Run' && failure() }} + if: ${{ inputs.release_type != 'Dry Run' && failure() }} uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 with: token: "${{ secrets.GITHUB_TOKEN }}" @@ -123,8 +109,7 @@ jobs: publish: name: Publish bws to crates.io runs-on: ubuntu-22.04 - needs: - - setup + needs: setup steps: - name: Checkout uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 @@ -153,7 +138,7 @@ jobs: run: cargo install cargo-release - name: Cargo release - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} env: PUBLISH_GRACE_SLEEP: 10 CARGO_REGISTRY_TOKEN: ${{ steps.retrieve-secrets.outputs.cratesio-api-token }} @@ -229,7 +214,7 @@ jobs: "GH_PAT=${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }}" - name: Log out of Docker and disable Docker Notary - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} run: | docker logout echo "DOCKER_CONTENT_TRUST=0" >> $GITHUB_ENV From 220cbcb925bf7e1fc8e273cf005a35cb9f913d04 Mon Sep 17 00:00:00 2001 From: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com> Date: Wed, 18 Sep 2024 06:17:48 -0600 Subject: [PATCH 31/77] Bump bws version to 1.0.0 (#1066) ## Type of change - [ ] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [X] Other ## Objective Automated bws version bump to 1.0.0 --- Cargo.lock | 2 +- crates/bws/Cargo.toml | 2 +- crates/bws/scripts/install.ps1 | 2 +- crates/bws/scripts/install.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e2ad1f04f..6dd102c50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -743,7 +743,7 @@ dependencies = [ [[package]] name = "bws" -version = "0.5.0" +version = "1.0.0" dependencies = [ "bat", "bitwarden", diff --git a/crates/bws/Cargo.toml b/crates/bws/Cargo.toml index 1b13c68a1..c6ef58396 100644 --- a/crates/bws/Cargo.toml +++ b/crates/bws/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bws" -version = "0.5.0" +version = "1.0.0" description = """ Bitwarden Secrets Manager CLI """ diff --git a/crates/bws/scripts/install.ps1 b/crates/bws/scripts/install.ps1 index f39846c20..daa5cf9d1 100755 --- a/crates/bws/scripts/install.ps1 +++ b/crates/bws/scripts/install.ps1 @@ -4,7 +4,7 @@ param ( $ErrorActionPreference = "Stop" -$defaultBwsVersion = "0.5.0" +$defaultBwsVersion = "1.0.0" $bwsVersion = if ($env:bwsVersion) { $env:bwsVersion } else { $defaultBwsVersion } $installDir = [Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData) | Join-Path -ChildPath "Programs" | Join-Path -ChildPath "Bitwarden" diff --git a/crates/bws/scripts/install.sh b/crates/bws/scripts/install.sh index 126ae9e22..6cd7fe01f 100755 --- a/crates/bws/scripts/install.sh +++ b/crates/bws/scripts/install.sh @@ -4,7 +4,7 @@ # An installer for the bws command line utility. # ################################################## -DEFAULT_BWS_VERSION="0.5.0" +DEFAULT_BWS_VERSION="1.0.0" BWS_VERSION="${BWS_VERSION:-$DEFAULT_BWS_VERSION}" main() { From 5eebbfd4d0e5ef68a7bc5329a872342af55f9375 Mon Sep 17 00:00:00 2001 From: Colton Hurst Date: Wed, 18 Sep 2024 09:16:43 -0400 Subject: [PATCH 32/77] Fix Linting Issue (#1064) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 📔 Objective Fix the failing linting CI introduced [here](https://github.com/bitwarden/sdk/commit/e535cc29175e70d2d31a03c50ac79c075682e7a5). ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes From 08859a350c83a3aae3fa78cc09704514cfe92679 Mon Sep 17 00:00:00 2001 From: Andreas Coroiu Date: Wed, 18 Sep 2024 15:23:59 +0200 Subject: [PATCH 33/77] [PM-11922] Handle apk key hash as origin (#1042) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking ## 📔 Objective Add support for the new `Origin` type in `passkey-rs` Points to: https://github.com/bitwarden/passkey-rs/pull/16 ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- Cargo.lock | 20 +++--- crates/bitwarden-fido/Cargo.toml | 5 +- crates/bitwarden-fido/src/client.rs | 22 +++---- crates/bitwarden-fido/src/lib.rs | 4 +- crates/bitwarden-fido/src/types.rs | 64 +++++++++++++++++++ crates/bitwarden-uniffi/src/platform/fido2.rs | 6 +- 6 files changed, 92 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6dd102c50..068df1254 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -518,6 +518,7 @@ dependencies = [ "log", "p256", "passkey", + "passkey-client", "reqwest", "schemars", "serde", @@ -2633,8 +2634,8 @@ dependencies = [ [[package]] name = "passkey" -version = "0.3.1" -source = "git+https://github.com/bitwarden/passkey-rs?rev=ae08e2cb7dd3d44d915caed395c0cdc56b50fa27#ae08e2cb7dd3d44d915caed395c0cdc56b50fa27" +version = "0.2.0" +source = "git+https://github.com/bitwarden/passkey-rs?rev=29bb052eb15a42e369728ded3cfb2aa7c91213df#29bb052eb15a42e369728ded3cfb2aa7c91213df" dependencies = [ "passkey-authenticator", "passkey-client", @@ -2644,8 +2645,8 @@ dependencies = [ [[package]] name = "passkey-authenticator" -version = "0.3.0" -source = "git+https://github.com/bitwarden/passkey-rs?rev=ae08e2cb7dd3d44d915caed395c0cdc56b50fa27#ae08e2cb7dd3d44d915caed395c0cdc56b50fa27" +version = "0.2.0" +source = "git+https://github.com/bitwarden/passkey-rs?rev=29bb052eb15a42e369728ded3cfb2aa7c91213df#29bb052eb15a42e369728ded3cfb2aa7c91213df" dependencies = [ "async-trait", "coset", @@ -2657,12 +2658,13 @@ dependencies = [ [[package]] name = "passkey-client" -version = "0.3.1" -source = "git+https://github.com/bitwarden/passkey-rs?rev=ae08e2cb7dd3d44d915caed395c0cdc56b50fa27#ae08e2cb7dd3d44d915caed395c0cdc56b50fa27" +version = "0.2.0" +source = "git+https://github.com/bitwarden/passkey-rs?rev=29bb052eb15a42e369728ded3cfb2aa7c91213df#29bb052eb15a42e369728ded3cfb2aa7c91213df" dependencies = [ "ciborium", "coset", "idna", + "nom", "passkey-authenticator", "passkey-types", "public-suffix", @@ -2674,12 +2676,12 @@ dependencies = [ [[package]] name = "passkey-transports" version = "0.1.0" -source = "git+https://github.com/bitwarden/passkey-rs?rev=ae08e2cb7dd3d44d915caed395c0cdc56b50fa27#ae08e2cb7dd3d44d915caed395c0cdc56b50fa27" +source = "git+https://github.com/bitwarden/passkey-rs?rev=29bb052eb15a42e369728ded3cfb2aa7c91213df#29bb052eb15a42e369728ded3cfb2aa7c91213df" [[package]] name = "passkey-types" version = "0.2.1" -source = "git+https://github.com/bitwarden/passkey-rs?rev=ae08e2cb7dd3d44d915caed395c0cdc56b50fa27#ae08e2cb7dd3d44d915caed395c0cdc56b50fa27" +source = "git+https://github.com/bitwarden/passkey-rs?rev=29bb052eb15a42e369728ded3cfb2aa7c91213df#29bb052eb15a42e369728ded3cfb2aa7c91213df" dependencies = [ "bitflags 2.6.0", "ciborium", @@ -2916,7 +2918,7 @@ dependencies = [ [[package]] name = "public-suffix" version = "0.1.1" -source = "git+https://github.com/bitwarden/passkey-rs?rev=ae08e2cb7dd3d44d915caed395c0cdc56b50fa27#ae08e2cb7dd3d44d915caed395c0cdc56b50fa27" +source = "git+https://github.com/bitwarden/passkey-rs?rev=29bb052eb15a42e369728ded3cfb2aa7c91213df#29bb052eb15a42e369728ded3cfb2aa7c91213df" [[package]] name = "pyo3" diff --git a/crates/bitwarden-fido/Cargo.toml b/crates/bitwarden-fido/Cargo.toml index e85e56a19..6b04bd796 100644 --- a/crates/bitwarden-fido/Cargo.toml +++ b/crates/bitwarden-fido/Cargo.toml @@ -30,7 +30,10 @@ coset = { version = "0.3.7" } itertools = "0.13.0" log = ">=0.4.18, <0.5" p256 = { version = ">=0.13.2, <0.14" } -passkey = { git = "https://github.com/bitwarden/passkey-rs", rev = "ae08e2cb7dd3d44d915caed395c0cdc56b50fa27" } +passkey = { git = "https://github.com/bitwarden/passkey-rs", rev = "ff757604cd7b4e8f321ed1616fef7e40e21ac5df" } +passkey-client = { git = "https://github.com/bitwarden/passkey-rs", rev = "ff757604cd7b4e8f321ed1616fef7e40e21ac5df", features = [ + "android-asset-validation", +] } reqwest = { version = ">=0.12.5, <0.13", default-features = false } schemars = { version = "0.8.21", features = ["uuid1", "chrono"] } serde = { version = ">=1.0, <2.0", features = ["derive"] } diff --git a/crates/bitwarden-fido/src/client.rs b/crates/bitwarden-fido/src/client.rs index a72dae6f5..ac4330be7 100644 --- a/crates/bitwarden-fido/src/client.rs +++ b/crates/bitwarden-fido/src/client.rs @@ -1,5 +1,4 @@ use passkey::client::WebauthnError; -use reqwest::Url; use thiserror::Error; use super::{ @@ -7,15 +6,12 @@ use super::{ get_string_name_from_enum, types::{ AuthenticatorAssertionResponse, AuthenticatorAttestationResponse, ClientData, - ClientExtensionResults, CredPropsResult, + ClientExtensionResults, CredPropsResult, Origin, }, Fido2Authenticator, PublicKeyCredentialAuthenticatorAssertionResponse, PublicKeyCredentialAuthenticatorAttestationResponse, }; - -#[derive(Debug, Error)] -#[error("Invalid origin: {0}")] -pub struct InvalidOriginError(String); +use crate::types::InvalidOriginError; #[derive(Debug, Error)] pub enum Fido2ClientError { @@ -43,12 +39,11 @@ pub struct Fido2Client<'a> { impl<'a> Fido2Client<'a> { pub async fn register( &mut self, - origin: String, + origin: Origin, request: String, client_data: ClientData, ) -> Result { - let origin = Url::parse(&origin).map_err(|e| InvalidOriginError(format!("{}", e)))?; - + let origin: passkey::client::Origin = origin.try_into()?; let request: passkey::types::webauthn::CredentialCreationOptions = serde_json::from_str(&request)?; @@ -67,7 +62,7 @@ impl<'a> Fido2Client<'a> { let rp_id = request.public_key.rp.id.clone(); let mut client = passkey::client::Client::new(self.authenticator.get_authenticator(true)); - let result = client.register(&origin, request, client_data).await?; + let result = client.register(origin, request, client_data).await?; Ok(PublicKeyCredentialAuthenticatorAttestationResponse { id: result.id, @@ -98,12 +93,11 @@ impl<'a> Fido2Client<'a> { pub async fn authenticate( &mut self, - origin: String, + origin: Origin, request: String, client_data: ClientData, ) -> Result { - let origin = Url::parse(&origin).map_err(|e| InvalidOriginError(format!("{}", e)))?; - + let origin: passkey::client::Origin = origin.try_into()?; let request: passkey::types::webauthn::CredentialRequestOptions = serde_json::from_str(&request)?; @@ -116,7 +110,7 @@ impl<'a> Fido2Client<'a> { .replace(uv); let mut client = passkey::client::Client::new(self.authenticator.get_authenticator(false)); - let result = client.authenticate(&origin, request, client_data).await?; + let result = client.authenticate(origin, request, client_data).await?; Ok(PublicKeyCredentialAuthenticatorAssertionResponse { id: result.id, diff --git a/crates/bitwarden-fido/src/lib.rs b/crates/bitwarden-fido/src/lib.rs index 991828eb3..be1dfdb53 100644 --- a/crates/bitwarden-fido/src/lib.rs +++ b/crates/bitwarden-fido/src/lib.rs @@ -32,10 +32,10 @@ pub use traits::{ pub use types::{ AuthenticatorAssertionResponse, AuthenticatorAttestationResponse, ClientData, Fido2CredentialAutofillView, Fido2CredentialAutofillViewError, GetAssertionRequest, - GetAssertionResult, MakeCredentialRequest, MakeCredentialResult, Options, + GetAssertionResult, MakeCredentialRequest, MakeCredentialResult, Options, Origin, PublicKeyCredentialAuthenticatorAssertionResponse, PublicKeyCredentialAuthenticatorAttestationResponse, PublicKeyCredentialRpEntity, - PublicKeyCredentialUserEntity, + PublicKeyCredentialUserEntity, UnverifiedAssetLink, }; use self::crypto::{cose_key_to_pkcs8, pkcs8_to_cose_key}; diff --git a/crates/bitwarden-fido/src/types.rs b/crates/bitwarden-fido/src/types.rs index 8bc8ae42c..409db7a98 100644 --- a/crates/bitwarden-fido/src/types.rs +++ b/crates/bitwarden-fido/src/types.rs @@ -1,7 +1,10 @@ +use std::borrow::Cow; + use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine}; use bitwarden_crypto::KeyContainer; use bitwarden_vault::{CipherError, CipherView}; use passkey::types::webauthn::UserVerificationRequirement; +use reqwest::Url; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use thiserror::Error; @@ -359,6 +362,67 @@ pub struct AuthenticatorAssertionResponse { pub user_handle: Vec, } +#[derive(Debug, Error)] +#[error("Invalid origin: {0}")] +pub struct InvalidOriginError(String); + +#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] +/// An Unverified asset link. +pub struct UnverifiedAssetLink { + /// Application package name. + package_name: String, + /// Fingerprint to compare. + sha256_cert_fingerprint: String, + /// Host to lookup the well known asset link. + host: String, + /// When sourced from the application statement list or parsed from host for passkeys. + /// Will be generated from `host` if not provided. + asset_link_url: Option, +} + +#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] +/// The origin of a WebAuthn request. +pub enum Origin { + /// A Url, meant for a request in the web browser. + Web(String), + /// An android digital asset fingerprint. + /// Meant for a request coming from an android application. + Android(UnverifiedAssetLink), +} + +impl<'a> TryFrom for passkey::client::Origin<'a> { + type Error = InvalidOriginError; + + fn try_from(value: Origin) -> Result { + Ok(match value { + Origin::Web(url) => { + let url = Url::parse(&url).map_err(|e| InvalidOriginError(format!("{}", e)))?; + passkey::client::Origin::Web(Cow::Owned(url)) + } + Origin::Android(link) => passkey::client::Origin::Android(link.try_into()?), + }) + } +} + +impl<'a> TryFrom for passkey::client::UnverifiedAssetLink<'a> { + type Error = InvalidOriginError; + + fn try_from(value: UnverifiedAssetLink) -> Result { + let asset_link_url = match value.asset_link_url { + Some(url) => Some(Url::parse(&url).map_err(|e| InvalidOriginError(format!("{}", e)))?), + None => None, + }; + + passkey::client::UnverifiedAssetLink::new( + Cow::from(value.package_name), + value.sha256_cert_fingerprint.as_str(), + Cow::from(value.host), + asset_link_url, + ) + .map_err(|e| InvalidOriginError(format!("{:?}", e))) + } +} + #[cfg(test)] mod tests { use serde::{Deserialize, Serialize}; diff --git a/crates/bitwarden-uniffi/src/platform/fido2.rs b/crates/bitwarden-uniffi/src/platform/fido2.rs index 3018d7beb..f483ff346 100644 --- a/crates/bitwarden-uniffi/src/platform/fido2.rs +++ b/crates/bitwarden-uniffi/src/platform/fido2.rs @@ -11,7 +11,7 @@ use bitwarden::{ }, vault::{Cipher, CipherView, Fido2CredentialNewView}, }; -use bitwarden_fido::Fido2CredentialAutofillView; +use bitwarden_fido::{Fido2CredentialAutofillView, Origin}; use crate::{error::Result, Client}; @@ -135,7 +135,7 @@ pub struct ClientFido2Client(pub(crate) ClientFido2Authenticator); impl ClientFido2Client { pub async fn register( &self, - origin: String, + origin: Origin, request: String, client_data: ClientData, ) -> Result { @@ -153,7 +153,7 @@ impl ClientFido2Client { pub async fn authenticate( &self, - origin: String, + origin: Origin, request: String, client_data: ClientData, ) -> Result { From 2f1717d3b08e34430b00b6be1af963d48a3c5e21 Mon Sep 17 00:00:00 2001 From: tangowithfoxtrot <5676771+tangowithfoxtrot@users.noreply.github.com> Date: Wed, 18 Sep 2024 06:47:32 -0700 Subject: [PATCH 34/77] SM-1402 - review and update php sdk (#1032) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/SM-1402 ## 📔 Objective Update PHP bindings in accordance with our other wrappers. This renames any "put" methods to "update", refactors `access_token_login` to `auth().login_access_token`, re-orders function args for `create` and `update`, and adds secret syncing. This update required quite a few changes to the schemas. However, since we cannot auto-generate them with `quicktype` (see the error referenced in glideapps/quicktype/pull/2407), schemas were generated with the swaggest/json-cli: ```sh json-cli gen-php ../../support/schemas/schema_types/SchemaTypes.json --ns '\Bitwarden\Sdk\Schemas' --ns-path ./src/schemas/ ``` The generated schemas still required hand modification to get human-readable class names for things like `ProjectCommand`, `SecretCommand`, etc. To validate the changes, I've run the `example.php` file after updating the schemas. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --------- Co-authored-by: Maciej Zieniuk Co-authored-by: vphan916 <95309255+vphan916@users.noreply.github.com> Co-authored-by: Maciej Zieniuk <167752252+mzieniukbw@users.noreply.github.com> --- languages/php/.gitignore | 2 + languages/php/INSTALL.md | 56 +++++ languages/php/README.md | 133 +++++----- languages/php/composer.json | 4 +- languages/php/composer.lock | 230 +----------------- languages/php/example.php | 106 ++++++-- languages/php/src/AuthClient.php | 35 +++ languages/php/src/BitwardenClient.php | 55 ++--- languages/php/src/BitwardenLib.php | 75 ++++-- languages/php/src/CommandRunner.php | 22 +- languages/php/src/ProjectsClient.php | 75 +++--- languages/php/src/SecretsClient.php | 113 +++++---- .../src/schemas/AccessTokenLoginRequest.php | 39 --- .../src/schemas/BitwardenClassStructure.php | 11 - .../schemas/BitwardenClassStructureTrait.php | 189 -------------- languages/php/src/schemas/ClientSettings.php | 133 ---------- languages/php/src/schemas/Command.php | 44 ---- .../php/src/schemas/ProjectCreateRequest.php | 43 ---- .../php/src/schemas/ProjectGetRequest.php | 37 --- .../php/src/schemas/ProjectPutRequest.php | 50 ---- languages/php/src/schemas/ProjectsCommand.php | 55 ----- .../php/src/schemas/ProjectsDeleteRequest.php | 39 --- .../php/src/schemas/ProjectsListRequest.php | 38 --- .../php/src/schemas/SecretCreateRequest.php | 58 ----- .../php/src/schemas/SecretGetRequest.php | 38 --- .../src/schemas/SecretIdentifiersRequest.php | 38 --- .../php/src/schemas/SecretPutRequest.php | 64 ----- .../src/schemas/SecretVerificationRequest.php | 35 --- languages/php/src/schemas/SecretsCommand.php | 56 ----- .../php/src/schemas/SecretsDeleteRequest.php | 39 --- .../php/src/schemas/SecretsGetRequest.php | 39 --- support/scripts/schemas.ts | 21 ++ 32 files changed, 471 insertions(+), 1501 deletions(-) create mode 100644 languages/php/INSTALL.md create mode 100644 languages/php/src/AuthClient.php delete mode 100644 languages/php/src/schemas/AccessTokenLoginRequest.php delete mode 100644 languages/php/src/schemas/BitwardenClassStructure.php delete mode 100644 languages/php/src/schemas/BitwardenClassStructureTrait.php delete mode 100644 languages/php/src/schemas/ClientSettings.php delete mode 100644 languages/php/src/schemas/Command.php delete mode 100644 languages/php/src/schemas/ProjectCreateRequest.php delete mode 100644 languages/php/src/schemas/ProjectGetRequest.php delete mode 100644 languages/php/src/schemas/ProjectPutRequest.php delete mode 100644 languages/php/src/schemas/ProjectsCommand.php delete mode 100644 languages/php/src/schemas/ProjectsDeleteRequest.php delete mode 100644 languages/php/src/schemas/ProjectsListRequest.php delete mode 100644 languages/php/src/schemas/SecretCreateRequest.php delete mode 100644 languages/php/src/schemas/SecretGetRequest.php delete mode 100644 languages/php/src/schemas/SecretIdentifiersRequest.php delete mode 100644 languages/php/src/schemas/SecretPutRequest.php delete mode 100644 languages/php/src/schemas/SecretVerificationRequest.php delete mode 100644 languages/php/src/schemas/SecretsCommand.php delete mode 100644 languages/php/src/schemas/SecretsDeleteRequest.php delete mode 100644 languages/php/src/schemas/SecretsGetRequest.php diff --git a/languages/php/.gitignore b/languages/php/.gitignore index b2a69e9a0..5d6ed424e 100644 --- a/languages/php/.gitignore +++ b/languages/php/.gitignore @@ -1,2 +1,4 @@ .DS_Store vendor +src/lib/ +src/Schemas/ diff --git a/languages/php/INSTALL.md b/languages/php/INSTALL.md new file mode 100644 index 000000000..299053389 --- /dev/null +++ b/languages/php/INSTALL.md @@ -0,0 +1,56 @@ +# PHP Installation + +## Introduction + +Composer is used to build the PHP Bitwarden client library. + +## Prerequisites + +- PHP >= 8.0 +- FFI extension enabled in PHP configuration +- Composer +- Bitwarden SDK native library. + - Expected in one of below locations, depending on the OS and architecture. + The `src` is relative path to the [src](./src) directory. + - Windows x86_64: `src\lib\windows-x64\bitwarden_c.dll` + - Linux x86_64: `src/lib/linux-x64/libbitwarden_c.so` + - macOS x86_64: `src/lib/macos-x64/libbitwarden_c.dylib` + - macOS aarch64: `src/lib/macos-arm64/libbitwarden_c.dylib` + - If you prefer to build the SDK yourself, see the [SDK README.md](../../README.md) for instructions. + +## Build Commands + +```shell +composer install +``` + +## Example + +### macOS + +#### Install Prerequisites + +Use brew Composer and PHP + +```shell +brew install php +brew install composer +``` + +#### Build Commands + +```shell +composer install +``` + +## Example SDK Usage Project + +```shell +export ACCESS_TOKEN="" +export STATE_FILE="" +export ORGANIZATION_ID="" +export API_URL="https://api.bitwarden.com" +export IDENTITY_URL="https://identity.bitwarden.com" + +php example.php +``` diff --git a/languages/php/README.md b/languages/php/README.md index 9e4a9385d..61991bd0e 100644 --- a/languages/php/README.md +++ b/languages/php/README.md @@ -1,100 +1,121 @@ # Bitwarden Secrets Manager SDK wrapper for PHP PHP bindings for interacting with the [Bitwarden Secrets Manager]. This is a beta release and might be missing some functionality. -Supported are CRUD operations on project and secret entities. ## Installation -Requirements: -- PHP >= 8.0 -- Composer -- Bitwarden C libraries which you can generate using BitwardenSDK and following instructions in its readme (requires Rust). https://github.com/bitwarden/sdk -If you are not using the standalone version of this library, file will be placed in `target/debug` folder if you are using from BitwardenSDK repository. -- Access token for the Bitwarden account - +See the [installation instructions](./INSTALL.md) ## Usage -To interact with the client first you need to obtain the access token from Bitwarden. -You can then initialize BitwardenSettings passing $api_url and $identity_url if needed. These parameteres are -optional and if they are not defined, BitwardenSettings instance will try to get these values from ENV, and -if they are not defined there as well, it will use defaults: `https://api.bitwarden.com` as api_url and -`https://identity.bitwarden.com` as identity_url. You can also pass device type as argument but that is entirely -optional. +### Create access token -Passing BitwardenSettings instance to BitwardenClient will initialize it. Before using the client you must -be authorized by calling the access_token_login method passing your Bitwarden access token to it. +To interact with the client first you need to obtain the access token from Bitwarden. +Review the help documentation on [Access Tokens]. +### Create new Bitwarden client ```php -$access_token = ''; -$api_url = ""; -$identity_url = ""; +require_once 'vendor/autoload.php'; + +$access_token = ""; +$state_file = ""; +$organization_id = ""; +$api_url = "https://api.bitwarden.com"; +$identity_url = "https://identity.bitwarden.com"; + $bitwarden_settings = new \Bitwarden\Sdk\BitwardenSettings($api_url, $identity_url); $bitwarden_client = new \Bitwarden\Sdk\BitwardenClient($bitwarden_settings); -$bitwarden_client->access_token_login($access_token); +$bitwarden_client->auth->login_access_token($access_token, $state_file); ``` -After successful authorization you can interact with client to manage your projects and secrets. -```php -$organization_id = ""; +Initialize `BitwardenSettings` by passing `$api_url` and `$identity_url` or set to null to use the defaults. +The default for `api_url` is `https://api.bitwarden.com` and for `identity_url` is `https://identity.bitwarden.com`. -$bitwarden_client = new \Bitwarden\Sdk\BitwardenClient($bitwarden_settings); -$res = $bitwarden_client->access_token_login($access_token); +### Create new project -// create project -$name = "PHP project" -$res = $bitwarden_client->projects->create($name, $organization_id); +```php +$name = "PHP project"; +$res = $bitwarden_client->projects->create($organization_id, $name); $project_id = $res->id; +``` -// get project +### Get project + +```php $res = $bitwarden_client->projects->get($project_id); +``` + +### List all projects -// list projects +```php $res = $bitwarden_client->projects->list($organization_id); +``` -// update project -$name = "Updated PHP project" -$res = $bitwarden_client->projects->put($project_id, $name, $organization_id); +### Update project -// get secret -$res = $bitwarden_client->secrets->get($secret_id); +```php +$name = "Updated PHP project"; +$res = $bitwarden_client->projects->update($organization_id, $project_id, $name); +``` -// list secrets -$res = $bitwarden_client->secrets->list($organization_id); +### Delete project -// delete project +```php $res = $bitwarden_client->projects->delete([$project_id]); +``` +### Create new secret + +```php +$key = "Secret key"; +$note = "Secret note"; +$value = "Secret value"; +$res = $bitwarden_client->secrets->create($organization_id, $key, $value, $note, [$project_id]); +$secret_id = $res->id; ``` -Similarly, you interact with secrets: +### Get secret + ```php -$organization_id = ""; +$res = $bitwarden_client->secrets->get($secret_id); +``` -// create secret -$key = "AWS secret key"; -$note = "Private account"; -$secret = "76asaj,Is_)" -$res = $bitwarden_client->secrets->create($key, $note, $organization_id, [$project_id], $secret); -$secret_id = $res->id; +### Get multiple secrets -// get secret -$res = $bitwarden_sdk->secrets->get($secret_id); +```php +$res = $bitwarden_client->secrets->get_by_ids([$secret_id]); +``` -// list secrets +### List all secrets + +```php $res = $bitwarden_client->secrets->list($organization_id); +``` + +### Update secret + +```php +$key = "Updated key"; +$note = "Updated note"; +$value = "Updated value"; +$res = $bitwarden_client->secrets->update($organization_id, $secret_id, $key, $value, $note, [$project_id]); +``` -// update secret -$note = "Updated account"; -$key = "AWS private updated" -$secret = "7uYTE,:Aer" -$res = $bitwarden_client->secrets->update($secret_id, $key, $note, $organization_id, [$project_id], $secret); +### Sync secrets -// delete secret -$res = $bitwarden_sdk->secrets->delete([$secret_id]); +```php +$last_synced_date = "2024-09-01T00:00:00Z"; +$res = $bitwarden_client->secrets->sync($organization_id, $last_synced_date); +``` + +### Delete secret + +```php +$res = $bitwarden_client->secrets->delete([$secret_id]); ``` +[Access Tokens]: https://bitwarden.com/help/access-tokens/ [Bitwarden Secrets Manager]: https://bitwarden.com/products/secrets-manager/ diff --git a/languages/php/composer.json b/languages/php/composer.json index 85447e72a..fce61f890 100644 --- a/languages/php/composer.json +++ b/languages/php/composer.json @@ -7,13 +7,13 @@ "version": "0.1.0", "require": { "php": "^8.0", - "swaggest/json-schema": "^0.12.42", "ext-ffi": "*" }, "autoload": { "psr-4": { "Bitwarden\\Sdk\\": "src/" - } + }, + "files": ["src/Schemas/Schemas.php"] }, "authors": [ { diff --git a/languages/php/composer.lock b/languages/php/composer.lock index fc6b42c4f..187511304 100644 --- a/languages/php/composer.lock +++ b/languages/php/composer.lock @@ -4,234 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7081b1bfe099982a63ad06d5ab9fa66d", - "packages": [ - { - "name": "phplang/scope-exit", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/phplang/scope-exit.git", - "reference": "239b73abe89f9414aa85a7ca075ec9445629192b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phplang/scope-exit/zipball/239b73abe89f9414aa85a7ca075ec9445629192b", - "reference": "239b73abe89f9414aa85a7ca075ec9445629192b", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "*" - }, - "type": "library", - "autoload": { - "psr-4": { - "PhpLang\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD" - ], - "authors": [ - { - "name": "Sara Golemon", - "email": "pollita@php.net", - "homepage": "https://twitter.com/SaraMG", - "role": "Developer" - } - ], - "description": "Emulation of SCOPE_EXIT construct from C++", - "homepage": "https://github.com/phplang/scope-exit", - "keywords": [ - "cleanup", - "exit", - "scope" - ], - "support": { - "issues": "https://github.com/phplang/scope-exit/issues", - "source": "https://github.com/phplang/scope-exit/tree/master" - }, - "time": "2016-09-17T00:15:18+00:00" - }, - { - "name": "swaggest/json-diff", - "version": "v3.10.4", - "source": { - "type": "git", - "url": "https://github.com/swaggest/json-diff.git", - "reference": "f4e511708060ff7511a3743fab4aa484a062bcfb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/swaggest/json-diff/zipball/f4e511708060ff7511a3743fab4aa484a062bcfb", - "reference": "f4e511708060ff7511a3743fab4aa484a062bcfb", - "shasum": "" - }, - "require": { - "ext-json": "*" - }, - "require-dev": { - "phperf/phpunit": "4.8.37" - }, - "type": "library", - "autoload": { - "psr-4": { - "Swaggest\\JsonDiff\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Viacheslav Poturaev", - "email": "vearutop@gmail.com" - } - ], - "description": "JSON diff/rearrange/patch/pointer library for PHP", - "support": { - "issues": "https://github.com/swaggest/json-diff/issues", - "source": "https://github.com/swaggest/json-diff/tree/v3.10.4" - }, - "time": "2022-11-09T13:21:05+00:00" - }, - { - "name": "swaggest/json-schema", - "version": "v0.12.42", - "source": { - "type": "git", - "url": "https://github.com/swaggest/php-json-schema.git", - "reference": "d23adb53808b8e2da36f75bc0188546e4cbe3b45" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/swaggest/php-json-schema/zipball/d23adb53808b8e2da36f75bc0188546e4cbe3b45", - "reference": "d23adb53808b8e2da36f75bc0188546e4cbe3b45", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": ">=5.4", - "phplang/scope-exit": "^1.0", - "swaggest/json-diff": "^3.8.2", - "symfony/polyfill-mbstring": "^1.19" - }, - "require-dev": { - "phperf/phpunit": "4.8.37" - }, - "suggest": { - "ext-mbstring": "For better performance" - }, - "type": "library", - "autoload": { - "psr-4": { - "Swaggest\\JsonSchema\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Viacheslav Poturaev", - "email": "vearutop@gmail.com" - } - ], - "description": "High definition PHP structures with JSON-schema based validation", - "support": { - "email": "vearutop@gmail.com", - "issues": "https://github.com/swaggest/php-json-schema/issues", - "source": "https://github.com/swaggest/php-json-schema/tree/v0.12.42" - }, - "time": "2023-09-12T14:43:42+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2023-07-28T09:04:16+00:00" - } - ], + "content-hash": "1769eb8cdcb42d17f993aa0ef123895b", + "packages": [], "packages-dev": [], "aliases": [], "minimum-stability": "stable", diff --git a/languages/php/example.php b/languages/php/example.php index 7eafcb96a..864a4ca23 100644 --- a/languages/php/example.php +++ b/languages/php/example.php @@ -3,45 +3,101 @@ require_once 'vendor/autoload.php'; $access_token = getenv('ACCESS_TOKEN'); +$state_file = getenv('STATE_FILE'); $organization_id = getenv('ORGANIZATION_ID'); // Configuring the URLS is optional, set them to null to use the default values $api_url = getenv('API_URL'); $identity_url = getenv('IDENTITY_URL'); -$client_settings = new \Bitwarden\Sdk\BitwardenSettings($api_url, $identity_url); +try { + $client_settings = new \Bitwarden\Sdk\BitwardenSettings($api_url, $identity_url); -$bitwarden_client = new \Bitwarden\Sdk\BitwardenClient($client_settings); -$bitwarden_client->access_token_login($access_token); + $bitwarden_client = new \Bitwarden\Sdk\BitwardenClient($client_settings); -// create project -$res = $bitwarden_client->projects->create('php project', $organization_id); -$project_id = $res->id; + $bitwarden_client->auth->login_access_token($access_token, $state_file); -// get project -$res = $bitwarden_client->projects->get($project_id); + // create project + print("Projects:\n"); + $res = $bitwarden_client->projects->create($organization_id, 'php project'); + $project_id = $res->id; + print("\tcreate: '" . $project_id . "'\n\n"); -// list projects -$res = $bitwarden_client->projects->list($organization_id); + // get project + $res = $bitwarden_client->projects->get($project_id); + print("\tget: '" . $res->name . "'\n\n"); -// update project -$res = $bitwarden_client->projects->put($project_id, 'php test awesome', $organization_id); + // list projects + $res = $bitwarden_client->projects->list($organization_id); + print("\tlist:\n"); + foreach ($res->data as $project) { + print("\t\tID: '" . $project->id . "', Name: '" . $project->name . "'\n"); + } + print("\n"); -// create secret -$res = $bitwarden_client->secrets->create("New Key", "hello world", $organization_id, [$project_id], "123"); -$secret_id = $res->id; + // update project + $res = $bitwarden_client->projects->update($organization_id, $project_id, 'php test project'); + print("\tupdate: '" . $res->name . "'\n\n"); -// get secret -$res = $bitwarden_client->secrets->get($secret_id); + // sync secrets + print("Secrets:\n"); + print("\tSyncing secrets...\n"); + $res = $bitwarden_client->secrets->sync($organization_id, null); + $now = new DateTime(); + $now_string = $now->format('Y-m-d\TH:i:s.u\Z'); + print("\t\tSync has changes: " . ($res->hasChanges ? 'true' : 'false') . "\n\n"); -// list secrets -$res = $bitwarden_client->secrets->list($organization_id); + print("\tSyncing again to ensure no changes since last sync...\n"); + $res = $bitwarden_client->secrets->sync($organization_id, $now_string); + print("\t\tSync has changes: " . ($res->hasChanges ? 'true' : 'false') . "\n\n"); -// update secret -$res = $bitwarden_client->secrets->update($secret_id, "hello world 2", "hello", $organization_id, [$project_id], "123"); + // create secret + $res = $bitwarden_client->secrets->create($organization_id, "New Key", "New value", "New note", [$project_id]); + $secret_id = $res->id; + print("\tcreate: '" . $secret_id . "'\n\n"); -// delete secret -$res = $bitwarden_client->secrets->delete([$secret_id]); + // get secret + $res = $bitwarden_client->secrets->get($secret_id); + print("\tget: '" . $res->key . "'\n\n"); -// delete project -$res = $bitwarden_client->projects->delete([$project_id]); + // get multiple secrets by ids + $res = $bitwarden_client->secrets->get_by_ids([$secret_id]); + print("\tget_by_ids:\n"); + foreach ($res->data as $secret) { + print("\t\tID: '" . $secret->id . "', Key: '" . $secret->key . "'\n"); + } + print("\n"); + + // list secrets + $res = $bitwarden_client->secrets->list($organization_id); + print("\tlist:\n"); + foreach ($res->data as $secret) { + print("\t\tID: '" . $secret->id . "', Key: '" . $secret->key . "'\n"); + } + print("\n"); + + // update secret + $res = $bitwarden_client->secrets->update($organization_id, $secret_id, "Updated key", "Updated value", "Updated note", [$project_id]); + print("\tupdate: '" . $res->key . "'\n\n"); + + // delete secret + print("Cleaning up secrets and projects:\n"); + $res = $bitwarden_client->secrets->delete([$secret_id]); + print("\tdelete:\n"); + foreach ($res->data as $secret) { + print("\t\tdeleted secret: '" . $secret->id . "'\n"); + } + print("\n"); + + // delete project + $res = $bitwarden_client->projects->delete([$project_id]); + print("\tdelete:\n"); + foreach ($res->data as $project) { + print("\t\tdeleted project: '" . $project->id . "'\n"); + } + print("\n"); + +} catch (Exception $e) { + print("Error: " . $e->getMessage() . "\n"); + exit(1); +} diff --git a/languages/php/src/AuthClient.php b/languages/php/src/AuthClient.php new file mode 100644 index 000000000..449c76905 --- /dev/null +++ b/languages/php/src/AuthClient.php @@ -0,0 +1,35 @@ +commandRunner = $commandRunner; + } + + /** + * @throws Exception + */ + public function login_access_token(string $access_token, ?string $state_file): void + { + $access_token_request = new AccessTokenLoginRequest($access_token, $state_file); + $command = new Command(passwordLogin: null, apiKeyLogin: null, loginAccessToken: $access_token_request, + getUserApiKey: null, fingerprint: null, sync: null, secrets: null, projects: null, generators: null); + try { + $result = $this->commandRunner->run($command); + if (!isset($result->authenticated) || !$result->authenticated) { + throw new Exception("Unauthorized"); + } + } catch (Exception $exception) { + throw new Exception("Authorization error: " . $exception->getMessage()); + } + } +} diff --git a/languages/php/src/BitwardenClient.php b/languages/php/src/BitwardenClient.php index 79fccdf9c..c125b6aa7 100644 --- a/languages/php/src/BitwardenClient.php +++ b/languages/php/src/BitwardenClient.php @@ -2,59 +2,40 @@ namespace Bitwarden\Sdk; -use Bitwarden\Sdk\Schemas\AccessTokenLoginRequest; -use Bitwarden\Sdk\schemas\ClientSettings; -use Bitwarden\Sdk\Schemas\Command; -use FFI; -use Swaggest\JsonDiff\Exception; - +use Bitwarden\Sdk\Schemas\ClientSettings; +use Bitwarden\Sdk\Schemas\DeviceType; +use JsonException; class BitwardenClient { - private BitwardenLib $bitwarden_lib; - - private ClientSettings $clientSettings; - public ProjectsClient $projects; public SecretsClient $secrets; - private CommandRunner $commandRunner; + public AuthClient $auth; - private FFI\CData $handle; + private BitwardenLib $bitwarden_lib; + private ClientSettings $clientSettings; + + private CommandRunner $commandRunner; + + /** + * @throws JsonException + */ public function __construct(BitwardenSettings $bitwardenSettings) { - $this->clientSettings = new ClientSettings(); - $this->clientSettings->apiUrl = $bitwardenSettings->get_api_url(); - $this->clientSettings->identityUrl = $bitwardenSettings->get_identity_url(); - $this->clientSettings->userAgent = "Bitwarden PHP-SDK"; + $this->clientSettings = new ClientSettings(apiUrl: $bitwardenSettings->get_api_url(), + deviceType: DeviceType::$SDK, identityUrl: $bitwardenSettings->get_identity_url(), + userAgent: "Bitwarden PHP-SDK"); $this->bitwarden_lib = new BitwardenLib(); - $this->handle = $this->bitwarden_lib->init($this->clientSettings); + $this->bitwarden_lib->init($this->clientSettings); - $this->commandRunner = new CommandRunner($this->bitwarden_lib, $this->handle); + $this->commandRunner = new CommandRunner($this->bitwarden_lib); $this->projects = new ProjectsClient($this->commandRunner); $this->secrets = new SecretsClient($this->commandRunner); - } - - /** - * @throws \Exception - */ - public function access_token_login(string $access_token) - { - $access_token_request = new AccessTokenLoginRequest(); - $access_token_request->accessToken = $access_token; - $command = new Command(); - $command->accessTokenLogin = $access_token_request->jsonSerialize(); - $result = $this->commandRunner->run($command); - if (!isset($result->authenticated)) { - throw new \Exception("Authorization error"); - } - - if ($result->authenticated == False) { - throw new \Exception("Unauthorized"); - } + $this->auth = new AuthClient($this->commandRunner); } public function __destruct() diff --git a/languages/php/src/BitwardenLib.php b/languages/php/src/BitwardenLib.php index 351728986..53be3299b 100644 --- a/languages/php/src/BitwardenLib.php +++ b/languages/php/src/BitwardenLib.php @@ -4,10 +4,11 @@ use Bitwarden\Sdk\Schemas\ClientSettings; use Bitwarden\Sdk\Schemas\Command; +use Exception; use FFI; -use Swaggest\JsonDiff\Exception; -use Swaggest\JsonSchema\JsonSchema; - +use JsonException; +use RuntimeException; +use stdClass; class BitwardenLib { @@ -15,36 +16,36 @@ class BitwardenLib public FFI\CData $handle; /** - * @throws \Exception + * @throws Exception */ public function __construct() { $lib_file = null; if (PHP_OS === 'WINNT') { - $lib_file = '/lib/windows-x64/bitwarden_c.dll'; - if (file_exists($lib_file) == false) { - $lib_file = __DIR__.'/../../../target/debug/bitwarden_c.dll'; + $lib_file = __DIR__ . '/lib/windows-x64/bitwarden_c.dll'; + if (!file_exists($lib_file)) { + $lib_file = __DIR__ . '/../../../target/debug/bitwarden_c.dll'; } } elseif (PHP_OS === 'Linux') { - $lib_file = '/lib/linux-x64/libbitwarden_c.so'; - if (file_exists($lib_file) == false) { - $lib_file = __DIR__.'/../../../target/debug/libbitwarden_c.so'; + $lib_file = __DIR__ . '/lib/linux-x64/libbitwarden_c.so'; + if (!file_exists($lib_file)) { + $lib_file = __DIR__ . '/../../../target/debug/libbitwarden_c.so'; } } elseif (PHP_OS === 'Darwin') { $architecture = trim(exec('uname -m')); if ($architecture === 'x86_64' || $architecture === 'amd64') { - $lib_file = __DIR__.'/lib/macos-x64/libbitwarden_c.dylib'; + $lib_file = __DIR__ . '/lib/macos-x64/libbitwarden_c.dylib'; } elseif ($architecture === 'arm64') { - $lib_file = __DIR__.'/lib/macos-arm64/libbitwarden_c.dylib'; + $lib_file = __DIR__ . '/lib/macos-arm64/libbitwarden_c.dylib'; } - if (file_exists($lib_file) == false) { - $lib_file = __DIR__.'/../../../target/debug/libbitwarden_c.dylib'; + if (!file_exists($lib_file)) { + $lib_file = __DIR__ . '/../../../target/debug/libbitwarden_c.dylib'; } } - if ($lib_file == null || is_file($lib_file) == false) { - throw new \Exception("Lib file not found"); + if ($lib_file == null || !is_file($lib_file)) { + throw new Exception("Lib file not found"); } $this->ffi = FFI::cdef(' @@ -55,20 +56,29 @@ public function __construct() ); } + /** + * @throws JsonException + * @throws Exception + */ public function init(ClientSettings $client_settings): FFI\CData { - $this->handle = $this->ffi->init(json_encode($client_settings->jsonSerialize())); + $encoded_json = $this::json_encode_sdk_format($client_settings->to()); + $this->handle = $this->ffi->init($encoded_json); return $this->handle; } - public function run_command(Command $command): \stdClass + /** + * @throws JsonException + * @throws Exception + */ + public function run_command(Command $command): stdClass { - $encoded_json = json_encode($command->jsonSerialize()); + $encoded_json = $this::json_encode_sdk_format($command->to()); try { $result = $this->ffi->run_command($encoded_json, $this->handle); return json_decode(FFI::string($result)); - } catch (\FFI\Exception $e) { - throw new \RuntimeException('Error occurred during FFI operation: ' . $e->getMessage()); + } catch (FFI\Exception $e) { + throw new RuntimeException('Error occurred during FFI operation: ' . $e->getMessage()); } } @@ -76,4 +86,27 @@ public function free_mem(): void { $this->ffi->free_mem($this->handle); } + + /** + * @throws JsonException + */ + private static function json_encode_sdk_format($object): string + { + $withoutNull = function ($a) use (&$withoutNull) { + if (is_object($a)) { + $a = array_filter((array)$a); + foreach ($a as $k => $v) { + $a[$k] = $withoutNull($v); + } + + return (object)$a; + } + + return $a; + }; + + $object_no_nulls = $withoutNull($object); + + return json_encode($object_no_nulls, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES); + } } diff --git a/languages/php/src/CommandRunner.php b/languages/php/src/CommandRunner.php index 9eec68b2d..532b9625e 100644 --- a/languages/php/src/CommandRunner.php +++ b/languages/php/src/CommandRunner.php @@ -2,36 +2,32 @@ namespace Bitwarden\Sdk; - use Bitwarden\Sdk\Schemas\Command; -use FFI; +use Exception; +use stdClass; class CommandRunner { - private FFI\CData $handle; - private BitwardenLib $bitwardenLib; - public function __construct(BitwardenLib $bitwardenLib, $handle) + public function __construct(BitwardenLib $bitwardenLib) { $this->bitwardenLib = $bitwardenLib; - $this->handle = $handle; } /** - * @throws \Exception + * @throws Exception */ - public function run(Command $command): \stdClass + public function run(Command $command): stdClass { $result = $this->bitwardenLib->run_command($command); - if ($result->success == true) { + if ($result->success) { return $result->data; } - if (isset($result->errorMessage)) - { - throw new \Exception($result->errorMessage); + if (isset($result->errorMessage)) { + throw new Exception($result->errorMessage); } - throw new \Exception("Unknown error occurred"); + throw new Exception("Unknown error occurred"); } } diff --git a/languages/php/src/ProjectsClient.php b/languages/php/src/ProjectsClient.php index 6b6f9fb6a..cca44f1e6 100644 --- a/languages/php/src/ProjectsClient.php +++ b/languages/php/src/ProjectsClient.php @@ -9,6 +9,8 @@ use Bitwarden\Sdk\Schemas\ProjectsCommand; use Bitwarden\Sdk\Schemas\ProjectsDeleteRequest; use Bitwarden\Sdk\Schemas\ProjectsListRequest; +use Exception; +use stdClass; class ProjectsClient { @@ -19,63 +21,74 @@ public function __construct(CommandRunner $commandRunner) $this->commandRunner = $commandRunner; } - public function get(string $project_id): \stdClass + /** + * @throws Exception + */ + public function get(string $project_id): stdClass { - $project_get_request = new ProjectGetRequest(); - $project_get_request->id = $project_id; + $project_get_request = new ProjectGetRequest($project_id); $project_get_request->validate(); - $project_command = new ProjectsCommand(); - $project_command->get = $project_get_request->jsonSerialize(); + $project_command = new ProjectsCommand(get: $project_get_request, create: null, list: null, update: null, + delete: null); return $this->run_project_command($project_command); } - public function list(string $organization_id): \stdClass + /** + * @throws Exception + */ + public function list(string $organization_id): stdClass { - $project_list_request = new ProjectsListRequest(); - $project_list_request->organizationId = $organization_id; + $project_list_request = new ProjectsListRequest($organization_id); $project_list_request->validate(); - $project_command = new ProjectsCommand(); - $project_command->list = $project_list_request->jsonSerialize(); + $project_command = new ProjectsCommand(get: null, create: null, list: $project_list_request, update: null, + delete: null); return $this->run_project_command($project_command); } - public function create(string $project_name, string $organization_id): \stdClass + /** + * @throws Exception + */ + public function create(string $organization_id, string $project_name): stdClass { - $project_create_request = new ProjectCreateRequest(); - $project_create_request->name = $project_name; - $project_create_request->organizationId = $organization_id; + $project_create_request = new ProjectCreateRequest(name: $project_name, organizationId: $organization_id); $project_create_request->validate(); - $project_command = new ProjectsCommand(); - $project_command->create = $project_create_request->jsonSerialize(); + $project_command = new ProjectsCommand(get: null, create: $project_create_request, list: null, update: null, + delete: null); return $this->run_project_command($project_command); } - public function put(string $project_id, string $project_name, string $organization_id): \stdClass + /** + * @throws Exception + */ + public function update(string $organization_id, string $project_id, string $project_name): stdClass { - $project_put_request = new ProjectPutRequest(); - $project_put_request->organizationId = $organization_id; - $project_put_request->name = $project_name; - $project_put_request->id = $project_id; + $project_put_request = new ProjectPutRequest(id: $project_id, name: $project_name, + organizationId: $organization_id); $project_put_request->validate(); - $project_command = new ProjectsCommand(); - $project_command->update = $project_put_request->jsonSerialize(); + $project_command = new ProjectsCommand(get: null, create: null, list: null, update: $project_put_request, + delete: null); return $this->run_project_command($project_command); } - public function delete(array $ids): \stdClass + /** + * @throws Exception + */ + public function delete(array $ids): stdClass { - $projects_delete_request = new ProjectsDeleteRequest(); - $projects_delete_request->ids = $ids; + $projects_delete_request = new ProjectsDeleteRequest($ids); $projects_delete_request->validate(); - $project_command = new ProjectsCommand(); - $project_command->delete = $projects_delete_request->jsonSerialize(); + $project_command = new ProjectsCommand(get: null, create: null, list: null, update: null, + delete: $projects_delete_request); return $this->run_project_command($project_command); } - public function run_project_command($projectCommand): \stdClass + /** + * @throws Exception + */ + public function run_project_command($projectCommand): stdClass { - $command = new Command(); - $command->projects = $projectCommand; + $command = new Command(passwordLogin: null, apiKeyLogin: null, loginAccessToken: null, getUserApiKey: null, + fingerprint: null, sync: null, secrets: null, projects: $projectCommand, generators: null); return $this->commandRunner->run($command); } } diff --git a/languages/php/src/SecretsClient.php b/languages/php/src/SecretsClient.php index d5c0b0cef..85bc334d5 100644 --- a/languages/php/src/SecretsClient.php +++ b/languages/php/src/SecretsClient.php @@ -10,6 +10,9 @@ use Bitwarden\Sdk\Schemas\SecretsCommand; use Bitwarden\Sdk\Schemas\SecretsDeleteRequest; use Bitwarden\Sdk\Schemas\SecretsGetRequest; +use Bitwarden\Sdk\Schemas\SecretsSyncRequest; +use Exception; +use stdClass; class SecretsClient { @@ -20,79 +23,103 @@ public function __construct(CommandRunner $commandRunner) $this->commandRunner = $commandRunner; } - public function get(string $secret_id): \stdClass + /** + * @throws Exception + */ + public function get(string $secret_id): stdClass { - $secret_get_request = new SecretGetRequest(); - $secret_get_request->id = $secret_id; + $secret_get_request = new SecretGetRequest($secret_id); $secret_get_request->validate(); - $secret_command = new SecretsCommand(); - $secret_command->get = $secret_get_request->jsonSerialize(); - return $this->run_secret_command($secret_command); + $secrets_command = new SecretsCommand(get: $secret_get_request, getByIds: null, create: null, list: null, + update: null, delete: null, sync: null); + return $this->run_secret_command($secrets_command); } - public function get_by_ids(array $secret_ids): \stdClass + /** + * @throws Exception + */ + public function get_by_ids(array $secret_ids): stdClass { - $project_get_by_ids_request = new SecretsGetRequest(); - $project_get_by_ids_request->ids = $secret_ids; + $project_get_by_ids_request = new SecretsGetRequest($secret_ids); $project_get_by_ids_request->validate(); - $secrets_command = new SecretsCommand(); - $secrets_command->get_by_ids = $project_get_by_ids_request->jsonSerialize(); + $secrets_command = new SecretsCommand(get: null, getByIds: $project_get_by_ids_request, create: null, list: null, + update: null, delete: null, sync: null); return $this->run_secret_command($secrets_command); } - public function list(string $organization_id): \stdClass + /** + * @throws Exception + */ + public function list(string $organization_id): stdClass { - $secrets_list_request = new SecretIdentifiersRequest(); - $secrets_list_request->organizationId = $organization_id; + $secrets_list_request = new SecretIdentifiersRequest($organization_id); $secrets_list_request->validate(); - $secrets_command = new SecretsCommand(); - $secrets_command->list = $secrets_list_request->jsonSerialize(); + $secrets_command = new SecretsCommand(get: null, getByIds: null, create: null, list: $secrets_list_request, + update: null, delete: null, sync: null); return $this->run_secret_command($secrets_command); } - public function create(string $key, string $note, string $organization_id, array $project_ids, string $value): \stdClass + /** + * @throws Exception + */ + public function create(string $organization_id, string $key, string $value, string $note, array $project_ids): stdClass { - $secrets_create_request = new SecretCreateRequest(); - $secrets_create_request->organizationId = $organization_id; - $secrets_create_request->projectIds = $project_ids; - $secrets_create_request->key = $key; - $secrets_create_request->note = $note; - $secrets_create_request->value = $value; + $secrets_create_request = new SecretCreateRequest(key: $key, note: $note, organizationId: $organization_id, + projectIds: $project_ids, value: $value); $secrets_create_request->validate(); - $secrets_command = new SecretsCommand(); - $secrets_command->create = $secrets_create_request->jsonSerialize(); + $secrets_command = new SecretsCommand(get: null, getByIds: null, create: $secrets_create_request, list: null, + update: null, delete: null, sync: null); return $this->run_secret_command($secrets_command); } - public function update(string $id, string $key, string $note, string $organization_id, array $project_ids, string $value): \stdClass + /** + * @throws Exception + */ + public function update(string $organization_id, string $id, string $key, string $value, string $note, array $project_ids): stdClass { - $secrets_put_request = new SecretPutRequest(); - $secrets_put_request->id = $id; - $secrets_put_request->organizationId = $organization_id; - $secrets_put_request->projectIds = $project_ids; - $secrets_put_request->key = $key; - $secrets_put_request->note = $note; - $secrets_put_request->value = $value; + $secrets_put_request = new SecretPutRequest(id: $id, key: $key, note: $note, organizationId: $organization_id, + projectIds: $project_ids, value: $value); $secrets_put_request->validate(); - $secrets_command = new SecretsCommand(); - $secrets_command->update = $secrets_put_request->jsonSerialize(); + $secrets_command = new SecretsCommand(get: null, getByIds: null, create: null, list: null, + update: $secrets_put_request, delete: null, sync: null); return $this->run_secret_command($secrets_command); } - public function delete(array $secrets_ids): \stdClass + /** + * @throws Exception + */ + public function delete(array $secrets_ids): stdClass { - $secrets_delete_request = new SecretsDeleteRequest(); - $secrets_delete_request->ids = $secrets_ids; + $secrets_delete_request = new SecretsDeleteRequest($secrets_ids); $secrets_delete_request->validate(); - $secrets_command = new SecretsCommand(); - $secrets_command->delete = $secrets_delete_request->jsonSerialize(); + $secrets_command = new SecretsCommand(get: null, getByIds: null, create: null, list: null, + update: null, delete: $secrets_delete_request, sync: null); + return $this->run_secret_command($secrets_command); + } + + /** + * @throws Exception + */ + public function sync(string $organization_id, ?string $last_synced_date): stdClass + { + if (empty($last_synced_date)) { + $last_synced_date = "1970-01-01T00:00:00.000Z"; + } + + $secrets_sync_request = new SecretsSyncRequest(lastSyncedDate: $last_synced_date, organizationId: $organization_id); + $secrets_sync_request->validate(); + $secrets_command = new SecretsCommand(get: null, getByIds: null, create: null, list: null, + update: null, delete: null, sync: $secrets_sync_request); return $this->run_secret_command($secrets_command); } - public function run_secret_command($secretsCommand): \stdClass + /** + * @throws Exception + */ + public function run_secret_command($secretsCommand): stdClass { - $command = new Command(); - $command->secrets = $secretsCommand; + $command = new Command(passwordLogin: null, apiKeyLogin: null, loginAccessToken: null, getUserApiKey: null, + fingerprint: null, sync: null, secrets: $secretsCommand, projects: null, generators: null); return $this->commandRunner->run($command); } } diff --git a/languages/php/src/schemas/AccessTokenLoginRequest.php b/languages/php/src/schemas/AccessTokenLoginRequest.php deleted file mode 100644 index a08805f92..000000000 --- a/languages/php/src/schemas/AccessTokenLoginRequest.php +++ /dev/null @@ -1,39 +0,0 @@ -accessToken = Schema::string(); - $properties->accessToken->description = "Bitwarden service API access token"; - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->description = "Login to Bitwarden with access token"; - $ownerSchema->required = array( - self::names()->accessToken, - ); - $ownerSchema->setFromRef('#/definitions/AccessTokenLoginRequest'); - } -} diff --git a/languages/php/src/schemas/BitwardenClassStructure.php b/languages/php/src/schemas/BitwardenClassStructure.php deleted file mode 100644 index fd50354d4..000000000 --- a/languages/php/src/schemas/BitwardenClassStructure.php +++ /dev/null @@ -1,11 +0,0 @@ -properties = $properties; - $schema->objectItemClass = $className; - $schemaWrapper = new Wrapper($schema); - static::setUpProperties($properties, $schema); - if (null === $schema->getFromRefs()) { - $schema->setFromRef('#/definitions/' . $className); - } - if ($properties->isEmpty()) { - $schema->properties = null; - } - $properties->lock(); - } - - return $schemaWrapper; - } - - /** - * @return Properties|static|null - */ - public static function properties() - { - return static::schema()->getProperties(); - } - - /** - * @param mixed $data - * @param Context $options - * @return static|mixed - * @throws \Swaggest\JsonSchema\Exception - * @throws \Swaggest\JsonSchema\InvalidValue - */ - public static function import($data, Context $options = null) - { - return static::schema()->in($data, $options); - } - - /** - * @param mixed $data - * @param Context $options - * @return mixed - * @throws \Swaggest\JsonSchema\InvalidValue - * @throws \Exception - */ - public static function export($data, Context $options = null) - { - return static::schema()->out($data, $options); - } - - /** - * @param ObjectItemContract $objectItem - * @return static - */ - public static function pick(ObjectItemContract $objectItem) - { - $className = get_called_class(); - return $objectItem->getNestedObject($className); - } - - /** - * @return static - */ - public static function create() - { - return new static; - } - - protected $__validateOnSet = true; // todo skip validation during import - - /** - * @return \stdClass - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - $result = new \stdClass(); - $schema = static::schema(); - $properties = $schema->getProperties(); - $processed = array(); - if (null !== $properties) { - foreach ($properties->getDataKeyMap() as $propertyName => $dataName) { - $value = $this->$propertyName ?? null; - - // Value is exported if exists. - if (null !== $value || array_key_exists($propertyName, $this->__arrayOfData)) { - $result->$dataName = $value; - $processed[$propertyName] = true; - continue; - } - - // Non-existent value is only exported if belongs to nullable property (having 'null' in type array). - $property = $schema->getProperty($propertyName); - if ($property instanceof Schema) { - $types = $property->type; - if ($types === Schema::NULL || (is_array($types) && in_array(Schema::NULL, $types))) { - $result->$dataName = $value; - } - } - } - } - foreach ($schema->getNestedPropertyNames() as $name) { - /** @var ObjectItem $nested */ - $nested = $this->$name; - if (null !== $nested) { - foreach ((array)$nested->jsonSerialize() as $key => $value) { - $result->$key = $value; - } - } - } - - if (!empty($this->__arrayOfData)) { - foreach ($this->__arrayOfData as $name => $value) { - if (!isset($processed[$name])) { - $result->$name = $this->{$name}; - } - } - } - - return $result; - } - - /** - * @return static|NameMirror - */ - public static function names(Properties $properties = null, $mapping = Schema::DEFAULT_MAPPING) - { - if ($properties !== null) { - return new NameMirror($properties->getDataKeyMap($mapping)); - } - - static $nameflector = null; - if (null === $nameflector) { - $nameflector = new NameMirror(); - } - return $nameflector; - } - - public function __set($name, $column) // todo nested schemas - { - if ($this->__validateOnSet) { - if ($property = static::schema()->getProperty($name)) { - $property->out($column); - } - } - $this->__arrayOfData[$name] = $column; - return $this; - } - - public static function className() - { - return get_called_class(); - } - - /** - * @throws \Exception - * @throws \Swaggest\JsonSchema\InvalidValue - */ - public function validate() - { - static::schema()->out($this); - } -} - diff --git a/languages/php/src/schemas/ClientSettings.php b/languages/php/src/schemas/ClientSettings.php deleted file mode 100644 index c27cc3322..000000000 --- a/languages/php/src/schemas/ClientSettings.php +++ /dev/null @@ -1,133 +0,0 @@ -identityUrl = Schema::string(); - $properties->identityUrl->description = "The identity url of the targeted Bitwarden instance. Defaults to `https://identity.bitwarden.com`"; - $properties->identityUrl->default = "https://identity.bitwarden.com"; - $properties->apiUrl = Schema::string(); - $properties->apiUrl->description = "The api url of the targeted Bitwarden instance. Defaults to `https://api.bitwarden.com`"; - $properties->apiUrl->default = "https://api.bitwarden.com"; - $properties->userAgent = Schema::string(); - $properties->userAgent->description = "The user_agent to sent to Bitwarden. Defaults to `Bitwarden Rust-SDK`"; - $properties->userAgent->default = "Bitwarden Rust-SDK"; - $properties->deviceType = new Schema(); - $propertiesDeviceTypeAllOf0 = Schema::string(); - $propertiesDeviceTypeAllOf0->enum = array( - self::ANDROID, - self::I_OS, - self::CHROME_EXTENSION, - self::FIREFOX_EXTENSION, - self::OPERA_EXTENSION, - self::EDGE_EXTENSION, - self::WINDOWS_DESKTOP, - self::MAC_OS_DESKTOP, - self::LINUX_DESKTOP, - self::CHROME_BROWSER, - self::FIREFOX_BROWSER, - self::OPERA_BROWSER, - self::EDGE_BROWSER, - self::IE_BROWSER, - self::UNKNOWN_BROWSER, - self::ANDROID_AMAZON, - self::UWP, - self::SAFARI_BROWSER, - self::VIVALDI_BROWSER, - self::VIVALDI_EXTENSION, - self::SAFARI_EXTENSION, - self::SDK, - ); - $propertiesDeviceTypeAllOf0->setFromRef('#/definitions/DeviceType'); - $properties->deviceType->allOf[0] = $propertiesDeviceTypeAllOf0; - $properties->deviceType->description = "Device type to send to Bitwarden. Defaults to SDK"; - $properties->deviceType->default = "SDK"; - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->schema = "http://json-schema.org/draft-07/schema#"; - $ownerSchema->title = "ClientSettings"; - $ownerSchema->description = "Basic client behavior settings. These settings specify the various targets and behavior of the Bitwarden Client. They are optional and uneditable once the client is initialized.\n\nDefaults to\n\n``` # use bitwarden::client::client_settings::{ClientSettings, DeviceType}; # use assert_matches::assert_matches; let settings = ClientSettings { identity_url: \"https://identity.bitwarden.com\".to_string(), api_url: \"https://api.bitwarden.com\".to_string(), user_agent: \"Bitwarden Rust-SDK\".to_string(), device_type: DeviceType::SDK, }; let default = ClientSettings::default(); assert_matches!(settings, default); ```\n\nTargets `localhost:8080` for debug builds."; - } -} diff --git a/languages/php/src/schemas/Command.php b/languages/php/src/schemas/Command.php deleted file mode 100644 index cbd649c2f..000000000 --- a/languages/php/src/schemas/Command.php +++ /dev/null @@ -1,44 +0,0 @@ -projects = ProjectsCommand::schema(); - $properties->secrets = SecretsCommand::schema(); - $properties->accessTokenLogin = AccessTokenLoginRequest::schema(); - - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - - $ownerSchema->oneOf = array( - self::names()->projects, - self::names()->secrets, - self::names()->accessTokenLogin, - ); - } -} diff --git a/languages/php/src/schemas/ProjectCreateRequest.php b/languages/php/src/schemas/ProjectCreateRequest.php deleted file mode 100644 index 6a4e0f082..000000000 --- a/languages/php/src/schemas/ProjectCreateRequest.php +++ /dev/null @@ -1,43 +0,0 @@ -organizationId = Schema::string(); - $properties->organizationId->description = "Organization where the project will be created"; - $properties->organizationId->format = "uuid"; - $properties->name = Schema::string(); - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->required = array( - self::names()->name, - self::names()->organizationId, - ); - $ownerSchema->setFromRef('#/definitions/ProjectCreateRequest'); - } -} diff --git a/languages/php/src/schemas/ProjectGetRequest.php b/languages/php/src/schemas/ProjectGetRequest.php deleted file mode 100644 index 972bf18ec..000000000 --- a/languages/php/src/schemas/ProjectGetRequest.php +++ /dev/null @@ -1,37 +0,0 @@ -id = Schema::string(); - $properties->id->description = "ID of the project to retrieve"; - $properties->id->format = "uuid"; - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->required = array( - self::names()->id, - ); - $ownerSchema->setFromRef('#/definitions/ProjectGetRequest'); - } -} diff --git a/languages/php/src/schemas/ProjectPutRequest.php b/languages/php/src/schemas/ProjectPutRequest.php deleted file mode 100644 index 96b9705e7..000000000 --- a/languages/php/src/schemas/ProjectPutRequest.php +++ /dev/null @@ -1,50 +0,0 @@ -id = Schema::string(); - $properties->id->description = "ID of the project to modify"; - $properties->id->format = "uuid"; - $properties->organizationId = Schema::string(); - $properties->organizationId->description = "Organization ID of the project to modify"; - $properties->organizationId->format = "uuid"; - $properties->name = Schema::string(); - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->required = array( - self::names()->id, - self::names()->name, - self::names()->organizationId, - ); - $ownerSchema->setFromRef('#/definitions/ProjectPutRequest'); - } -} diff --git a/languages/php/src/schemas/ProjectsCommand.php b/languages/php/src/schemas/ProjectsCommand.php deleted file mode 100644 index 22645db3c..000000000 --- a/languages/php/src/schemas/ProjectsCommand.php +++ /dev/null @@ -1,55 +0,0 @@ - Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the projects whose IDs match the provided ones - * - * Returns: [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse) - */ -class ProjectsCommand extends BitwardenClassStructure -{ - public ?\stdClass $delete; - - public ?\stdClass $get; - - public ?\stdClass $list; - - public ?\stdClass $create; - - public ?\stdClass $update; - - - /** - * @param Properties|static $properties - * @param Schema $ownerSchema - */ - public static function setUpProperties($properties, Schema $ownerSchema) - { - $properties->delete = ProjectsDeleteRequest::schema() ? ProjectsDeleteRequest::schema() : null; - $properties->get = ProjectGetRequest::schema() ? ProjectGetRequest::schema() : null; - $properties->list = ProjectsListRequest::schema() ? ProjectsListRequest::schema() : null; - $properties->update = ProjectPutRequest::schema() ? ProjectPutRequest::schema() : null; - $properties->create = ProjectCreateRequest::schema() ? ProjectCreateRequest::schema() : null; - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->description = "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the projects whose IDs match the provided ones\n\nReturns: [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse)"; - - $ownerSchema->oneOf = array( - self::names()->create, - self::names()->delete, - self::names()->get, - self::names()->list, - self::names()->update, - ); - } -} diff --git a/languages/php/src/schemas/ProjectsDeleteRequest.php b/languages/php/src/schemas/ProjectsDeleteRequest.php deleted file mode 100644 index 87a7cfad7..000000000 --- a/languages/php/src/schemas/ProjectsDeleteRequest.php +++ /dev/null @@ -1,39 +0,0 @@ -ids = Schema::arr(); - $properties->ids->items = Schema::string(); - $properties->ids->items->format = "uuid"; - $properties->ids->description = "IDs of the projects to delete"; - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->required = array( - self::names()->ids, - ); - $ownerSchema->setFromRef('#/definitions/ProjectsDeleteRequest'); - } -} diff --git a/languages/php/src/schemas/ProjectsListRequest.php b/languages/php/src/schemas/ProjectsListRequest.php deleted file mode 100644 index cc1a9474f..000000000 --- a/languages/php/src/schemas/ProjectsListRequest.php +++ /dev/null @@ -1,38 +0,0 @@ -organizationId = Schema::string(); - $properties->organizationId->description = "Organization to retrieve all the projects from"; - $properties->organizationId->format = "uuid"; - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->required = array( - self::names()->organizationId, - ); - $ownerSchema->setFromRef('#/definitions/ProjectsListRequest'); - } -} diff --git a/languages/php/src/schemas/SecretCreateRequest.php b/languages/php/src/schemas/SecretCreateRequest.php deleted file mode 100644 index d34b36e98..000000000 --- a/languages/php/src/schemas/SecretCreateRequest.php +++ /dev/null @@ -1,58 +0,0 @@ -organizationId = Schema::string(); - $properties->organizationId->description = "Organization where the secret will be created"; - $properties->organizationId->format = "uuid"; - $properties->key = Schema::string(); - $properties->value = Schema::string(); - $properties->note = Schema::string(); - $properties->projectIds = (new Schema())->setType([Schema::_ARRAY, Schema::NULL]); - $properties->projectIds->items = Schema::string(); - $properties->projectIds->items->format = "uuid"; - $properties->projectIds->description = "IDs of the projects that this secret will belong to"; - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->required = array( - self::names()->key, - self::names()->note, - self::names()->organizationId, - self::names()->value, - ); - $ownerSchema->setFromRef('#/definitions/SecretCreateRequest'); - } -} diff --git a/languages/php/src/schemas/SecretGetRequest.php b/languages/php/src/schemas/SecretGetRequest.php deleted file mode 100644 index f31f7cad3..000000000 --- a/languages/php/src/schemas/SecretGetRequest.php +++ /dev/null @@ -1,38 +0,0 @@ -id = Schema::string(); - $properties->id->description = "ID of the secret to retrieve"; - $properties->id->format = "uuid"; - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->required = array( - self::names()->id, - ); - $ownerSchema->setFromRef('#/definitions/SecretGetRequest'); - } -} diff --git a/languages/php/src/schemas/SecretIdentifiersRequest.php b/languages/php/src/schemas/SecretIdentifiersRequest.php deleted file mode 100644 index b4e75b801..000000000 --- a/languages/php/src/schemas/SecretIdentifiersRequest.php +++ /dev/null @@ -1,38 +0,0 @@ -organizationId = Schema::string(); - $properties->organizationId->description = "Organization to retrieve all the secrets from"; - $properties->organizationId->format = "uuid"; - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->required = array( - self::names()->organizationId, - ); - $ownerSchema->setFromRef('#/definitions/SecretIdentifiersRequest'); - } -} diff --git a/languages/php/src/schemas/SecretPutRequest.php b/languages/php/src/schemas/SecretPutRequest.php deleted file mode 100644 index d890a909d..000000000 --- a/languages/php/src/schemas/SecretPutRequest.php +++ /dev/null @@ -1,64 +0,0 @@ -id = Schema::string(); - $properties->id->description = "ID of the secret to modify"; - $properties->id->format = "uuid"; - $properties->organizationId = Schema::string(); - $properties->organizationId->description = "Organization ID of the secret to modify"; - $properties->organizationId->format = "uuid"; - $properties->key = Schema::string(); - $properties->value = Schema::string(); - $properties->note = Schema::string(); - $properties->projectIds = (new Schema())->setType([Schema::_ARRAY, Schema::NULL]); - $properties->projectIds->items = Schema::string(); - $properties->projectIds->items->format = "uuid"; - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->required = array( - self::names()->id, - self::names()->key, - self::names()->note, - self::names()->organizationId, - self::names()->value, - ); - $ownerSchema->setFromRef('#/definitions/SecretPutRequest'); - } -} diff --git a/languages/php/src/schemas/SecretVerificationRequest.php b/languages/php/src/schemas/SecretVerificationRequest.php deleted file mode 100644 index 95cfd1e15..000000000 --- a/languages/php/src/schemas/SecretVerificationRequest.php +++ /dev/null @@ -1,35 +0,0 @@ -masterPassword = (new Schema())->setType([Schema::STRING, Schema::NULL]); - $properties->masterPassword->description = "The user's master password to use for user verification. If supplied, this will be used for verification purposes."; - $properties->otp = (new Schema())->setType([Schema::STRING, Schema::NULL]); - $properties->otp->description = "Alternate user verification method through OTP. This is provided for users who have no master password due to use of Customer Managed Encryption. Must be present and valid if master_password is absent."; - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->setFromRef('#/definitions/SecretVerificationRequest'); - } -} diff --git a/languages/php/src/schemas/SecretsCommand.php b/languages/php/src/schemas/SecretsCommand.php deleted file mode 100644 index 1ed8c97c5..000000000 --- a/languages/php/src/schemas/SecretsCommand.php +++ /dev/null @@ -1,56 +0,0 @@ - Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the secrets whose IDs match the provided ones - * - * Returns: [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse) - */ -class SecretsCommand extends BitwardenClassStructure -{ - public ?\stdClass $delete; - - public ?\stdClass $get; - - public ?\stdClass $getByIds; - - public ?\stdClass $list; - - public ?\stdClass $create; - - public ?\stdClass $put; - - /** - * @param Properties|static $properties - * @param Schema $ownerSchema - */ - public static function setUpProperties($properties, Schema $ownerSchema) - { - $properties->delete = SecretsDeleteRequest::schema() ? SecretsDeleteRequest::schema() : null; - $properties->getByIds = SecretsGetRequest::schema() ? SecretGetRequest::schema() : null; - $properties->create = SecretCreateRequest::schema() ? SecretCreateRequest::schema() : null; - $properties->put = SecretPutRequest::schema() ? SecretPutRequest::schema() : null; - $properties->list = SecretIdentifiersRequest::schema() ? SecretIdentifiersRequest::schema() : null; - $properties->get = SecretsGetRequest::schema() ? SecretGetRequest::schema() : null; - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->description = "> Requires Authentication > Requires using an Access Token for login or calling Sync at least once Deletes all the secrets whose IDs match the provided ones\n\nReturns: [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse)"; - $ownerSchema->oneOf = array( - self::names()->create, - self::names()->put, - self::names()->list, - self::names()->getByIds, - self::names()->delete, - ); - } -} diff --git a/languages/php/src/schemas/SecretsDeleteRequest.php b/languages/php/src/schemas/SecretsDeleteRequest.php deleted file mode 100644 index 35138fcb1..000000000 --- a/languages/php/src/schemas/SecretsDeleteRequest.php +++ /dev/null @@ -1,39 +0,0 @@ -ids = Schema::arr(); - $properties->ids->items = Schema::string(); - $properties->ids->items->format = "uuid"; - $properties->ids->description = "IDs of the secrets to delete"; - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->required = array( - self::names()->ids, - ); - $ownerSchema->setFromRef('#/definitions/SecretsDeleteRequest'); - } -} diff --git a/languages/php/src/schemas/SecretsGetRequest.php b/languages/php/src/schemas/SecretsGetRequest.php deleted file mode 100644 index 4758dabf4..000000000 --- a/languages/php/src/schemas/SecretsGetRequest.php +++ /dev/null @@ -1,39 +0,0 @@ -ids = Schema::arr(); - $properties->ids->items = Schema::string(); - $properties->ids->items->format = "uuid"; - $properties->ids->description = "IDs of the secrets to retrieve"; - $ownerSchema->type = Schema::OBJECT; - $ownerSchema->additionalProperties = false; - $ownerSchema->required = array( - self::names()->ids, - ); - $ownerSchema->setFromRef('#/definitions/SecretsGetRequest'); - } -} diff --git a/support/scripts/schemas.ts b/support/scripts/schemas.ts index 5ea71408c..3eaad1903 100644 --- a/support/scripts/schemas.ts +++ b/support/scripts/schemas.ts @@ -117,9 +117,30 @@ async function main() { java.forEach((file, path) => { writeToFile(javaDir + path, file.lines); }); + + const php = await quicktype({ + inputData, + lang: "php", + inferUuids: false, + inferDateTimes: false, + rendererOptions: { + "acronym-style": "camel", + "with-get": false, + }, + }); + + const phpDir = "./languages/php/src/Schemas/"; + if (!fs.existsSync(phpDir)) { + fs.mkdirSync(phpDir); + } + + php.lines.splice(1, 0, "namespace Bitwarden\\Sdk\\Schemas;", "use stdClass;", "use Exception;"); + + writeToFile("./languages/php/src/Schemas/Schemas.php", php.lines); } main(); + function writeToFile(filename: string, lines: string[]) { const output = fs.createWriteStream(filename); lines.forEach((line) => { From 76417172489d5790babbe14bb8c6ad8b3aac2a33 Mon Sep 17 00:00:00 2001 From: Colton Hurst Date: Thu, 19 Sep 2024 08:13:37 -0400 Subject: [PATCH 35/77] [SM-1444] Fix Windows GNU Builds (#1053) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/SM-1444 ## 📔 Objective Windows GNU builds are currently broken due to a bug in [rustls-platform-verifier](https://github.com/rustls/rustls-platform-verifier) when LTO is turned on. I have submitted a GH Issue for this here: https://github.com/rustls/rustls-platform-verifier/issues/141 ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .github/workflows/build-rust-cross-platform.yml | 12 +++++++++++- Cargo.toml | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index a8c626d2c..7c567135b 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -60,14 +60,23 @@ jobs: - name: Add build architecture run: rustup target add ${{ matrix.settings.target }} + # Build Rust for musl - name: Build Rust for - ${{ matrix.settings.target }} if: ${{ contains(matrix.settings.target, 'musl') }} env: RUSTFLAGS: "-D warnings" run: cargo zigbuild -p bitwarden-c --target ${{ matrix.settings.target }} --release + # Build Rust for windows-gnu - name: Build Rust for - ${{ matrix.settings.target }} - if: ${{ !contains(matrix.settings.target, 'musl') }} + if: ${{ matrix.settings.target == 'x86_64-pc-windows-gnu' }} + env: + RUSTFLAGS: "-D warnings" + run: cargo build -p bitwarden-c --target ${{ matrix.settings.target }} --profile=release-windows + + # Build Rust for !musl && !windows-gnu + - name: Build Rust for - ${{ matrix.settings.target }} + if: ${{ !contains(matrix.settings.target, 'musl') && matrix.settings.target != 'x86_64-pc-windows-gnu' }} env: RUSTFLAGS: "-D warnings" MACOSX_DEPLOYMENT_TARGET: "10.14" # allows using new macos runner versions while still supporting older systems @@ -79,3 +88,4 @@ jobs: name: libbitwarden_c_files-${{ matrix.settings.target }} path: | target/${{ matrix.settings.target }}/release/*bitwarden_c* + target/${{ matrix.settings.target }}/release-windows/*bitwarden_c* diff --git a/Cargo.toml b/Cargo.toml index 7d452869c..8c978819b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,6 +49,13 @@ opt-level = 1 [profile.release] lto = "thin" codegen-units = 1 + +# Turn off LTO on release mode for windows +# This is a workaround until this is fixed: https://github.com/rustls/rustls-platform-verifier/issues/141 +[profile.release-windows] +inherits = "release" +lto = "off" + # Stripping the binary reduces the size by ~30%, but the stacktraces won't be usable anymore. # This is fine as long as we don't have any unhandled panics, but let's keep it disabled for now # strip = true From 3ab4eefdc6b20e5f87410b967a3264ea44226422 Mon Sep 17 00:00:00 2001 From: Colton Hurst Date: Thu, 19 Sep 2024 12:37:57 -0400 Subject: [PATCH 36/77] [SM-1445] Fix Go build on Windows (#1059) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/SM-1445 ## 📔 Objective Go builds on Windows are failing, this PR adds the needed libraries that are missing. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- languages/go/internal/cinterface/bitwarden_library.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/go/internal/cinterface/bitwarden_library.go b/languages/go/internal/cinterface/bitwarden_library.go index 3a63be61b..69d752716 100644 --- a/languages/go/internal/cinterface/bitwarden_library.go +++ b/languages/go/internal/cinterface/bitwarden_library.go @@ -11,7 +11,7 @@ import ( #cgo linux,arm64 LDFLAGS: -L ./lib/linux-arm64 #cgo darwin,amd64 LDFLAGS: -L ./lib/darwin-x64 -framework Security -framework SystemConfiguration #cgo darwin,arm64 LDFLAGS: -L ./lib/darwin-arm64 -framework Security -framework SystemConfiguration -#cgo windows,amd64 LDFLAGS: -L ./lib/windows-x64 -lbitwarden_c -ladvapi32 -lbcrypt -lcrypt32 -lcryptnet -lkernel32 -lncrypt -lntdll -luserenv -lws2_32 -lmsvcrt +#cgo windows,amd64 LDFLAGS: -L ./lib/windows-x64 -lbitwarden_c -ladvapi32 -lbcrypt -lcrypt32 -lcryptnet -lkernel32 -lncrypt -lntdll -luserenv -lws2_32 -lmsvcrt -loleaut32 -lruntimeobject #include typedef void* ClientPtr; extern char* run_command(const char *command, ClientPtr client); From 2e506f735ba9e34e39c5e6efb9126a6314694028 Mon Sep 17 00:00:00 2001 From: Colton Hurst Date: Thu, 19 Sep 2024 14:57:35 -0400 Subject: [PATCH 37/77] [SM-1425] Update Napi SDK (#1045) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/SM-1425 ## 📔 Objective Update the Napi SDK to include the SM updates. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- crates/bitwarden-napi/README.md | 3 +- .../src-ts/bitwarden_client/index.ts | 46 ++++++++++++------- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/crates/bitwarden-napi/README.md b/crates/bitwarden-napi/README.md index e9c3d0a71..6fce8d069 100644 --- a/crates/bitwarden-napi/README.md +++ b/crates/bitwarden-napi/README.md @@ -17,11 +17,12 @@ const settings: ClientSettings = { }; const accessToken = "-- REDACTED --"; +const stateFile = "some/path/to/state/file"; const client = new BitwardenClient(settings, LogLevel.Info); // Authenticating using a machine account access token -await client.accessTokenLogin(accessToken); +await client.auth().loginAccessToken(accessToken, stateFile); // List secrets const secrets = await client.secrets().list(); diff --git a/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts b/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts index 52a53ef4f..3a3765a12 100644 --- a/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts +++ b/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts @@ -37,19 +37,6 @@ export class BitwardenClient { this.client = new rust.BitwardenClient(settingsJson, loggingLevel ?? LogLevel.Info); } - async accessTokenLogin(accessToken: string, stateFile?: string): Promise { - const response = await this.client.runCommand( - Convert.commandToJson({ - accessTokenLogin: { - accessToken, - stateFile, - }, - }), - ); - - handleResponse(Convert.toResponseForAccessTokenLoginResponse(response)); - } - secrets(): SecretsClient { return new SecretsClient(this.client); } @@ -57,6 +44,10 @@ export class BitwardenClient { projects(): ProjectsClient { return new ProjectsClient(this.client); } + + auth(): AuthClient { + return new AuthClient(this.client); + } } export class SecretsClient { @@ -91,11 +82,11 @@ export class SecretsClient { } async create( + organizationId: string, key: string, value: string, note: string, projectIds: string[], - organizationId: string, ): Promise { const response = await this.client.runCommand( Convert.commandToJson({ @@ -121,12 +112,12 @@ export class SecretsClient { } async update( + organizationId: string, id: string, key: string, value: string, note: string, projectIds: string[], - organizationId: string, ): Promise { const response = await this.client.runCommand( Convert.commandToJson({ @@ -183,7 +174,7 @@ export class ProjectsClient { return handleResponse(Convert.toResponseForProjectResponse(response)); } - async create(name: string, organizationId: string): Promise { + async create(organizationId: string, name: string): Promise { const response = await this.client.runCommand( Convert.commandToJson({ projects: { @@ -207,7 +198,7 @@ export class ProjectsClient { return handleResponse(Convert.toResponseForProjectsResponse(response)); } - async update(id: string, name: string, organizationId: string): Promise { + async update(organizationId: string, id: string, name: string): Promise { const response = await this.client.runCommand( Convert.commandToJson({ projects: { @@ -231,3 +222,24 @@ export class ProjectsClient { return handleResponse(Convert.toResponseForProjectsDeleteResponse(response)); } } + +export class AuthClient { + client: rust.BitwardenClient; + + constructor(client: rust.BitwardenClient) { + this.client = client; + } + + async loginAccessToken(accessToken: string, stateFile?: string): Promise { + const response = await this.client.runCommand( + Convert.commandToJson({ + loginAccessToken: { + accessToken, + stateFile, + }, + }), + ); + + handleResponse(Convert.toResponseForAccessTokenLoginResponse(response)); + } +} From 88537a838cb57c702172a74949a9419a0b99620b Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 20 Sep 2024 11:20:13 +0200 Subject: [PATCH 38/77] Bundle platform-verifier (#1039) We've run into some issues related to rustls-platform-verifier distributing an android library through their crate, which works great if you use platform-verifier within an application. However since we distribute an sdk, the application have difficulties locating the android specific platform-verifier library. To resolve this we follow the method established in https://github.com/rustls/rustls-platform-verifier/issues/115 and bundle the classes with the library. --- crates/bitwarden-uniffi/src/lib.rs | 14 ++++++++++- languages/kotlin/sdk/build.gradle | 39 ++++++++++++++++++++++-------- languages/kotlin/settings.gradle | 18 +------------- 3 files changed, 43 insertions(+), 28 deletions(-) diff --git a/crates/bitwarden-uniffi/src/lib.rs b/crates/bitwarden-uniffi/src/lib.rs index d0209de01..0d89ffdb8 100644 --- a/crates/bitwarden-uniffi/src/lib.rs +++ b/crates/bitwarden-uniffi/src/lib.rs @@ -28,7 +28,7 @@ use vault::ClientVault; #[derive(uniffi::Object)] pub struct Client(bitwarden::Client); -#[uniffi::export] +#[uniffi::export(async_runtime = "tokio")] impl Client { /// Initialize a new instance of the SDK client #[uniffi::constructor] @@ -79,6 +79,18 @@ impl Client { pub fn echo(&self, msg: String) -> String { msg } + + /// Test method, calls http endpoint + pub async fn http_get(&self, url: String) -> Result { + let client = self.0.internal.get_http_client(); + let res = client + .get(&url) + .send() + .await + .map_err(bitwarden::Error::Reqwest)?; + + Ok(res.text().await.map_err(bitwarden::Error::Reqwest)?) + } } fn init_logger() { diff --git a/languages/kotlin/sdk/build.gradle b/languages/kotlin/sdk/build.gradle index c41bccac1..d3ea098e3 100644 --- a/languages/kotlin/sdk/build.gradle +++ b/languages/kotlin/sdk/build.gradle @@ -12,8 +12,8 @@ android { minSdk 28 targetSdk 34 - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles "consumer-rules.pro" + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' + consumerProguardFiles 'consumer-rules.pro' } buildTypes { @@ -31,7 +31,7 @@ android { } lint { - baseline = file("lint-baseline.xml") + baseline = file('lint-baseline.xml') } publishing { @@ -52,9 +52,9 @@ publishing { // PRs: use the branch name. // Main: Grab it from `crates/bitwarden/Cargo.toml` - def branchName = "git branch --show-current".execute().text.trim() + def branchName = 'git branch --show-current'.execute().text.trim() - if (branchName == "main") { + if (branchName == 'main') { def content = ['grep', '-o', '^version = ".*"', '../../Cargo.toml'].execute().text.trim() def match = ~/version = "(.*)"/ def matcher = match.matcher(content) @@ -73,19 +73,38 @@ publishing { } repositories { maven { - name = "GitHubPackages" - url = "https://maven.pkg.github.com/bitwarden/sdk" + name = 'GitHubPackages' + url = 'https://maven.pkg.github.com/bitwarden/sdk' credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") + username = System.getenv('GITHUB_ACTOR') + password = System.getenv('GITHUB_TOKEN') } } } } +// Find and include the classes.jar from platform-verifier. +// +// Based on the instructions from the readme in https://github.com/rustls/rustls-platform-verifier +// and issue details from https://github.com/rustls/rustls-platform-verifier/issues/115. +File findRustlsPlatformVerifierClassesJar() { + def dependencyText = providers.exec { + it.workingDir = new File('../../') + commandLine('cargo', 'metadata', '--format-version', '1', '--manifest-path', 'crates/bitwarden-uniffi/Cargo.toml') + }.standardOutput.asText.get() + + def dependencyJson = new groovy.json.JsonSlurper().parseText(dependencyText) + def manifestPath = file(dependencyJson.packages.find { it.name == "rustls-platform-verifier-android" }.manifest_path) + + def aar = fileTree(manifestPath.parentFile).matching { + include "maven/rustls/rustls-platform-verifier/*/rustls-platform-verifier-*.aar" + }.getSingleFile() + return zipTree(aar).matching { include 'classes.jar'}.getSingleFile() +} + dependencies { implementation 'net.java.dev.jna:jna:5.14.0@aar' - implementation 'rustls:rustls-platform-verifier:latest.release' + implementation files(findRustlsPlatformVerifierClassesJar()) implementation 'androidx.core:core-ktx:1.13.0' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' diff --git a/languages/kotlin/settings.gradle b/languages/kotlin/settings.gradle index e82ac3727..fac8f3fae 100644 --- a/languages/kotlin/settings.gradle +++ b/languages/kotlin/settings.gradle @@ -10,25 +10,9 @@ dependencyResolutionManagement { repositories { google() mavenCentral() - - maven { - url = findRustlsPlatformVerifierProject() - metadataSources.artifact() - } } } -String findRustlsPlatformVerifierProject() { - def dependencyText = providers.exec { - it.workingDir = new File("../../") - commandLine("cargo", "metadata", "--format-version", "1", "--manifest-path", "crates/bitwarden-uniffi/Cargo.toml") - }.standardOutput.asText.get() - - def dependencyJson = new groovy.json.JsonSlurper().parseText(dependencyText) - def manifestPath = file(dependencyJson.packages.find { it.name == "rustls-platform-verifier-android" }.manifest_path) - return new File(manifestPath.parentFile, "maven").path -} - -rootProject.name = "My Application" +rootProject.name = 'My Application' include ':app' include ':sdk' From 3cb295c438c5abffd45fb55724019fc1c3ba75d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ch=C4=99ci=C5=84ski?= Date: Fri, 20 Sep 2024 17:38:29 +0200 Subject: [PATCH 39/77] [BRE-339] Fix Swift release workflow - artifact zip (#1071) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/BRE-339 ## 📔 Objective When unpack the created artifact it takes the name of the zip file. It should unpack as `BitwardenFFI.xcframework`. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .github/workflows/build-swift.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 4192662bf..22da084ed 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -61,11 +61,16 @@ jobs: # SHA Short echo "short-sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + - name: Zip BitwardenFFI.xcframework + run: | + mkdir artifacts + cp -rf languages/swift/BitwardenFFI.xcframework artifacts + - name: Upload BitwardenFFI.xcframework artifact uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: BitwardenFFI-${{ env._VERSION }}-${{ steps.build.outputs.short-sha }}.xcframework - path: languages/swift/BitwardenFFI.xcframework + path: artifacts if-no-files-found: error - name: Upload BitwardenSdk sources From dd555ce500d3e8ef6ec497a76aa1c368d6ae7292 Mon Sep 17 00:00:00 2001 From: tangowithfoxtrot <5676771+tangowithfoxtrot@users.noreply.github.com> Date: Fri, 20 Sep 2024 09:34:05 -0700 Subject: [PATCH 40/77] breaking: SM-1403 review and update cpp sdk (#1002) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/SM-1403 ## 📔 Objective Update the C++ bindings to include the features we support and make the function parameters consistent with the other wrappers. - `accessTokenLogin(token)` -> `loginAccessToken(token, stateFile)` - `updateProject(projectId, orgId, name)` -> `updateProject(orgId, projectId, name)` - `createSecret(key, value, note, orgId, {projectId})` -> `createSecret(orgId, key, value, note, {projectId})` - `updateSecret(id, key, value, note, orgId, {projectId})` -> `createSecret(orgId, id, key, value, note, {projectId})` - add secret syncing - add `getByIds` - update the example wrapper to use the newer bindings as well as produce output for each project/secret operation ## 📸 Screenshots ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --------- Co-authored-by: Colton Hurst --- .gitignore | 3 + languages/cpp/CMakeBuild.md | 14 +++- languages/cpp/README.md | 33 ++++++--- languages/cpp/examples/Wrapper.cpp | 99 +++++++++++++++++++------ languages/cpp/include/BitwardenClient.h | 14 ++-- languages/cpp/include/Projects.h | 2 +- languages/cpp/include/Secrets.h | 8 +- languages/cpp/src/BitwardenClient.cpp | 29 ++++++-- languages/cpp/src/Projects.cpp | 2 +- languages/cpp/src/Secrets.cpp | 89 +++++++++++++++++++++- 10 files changed, 240 insertions(+), 53 deletions(-) diff --git a/.gitignore b/.gitignore index b13651d19..4a1d79fca 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,6 @@ languages/java/src/main/java/com/bitwarden/sdk/schema languages/js/sdk-client/src/schemas.ts languages/python/bitwarden_sdk/schemas.py support/schemas + +# Cmake build files +languages/cpp/cmake-build-debug diff --git a/languages/cpp/CMakeBuild.md b/languages/cpp/CMakeBuild.md index cb148069e..b75da5c17 100644 --- a/languages/cpp/CMakeBuild.md +++ b/languages/cpp/CMakeBuild.md @@ -3,7 +3,6 @@ ## Introduction Cmake is used to build the C++ Bitwarden client library. Output should be placed in the build directory. - The output contains two dynamic libraries: - The C++ client `BitwardenClient` @@ -20,7 +19,8 @@ See how to use these libraries in the [example use guide](./examples/ExampleUse. ## Build Commands -One should be in the root directory of the C++ wrapper (the same level where is CMakeLists.txt placed). Paths of the three libraries should be placed inside the cmake build command: +One should be in the root directory of the C++ wrapper (the same level where is CMakeLists.txt placed). Paths of the +three libraries should be placed inside the cmake build command: ```bash mkdir -p build @@ -29,6 +29,16 @@ cmake .. -DNLOHMANN=/path/to/include/nlohmann -DBOOST=/path/to/include/boost -DT cmake --build . ``` +## IDE Support + +You may need to manually set the CMake `TARGET` variable for your IDE. For CLion, add the following to the CMake options +settings: + +```bash +# macOS example +-DTARGET=../../target/release/libbitwarden_c.dylib +``` + ## Example ### macOS diff --git a/languages/cpp/README.md b/languages/cpp/README.md index 23b59ac76..fb714a20e 100644 --- a/languages/cpp/README.md +++ b/languages/cpp/README.md @@ -22,9 +22,10 @@ bitwardenSettings.set_identity_url(""); ```c++ std::string accessToken = ""; +std::string stateFile = ""; // Optional - argument in BitwardenClient BitwardenClient bitwardenClient = BitwardenClient(bitwardenSettings); -bitwardenClient.accessTokenLogin(accessToken); +bitwardenClient.loginAccessToken(accessToken, stateFile); ``` ### Create new project @@ -32,6 +33,7 @@ bitwardenClient.accessTokenLogin(accessToken); ```c++ boost::uuids::uuid organizationUuid = boost::uuids::string_generator()(""); ProjectResponse projectResponseCreate = bitwardenClient.createProject(organizationUuid, "TestProject"); +boost::uuids::uuid projectId = boost::uuids::string_generator()(projectResponseCreate.get_id()); ``` ### List all projects @@ -43,21 +45,19 @@ ProjectsResponse projectResponseList = bitwardenClient.listProjects(organization ### Get project details ```c++ -boost::uuids::uuid projectId = boost::uuids::string_generator()(projectResponseCreate.get_id()); ProjectResponse projectResponseGet = bitwardenClient.getProject(projectId); ``` ### Update project ```c++ -boost::uuids::uuid projectId = boost::uuids::string_generator()(projectResponseCreate.get_id()); -ProjectResponse projectResponseUpdate = bitwardenClient.updateProject(projectId, organizationUuid, "TestProjectUpdated"); +ProjectResponse projectResponseUpdate = bitwardenClient.updateProject(organizationUuid, projectId, "TestProjectUpdated"); ``` ### Delete projects ```c++ -SecretsDeleteResponse secretsDeleteResponse = bitwardenClient.deleteSecrets({secretId}); +ProjectsDeleteResponse projectsDeleteResponse = bitwardenClient.deleteProjects({projectId}); ``` ### Add new secret @@ -66,7 +66,8 @@ SecretsDeleteResponse secretsDeleteResponse = bitwardenClient.deleteSecrets({sec std::string key = "key"; std::string value = "value"; std::string note = "note"; -SecretResponse secretResponseCreate = bitwardenClient.createSecret(key, value, note, organizationUuid, {projectId}); +SecretResponse secretResponseCreate = bitwardenClient.createSecret(organizationUuid, key, value, note, {projectId}); +boost::uuids::uuid secretId = boost::uuids::string_generator()(secretResponseCreate.get_id()); ``` ### List secrets @@ -77,14 +78,28 @@ SecretIdentifiersResponse secretIdentifiersResponse = bitwardenClient.listSecret ### Get secret details -``` -boost::uuids::uuid secretId = boost::uuids::string_generator()(secretResponseCreate.get_id()); +```c++ SecretResponse secretResponseGet = bitwardenClient.getSecret(secretId); ``` +### Get multiple secrets by ids + +```c++ +std::vector secretIds = {secretId, secretId2}; +SecretsResponse secretsResponseGet = bitwardenClient.getSecrets(secretIds); +``` + ### Update secret + +```c++ +SecretResponse secretResponseUpdate = bitwardenClient.updateSecret(organizationUuid, secretId, "key2", "value2", "note2", {projectId}); +``` + +### Sync secrets + ```c++ -SecretResponse secretResponseUpdate = bitwardenClient.updateSecret(secretId, "key2", "value2", "note2", organizationUuid, {projectId}); +std::chrono::system_clock::time_point lastSyncedDate = std::chrono::system_clock::now(); +SecretsSyncResponse secretsSyncResponse = bitwardenClient.sync(orgnizationUuid, lastSyncedDate); ``` # Delete secrets diff --git a/languages/cpp/examples/Wrapper.cpp b/languages/cpp/examples/Wrapper.cpp index bb53bf0c4..7790adfb0 100644 --- a/languages/cpp/examples/Wrapper.cpp +++ b/languages/cpp/examples/Wrapper.cpp @@ -1,14 +1,18 @@ #include "BitwardenClient.h" #include #include +#include int main() { // Retrieve access token and organization ID from environment variables - const char* accessTokenEnv = std::getenv("ACCESS_TOKEN"); - const char* organizationIdEnv = std::getenv("ORGANIZATION_ID"); + const char *accessTokenEnv = std::getenv("ACCESS_TOKEN"); + const char *organizationIdEnv = std::getenv("ORGANIZATION_ID"); - const char* apiUrl = std::getenv("API_URL"); - const char* identityUrl = std::getenv("IDENTITY_URL"); + // Use optional state file for authentication + const char *stateFile = std::getenv("STATE_FILE"); + + const char *apiUrl = std::getenv("API_URL"); + const char *identityUrl = std::getenv("IDENTITY_URL"); if (!accessTokenEnv || !organizationIdEnv) { std::cerr << "Error: Environment variables ACCESS_TOKEN or ORGANIZATION_ID not set." << std::endl; @@ -18,57 +22,110 @@ int main() { std::string accessToken = accessTokenEnv; std::string organizationId = organizationIdEnv; - // Configuring the URLS is optional, remove them to use the default values + // Configuring the URLS is optional; if unset, use bitwarden.com BitwardenSettings bitwardenSettings; - bitwardenSettings.set_api_url(apiUrl); - bitwardenSettings.set_identity_url(identityUrl); + if (apiUrl != nullptr && identityUrl != nullptr) { + bitwardenSettings.set_api_url(apiUrl); + bitwardenSettings.set_identity_url(identityUrl); + } else { + std::cerr << "Info: API_URL and IDENTITY_URL are not set, using default values..." << std::endl; + } // Create a Bitwarden client instance - BitwardenClient bitwardenClient = BitwardenClient(bitwardenSettings); - // // Access token login - bitwardenClient.loginAccessToken(accessToken); - // Organization ID - boost::uuids::uuid organizationUuid = boost::uuids::string_generator()(organizationId); - - // // Create a new project + BitwardenClient bitwardenClient(bitwardenSettings); + + // Access token login + if (stateFile != nullptr) { + bitwardenClient.loginAccessToken(accessToken, stateFile); + } else { + bitwardenClient.loginAccessToken(accessToken); + } + + // Convert organization ID to UUID + boost::uuids::uuid organizationUuid = boost::uuids::string_generator()(organizationId); + + // Create a new project + std::cout << "Projects:\n"; ProjectResponse projectResponseCreate = bitwardenClient.createProject(organizationUuid, "NewTestProject"); boost::uuids::uuid projectId = boost::uuids::string_generator()(projectResponseCreate.get_id()); - + + std::cout << "\tcreateProject: '" << projectResponseCreate.get_name() << "'\n\n"; + // List projects ProjectsResponse projectResponseList = bitwardenClient.listProjects(organizationUuid); + std::cout << "\tlistProjects:\n"; + for (const ProjectResponse& project : projectResponseList.get_data()) { + std::cout << "\t\tID: '" << project.get_id() << "', Name: '" << project.get_name() << "'\n"; + } + std::cout << '\n'; // Get project details ProjectResponse projectResponseGet = bitwardenClient.getProject(projectId); + std::cout << "\tgetProject:\n\t\tID: '" << projectResponseGet.get_id() << "', Name: '" << projectResponseGet.get_name() << "'\n\n"; // Update project - ProjectResponse ProjectResponseUpdate = bitwardenClient.updateProject(projectId, organizationUuid, "NewTestProject2"); + ProjectResponse projectResponseUpdate = bitwardenClient.updateProject(organizationUuid, projectId, "NewTestProject2"); + std::cout << "\tupdateProject: '" << projectResponseUpdate.get_name() << "'\n\n"; // Secrets std::string key = "key"; std::string value = "value"; std::string note = "note"; + // Sync secrets + std::cout << "Secrets:\n"; + std::cout << "\tSyncing secrets...\n"; + SecretsSyncResponse secretsSyncResponse = bitwardenClient.sync(organizationUuid, {}); + std::chrono::system_clock::time_point lastSyncedDate = std::chrono::system_clock::now(); + std::cout << "\t\tSync has changes: '" << (secretsSyncResponse.get_has_changes() ? "true" : "false") << "'\n\n"; + + std::cout << "\tSyncing again to ensure no changes since last sync...\n"; + secretsSyncResponse = bitwardenClient.sync(organizationUuid, lastSyncedDate); + std::cout << "\t\tSync has changes: '" << (secretsSyncResponse.get_has_changes() ? "true" : "false") << "'\n\n"; + // Create a new secret - SecretResponse secretResponseCreate = bitwardenClient.createSecret(key, value, note, organizationUuid, {projectId}); + SecretResponse secretResponseCreate = bitwardenClient.createSecret(organizationUuid, key, value, note, {projectId}); boost::uuids::uuid secretId = boost::uuids::string_generator()(secretResponseCreate.get_id()); + std::cout << "\tcreateSecret: '" << secretResponseCreate.get_key() << "'\n\n"; + // List secrets SecretIdentifiersResponse secretIdentifiersResponse = bitwardenClient.listSecrets(organizationUuid); + std::cout << "\tlistSecrets:\n"; + for (const SecretIdentifierResponse& secretIdentifier : secretIdentifiersResponse.get_data()) { + std::cout << "\t\tID: '" << secretIdentifier.get_id() << "'\n"; + } + std::cout << '\n'; // Get secret details SecretResponse secretResponseGet = bitwardenClient.getSecret(secretId); + std::cout << "\tgetSecret: '" << secretResponseGet.get_key() << "'\n\n"; + + // Get secrets by IDs + std::cout << "\tgetSecretsByIds:\n"; + SecretsResponse secretsResponseGetByIds = bitwardenClient.getSecretsByIds({secretId}); + for (const SecretResponse& secret : secretsResponseGetByIds.get_data()) { + std::cout << "\t\tID: '" << secret.get_id() << "', Key: '" << secret.get_key() << "'\n"; + } + std::cout << '\n'; // Update secret - key = "key2"; - value = "value2"; - note = "note2"; - SecretResponse responseForSecretResponseUpdate = bitwardenClient.updateSecret(secretId, key, value, note, organizationUuid, {projectId}); + key = "updated-key"; + value = "updated-value"; + note = "updated-note"; + SecretResponse responseForSecretResponseUpdate = bitwardenClient.updateSecret( + organizationUuid, secretId, key, value, note, {projectId}); + + std::cout << "\tupdateSecret: '" << responseForSecretResponseUpdate.get_key() << "'\n\n"; // Delete secrets + std::cout << "Deleting projects and secrets...\n"; SecretsDeleteResponse secretsDeleteResponse = bitwardenClient.deleteSecrets({secretId}); + std::cout << "\tdeleteSecrets: '" << secretsDeleteResponse.get_data()[0].get_id() << "'\n\n"; // Delete projects ProjectsDeleteResponse projectsDeleteResponse = bitwardenClient.deleteProjects({projectId}); + std::cout << "\tdeleteProjects: '" << projectsDeleteResponse.get_data()[0].get_id() << "'\n\n"; return 0; } diff --git a/languages/cpp/include/BitwardenClient.h b/languages/cpp/include/BitwardenClient.h index a5cf72475..2910c49b7 100644 --- a/languages/cpp/include/BitwardenClient.h +++ b/languages/cpp/include/BitwardenClient.h @@ -9,20 +9,22 @@ class BitwardenClient { public: - BitwardenClient(const BitwardenSettings& bitwardenSettings = BitwardenSettings()); + explicit BitwardenClient(const BitwardenSettings& bitwardenSettings = BitwardenSettings()); ~BitwardenClient(); - - void accessTokenLogin(const std::string& accessToken); + + void loginAccessToken(const std::string& accessToken, const std::string& stateFile = ""); ProjectResponse getProject(const boost::uuids::uuid& id); ProjectResponse createProject(const boost::uuids::uuid& organizationId, const std::string& name); - ProjectResponse updateProject(const boost::uuids::uuid& id, const boost::uuids::uuid& organizationId, const std::string& name); + ProjectResponse updateProject(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& name); ProjectsDeleteResponse deleteProjects(const std::vector& ids); ProjectsResponse listProjects(const boost::uuids::uuid &organizationId); SecretResponse getSecret(const boost::uuids::uuid& id); - SecretResponse createSecret(const std::string& key, const std::string& value, const std::string& note, const boost::uuids::uuid& organizationId, const std::vector& projectIds); - SecretResponse updateSecret(const boost::uuids::uuid& id, const std::string& key, const std::string& value, const std::string& note, const boost::uuids::uuid& organizationId, const std::vector& projectIds); + SecretsResponse getSecretsByIds(const std::vector& ids); + SecretResponse createSecret(const boost::uuids::uuid& organizationId, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds); + SecretResponse updateSecret(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds); SecretsDeleteResponse deleteSecrets(const std::vector& ids); SecretIdentifiersResponse listSecrets(const boost::uuids::uuid& organizationId); + SecretsSyncResponse sync(const boost::uuids::uuid &organizationId, const std::chrono::system_clock::time_point &lastSyncedDate); private: BitwardenLibrary* library; diff --git a/languages/cpp/include/Projects.h b/languages/cpp/include/Projects.h index 9bef19b9c..27511c327 100644 --- a/languages/cpp/include/Projects.h +++ b/languages/cpp/include/Projects.h @@ -10,7 +10,7 @@ class Projects { ProjectResponse get(const boost::uuids::uuid& id); ProjectResponse create(const boost::uuids::uuid& organizationId, const std::string& name); - ProjectResponse update(const boost::uuids::uuid& id, const boost::uuids::uuid& organizationId, const std::string& name); + ProjectResponse update(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& name); ProjectsDeleteResponse deleteProjects(const std::vector& ids); ProjectsResponse list(const boost::uuids::uuid& organizationId); diff --git a/languages/cpp/include/Secrets.h b/languages/cpp/include/Secrets.h index 024ec3692..5c5a3275c 100644 --- a/languages/cpp/include/Secrets.h +++ b/languages/cpp/include/Secrets.h @@ -1,6 +1,8 @@ #pragma once #include +#include +#include #include #include "CommandRunner.h" @@ -9,10 +11,12 @@ class Secrets { Secrets(CommandRunner* commandRunner); SecretResponse get(const boost::uuids::uuid& id); - SecretResponse create(const std::string& key, const std::string& value, const std::string& note, const boost::uuids::uuid& organizationId, const std::vector& projectIds); - SecretResponse update(const boost::uuids::uuid& id, const std::string& key, const std::string& value, const std::string& note, const boost::uuids::uuid& organizationId, const std::vector& projectIds); + SecretsResponse getByIds(const std::vector &ids); + SecretResponse create(const boost::uuids::uuid& organizationId, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds); + SecretResponse update(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds); SecretsDeleteResponse deleteSecrets(const std::vector& ids); SecretIdentifiersResponse list(const boost::uuids::uuid& organizationId); + SecretsSyncResponse sync(const boost::uuids::uuid& organizationId, const boost::optional& lastSyncedDate); private: CommandRunner* commandRunner; diff --git a/languages/cpp/src/BitwardenClient.cpp b/languages/cpp/src/BitwardenClient.cpp index ce161a2bf..2d11977d4 100644 --- a/languages/cpp/src/BitwardenClient.cpp +++ b/languages/cpp/src/BitwardenClient.cpp @@ -50,10 +50,11 @@ BitwardenClient::~BitwardenClient() { } } -void BitwardenClient::loginAccessToken(const std::string& accessToken) { +void BitwardenClient::loginAccessToken(const std::string& accessToken, const std::string& stateFile) { Command command; AccessTokenLoginRequest accessTokenLoginRequest; accessTokenLoginRequest.set_access_token(accessToken); + accessTokenLoginRequest.set_state_file(stateFile); command.set_login_access_token(accessTokenLoginRequest); auto deserializer = [](const char* response) -> ResponseForApiKeyLoginResponse { @@ -84,11 +85,11 @@ ProjectResponse BitwardenClient::createProject(const boost::uuids::uuid& organiz return projects.create(organizationId, name); } -ProjectResponse BitwardenClient::updateProject(const boost::uuids::uuid& id, const boost::uuids::uuid& organizationId, const std::string& name){ +ProjectResponse BitwardenClient::updateProject(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& name){ if (!isClientOpen) { throw std::runtime_error("Client is not open."); } - return projects.update(id, organizationId, name); + return projects.update(organizationId, id, name); } ProjectsDeleteResponse BitwardenClient::deleteProjects(const std::vector& ids) { @@ -114,18 +115,25 @@ SecretResponse BitwardenClient::getSecret(const boost::uuids::uuid& id){ return secrets.get(id); } -SecretResponse BitwardenClient::createSecret(const std::string& key, const std::string& value, const std::string& note, const boost::uuids::uuid& organizationId, const std::vector& projectIds){ +SecretsResponse BitwardenClient::getSecretsByIds(const std::vector& ids){ if (!isClientOpen) { throw std::runtime_error("Client is not open."); } - return secrets.create(key, value, note, organizationId, projectIds); + return secrets.getByIds(ids); } -SecretResponse BitwardenClient::updateSecret(const boost::uuids::uuid& id, const std::string& key, const std::string& value, const std::string& note, const boost::uuids::uuid& organizationId, const std::vector& projectIds){ +SecretResponse BitwardenClient::createSecret(const boost::uuids::uuid& organizationId, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds){ if (!isClientOpen) { throw std::runtime_error("Client is not open."); } - return secrets.update(id, key, value, note, organizationId, projectIds); + return secrets.create(organizationId, key, value, note, projectIds); +} + +SecretResponse BitwardenClient::updateSecret(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds){ + if (!isClientOpen) { + throw std::runtime_error("Client is not open."); + } + return secrets.update(organizationId, id, key, value, note, projectIds); } SecretsDeleteResponse BitwardenClient::deleteSecrets(const std::vector& ids) { @@ -143,3 +151,10 @@ SecretIdentifiersResponse BitwardenClient::listSecrets(const boost::uuids::uuid return secrets.list(organizationId); } + +SecretsSyncResponse BitwardenClient::sync(const boost::uuids::uuid &organizationId, const std::chrono::system_clock::time_point &lastSyncedDate) { + if (!isClientOpen) { + throw std::runtime_error("Client is not open."); + } + return secrets.sync(organizationId, lastSyncedDate); +} diff --git a/languages/cpp/src/Projects.cpp b/languages/cpp/src/Projects.cpp index d0aa6ed49..b2fa1c688 100644 --- a/languages/cpp/src/Projects.cpp +++ b/languages/cpp/src/Projects.cpp @@ -67,7 +67,7 @@ ProjectResponse Projects::create(const boost::uuids::uuid& organizationId, const } } -ProjectResponse Projects::update(const boost::uuids::uuid& id, const boost::uuids::uuid& organizationId, const std::string& name) { +ProjectResponse Projects::update(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& name) { Command command; ProjectsCommand projectsCommand; ProjectPutRequest projectPutRequest; diff --git a/languages/cpp/src/Secrets.cpp b/languages/cpp/src/Secrets.cpp index e153ea7f1..1fff9441f 100644 --- a/languages/cpp/src/Secrets.cpp +++ b/languages/cpp/src/Secrets.cpp @@ -1,8 +1,8 @@ #include "Secrets.h" #include #include -#include -#include +#include +#include Secrets::Secrets(CommandRunner* commandRunner) : commandRunner(commandRunner) {} @@ -13,6 +13,13 @@ auto secretsDeserializer = [](const std::string& response) -> ResponseForSecretR return secretResponse; }; +auto secretsByIdsDeserializer = [](const std::string& response) -> ResponseForSecretsResponse { + nlohmann::json jsonResponse = nlohmann::json::parse(response); + ResponseForSecretsResponse secretsResponse; + Bitwarden::Sdk::from_json(jsonResponse, secretsResponse); + return secretsResponse; +}; + auto deleteSecretsDeserializer = [](const std::string& response) -> ResponseForSecretsDeleteResponse { nlohmann::json jsonResponse = nlohmann::json::parse(response); ResponseForSecretsDeleteResponse deleteSecretsResponse; @@ -27,6 +34,13 @@ auto secretListDeserializer = [](const std::string& response) -> ResponseForSecr return listResponse; }; +auto secretsSyncDeserializer = [](const std::string& response) -> ResponseForSecretsSyncResponse { + nlohmann::json jsonResponse = nlohmann::json::parse(response); + ResponseForSecretsSyncResponse syncResponse; + Bitwarden::Sdk::from_json(jsonResponse, syncResponse); + return syncResponse; +}; + SecretResponse Secrets::get(const boost::uuids::uuid& id) { Command command; SecretsCommand secretsCommand; @@ -46,7 +60,29 @@ SecretResponse Secrets::get(const boost::uuids::uuid& id) { } } -SecretResponse Secrets::create(const std::string& key, const std::string& value, const std::string& note, const boost::uuids::uuid& organizationId, const std::vector& projectIds) { +SecretsResponse Secrets::getByIds(const std::vector& ids) { + Command command; + SecretsCommand secretsCommand; + SecretsGetRequest secretsGetRequest; + + std::vector idsStr; + for (const auto& id : ids) { + idsStr.push_back(boost::uuids::to_string(id)); + } + secretsGetRequest.set_ids(idsStr); + + secretsCommand.set_get_by_ids(secretsGetRequest); + command.set_secrets(secretsCommand); + + try { + return commandRunner->runCommand(command, secretsByIdsDeserializer); + } catch (const std::exception& ex) { + std::cerr << "Error in getSecretsByIds: " << ex.what() << std::endl; + throw ex; + } +} + +SecretResponse Secrets::create(const boost::uuids::uuid& organizationId, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds) { Command command; SecretsCommand secretsCommand; SecretCreateRequest secretCreateRequest; @@ -75,7 +111,7 @@ SecretResponse Secrets::create(const std::string& key, const std::string& value, } } -SecretResponse Secrets::update(const boost::uuids::uuid& id, const std::string& key, const std::string& value, const std::string& note, const boost::uuids::uuid& organizationId, const std::vector& projectIds) { +SecretResponse Secrets::update(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds) { Command command; SecretsCommand secretsCommand; SecretPutRequest secretPutRequest; @@ -147,3 +183,48 @@ SecretIdentifiersResponse Secrets::list(const boost::uuids::uuid& organizationId throw ex; } } + +SecretsSyncResponse Secrets::sync(const boost::uuids::uuid& organizationId, const boost::optional& lastSyncedDate) { + Command command; + SecretsCommand secretsCommand; + SecretsSyncRequest secretsSyncRequest; + + std::string orgIdStr = boost::uuids::to_string(organizationId); + secretsSyncRequest.set_organization_id(orgIdStr); + + if (lastSyncedDate.has_value()) { + auto timePoint = lastSyncedDate.value(); + + // Get time as time_t and milliseconds + auto timeT = std::chrono::system_clock::to_time_t(timePoint); + auto milliseconds = std::chrono::duration_cast(timePoint.time_since_epoch()) % 1000; + + // Convert to a tm struct + std::tm tm = *std::gmtime(&timeT); + + // Create a string stream to format the date and time + std::stringstream dateStream; + dateStream << std::put_time(&tm, "%Y-%m-%dT%H:%M:%S"); + + // Add milliseconds + dateStream << '.' << std::setw(3) << std::setfill('0') << milliseconds.count() << 'Z'; + + // Convert to string + std::string dateStr = dateStream.str(); + + // Set the last synced date + secretsSyncRequest.set_last_synced_date(dateStr); + } else { + secretsSyncRequest.set_last_synced_date(boost::none); + } + + secretsCommand.set_sync(secretsSyncRequest); + command.set_secrets(secretsCommand); + + try { + return commandRunner->runCommand(command, secretsSyncDeserializer); + } catch (const std::exception& ex) { + std::cerr << "Error in syncSecrets: " << ex.what() << std::endl; + throw ex; + } +} From eeda46230de545de12ca2ebd183871d376af8716 Mon Sep 17 00:00:00 2001 From: tangowithfoxtrot <5676771+tangowithfoxtrot@users.noreply.github.com> Date: Fri, 20 Sep 2024 10:30:41 -0700 Subject: [PATCH 41/77] Fix C++ build workflow (#1065) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/SM-1446 ## 📔 Objective Fix the C++ build workflow. Relies on changes from #1002, which will need to be merged first. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --------- Co-authored-by: Colton Hurst Co-authored-by: Colton Hurst Co-authored-by: Maciej Zieniuk --- .github/workflows/build-cpp.yml | 69 +++++++++++++++------------------ languages/cpp/CMakeLists.txt | 1 + languages/cpp/vcpkg.json | 17 ++++---- 3 files changed, 42 insertions(+), 45 deletions(-) diff --git a/.github/workflows/build-cpp.yml b/.github/workflows/build-cpp.yml index e95e6cbf2..606cefdee 100644 --- a/.github/workflows/build-cpp.yml +++ b/.github/workflows/build-cpp.yml @@ -30,8 +30,11 @@ jobs: - os: macos-13 target: x86_64-apple-darwin - # - os: windows-2022 - # target: x86_64-pc-windows-msvc + - os: macos-13 + target: aarch64-apple-darwin + + - os: windows-2022 + target: x86_64-pc-windows-msvc - os: ubuntu-22.04 target: x86_64-unknown-linux-gnu @@ -52,16 +55,6 @@ jobs: brew install nlohmann-json brew install boost - - name: Cache vcpkg - if: runner.os == 'Windows' - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - path: C:/vcpkg/ - key: vcpkg-${{ runner.os }}-${{ matrix.settings.target }} - restore-keys: | - vcpkg-${{ runner.os }}- - vcpkg- - - name: Export GitHub Actions cache environment variables if: runner.os == 'Windows' uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 @@ -70,22 +63,6 @@ jobs: core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - - name: Install libraries for Windows - if: runner.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' - env: - VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" - run: | - vcpkg install boost --binarysource="clear;x-gha,readwrite" - vcpkg install nlohmann-json --binarysource="clear;x-gha,readwrite" - shell: pwsh - - - name: Save cache - if: runner.os == 'Windows' - uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - path: C:/vcpkg/ - key: vcpkg-${{ runner.os }}-${{ matrix.settings.target }} - - name: Download schemas uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: @@ -114,6 +91,20 @@ jobs: Get-Acl languages/cpp/include/* | Format-List + - name: Ensure bitwarden-c is in include folder + working-directory: languages/cpp + shell: bash + run: | + mv include/release/* include/ + if [[ '${{ runner.os }}' == 'macOS' || '${{ runner.os }}' == 'Linux' ]]; then + ls include/libbitwarden_c.* || { echo "Missing libbitwarden_c.*"; exit 1; } + fi + if [[ '${{ runner.os }}' == 'Windows' ]]; then + ls include/bitwarden_c.dll || { echo "Missing bitwarden_c.dll"; exit 1; } + ls include/bitwarden_c.dll.lib || { echo "Missing bitwarden_c.dll.lib"; exit 1; } + fi + rmdir include/release + - name: Build unix working-directory: languages/cpp if: runner.os == 'macOS' || runner.os == 'Linux' @@ -139,24 +130,28 @@ jobs: if: runner.os == 'Windows' working-directory: languages/cpp env: - BOOST_INCLUDE_DIR: C:\vcpkg\installed\x64-windows\include\boost - NLOHMANN_JSON_INCLUDE_DIR: C:\vcpkg\installed\x64-windows\include\nlohmann-json + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" run: | mkdir build cd build - $DNLOHMANN_PATH="C:\vcpkg\installed\x64-windows\include\nlohmann-json" - $DBOOST_PATH="C:\vcpkg\installed\x64-windows\include\boost" - $DTARGET="include/libbitwarden_c.dll" - cmake .. -DNLOHMANN=$DNLOHMANN_PATH -DBOOST=$DBOOST_PATH -DTARGET="include/libbitwarden_c.dll" -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/languages/cpp/ -DBUILD_TESTING=OFF - cmake --build . + $env:DTARGET="include\bitwarden_c.dll.lib" + cmake .. -DTARGET="$env:DTARGET" -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" + cmake --build . --config Release shell: pwsh - name: Copy artifacts working-directory: languages/cpp/build + shell: bash run: | mkdir artifacts - cp libbitwarden_c.* artifacts - cp libBitwardenClient.* artifacts + if [[ '${{ runner.os }}' == 'macOS' || '${{ runner.os }}' == 'Linux' ]]; then + cp libbitwarden_c.* artifacts + cp libBitwardenClient.* artifacts + fi + if [[ '${{ runner.os }}' == 'Windows' ]]; then + cp */BitwardenClient.* artifacts + cp ../include/bitwarden_c.{lib,dll.lib,dll} artifacts + fi - name: Upload C++ package for ${{ matrix.settings.target }} uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 diff --git a/languages/cpp/CMakeLists.txt b/languages/cpp/CMakeLists.txt index e513a32ed..e6ad7f4f3 100644 --- a/languages/cpp/CMakeLists.txt +++ b/languages/cpp/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.15) project(BitwardenClient) set(CMAKE_CXX_STANDARD 20) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) # Set placeholders to be passed from command line set(NLOHMANN_JSON_INCLUDE_DIR_PLACEHOLDER ${NLOHMANN}) diff --git a/languages/cpp/vcpkg.json b/languages/cpp/vcpkg.json index 06a7b968c..8e5b968b9 100644 --- a/languages/cpp/vcpkg.json +++ b/languages/cpp/vcpkg.json @@ -1,10 +1,11 @@ { - "name": "bitwarden-sdk-secrets", - "version": "0.1.0", - "homepage": "https://github.com/bitwarden/sdk/tree/languages/cpp", - "description": "Bitwarden Secrets Manager SDK for C++", - "dependencies": [ - "boost", - "nlohmann-json" - ] + "name": "bitwarden-sdk-secrets", + "version": "0.1.0", + "homepage": "https://github.com/bitwarden/sdk/tree/languages/cpp", + "description": "Bitwarden Secrets Manager SDK for C++", + "dependencies": [ + "boost-uuid", + "boost-optional", + "nlohmann-json" + ] } From 7ff270d976d89c4467123bddf24aa579d5d37a2b Mon Sep 17 00:00:00 2001 From: Aaron Feickert <66188213+AaronFeickert@users.noreply.github.com> Date: Mon, 23 Sep 2024 03:43:44 -0500 Subject: [PATCH 42/77] Improve zeroization of key buffer (#1069) Currently, the temporary buffer used for deriving shareable keys is [manually zeroized](https://github.com/bitwarden/sdk/blob/76417172489d5790babbe14bb8c6ad8b3aac2a33/crates/bitwarden-crypto/src/keys/shareable_key.rs#L32-L33). While documentation indicates that preceding `expect` calls cannot fail, this still seems brittle to future changes. This PR places the buffer into a `Zeroizing` wrapper. It is still the case that zeroization may not occur on a panic, but this was already the case with the existing implementation, which would never zeroize in such a case. --- .../bitwarden-crypto/src/keys/shareable_key.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/crates/bitwarden-crypto/src/keys/shareable_key.rs b/crates/bitwarden-crypto/src/keys/shareable_key.rs index 556432aea..c6a44405c 100644 --- a/crates/bitwarden-crypto/src/keys/shareable_key.rs +++ b/crates/bitwarden-crypto/src/keys/shareable_key.rs @@ -3,7 +3,7 @@ use std::pin::Pin; use aes::cipher::typenum::U64; use generic_array::GenericArray; use hmac::Mac; -use zeroize::{Zeroize, Zeroizing}; +use zeroize::Zeroizing; use crate::{ keys::SymmetricCryptoKey, @@ -20,18 +20,17 @@ pub fn derive_shareable_key( info: Option<&str>, ) -> SymmetricCryptoKey { // Because all inputs are fixed size, we can unwrap all errors here without issue - let mut res = PbkdfSha256Hmac::new_from_slice(format!("bitwarden-{}", name).as_bytes()) - .expect("hmac new_from_slice should not fail") - .chain_update(secret) - .finalize() - .into_bytes(); + let res = Zeroizing::new( + PbkdfSha256Hmac::new_from_slice(format!("bitwarden-{}", name).as_bytes()) + .expect("hmac new_from_slice should not fail") + .chain_update(secret) + .finalize() + .into_bytes(), + ); let mut key: Pin>> = hkdf_expand(&res, info).expect("Input is a valid size"); - // Zeroize the temporary buffer - res.zeroize(); - SymmetricCryptoKey::try_from(key.as_mut_slice()).expect("Key is a valid size") } From 56fc75da9e94f0de4118cd89b6b24296ab76a682 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Mon, 23 Sep 2024 09:48:06 -0400 Subject: [PATCH 43/77] BRE-341 - Update Publish PHP workflow (#1074) --- .github/workflows/publish-php.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-php.yml b/.github/workflows/publish-php.yml index 0cf7c59b0..74939ec58 100644 --- a/.github/workflows/publish-php.yml +++ b/.github/workflows/publish-php.yml @@ -1,3 +1,4 @@ +--- name: Publish PHP SDK run-name: Publish PHP SDK ${{ inputs.release_type }} @@ -29,9 +30,9 @@ jobs: - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} run: | - if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then echo "===================================" - echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" + echo "[!] Can only release from the 'main' branch" echo "===================================" exit 1 fi @@ -123,7 +124,7 @@ jobs: working-directory: sm-sdk-php run: | git add . - git commit -m "Update Go SDK to ${{ github.sha }}" + git commit -m "Update PHP SDK to ${{ github.sha }}" if [[ "${{ inputs.release_type }}" == "Dry Run" ]]; then echo "===================================" @@ -135,7 +136,7 @@ jobs: git push origin main fi - - name: Create release tag on SDK Go repo + - name: Create release tag on PHP SDK repo if: ${{ inputs.release_type != 'Dry Run' }} working-directory: sm-sdk-php run: | @@ -177,7 +178,7 @@ jobs: with: workflow: build-rust-cross-platform.yml workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: main artifacts: libbitwarden_c_files-x86_64-apple-darwin skip_unpack: true @@ -186,7 +187,7 @@ jobs: with: workflow: build-rust-cross-platform.yml workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: main artifacts: libbitwarden_c_files-aarch64-apple-darwin skip_unpack: true @@ -195,7 +196,7 @@ jobs: with: workflow: build-rust-cross-platform.yml workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: main artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu skip_unpack: true @@ -204,7 +205,7 @@ jobs: with: workflow: build-rust-cross-platform.yml workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: main artifacts: libbitwarden_c_files-x86_64-pc-windows-msvc skip_unpack: true From f62ed98e61d529a9a6270109814c23ee776da6ee Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2024 12:26:35 +0200 Subject: [PATCH 44/77] [deps]: Lock file maintenance (#1075) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Update | Change | |---|---| | lockFileMaintenance | All locks refreshed | 🔧 This Pull Request updates lock files to use the latest dependency versions. --- ### Configuration 📅 **Schedule**: Branch creation - "every 2nd week starting on the 2 week of the year before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. đŸ‘ģ **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/bitwarden/sdk). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 84 +++++++++++------------ languages/js/sdk-client/package-lock.json | 26 ++----- package-lock.json | 26 ++----- 3 files changed, 54 insertions(+), 82 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 068df1254..133750786 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -786,9 +786,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "bytesize" @@ -845,9 +845,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.19" +version = "1.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d74707dde2ba56f86ae90effb3b43ddd369504387e718014de010cec7959800" +checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" dependencies = [ "shlex", ] @@ -919,9 +919,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.17" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" +checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" dependencies = [ "clap_builder", "clap_derive", @@ -929,9 +929,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.17" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" +checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" dependencies = [ "anstream", "anstyle", @@ -941,18 +941,18 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.26" +version = "4.5.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "205d5ef6d485fa47606b98b0ddc4ead26eb850aaa86abfb562a94fb3280ecba0" +checksum = "8937760c3f4c60871870b8c3ee5f9b30771f792a7045c48bcbba999d7d6b3b8e" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -2022,9 +2022,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2368,9 +2368,9 @@ dependencies = [ [[package]] name = "napi" -version = "2.16.10" +version = "2.16.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04409e8c2d61995696e44d2181b79b68c1dd41f7e24a17cde60bbd9f54ddddef" +checksum = "53575dfa17f208dd1ce3a2da2da4659aae393b256a472f2738a8586a6c4107fd" dependencies = [ "bitflags 2.6.0", "ctor", @@ -2536,9 +2536,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ea5043e58958ee56f3e15a90aee535795cd7dfd319846288d93c5b57d85cbe" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "onig" @@ -2635,7 +2635,7 @@ dependencies = [ [[package]] name = "passkey" version = "0.2.0" -source = "git+https://github.com/bitwarden/passkey-rs?rev=29bb052eb15a42e369728ded3cfb2aa7c91213df#29bb052eb15a42e369728ded3cfb2aa7c91213df" +source = "git+https://github.com/bitwarden/passkey-rs?rev=ff757604cd7b4e8f321ed1616fef7e40e21ac5df#ff757604cd7b4e8f321ed1616fef7e40e21ac5df" dependencies = [ "passkey-authenticator", "passkey-client", @@ -2646,7 +2646,7 @@ dependencies = [ [[package]] name = "passkey-authenticator" version = "0.2.0" -source = "git+https://github.com/bitwarden/passkey-rs?rev=29bb052eb15a42e369728ded3cfb2aa7c91213df#29bb052eb15a42e369728ded3cfb2aa7c91213df" +source = "git+https://github.com/bitwarden/passkey-rs?rev=ff757604cd7b4e8f321ed1616fef7e40e21ac5df#ff757604cd7b4e8f321ed1616fef7e40e21ac5df" dependencies = [ "async-trait", "coset", @@ -2659,7 +2659,7 @@ dependencies = [ [[package]] name = "passkey-client" version = "0.2.0" -source = "git+https://github.com/bitwarden/passkey-rs?rev=29bb052eb15a42e369728ded3cfb2aa7c91213df#29bb052eb15a42e369728ded3cfb2aa7c91213df" +source = "git+https://github.com/bitwarden/passkey-rs?rev=ff757604cd7b4e8f321ed1616fef7e40e21ac5df#ff757604cd7b4e8f321ed1616fef7e40e21ac5df" dependencies = [ "ciborium", "coset", @@ -2676,12 +2676,12 @@ dependencies = [ [[package]] name = "passkey-transports" version = "0.1.0" -source = "git+https://github.com/bitwarden/passkey-rs?rev=29bb052eb15a42e369728ded3cfb2aa7c91213df#29bb052eb15a42e369728ded3cfb2aa7c91213df" +source = "git+https://github.com/bitwarden/passkey-rs?rev=ff757604cd7b4e8f321ed1616fef7e40e21ac5df#ff757604cd7b4e8f321ed1616fef7e40e21ac5df" [[package]] name = "passkey-types" version = "0.2.1" -source = "git+https://github.com/bitwarden/passkey-rs?rev=29bb052eb15a42e369728ded3cfb2aa7c91213df#29bb052eb15a42e369728ded3cfb2aa7c91213df" +source = "git+https://github.com/bitwarden/passkey-rs?rev=ff757604cd7b4e8f321ed1616fef7e40e21ac5df#ff757604cd7b4e8f321ed1616fef7e40e21ac5df" dependencies = [ "bitflags 2.6.0", "ciborium", @@ -2801,9 +2801,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "plain" @@ -2854,9 +2854,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" +checksum = "d30538d42559de6b034bc76fd6dd4c38961b1ee5c6c56e3808c50128fdbc22ce" [[package]] name = "powerfmt" @@ -2918,7 +2918,7 @@ dependencies = [ [[package]] name = "public-suffix" version = "0.1.1" -source = "git+https://github.com/bitwarden/passkey-rs?rev=29bb052eb15a42e369728ded3cfb2aa7c91213df#29bb052eb15a42e369728ded3cfb2aa7c91213df" +source = "git+https://github.com/bitwarden/passkey-rs?rev=ff757604cd7b4e8f321ed1616fef7e40e21ac5df#ff757604cd7b4e8f321ed1616fef7e40e21ac5df" [[package]] name = "pyo3" @@ -3501,9 +3501,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" dependencies = [ "core-foundation-sys", "libc", @@ -3942,18 +3942,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", @@ -4109,9 +4109,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.22.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "3b072cee73c449a636ffd6f32bd8de3a9f7119139aff882f44943ce2986dc5cf" dependencies = [ "indexmap 2.5.0", "serde", @@ -4223,9 +4223,9 @@ checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] @@ -4238,9 +4238,9 @@ checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "uniffi" @@ -4600,9 +4600,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.5" +version = "0.26.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bd24728e5af82c6c4ec1b66ac4844bdf8156257fccda846ec58b42cd0cdbe6a" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" dependencies = [ "rustls-pki-types", ] diff --git a/languages/js/sdk-client/package-lock.json b/languages/js/sdk-client/package-lock.json index e81afb713..ab7809936 100644 --- a/languages/js/sdk-client/package-lock.json +++ b/languages/js/sdk-client/package-lock.json @@ -29,21 +29,10 @@ "node": ">=12" } }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, - "license": "MIT", - "optional": true, - "engines": { - "node": ">=14" - } - }, "node_modules/@types/node": { - "version": "20.16.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.5.tgz", - "integrity": "sha512-VwYCweNo3ERajwy0IUlqqcyZ8/A7Zwa9ZP3MnENWcB11AejO+tLy3pu850goUW2FC/IJMdZUfKpX/yxL1gymCA==", + "version": "20.16.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.6.tgz", + "integrity": "sha512-T7PpxM/6yeDE+AdlVysT62BX6/bECZOmQAgiFg5NoBd5MQheZ3tzal7f1wvzfiEcmrcJNRi2zRr2nY2zF+0uqw==", "dev": true, "license": "MIT", "dependencies": { @@ -201,9 +190,9 @@ "license": "ISC" }, "node_modules/jackspeak": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.1.tgz", - "integrity": "sha512-cub8rahkh0Q/bw1+GxP7aeSe29hHHn2V4m29nnDlvCdlgU+3UGxkZp7Z53jLUdpX3jdTO0nJZUDl3xvbWc2Xog==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz", + "integrity": "sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { @@ -214,9 +203,6 @@ }, "funding": { "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" } }, "node_modules/lru-cache": { diff --git a/package-lock.json b/package-lock.json index 859e169ff..59b48116d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -330,17 +330,6 @@ "url": "https://opencollective.com/openapi_generator" } }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, - "license": "MIT", - "optional": true, - "engines": { - "node": ">=14" - } - }, "node_modules/@tsconfig/node10": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", @@ -370,9 +359,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.5.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.5.tgz", - "integrity": "sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==", + "version": "22.6.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.6.1.tgz", + "integrity": "sha512-V48tCfcKb/e6cVUigLAaJDAILdMP0fUW6BidkPK4GpGjXcfbnoHasCZDwz3N3yVt5we2RHm4XTQCpv0KJz9zqw==", "dev": true, "license": "MIT", "peer": true, @@ -1339,9 +1328,9 @@ } }, "node_modules/jackspeak": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.1.tgz", - "integrity": "sha512-cub8rahkh0Q/bw1+GxP7aeSe29hHHn2V4m29nnDlvCdlgU+3UGxkZp7Z53jLUdpX3jdTO0nJZUDl3xvbWc2Xog==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz", + "integrity": "sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { @@ -1352,9 +1341,6 @@ }, "funding": { "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" } }, "node_modules/js-base64": { From 074762124ab1e182455deacc5f65956723913b7b Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Tue, 24 Sep 2024 13:21:32 +0200 Subject: [PATCH 45/77] [PM-12576] Support publishing gradle to local maven repository (#1076) Support publishing to local maven repository. --- languages/kotlin/publish-local.sh | 16 ++++++++++++++ languages/kotlin/sdk/build.gradle | 36 ++++++++++++++++--------------- 2 files changed, 35 insertions(+), 17 deletions(-) create mode 100755 languages/kotlin/publish-local.sh diff --git a/languages/kotlin/publish-local.sh b/languages/kotlin/publish-local.sh new file mode 100755 index 000000000..68e67455f --- /dev/null +++ b/languages/kotlin/publish-local.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -e + +cd "$(dirname "$0")" + +mkdir -p ./sdk/src/main/jniLibs/{arm64-v8a,armeabi-v7a,x86_64,x86} + +# Build arm64 for emulator +cross build -p bitwarden-uniffi --release --target=aarch64-linux-android +mv ../../target/aarch64-linux-android/release/libbitwarden_uniffi.so ./sdk/src/main/jniLibs/arm64-v8a/libbitwarden_uniffi.so + +# Generate latest bindings +./build-schemas.sh + +# Publish to local maven +./gradlew sdk:publishToMavenLocal -Pversion=LOCAL diff --git a/languages/kotlin/sdk/build.gradle b/languages/kotlin/sdk/build.gradle index d3ea098e3..2006e4673 100644 --- a/languages/kotlin/sdk/build.gradle +++ b/languages/kotlin/sdk/build.gradle @@ -47,23 +47,25 @@ publishing { groupId = 'com.bitwarden' artifactId = 'sdk-android' - // Determine the version from the git history. - // - // PRs: use the branch name. - // Main: Grab it from `crates/bitwarden/Cargo.toml` - - def branchName = 'git branch --show-current'.execute().text.trim() - - if (branchName == 'main') { - def content = ['grep', '-o', '^version = ".*"', '../../Cargo.toml'].execute().text.trim() - def match = ~/version = "(.*)"/ - def matcher = match.matcher(content) - matcher.find() - - version = "${matcher.group(1)}-SNAPSHOT" - } else { - // branchName-SNAPSHOT - version = "${branchName.replaceAll('/', '-')}-SNAPSHOT" + if (findProperty('version') == 'unspecified') { + // Determine the version from the git history. + // + // PRs: use the branch name. + // Main: Grab it from `crates/bitwarden/Cargo.toml` + + def branchName = 'git branch --show-current'.execute().text.trim() + + if (branchName == 'main') { + def content = ['grep', '-o', '^version = ".*"', '../../Cargo.toml'].execute().text.trim() + def match = ~/version = "(.*)"/ + def matcher = match.matcher(content) + matcher.find() + + version = "${matcher.group(1)}-SNAPSHOT" + } else { + // branchName-SNAPSHOT + version = "${branchName.replaceAll('/', '-')}-SNAPSHOT" + } } afterEvaluate { From ae05bd000e8fb2182d05ac9d6e6cb879dc39c92a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2024 11:34:45 -0400 Subject: [PATCH 46/77] [deps]: Update gh minor (#1047) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build-android.yml | 4 ++-- .github/workflows/build-java.yml | 2 +- .github/workflows/build-napi.yml | 2 +- .github/workflows/build-python-wheels.yml | 2 +- .github/workflows/build-wasm.yml | 2 +- .github/workflows/generate_schemas.yml | 2 +- .github/workflows/lint.yml | 4 ++-- .github/workflows/publish-java.yml | 4 ++-- .github/workflows/publish-ruby.yml | 2 +- .github/workflows/release-napi.yml | 2 +- .github/workflows/release-wasm.yml | 2 +- .github/workflows/scan.yml | 4 ++-- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index 909e689c4..e94bfd7a9 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -80,7 +80,7 @@ jobs: key: cargo-combine-cache - name: Setup Java - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0 with: distribution: temurin java-version: 17 @@ -102,7 +102,7 @@ jobs: run: ./build-schemas.sh - name: Setup gradle - uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4.0.1 + uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0 - name: Publish run: ./gradlew sdk:publish diff --git a/.github/workflows/build-java.yml b/.github/workflows/build-java.yml index a42663e3f..7f5713087 100644 --- a/.github/workflows/build-java.yml +++ b/.github/workflows/build-java.yml @@ -34,7 +34,7 @@ jobs: path: languages/java/src/main/java/bit/sdk/schema/ - name: Setup Java - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0 with: distribution: temurin java-version: 17 diff --git a/.github/workflows/build-napi.yml b/.github/workflows/build-napi.yml index e950b5e7a..a7d8f7bca 100644 --- a/.github/workflows/build-napi.yml +++ b/.github/workflows/build-napi.yml @@ -54,7 +54,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Node - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 with: node-version: 18 cache: "npm" diff --git a/.github/workflows/build-python-wheels.yml b/.github/workflows/build-python-wheels.yml index 943177d69..ed07bbb94 100644 --- a/.github/workflows/build-python-wheels.yml +++ b/.github/workflows/build-python-wheels.yml @@ -66,7 +66,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Node - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 with: node-version: 18 diff --git a/.github/workflows/build-wasm.yml b/.github/workflows/build-wasm.yml index c2c79d3ad..996ff0ade 100644 --- a/.github/workflows/build-wasm.yml +++ b/.github/workflows/build-wasm.yml @@ -25,7 +25,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Node - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 with: node-version: 18 registry-url: "https://npm.pkg.github.com" diff --git a/.github/workflows/generate_schemas.yml b/.github/workflows/generate_schemas.yml index 9f3e6743c..c1db37d5d 100644 --- a/.github/workflows/generate_schemas.yml +++ b/.github/workflows/generate_schemas.yml @@ -27,7 +27,7 @@ jobs: toolchain: stable - name: Set up Node - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 with: cache: "npm" cache-dependency-path: "package-lock.json" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 686b5775a..951c8fcba 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -45,12 +45,12 @@ jobs: RUSTFLAGS: "-D warnings" - name: Upload Clippy results to GitHub - uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 with: sarif_file: clippy_result.sarif - name: Set up Node - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 with: cache: "npm" cache-dependency-path: "package-lock.json" diff --git a/.github/workflows/publish-java.yml b/.github/workflows/publish-java.yml index fdf0be986..2daeffe5a 100644 --- a/.github/workflows/publish-java.yml +++ b/.github/workflows/publish-java.yml @@ -64,13 +64,13 @@ jobs: maven-sonartype-ossrh-password" - name: Setup java - uses: actions/setup-java@6a0805fcefea3d4657a47ac4c165951e33482018 # v4.2.2 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0 with: distribution: temurin java-version: 17 - name: Setup Gradle - uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4.0.1 + uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0 - name: Publish package to GitHub Packages if: ${{ inputs.release_type != 'Dry Run' }} diff --git a/.github/workflows/publish-ruby.yml b/.github/workflows/publish-ruby.yml index a2390953e..c372a476d 100644 --- a/.github/workflows/publish-ruby.yml +++ b/.github/workflows/publish-ruby.yml @@ -36,7 +36,7 @@ jobs: fi - name: Set up Ruby - uses: ruby/setup-ruby@52753b7da854d5c07df37391a986c76ab4615999 # v1.191.0 + uses: ruby/setup-ruby@f321cf5a4d1533575411f8752cf25b86478b0442 # v1.193.0 with: ruby-version: 3.2 diff --git a/.github/workflows/release-napi.yml b/.github/workflows/release-napi.yml index bdb579ec2..fc4eaa367 100644 --- a/.github/workflows/release-napi.yml +++ b/.github/workflows/release-napi.yml @@ -93,7 +93,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Node - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 with: node-version: 18 cache: "npm" diff --git a/.github/workflows/release-wasm.yml b/.github/workflows/release-wasm.yml index 268dd1ce2..dac64a6ce 100644 --- a/.github/workflows/release-wasm.yml +++ b/.github/workflows/release-wasm.yml @@ -92,7 +92,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup Node - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 with: node-version: 18 cache: "npm" diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml index 5595316de..364298f98 100644 --- a/.github/workflows/scan.yml +++ b/.github/workflows/scan.yml @@ -31,7 +31,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - name: Scan with Checkmarx - uses: checkmarx/ast-github-action@1fe318de2993222574e6249750ba9000a4e2a6cd # 2.0.33 + uses: checkmarx/ast-github-action@9fda5a4a2c297608117a5a56af424502a9192e57 # 2.0.34 env: INCREMENTAL: "${{ contains(github.event_name, 'pull_request') && '--sast-incremental' || '' }}" with: @@ -46,7 +46,7 @@ jobs: --output-path . ${{ env.INCREMENTAL }} - name: Upload Checkmarx results to GitHub - uses: github/codeql-action/upload-sarif@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 with: sarif_file: cx_result.sarif From 5b5b36eb18f01c023cba66decb8d53257f9898a9 Mon Sep 17 00:00:00 2001 From: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com> Date: Wed, 25 Sep 2024 10:53:49 -0600 Subject: [PATCH 47/77] Bump java-sdk version to 1.0.0 (#1079) ## Type of change - [ ] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [X] Other ## Objective Automated java-sdk version bump to 1.0.0 --- languages/java/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/java/build.gradle b/languages/java/build.gradle index 6f24369d7..52337a447 100644 --- a/languages/java/build.gradle +++ b/languages/java/build.gradle @@ -36,7 +36,7 @@ repositories { def branchName = "git branch --show-current".execute().text.trim() if (branchName == "main" || branchName == "rc" || branchName == "hotfix-rc") { - version = "0.1.0" + version = "1.0.0" } else { // branchName-SNAPSHOT version = "${branchName.replaceAll('/', '-')}-SNAPSHOT" From 605ebf67780b18203c21b1ea7853c8ad0f0dcb51 Mon Sep 17 00:00:00 2001 From: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com> Date: Wed, 25 Sep 2024 11:49:20 -0600 Subject: [PATCH 48/77] Bump go-sdk version to 1.0.1 (#1080) ## Type of change - [ ] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [X] Other ## Objective Automated go-sdk version bump to 1.0.1 --- languages/go/.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/go/.version b/languages/go/.version index afaf360d3..7f207341d 100644 --- a/languages/go/.version +++ b/languages/go/.version @@ -1 +1 @@ -1.0.0 \ No newline at end of file +1.0.1 \ No newline at end of file From 1a991965896d50b95a413c31aacade8dfb464e96 Mon Sep 17 00:00:00 2001 From: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com> Date: Wed, 25 Sep 2024 11:52:24 -0600 Subject: [PATCH 49/77] Bump python-sdk version to 1.0.0 (#1081) ## Type of change - [ ] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [X] Other ## Objective Automated python-sdk version bump to 1.0.0 --- languages/python/bitwarden_sdk/__init__.py | 2 +- languages/python/pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/languages/python/bitwarden_sdk/__init__.py b/languages/python/bitwarden_sdk/__init__.py index 067ed3aa5..f1712c77b 100644 --- a/languages/python/bitwarden_sdk/__init__.py +++ b/languages/python/bitwarden_sdk/__init__.py @@ -1,6 +1,6 @@ """The official Bitwarden client library for Python.""" -__version__ = "0.1.1" +__version__ = "1.0.0" from .bitwarden_client import * from .schemas import * diff --git a/languages/python/pyproject.toml b/languages/python/pyproject.toml index 0ce9a96b2..a4ab1f693 100644 --- a/languages/python/pyproject.toml +++ b/languages/python/pyproject.toml @@ -17,7 +17,7 @@ description = "A Bitwarden Client for python" name = "bitwarden_sdk" readme = "README.md" requires-python = ">=3.0" -version = "0.1.1" +version = "1.0.0" [tool.maturin] bindings = "pyo3" From ae2a7c0447e70c8c5510fe14d57a8b949abee05d Mon Sep 17 00:00:00 2001 From: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com> Date: Wed, 25 Sep 2024 11:54:34 -0600 Subject: [PATCH 50/77] Bump php-sdk version to 1.0.0 (#1082) ## Type of change - [ ] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [X] Other ## Objective Automated php-sdk version bump to 1.0.0 --- languages/php/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/php/composer.json b/languages/php/composer.json index fce61f890..6df44ed0b 100644 --- a/languages/php/composer.json +++ b/languages/php/composer.json @@ -4,7 +4,7 @@ "type": "library", "keywords": ["bitwarden","sdk","password-manager"], "homepage": "https://github.com/bitwarden/sdk", - "version": "0.1.0", + "version": "1.0.0", "require": { "php": "^8.0", "ext-ffi": "*" From 4d5b713089ffa9310255b1cd7f1779b610d8eb95 Mon Sep 17 00:00:00 2001 From: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com> Date: Wed, 25 Sep 2024 11:59:20 -0600 Subject: [PATCH 51/77] Bump napi version to 1.0.0 (#1083) ## Type of change - [ ] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [X] Other ## Objective Automated napi version bump to 1.0.0 --- Cargo.lock | 2 +- crates/bitwarden-napi/Cargo.toml | 2 +- crates/bitwarden-napi/npm/darwin-arm64/package.json | 2 +- crates/bitwarden-napi/npm/darwin-x64/package.json | 2 +- crates/bitwarden-napi/npm/linux-x64-gnu/package.json | 2 +- crates/bitwarden-napi/npm/win32-x64-msvc/package.json | 2 +- crates/bitwarden-napi/package-lock.json | 4 ++-- crates/bitwarden-napi/package.json | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 133750786..a1a9bcd23 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -559,7 +559,7 @@ dependencies = [ [[package]] name = "bitwarden-napi" -version = "0.3.1" +version = "1.0.0" dependencies = [ "bitwarden-json", "env_logger", diff --git a/crates/bitwarden-napi/Cargo.toml b/crates/bitwarden-napi/Cargo.toml index 7bcd54aad..59ca137aa 100644 --- a/crates/bitwarden-napi/Cargo.toml +++ b/crates/bitwarden-napi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bitwarden-napi" -version = "0.3.1" +version = "1.0.0" description = """ N-API bindings for the Bitwarden Secrets Manager SDK """ diff --git a/crates/bitwarden-napi/npm/darwin-arm64/package.json b/crates/bitwarden-napi/npm/darwin-arm64/package.json index 52d785d87..88e3122c5 100644 --- a/crates/bitwarden-napi/npm/darwin-arm64/package.json +++ b/crates/bitwarden-napi/npm/darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@bitwarden/sdk-napi-darwin-arm64", - "version": "0.3.1", + "version": "1.0.0", "homepage": "https://github.com/bitwarden/sdk#readme", "bugs": { "url": "https://github.com/bitwarden/sdk/issues" diff --git a/crates/bitwarden-napi/npm/darwin-x64/package.json b/crates/bitwarden-napi/npm/darwin-x64/package.json index 0a1b06423..4650654ce 100644 --- a/crates/bitwarden-napi/npm/darwin-x64/package.json +++ b/crates/bitwarden-napi/npm/darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "@bitwarden/sdk-napi-darwin-x64", - "version": "0.3.1", + "version": "1.0.0", "homepage": "https://github.com/bitwarden/sdk#readme", "bugs": { "url": "https://github.com/bitwarden/sdk/issues" diff --git a/crates/bitwarden-napi/npm/linux-x64-gnu/package.json b/crates/bitwarden-napi/npm/linux-x64-gnu/package.json index 2284d8415..ed3b62f80 100644 --- a/crates/bitwarden-napi/npm/linux-x64-gnu/package.json +++ b/crates/bitwarden-napi/npm/linux-x64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@bitwarden/sdk-napi-linux-x64-gnu", - "version": "0.3.1", + "version": "1.0.0", "homepage": "https://github.com/bitwarden/sdk#readme", "bugs": { "url": "https://github.com/bitwarden/sdk/issues" diff --git a/crates/bitwarden-napi/npm/win32-x64-msvc/package.json b/crates/bitwarden-napi/npm/win32-x64-msvc/package.json index 261554e93..5b2a93121 100644 --- a/crates/bitwarden-napi/npm/win32-x64-msvc/package.json +++ b/crates/bitwarden-napi/npm/win32-x64-msvc/package.json @@ -1,6 +1,6 @@ { "name": "@bitwarden/sdk-napi-win32-x64-msvc", - "version": "0.3.1", + "version": "1.0.0", "homepage": "https://github.com/bitwarden/sdk#readme", "bugs": { "url": "https://github.com/bitwarden/sdk/issues" diff --git a/crates/bitwarden-napi/package-lock.json b/crates/bitwarden-napi/package-lock.json index 8082a7a80..eaa8d3473 100644 --- a/crates/bitwarden-napi/package-lock.json +++ b/crates/bitwarden-napi/package-lock.json @@ -1,12 +1,12 @@ { "name": "@bitwarden/sdk-napi", - "version": "0.3.1", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@bitwarden/sdk-napi", - "version": "0.3.1", + "version": "1.0.0", "license": "SEE LICENSE IN LICENSE", "devDependencies": { "@napi-rs/cli": "2.18.4", diff --git a/crates/bitwarden-napi/package.json b/crates/bitwarden-napi/package.json index 9f1048d18..31cee632b 100644 --- a/crates/bitwarden-napi/package.json +++ b/crates/bitwarden-napi/package.json @@ -1,6 +1,6 @@ { "name": "@bitwarden/sdk-napi", - "version": "0.3.1", + "version": "1.0.0", "homepage": "https://github.com/bitwarden/sdk#readme", "bugs": { "url": "https://github.com/bitwarden/sdk/issues" From 73d3ce83cebb68e156955fe6eee8e98b13a5a0bd Mon Sep 17 00:00:00 2001 From: Colton Hurst Date: Thu, 26 Sep 2024 12:05:17 -0400 Subject: [PATCH 52/77] [PM-12431] Temporarily un-export bitwarden_fido (#1072) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/PM-12431 ## 📔 Objective Temporarily un-export `bitwarden-fido`. We can't release crates for `1.0` because: - `bitwarden-fido` currently relies on dependencies that are GitHub repositories ([reference](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies-from-other-registries)) - `bitwarden-fido` is not yet released (same with the aforementioned dependencies) This PR also includes the auto-updates to the `Cargo.lock file`, which should be fine. ⭐ī¸**NOTE**⭐ī¸: This will break CI, this should only be merged when we are ready to do 1.0 releases of `bitwarden`, `bws`, etc. It should quickly be followed up a PR, after release, which reverses this. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .github/workflows/publish-rust-crates.yml | 2 +- Cargo.lock | 1 - crates/bitwarden/Cargo.toml | 6 ++++-- crates/bitwarden/src/error.rs | 4 +++- crates/bitwarden/src/lib.rs | 16 ++++++++++++---- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish-rust-crates.yml b/.github/workflows/publish-rust-crates.yml index bdb39d9b7..ec9848127 100644 --- a/.github/workflows/publish-rust-crates.yml +++ b/.github/workflows/publish-rust-crates.yml @@ -72,7 +72,7 @@ jobs: env: PUBLISH_GRACE_SLEEP: 10 CARGO_REGISTRY_TOKEN: ${{ steps.retrieve-secrets.outputs.cratesio-api-token }} - run: cargo-release release publish --exclude bw --exclude bws --execute --no-confirm + run: cargo-release release publish --exclude bw --exclude bws --exclude bitwarden-fido --execute --no-confirm - name: Update deployment status to Success if: ${{ inputs.release_type != 'Dry Run' && success() }} diff --git a/Cargo.lock b/Cargo.lock index a1a9bcd23..9bfdbe70c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -367,7 +367,6 @@ dependencies = [ "bitwarden-core", "bitwarden-crypto", "bitwarden-exporters", - "bitwarden-fido", "bitwarden-generators", "bitwarden-send", "bitwarden-sm", diff --git a/crates/bitwarden/Cargo.toml b/crates/bitwarden/Cargo.toml index f927564cf..31d84b877 100644 --- a/crates/bitwarden/Cargo.toml +++ b/crates/bitwarden/Cargo.toml @@ -30,7 +30,8 @@ uniffi = [ "bitwarden-core/uniffi", "bitwarden-crypto/uniffi", "bitwarden-exporters/uniffi", - "bitwarden-fido/uniffi", + # PR #1072 + # "bitwarden-fido/uniffi", "bitwarden-generators/uniffi", "bitwarden-send/uniffi", "bitwarden-vault/uniffi", @@ -43,7 +44,8 @@ bitwarden-api-identity = { workspace = true } bitwarden-core = { workspace = true } bitwarden-crypto = { workspace = true } bitwarden-exporters = { workspace = true, optional = true } -bitwarden-fido = { workspace = true, optional = true } +# PR #1072 +# bitwarden-fido = { workspace = true, optional = true } bitwarden-generators = { workspace = true, optional = true } bitwarden-send = { workspace = true, optional = true } bitwarden-sm = { workspace = true, optional = true } diff --git a/crates/bitwarden/src/error.rs b/crates/bitwarden/src/error.rs index 06ef09648..a6f6c09de 100644 --- a/crates/bitwarden/src/error.rs +++ b/crates/bitwarden/src/error.rs @@ -37,6 +37,8 @@ pub enum Error { ExportError(#[from] ExportError), // Fido + /* + # PR #1072 #[cfg(all(feature = "uniffi", feature = "internal"))] #[error(transparent)] MakeCredential(#[from] bitwarden_fido::MakeCredentialError), @@ -57,7 +59,7 @@ pub enum Error { #[cfg(all(feature = "uniffi", feature = "internal"))] #[error(transparent)] Fido2Client(#[from] bitwarden_fido::Fido2ClientError), - + */ #[error("Internal error: {0}")] Internal(Cow<'static, str>), } diff --git a/crates/bitwarden/src/lib.rs b/crates/bitwarden/src/lib.rs index c87693ce7..5751c313b 100644 --- a/crates/bitwarden/src/lib.rs +++ b/crates/bitwarden/src/lib.rs @@ -79,10 +79,18 @@ pub mod internal { pub use bitwarden_vault::*; } - #[cfg(feature = "uniffi")] - pub mod fido { - pub use bitwarden_fido::*; - } + /* + PM-12431 + # PR #1072 + + Temporarily un-export bitwarden_fido, as bitwarden_fido + is not ready for release yet. This will unblock the + 1.0 releases. + */ + // #[cfg(feature = "uniffi")] + // pub mod fido { + // pub use bitwarden_fido::*; + // } } #[cfg(feature = "internal")] pub use internal::*; From 5069409e1c043488543d5e0663a8d06cc17edc35 Mon Sep 17 00:00:00 2001 From: Colton Hurst Date: Thu, 26 Sep 2024 12:51:49 -0400 Subject: [PATCH 53/77] Revert "[PM-12431] Temporarily un-export bitwarden_fido" (#1086) Reverts bitwarden/sdk#1072 --- .github/workflows/publish-rust-crates.yml | 2 +- Cargo.lock | 1 + crates/bitwarden/Cargo.toml | 6 ++---- crates/bitwarden/src/error.rs | 4 +--- crates/bitwarden/src/lib.rs | 16 ++++------------ 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/.github/workflows/publish-rust-crates.yml b/.github/workflows/publish-rust-crates.yml index ec9848127..bdb39d9b7 100644 --- a/.github/workflows/publish-rust-crates.yml +++ b/.github/workflows/publish-rust-crates.yml @@ -72,7 +72,7 @@ jobs: env: PUBLISH_GRACE_SLEEP: 10 CARGO_REGISTRY_TOKEN: ${{ steps.retrieve-secrets.outputs.cratesio-api-token }} - run: cargo-release release publish --exclude bw --exclude bws --exclude bitwarden-fido --execute --no-confirm + run: cargo-release release publish --exclude bw --exclude bws --execute --no-confirm - name: Update deployment status to Success if: ${{ inputs.release_type != 'Dry Run' && success() }} diff --git a/Cargo.lock b/Cargo.lock index 9bfdbe70c..a1a9bcd23 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -367,6 +367,7 @@ dependencies = [ "bitwarden-core", "bitwarden-crypto", "bitwarden-exporters", + "bitwarden-fido", "bitwarden-generators", "bitwarden-send", "bitwarden-sm", diff --git a/crates/bitwarden/Cargo.toml b/crates/bitwarden/Cargo.toml index 31d84b877..f927564cf 100644 --- a/crates/bitwarden/Cargo.toml +++ b/crates/bitwarden/Cargo.toml @@ -30,8 +30,7 @@ uniffi = [ "bitwarden-core/uniffi", "bitwarden-crypto/uniffi", "bitwarden-exporters/uniffi", - # PR #1072 - # "bitwarden-fido/uniffi", + "bitwarden-fido/uniffi", "bitwarden-generators/uniffi", "bitwarden-send/uniffi", "bitwarden-vault/uniffi", @@ -44,8 +43,7 @@ bitwarden-api-identity = { workspace = true } bitwarden-core = { workspace = true } bitwarden-crypto = { workspace = true } bitwarden-exporters = { workspace = true, optional = true } -# PR #1072 -# bitwarden-fido = { workspace = true, optional = true } +bitwarden-fido = { workspace = true, optional = true } bitwarden-generators = { workspace = true, optional = true } bitwarden-send = { workspace = true, optional = true } bitwarden-sm = { workspace = true, optional = true } diff --git a/crates/bitwarden/src/error.rs b/crates/bitwarden/src/error.rs index a6f6c09de..06ef09648 100644 --- a/crates/bitwarden/src/error.rs +++ b/crates/bitwarden/src/error.rs @@ -37,8 +37,6 @@ pub enum Error { ExportError(#[from] ExportError), // Fido - /* - # PR #1072 #[cfg(all(feature = "uniffi", feature = "internal"))] #[error(transparent)] MakeCredential(#[from] bitwarden_fido::MakeCredentialError), @@ -59,7 +57,7 @@ pub enum Error { #[cfg(all(feature = "uniffi", feature = "internal"))] #[error(transparent)] Fido2Client(#[from] bitwarden_fido::Fido2ClientError), - */ + #[error("Internal error: {0}")] Internal(Cow<'static, str>), } diff --git a/crates/bitwarden/src/lib.rs b/crates/bitwarden/src/lib.rs index 5751c313b..c87693ce7 100644 --- a/crates/bitwarden/src/lib.rs +++ b/crates/bitwarden/src/lib.rs @@ -79,18 +79,10 @@ pub mod internal { pub use bitwarden_vault::*; } - /* - PM-12431 - # PR #1072 - - Temporarily un-export bitwarden_fido, as bitwarden_fido - is not ready for release yet. This will unblock the - 1.0 releases. - */ - // #[cfg(feature = "uniffi")] - // pub mod fido { - // pub use bitwarden_fido::*; - // } + #[cfg(feature = "uniffi")] + pub mod fido { + pub use bitwarden_fido::*; + } } #[cfg(feature = "internal")] pub use internal::*; From 2d1c6872eaac4405bf74efa011156a5d49a0bff3 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Thu, 26 Sep 2024 19:12:43 +0200 Subject: [PATCH 54/77] Add links to documentation (#1085) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 📔 Objective Add links to documentation. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 497af6547..14ca1f667 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,19 @@ To build, you will need the following in your PATH: - We recommend installing this via the [Visual Studio Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022) +## Documentation + +Please refer to our [Contributing Docs](https://contributing.bitwarden.com/) for +[getting started](https://contributing.bitwarden.com/getting-started/sdk/) instructions and +[architectural documentation](https://contributing.bitwarden.com/architecture/sdk/). + +You can also browse the latest published documentation: + +- [docs.rs](https://docs.rs/bitwarden/latest/bitwarden/) for the public SDK. +- Or for developers of the SDK, view the internal + [API documentation](https://sdk-api-docs.bitwarden.com/bitwarden/index.html) which includes + private items. + ## Crates The project is structured as a monorepo using cargo workspaces. Some of the more noteworthy crates From 42b536a1af65e3877e811c1420fa93055261ce32 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Fri, 27 Sep 2024 08:56:01 -0400 Subject: [PATCH 55/77] BRE-345 - Update Java workflows (#1087) --- .github/workflows/build-java.yml | 24 ++++++++++++++++++-- .github/workflows/publish-java.yml | 36 +++++++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-java.yml b/.github/workflows/build-java.yml index 7f5713087..98880e52b 100644 --- a/.github/workflows/build-java.yml +++ b/.github/workflows/build-java.yml @@ -1,11 +1,10 @@ +--- name: Build Java SDK on: push: branches: - main - - rc - - hotfix-rc pull_request: workflow_dispatch: @@ -66,3 +65,24 @@ jobs: - name: Build Maven run: ./gradlew build working-directory: languages/java + + - name: Upload Java SDK Build + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: build + path: ${{ github.workspace }}/languages/java/build + if-no-files-found: error + + - name: Upload Java SDK Build + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: resources + path: ${{ github.workspace }}/languages/java/src/main/resources + if-no-files-found: error + + - name: Upload Java SDK Build + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: schemas + path: languages/java/src/main/java/bit/sdk/schema + if-no-files-found: error diff --git a/.github/workflows/publish-java.yml b/.github/workflows/publish-java.yml index 2daeffe5a..65e0b0abe 100644 --- a/.github/workflows/publish-java.yml +++ b/.github/workflows/publish-java.yml @@ -1,3 +1,4 @@ +--- name: Publish Java SDK run-name: Publish Java SDK ${{ inputs.release_type }} @@ -13,6 +14,11 @@ on: - Release - Dry Run +defaults: + run: + shell: bash + working-directory: languages/java + env: _KEY_VAULT: "bitwarden-ci" @@ -29,9 +35,9 @@ jobs: - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} run: | - if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then echo "===================================" - echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" + echo "[!] Can only release from the 'main' branch" echo "===================================" exit 1 fi @@ -39,7 +45,7 @@ jobs: - name: Get version id: version run: | - VERSION=$(cat languages/java/build.gradle | grep -Eo 'version = "[0-9]+\.[0-9]+\.[0-9]+"' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') + VERSION=$(cat build.gradle | grep -Eo 'version = "[0-9]+\.[0-9]+\.[0-9]+"' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') echo "version=$VERSION" >> $GITHUB_OUTPUT publish: @@ -72,6 +78,30 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0 + - name: Download Java SDK Build + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-java.yml + workflow_conclusion: success + artifacts: build + path: languages/java/build + + - name: Download Java Resources + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-java.yml + workflow_conclusion: success + artifacts: resources + path: languages/java/src/main/resources + + - name: Download Java Resources + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-java.yml + workflow_conclusion: success + artifacts: schemas + path: languages/java/src/main/java/bit/sdk/schema + - name: Publish package to GitHub Packages if: ${{ inputs.release_type != 'Dry Run' }} run: ./gradlew publish From 90f8a5461e5e7ed07b1f5a13fc2fb793994a6fb5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 10:36:55 +0200 Subject: [PATCH 56/77] [deps]: Lock file maintenance (#1099) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Update | Change | |---|---| | lockFileMaintenance | All locks refreshed | 🔧 This Pull Request updates lock files to use the latest dependency versions. --- ### Configuration 📅 **Schedule**: Branch creation - "every 2nd week starting on the 2 week of the year before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. đŸ‘ģ **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/bitwarden/sdk). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 179 +++++++++------------- languages/js/sdk-client/package-lock.json | 12 +- package-lock.json | 12 +- 3 files changed, 82 insertions(+), 121 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a1a9bcd23..27eddfa65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -188,7 +188,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -231,13 +231,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.82" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -248,9 +248,9 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" @@ -845,9 +845,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.21" +version = "1.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" +checksum = "9540e661f81799159abee814118cc139a2004b3a3aa3ea37724a1b66530b90e0" dependencies = [ "shlex", ] @@ -957,7 +957,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1300,7 +1300,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" dependencies = [ "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1324,7 +1324,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1335,7 +1335,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1414,7 +1414,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1424,7 +1424,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4abae7035bf79b9877b779505d8cf3749285b80c43941eda66604841889451dc" dependencies = [ "derive_builder_core", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1602,9 +1602,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" dependencies = [ "crc32fast", "miniz_oxide 0.8.0", @@ -1690,7 +1690,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2002,9 +2002,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" dependencies = [ "bytes", "futures-channel", @@ -2015,7 +2015,6 @@ dependencies = [ "pin-project-lite", "socket2", "tokio", - "tower", "tower-service", "tracing", ] @@ -2213,9 +2212,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.158" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libloading" @@ -2397,7 +2396,7 @@ dependencies = [ "napi-derive-backend", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2412,7 +2411,7 @@ dependencies = [ "quote", "regex", "semver", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2536,9 +2535,12 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" +dependencies = [ + "portable-atomic", +] [[package]] name = "onig" @@ -2746,26 +2748,6 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - [[package]] name = "pin-project-lite" version = "0.2.14" @@ -2854,9 +2836,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d30538d42559de6b034bc76fd6dd4c38961b1ee5c6c56e3808c50128fdbc22ce" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" [[package]] name = "powerfmt" @@ -2978,7 +2960,7 @@ dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2991,7 +2973,7 @@ dependencies = [ "proc-macro2", "pyo3-build-config", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3112,9 +3094,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" +checksum = "355ae415ccd3a04315d3f8246e86d67689ea74d88d915576e1589a351062a13b" dependencies = [ "bitflags 2.6.0", ] @@ -3132,9 +3114,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", @@ -3144,9 +3126,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", @@ -3155,9 +3137,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" @@ -3326,9 +3308,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" [[package]] name = "rustls-platform-verifier" @@ -3422,7 +3404,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3454,7 +3436,7 @@ checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3535,7 +3517,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3546,7 +3528,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3581,14 +3563,14 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "serde_spanned" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -3632,7 +3614,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3831,7 +3813,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3844,7 +3826,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3874,9 +3856,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -3920,9 +3902,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand", @@ -3957,7 +3939,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -4050,7 +4032,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -4109,9 +4091,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.21" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b072cee73c449a636ffd6f32bd8de3a9f7119139aff882f44943ce2986dc5cf" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap 2.5.0", "serde", @@ -4120,27 +4102,6 @@ dependencies = [ "winnow", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - [[package]] name = "tower-service" version = "0.3.3" @@ -4306,7 +4267,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a22dbe67c1c957ac6e7611bdf605a6218aa86b0eebeb8be58b70ae85ad7d73dc" dependencies = [ "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -4338,7 +4299,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.77", + "syn 2.0.79", "toml 0.5.11", "uniffi_meta", ] @@ -4453,7 +4414,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -4517,7 +4478,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-shared", ] @@ -4551,7 +4512,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4585,7 +4546,7 @@ checksum = "4b8220be1fa9e4c889b30fd207d4906657e7e90b12e0e6b0c8b8d8709f5de021" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -4848,9 +4809,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -4903,7 +4864,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -4924,7 +4885,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] diff --git a/languages/js/sdk-client/package-lock.json b/languages/js/sdk-client/package-lock.json index ab7809936..f5b6f590b 100644 --- a/languages/js/sdk-client/package-lock.json +++ b/languages/js/sdk-client/package-lock.json @@ -30,9 +30,9 @@ } }, "node_modules/@types/node": { - "version": "20.16.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.6.tgz", - "integrity": "sha512-T7PpxM/6yeDE+AdlVysT62BX6/bECZOmQAgiFg5NoBd5MQheZ3tzal7f1wvzfiEcmrcJNRi2zRr2nY2zF+0uqw==", + "version": "20.16.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.10.tgz", + "integrity": "sha512-vQUKgWTjEIRFCvK6CyriPH3MZYiYlNy0fKiEYHWbcoWLEgs4opurGGKlebrTLqdSMIbXImH6XExNiIyNUv3WpA==", "dev": true, "license": "MIT", "dependencies": { @@ -242,9 +242,9 @@ } }, "node_modules/package-json-from-dist": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", - "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", "dev": true, "license": "BlueOak-1.0.0" }, diff --git a/package-lock.json b/package-lock.json index 59b48116d..9ceb5ffed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -359,9 +359,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.6.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.6.1.tgz", - "integrity": "sha512-V48tCfcKb/e6cVUigLAaJDAILdMP0fUW6BidkPK4GpGjXcfbnoHasCZDwz3N3yVt5we2RHm4XTQCpv0KJz9zqw==", + "version": "22.7.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.4.tgz", + "integrity": "sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==", "dev": true, "license": "MIT", "peer": true, @@ -1573,9 +1573,9 @@ } }, "node_modules/package-json-from-dist": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", - "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", "dev": true, "license": "BlueOak-1.0.0" }, From 2868f26058ddce9709bed2a8f31b967475dd80e4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:44:51 +0200 Subject: [PATCH 57/77] [deps]: Update gh minor (#1097) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://redirect.github.com/actions/checkout) | action | minor | `v4.1.7` -> `v4.2.0` | | [docker/build-push-action](https://redirect.github.com/docker/build-push-action) | action | minor | `v6.7.0` -> `v6.8.0` | | [github/codeql-action](https://redirect.github.com/github/codeql-action) | action | patch | `v3.26.8` -> `v3.26.9` | | [goto-bus-stop/setup-zig](https://redirect.github.com/goto-bus-stop/setup-zig) | action | patch | `v2.2.0` -> `v2.2.1` | | [ruby/setup-ruby](https://redirect.github.com/ruby/setup-ruby) | action | minor | `v1.193.0` -> `v1.194.0` | --- ### Release Notes
actions/checkout (actions/checkout) ### [`v4.2.0`](https://redirect.github.com/actions/checkout/blob/HEAD/CHANGELOG.md#v420) [Compare Source](https://redirect.github.com/actions/checkout/compare/v4.1.7...v4.2.0) - Add Ref and Commit outputs by [@​lucacome](https://redirect.github.com/lucacome) in [https://github.com/actions/checkout/pull/1180](https://redirect.github.com/actions/checkout/pull/1180) - Dependency updates by [@​dependabot-](https://redirect.github.com/dependabot-) [https://github.com/actions/checkout/pull/1777](https://redirect.github.com/actions/checkout/pull/1777), [https://github.com/actions/checkout/pull/1872](https://redirect.github.com/actions/checkout/pull/1872)
docker/build-push-action (docker/build-push-action) ### [`v6.8.0`](https://redirect.github.com/docker/build-push-action/releases/tag/v6.8.0) [Compare Source](https://redirect.github.com/docker/build-push-action/compare/v6.7.0...v6.8.0) - Bump [@​docker/actions-toolkit](https://redirect.github.com/docker/actions-toolkit) from 0.37.1 to 0.38.0 in [https://github.com/docker/build-push-action/pull/1230](https://redirect.github.com/docker/build-push-action/pull/1230) **Full Changelog**: https://github.com/docker/build-push-action/compare/v6.7.0...v6.8.0
github/codeql-action (github/codeql-action) ### [`v3.26.9`](https://redirect.github.com/github/codeql-action/compare/v3.26.8...v3.26.9) [Compare Source](https://redirect.github.com/github/codeql-action/compare/v3.26.8...v3.26.9)
goto-bus-stop/setup-zig (goto-bus-stop/setup-zig) ### [`v2.2.1`](https://redirect.github.com/goto-bus-stop/setup-zig/releases/tag/v2.2.1) [Compare Source](https://redirect.github.com/goto-bus-stop/setup-zig/compare/v2.2.0...v2.2.1) This will be the final release in this repository. Please see [#​88](https://redirect.github.com/goto-bus-stop/setup-zig/issues/88) for an upgrade guide. Thanks for using setup-zig! - Fix Apple Silicon. [#​68](https://redirect.github.com/goto-bus-stop/setup-zig/pull/68) - Deprecate in favour of [mlugg/setup-zig](https://redirect.github.com/mlugg/setup-zig). [#​89](https://redirect.github.com/goto-bus-stop/setup-zig/pull/89) Thanks [@​davidgm94](https://redirect.github.com/davidgm94) and [@​mlugg](https://redirect.github.com/mlugg)!
ruby/setup-ruby (ruby/setup-ruby) ### [`v1.194.0`](https://redirect.github.com/ruby/setup-ruby/releases/tag/v1.194.0) [Compare Source](https://redirect.github.com/ruby/setup-ruby/compare/v1.193.0...v1.194.0) **Full Changelog**: https://github.com/ruby/setup-ruby/compare/v1.193.0...v1.194.0
--- ### Configuration 📅 **Schedule**: Branch creation - "every 2nd week starting on the 2 week of the year before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. đŸ‘ģ **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/bitwarden/sdk). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build-android.yml | 6 +++--- .github/workflows/build-cli-docker.yml | 4 ++-- .github/workflows/build-cli.yml | 16 ++++++++-------- .github/workflows/build-cpp.yml | 2 +- .github/workflows/build-dotnet.yml | 4 ++-- .github/workflows/build-go.yaml | 2 +- .github/workflows/build-java.yml | 2 +- .github/workflows/build-napi.yml | 2 +- .github/workflows/build-python-wheels.yml | 4 ++-- .github/workflows/build-rust-crates.yml | 4 ++-- .github/workflows/build-rust-cross-platform.yml | 4 ++-- .github/workflows/build-swift.yml | 4 ++-- .github/workflows/build-wasm.yml | 2 +- .github/workflows/cloc.yml | 2 +- .github/workflows/direct-minimal-versions.yml | 2 +- .github/workflows/generate_schemas.yml | 2 +- .github/workflows/lint.yml | 4 ++-- .github/workflows/memory-testing.yml | 2 +- .github/workflows/minimum-rust-version.yml | 2 +- .github/workflows/publish-dotnet.yml | 2 +- .github/workflows/publish-java.yml | 4 ++-- .github/workflows/publish-php.yml | 10 +++++----- .github/workflows/publish-python.yml | 2 +- .github/workflows/publish-ruby.yml | 4 ++-- .github/workflows/publish-rust-crates.yml | 2 +- .github/workflows/release-cli.yml | 8 ++++---- .github/workflows/release-cpp.yml | 2 +- .github/workflows/release-go.yml | 6 +++--- .github/workflows/release-napi.yml | 4 ++-- .github/workflows/release-swift.yml | 6 +++--- .github/workflows/release-wasm.yml | 4 ++-- .github/workflows/rust-test.yml | 6 +++--- .github/workflows/rustdoc.yml | 2 +- .github/workflows/scan.yml | 6 +++--- .github/workflows/version-bump.yml | 4 ++-- 35 files changed, 71 insertions(+), 71 deletions(-) diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index e94bfd7a9..7607d530d 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -25,7 +25,7 @@ jobs: - target: i686-linux-android steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable @@ -57,14 +57,14 @@ jobs: needs: build steps: - name: Checkout repo (PR) - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 if: github.event_name == 'pull_request' with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.ref }} - name: Checkout repo (Push) - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 if: github.event_name == 'push' with: fetch-depth: 0 diff --git a/.github/workflows/build-cli-docker.yml b/.github/workflows/build-cli-docker.yml index eaf2299ff..83daabf2d 100644 --- a/.github/workflows/build-cli-docker.yml +++ b/.github/workflows/build-cli-docker.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Check Branch to Publish id: publish-branch-check @@ -87,7 +87,7 @@ jobs: fi - name: Build and push Docker image - uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0 + uses: docker/build-push-action@32945a339266b759abcbdc89316275140b0fc960 # v6.8.0 with: context: . file: crates/bws/Dockerfile diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 355575716..9ffb3bdea 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -21,7 +21,7 @@ jobs: sign: ${{ steps.sign.outputs.sign }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Get Package Version id: retrieve-version @@ -56,7 +56,7 @@ jobs: target: aarch64-pc-windows-msvc steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable @@ -145,7 +145,7 @@ jobs: steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable @@ -259,7 +259,7 @@ jobs: target: aarch64-unknown-linux-gnu steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable @@ -268,7 +268,7 @@ jobs: targets: ${{ matrix.settings.target }} - name: Set up Zig - uses: goto-bus-stop/setup-zig@7ab2955eb728f5440978d5824358023be3a2802d # v2.2.0 + uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1 with: version: 0.12.0 @@ -305,7 +305,7 @@ jobs: _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Download x86_64-apple-darwin artifact uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 @@ -407,7 +407,7 @@ jobs: - setup steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable @@ -441,7 +441,7 @@ jobs: needs: setup steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable diff --git a/.github/workflows/build-cpp.yml b/.github/workflows/build-cpp.yml index 606cefdee..01222aac9 100644 --- a/.github/workflows/build-cpp.yml +++ b/.github/workflows/build-cpp.yml @@ -41,7 +41,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: install dependencies linux if: runner.os == 'Linux' diff --git a/.github/workflows/build-dotnet.yml b/.github/workflows/build-dotnet.yml index 97d43dfbe..bb5d56b6b 100644 --- a/.github/workflows/build-dotnet.yml +++ b/.github/workflows/build-dotnet.yml @@ -23,7 +23,7 @@ jobs: version: ${{ steps.version.outputs.version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install xmllint run: sudo apt-get install -y libxml2-utils @@ -44,7 +44,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Download C# schemas artifact uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 diff --git a/.github/workflows/build-go.yaml b/.github/workflows/build-go.yaml index 4ad7d0345..ffb4d6693 100644 --- a/.github/workflows/build-go.yaml +++ b/.github/workflows/build-go.yaml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup Go environment uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 diff --git a/.github/workflows/build-java.yml b/.github/workflows/build-java.yml index 98880e52b..6994a5a61 100644 --- a/.github/workflows/build-java.yml +++ b/.github/workflows/build-java.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Download Java schemas artifact uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 diff --git a/.github/workflows/build-napi.yml b/.github/workflows/build-napi.yml index a7d8f7bca..41ed1d17d 100644 --- a/.github/workflows/build-napi.yml +++ b/.github/workflows/build-napi.yml @@ -51,7 +51,7 @@ jobs: strip *.node steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup Node uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 diff --git a/.github/workflows/build-python-wheels.yml b/.github/workflows/build-python-wheels.yml index ed07bbb94..b39195679 100644 --- a/.github/workflows/build-python-wheels.yml +++ b/.github/workflows/build-python-wheels.yml @@ -26,7 +26,7 @@ jobs: package_version: ${{ steps.retrieve-version.outputs.package_version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Get Package Version id: retrieve-version @@ -63,7 +63,7 @@ jobs: steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup Node uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 diff --git a/.github/workflows/build-rust-crates.yml b/.github/workflows/build-rust-crates.yml index b7d0832fb..d4116bcf9 100644 --- a/.github/workflows/build-rust-crates.yml +++ b/.github/workflows/build-rust-crates.yml @@ -34,7 +34,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable @@ -62,7 +62,7 @@ jobs: needs: build steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index 7c567135b..fab7df991 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -38,7 +38,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable @@ -48,7 +48,7 @@ jobs: - name: Cache cargo registry uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - - uses: goto-bus-stop/setup-zig@7ab2955eb728f5440978d5824358023be3a2802d # v2.2.0 + - uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1 if: ${{ contains(matrix.settings.target, 'musl') }} with: version: 0.12.0 diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 22da084ed..372241348 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -17,7 +17,7 @@ jobs: package_version: ${{ steps.retrieve-version.outputs.package_version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Get Package Version id: retrieve-version @@ -33,7 +33,7 @@ jobs: _VERSION: ${{ needs.version.outputs.package_version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable diff --git a/.github/workflows/build-wasm.yml b/.github/workflows/build-wasm.yml index 996ff0ade..35c0ca6b6 100644 --- a/.github/workflows/build-wasm.yml +++ b/.github/workflows/build-wasm.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup Node uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 diff --git a/.github/workflows/cloc.yml b/.github/workflows/cloc.yml index 120aeb511..644dc0bfd 100644 --- a/.github/workflows/cloc.yml +++ b/.github/workflows/cloc.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Set up cloc run: | diff --git a/.github/workflows/direct-minimal-versions.yml b/.github/workflows/direct-minimal-versions.yml index 3cfec8a48..22feb04cf 100644 --- a/.github/workflows/direct-minimal-versions.yml +++ b/.github/workflows/direct-minimal-versions.yml @@ -36,7 +36,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable diff --git a/.github/workflows/generate_schemas.yml b/.github/workflows/generate_schemas.yml index c1db37d5d..434174c7b 100644 --- a/.github/workflows/generate_schemas.yml +++ b/.github/workflows/generate_schemas.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 951c8fcba..a12e263c4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable @@ -45,7 +45,7 @@ jobs: RUSTFLAGS: "-D warnings" - name: Upload Clippy results to GitHub - uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 + uses: github/codeql-action/upload-sarif@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9 with: sarif_file: clippy_result.sarif diff --git a/.github/workflows/memory-testing.yml b/.github/workflows/memory-testing.yml index a9635bc68..41b158536 100644 --- a/.github/workflows/memory-testing.yml +++ b/.github/workflows/memory-testing.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Check out repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Set up gdb run: | diff --git a/.github/workflows/minimum-rust-version.yml b/.github/workflows/minimum-rust-version.yml index 19b81de63..fa95eb0bb 100644 --- a/.github/workflows/minimum-rust-version.yml +++ b/.github/workflows/minimum-rust-version.yml @@ -27,7 +27,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable diff --git a/.github/workflows/publish-dotnet.yml b/.github/workflows/publish-dotnet.yml index 1c4cf5840..28a57e683 100644 --- a/.github/workflows/publish-dotnet.yml +++ b/.github/workflows/publish-dotnet.yml @@ -24,7 +24,7 @@ jobs: version: ${{ steps.version.outputs.version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} diff --git a/.github/workflows/publish-java.yml b/.github/workflows/publish-java.yml index 65e0b0abe..98f6fadd2 100644 --- a/.github/workflows/publish-java.yml +++ b/.github/workflows/publish-java.yml @@ -30,7 +30,7 @@ jobs: version: ${{ steps.version.outputs.version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} @@ -54,7 +54,7 @@ jobs: needs: validate steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Azure login uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 diff --git a/.github/workflows/publish-php.yml b/.github/workflows/publish-php.yml index 74939ec58..986923ab5 100644 --- a/.github/workflows/publish-php.yml +++ b/.github/workflows/publish-php.yml @@ -25,7 +25,7 @@ jobs: version: ${{ steps.version.outputs.version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} @@ -48,7 +48,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup PHP with PECL extension uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # 2.31.1 @@ -76,7 +76,7 @@ jobs: _PKG_VERSION: ${{ needs.validate.outputs.version }} steps: - name: Checkout SDK repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: sdk @@ -93,7 +93,7 @@ jobs: secrets: "github-pat-bitwarden-devops-bot-repo-scope" - name: Checkout SDK-PHP repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: bitwarden/sm-sdk-php path: sm-sdk-php @@ -255,7 +255,7 @@ jobs: packagist-key" - name: Checkout SDK-PHP repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: bitwarden/sm-sdk-php path: sm-sdk-php diff --git a/.github/workflows/publish-python.yml b/.github/workflows/publish-python.yml index ef30d6598..dcbfee22f 100644 --- a/.github/workflows/publish-python.yml +++ b/.github/workflows/publish-python.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} diff --git a/.github/workflows/publish-ruby.yml b/.github/workflows/publish-ruby.yml index c372a476d..6184586a1 100644 --- a/.github/workflows/publish-ruby.yml +++ b/.github/workflows/publish-ruby.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} @@ -36,7 +36,7 @@ jobs: fi - name: Set up Ruby - uses: ruby/setup-ruby@f321cf5a4d1533575411f8752cf25b86478b0442 # v1.193.0 + uses: ruby/setup-ruby@c04af2bb7258bb6a03df1d3c1865998ac9390972 # v1.194.0 with: ruby-version: 3.2 diff --git a/.github/workflows/publish-rust-crates.yml b/.github/workflows/publish-rust-crates.yml index bdb39d9b7..a614608f9 100644 --- a/.github/workflows/publish-rust-crates.yml +++ b/.github/workflows/publish-rust-crates.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 80c09142e..30f0dfd93 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -25,7 +25,7 @@ jobs: release-version: ${{ steps.version.outputs.version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} @@ -112,7 +112,7 @@ jobs: needs: setup steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Login to Azure uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 @@ -150,7 +150,7 @@ jobs: needs: setup steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Generate tag list id: tag-list @@ -201,7 +201,7 @@ jobs: azure-keyvault-name: "bitwarden-ci" - name: Build and push Docker image - uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0 + uses: docker/build-push-action@32945a339266b759abcbdc89316275140b0fc960 # v6.8.0 with: context: . file: crates/bws/Dockerfile diff --git a/.github/workflows/release-cpp.yml b/.github/workflows/release-cpp.yml index c96b8e088..aa4d37f62 100644 --- a/.github/workflows/release-cpp.yml +++ b/.github/workflows/release-cpp.yml @@ -24,7 +24,7 @@ jobs: version: ${{ steps.version.outputs.version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 2c2aea4e4..f88e52af5 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -26,7 +26,7 @@ jobs: version: ${{ steps.version.outputs.version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} @@ -55,7 +55,7 @@ jobs: steps: - name: Checkout SDK repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: sdk @@ -72,7 +72,7 @@ jobs: secrets: "github-pat-bitwarden-devops-bot-repo-scope" - name: Checkout SDK-Go repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: bitwarden/sdk-go path: sdk-go diff --git a/.github/workflows/release-napi.yml b/.github/workflows/release-napi.yml index fc4eaa367..fb99cc1cf 100644 --- a/.github/workflows/release-napi.yml +++ b/.github/workflows/release-napi.yml @@ -33,7 +33,7 @@ jobs: release-version: ${{ steps.version.outputs.version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Branch check if: ${{ github.event.inputs.release_type != 'Dry Run' }} @@ -90,7 +90,7 @@ jobs: _PKG_VERSION: ${{ needs.setup.outputs.release-version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup Node uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index a9ab213a6..351581a7a 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -42,7 +42,7 @@ jobs: swift_checksum: ${{ steps.calculate-swift-checksum.outputs.checksum }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Get version id: version @@ -114,7 +114,7 @@ jobs: _BUILD_RUN_ID: ${{ needs.validate.outputs.run_id }} steps: - name: Checkout SDK repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: path: sdk @@ -142,7 +142,7 @@ jobs: github-pat-bitwarden-devops-bot-repo-scope" - name: Checkout SDK-Swift repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: repository: bitwarden/sdk-swift path: sdk-swift diff --git a/.github/workflows/release-wasm.yml b/.github/workflows/release-wasm.yml index dac64a6ce..b6476e833 100644 --- a/.github/workflows/release-wasm.yml +++ b/.github/workflows/release-wasm.yml @@ -32,7 +32,7 @@ jobs: release-version: ${{ steps.version.outputs.version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Branch check if: ${{ github.event.inputs.release_type != 'Dry Run' }} @@ -89,7 +89,7 @@ jobs: _PKG_VERSION: ${{ needs.setup.outputs.release-version }} steps: - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Setup Node uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 diff --git a/.github/workflows/rust-test.yml b/.github/workflows/rust-test.yml index 3d9ed6f00..5e7703e84 100644 --- a/.github/workflows/rust-test.yml +++ b/.github/workflows/rust-test.yml @@ -34,7 +34,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable @@ -54,7 +54,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable @@ -83,7 +83,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable diff --git a/.github/workflows/rustdoc.yml b/.github/workflows/rustdoc.yml index a2a07490c..45ab6d07d 100644 --- a/.github/workflows/rustdoc.yml +++ b/.github/workflows/rustdoc.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Install rust uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml index 364298f98..193c9fcf6 100644 --- a/.github/workflows/scan.yml +++ b/.github/workflows/scan.yml @@ -26,7 +26,7 @@ jobs: steps: - name: Check out repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: ref: ${{ github.event.pull_request.head.sha }} @@ -46,7 +46,7 @@ jobs: --output-path . ${{ env.INCREMENTAL }} - name: Upload Checkmarx results to GitHub - uses: github/codeql-action/upload-sarif@294a9d92911152fe08befb9ec03e240add280cb3 # v3.26.8 + uses: github/codeql-action/upload-sarif@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3.26.9 with: sarif_file: cx_result.sarif @@ -60,7 +60,7 @@ jobs: steps: - name: Check out repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index 8357d49bd..7053181eb 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -59,7 +59,7 @@ jobs: github-pat-bitwarden-devops-bot-repo-scope" - name: Checkout Branch - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: ref: main repository: bitwarden/sdk @@ -236,7 +236,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout Branch - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 with: ref: main From a6fd484c31aead9f8bbdc0576cc2be3a069c9891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ch=C4=99ci=C5=84ski?= Date: Mon, 30 Sep 2024 15:12:34 +0200 Subject: [PATCH 58/77] [BRE-224] Create a GitHub release workflows for sdk (#1078) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/BRE-224 ## 📔 Objective Create and/or split workflow to create a GitHub Release for SDK parts. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --------- Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> --- .github/workflows/build-ruby.yml | 95 +++++++++++ .../{release-cli.yml => publish-bws.yml} | 116 +++++++------ .github/workflows/publish-dotnet.yml | 69 ++++++-- .github/workflows/publish-java.yml | 27 ++- .github/workflows/publish-napi.yml | 155 ++++++++++++++++++ .github/workflows/publish-python.yml | 55 +++++-- .github/workflows/publish-ruby.yml | 130 +++++++-------- .github/workflows/publish-rust-crates.yml | 38 ++++- .github/workflows/publish-wasm.yml | 138 ++++++++++++++++ .github/workflows/release-bws.yml | 77 +++++++++ .github/workflows/release-cpp.yml | 8 +- .github/workflows/release-dotnet.yml | 76 +++++++++ .github/workflows/release-java.yml | 61 +++++++ .github/workflows/release-napi.yml | 142 ++++------------ .github/workflows/release-python.yml | 74 +++++++++ .github/workflows/release-ruby.yml | 71 ++++++++ .github/workflows/release-rust-crates.yml | 53 ++++++ .github/workflows/release-wasm.yml | 96 +++-------- 18 files changed, 1128 insertions(+), 353 deletions(-) create mode 100644 .github/workflows/build-ruby.yml rename .github/workflows/{release-cli.yml => publish-bws.yml} (72%) create mode 100644 .github/workflows/publish-napi.yml create mode 100644 .github/workflows/publish-wasm.yml create mode 100644 .github/workflows/release-bws.yml create mode 100644 .github/workflows/release-dotnet.yml create mode 100644 .github/workflows/release-java.yml create mode 100644 .github/workflows/release-python.yml create mode 100644 .github/workflows/release-ruby.yml create mode 100644 .github/workflows/release-rust-crates.yml diff --git a/.github/workflows/build-ruby.yml b/.github/workflows/build-ruby.yml new file mode 100644 index 000000000..5a3f1a016 --- /dev/null +++ b/.github/workflows/build-ruby.yml @@ -0,0 +1,95 @@ +--- +name: Build Ruby + +on: + pull_request: + push: + branches: + - "main" + workflow_dispatch: + +jobs: + build: + name: Build Ruby + runs-on: ubuntu-22.04 + steps: + - name: Checkout Repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Set up Ruby + uses: ruby/setup-ruby@52753b7da854d5c07df37391a986c76ab4615999 # v1.191.0 + with: + ruby-version: 3.2 + + - name: Download artifacts + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: generate_schemas.yml + path: languages/ruby/bitwarden_sdk_secrets/lib + workflow_conclusion: success + branch: ${{ github.ref_name }} + artifacts: schemas.rb + + - name: Download x86_64-apple-darwin artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + path: temp/macos-x64 + workflow_conclusion: success + branch: ${{ github.ref_name }} + artifacts: libbitwarden_c_files-x86_64-apple-darwin + + - name: Download aarch64-apple-darwin artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + workflow_conclusion: success + branch: ${{ github.ref_name }} + artifacts: libbitwarden_c_files-aarch64-apple-darwin + path: temp/macos-arm64 + + - name: Download x86_64-unknown-linux-gnu artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + workflow_conclusion: success + branch: ${{ github.ref_name }} + artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu + path: temp/linux-x64 + + - name: Download x86_64-pc-windows-msvc artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-rust-cross-platform.yml + workflow_conclusion: success + branch: ${{ github.ref_name }} + artifacts: libbitwarden_c_files-x86_64-pc-windows-msvc + path: temp/windows-x64 + + - name: Copy lib files + run: | + mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/macos-arm64 + mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/linux-x64 + mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/macos-x64 + mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/windows-x64 + + platforms=("macos-arm64" "linux-x64" "macos-x64" "windows-x64") + files=("libbitwarden_c.dylib" "libbitwarden_c.so" "libbitwarden_c.dylib" "bitwarden_c.dll") + + for ((i=0; i<${#platforms[@]}; i++)); do + cp "temp/${platforms[$i]}/${files[$i]}" "languages/ruby/bitwarden_sdk_secrets/lib/${platforms[$i]}/${files[$i]}" + done + + - name: bundle install + run: bundle install + working-directory: languages/ruby/bitwarden_sdk_secrets + + - name: Build gem + run: gem build bitwarden-sdk-secrets.gemspec + working-directory: languages/ruby/bitwarden_sdk_secrets + + - name: Upload artifact + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + path: bitwarden-sdk-secrets-*.gem + name: bitwarden-sdk-secrets diff --git a/.github/workflows/release-cli.yml b/.github/workflows/publish-bws.yml similarity index 72% rename from .github/workflows/release-cli.yml rename to .github/workflows/publish-bws.yml index 30f0dfd93..506427faa 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/publish-bws.yml @@ -1,6 +1,6 @@ --- -name: Release CLI -run-name: Release CLI ${{ inputs.release_type }} +name: Publish bws CLI +run-name: Publish bws CLI ${{ inputs.release_type }} on: workflow_dispatch: @@ -13,6 +13,11 @@ on: options: - Release - Dry Run + version: + description: 'Version to publish (default: latest bws cli release)' + required: true + type: string + default: latest env: _AZ_REGISTRY: bitwardenprod.azurecr.io @@ -22,7 +27,9 @@ jobs: name: Setup runs-on: ubuntu-22.04 outputs: - release-version: ${{ steps.version.outputs.version }} + release-version: ${{ steps.version-output.outputs.version }} + release-tag: ${{ steps.version-output.outputs.tag_name }} + deployment-id: ${{ steps.deployment.outputs.deployment_id }} steps: - name: Checkout repo uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 @@ -37,11 +44,21 @@ jobs: exit 1 fi - - name: Check Release Version - id: version + - name: Version output + id: version-output run: | - VERSION=$(grep -o '^version = ".*"' crates/bws/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") - echo "version=$VERSION" >> $GITHUB_OUTPUT + if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then + TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("bws")) | .tag_name' | head -1) + VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') + echo "Latest Released Version: $VERSION" + echo "version=$VERSION" >> $GITHUB_OUTPUT + + echo "Latest Released Tag name: $TAG_NAME" + echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT + else + echo "Release Version: ${{ inputs.version }}" + echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT + fi - name: Create GitHub deployment if: ${{ inputs.release_type != 'Dry Run' }} @@ -50,66 +67,18 @@ jobs: with: token: "${{ secrets.GITHUB_TOKEN }}" initial-status: "in_progress" - environment: "CLI - Production" - description: "Deployment ${{ steps.version.outputs.version }} from branch ${{ github.ref_name }}" + environment: "bws CLI - Production" + description: "Deployment ${{ steps.version-output.outputs.version }} from branch ${{ github.ref_name }}" task: release - - name: Download all Release artifacts - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-cli.yml - path: packages - workflow_conclusion: success - branch: ${{ github.ref_name }} - - - name: Get checksum files - uses: bitwarden/gh-actions/get-checksum@main - with: - packages_dir: "packages" - file_path: "packages/bws-sha256-checksums-${{ steps.version.outputs.version }}.txt" - - - name: Create release - if: ${{ inputs.release_type != 'Dry Run' }} - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 - env: - PKG_VERSION: ${{ steps.version.outputs.version }} - with: - artifacts: "packages/bws-x86_64-apple-darwin-${{ env.PKG_VERSION }}.zip, - packages/bws-aarch64-apple-darwin-${{ env.PKG_VERSION }}.zip, - packages/bws-macos-universal-${{ env.PKG_VERSION }}.zip, - packages/bws-x86_64-pc-windows-msvc-${{ env.PKG_VERSION }}.zip, - packages/bws-aarch64-pc-windows-msvc-${{ env.PKG_VERSION }}.zip, - packages/bws-x86_64-unknown-linux-gnu-${{ env.PKG_VERSION }}.zip, - packages/bws-aarch64-unknown-linux-gnu-${{ env.PKG_VERSION }}.zip, - packages/THIRDPARTY.html, - packages/bws-sha256-checksums-${{ env.PKG_VERSION }}.txt" - commit: ${{ github.sha }} - tag: bws-v${{ env.PKG_VERSION }} - name: bws CLI v${{ env.PKG_VERSION }} - body: "" - token: ${{ secrets.GITHUB_TOKEN }} - draft: true - - - name: Update deployment status to Success - if: ${{ inputs.release_type != 'Dry Run' && success() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "success" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} - - - name: Update deployment status to Failure - if: ${{ inputs.release_type != 'Dry Run' && failure() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "failure" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} publish: name: Publish bws to crates.io runs-on: ubuntu-22.04 needs: setup + env: + _VERSION: ${{ needs.setup.outputs.release-version }} + _TAG_NAME: ${{ needs.setup.outputs.release-tag }} steps: - name: Checkout uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 @@ -118,6 +87,7 @@ jobs: uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 with: creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} + ref: ${{ env._TAG_NAME }} - name: Retrieve secrets id: retrieve-secrets @@ -151,6 +121,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + with: + ref: ${{ env._TAG_NAME }} - name: Generate tag list id: tag-list @@ -218,3 +190,27 @@ jobs: run: | docker logout echo "DOCKER_CONTENT_TRUST=0" >> $GITHUB_ENV + + update_release_status: + name: Update GitHub deployment status + runs-on: ubuntu-22.04 + needs: setup + if: ${{ inputs.release_type != 'Dry Run' }} + env: + _DEPLOYMENT_ID: ${{ needs.setup.outputs.deployment-id }} + steps: + - name: Update deployment status to Success + if: ${{ inputs.release_type != 'Dry Run' && success() }} + uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 + with: + token: "${{ secrets.GITHUB_TOKEN }}" + state: "success" + deployment-id: ${{ env._DEPLOYMENT_ID }} + + - name: Update deployment status to Failure + if: ${{ inputs.release_type != 'Dry Run' && failure() }} + uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 + with: + token: "${{ secrets.GITHUB_TOKEN }}" + state: "failure" + deployment-id: ${{ env._DEPLOYMENT_ID }} diff --git a/.github/workflows/publish-dotnet.yml b/.github/workflows/publish-dotnet.yml index 28a57e683..baafcc522 100644 --- a/.github/workflows/publish-dotnet.yml +++ b/.github/workflows/publish-dotnet.yml @@ -12,6 +12,10 @@ on: options: - Release - Dry Run + version: + description: "Release Version" + required: false + default: "latest" env: _KEY_VAULT: "bitwarden-ci" @@ -21,7 +25,7 @@ jobs: name: Setup runs-on: ubuntu-22.04 outputs: - version: ${{ steps.version.outputs.version }} + version: ${{ steps.version-output.outputs.version }} steps: - name: Checkout repo uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 @@ -29,35 +33,50 @@ jobs: - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} run: | - if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then echo "===================================" - echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" + echo "[!] Can only release from the 'main' branch" echo "===================================" exit 1 fi - - name: Install xmllint - run: sudo apt-get install -y libxml2-utils - - - name: Get version - id: version + - name: Version output + id: version-output run: | - VERSION=$(xmllint --xpath 'string(/Project/PropertyGroup/Version)' languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj) - echo "version=$VERSION" >> $GITHUB_OUTPUT + if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then + TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("dotnet")) | .tag_name' | head -1) + VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') + echo "Latest Released Version: $VERSION" + echo "version=$VERSION" >> $GITHUB_OUTPUT + + echo "Latest Released Tag name: $TAG_NAME" + echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT + else + echo "Release Version: ${{ inputs.version }}" + echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT + fi deploy: name: Deploy runs-on: ubuntu-22.04 needs: validate steps: - - name: Download NuGet package - uses: bitwarden/gh-actions/download-artifacts@main + - name: Create GitHub deployment + if: ${{ inputs.release_type != 'Dry Run' }} + uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 + id: deployment with: - workflow: build-dotnet.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: Bitwarden.Sdk.${{ needs.validate.outputs.version }}.nupkg - path: ./nuget-output + token: '${{ secrets.GITHUB_TOKEN }}' + initial-status: 'in_progress' + environment: 'dotnet - Production' + description: 'Deployment ${{ needs.validate.outputs.version }} from branch ${{ github.ref_name }}' + task: release + + - name: Download artifact + run: | + mkdir -p nuget-output + cd nuget-output + wget https://github.com/bitwarden/sdk/releases/download/dotnet-v${{ needs.validate.outputs.version }}/Bitwarden.Sdk.${{ needs.validate.outputs.version }}.nupkg - name: Login to Azure - Prod Subscription uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 @@ -76,3 +95,19 @@ jobs: env: NUGET_API_KEY: ${{ steps.retrieve-secrets.outputs.nuget-api-key }} run: dotnet nuget push ./nuget-output/*.nupkg -k ${{ env.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json + + - name: Update deployment status to Success + if: ${{ inputs.release_type != 'Dry Run' && success() }} + uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 + with: + token: '${{ secrets.GITHUB_TOKEN }}' + state: 'success' + deployment-id: ${{ steps.deployment.outputs.deployment_id }} + + - name: Update deployment status to Failure + if: ${{ inputs.release_type != 'Dry Run' && failure() }} + uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 + with: + token: '${{ secrets.GITHUB_TOKEN }}' + state: 'failure' + deployment-id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/.github/workflows/publish-java.yml b/.github/workflows/publish-java.yml index 98f6fadd2..002a61ee4 100644 --- a/.github/workflows/publish-java.yml +++ b/.github/workflows/publish-java.yml @@ -13,6 +13,10 @@ on: options: - Release - Dry Run + version: + description: "Release Version" + required: false + default: "latest" defaults: run: @@ -27,7 +31,8 @@ jobs: name: Setup runs-on: ubuntu-22.04 outputs: - version: ${{ steps.version.outputs.version }} + version: ${{ steps.version-output.outputs.version }} + tag_name: ${{ steps.version-output.outputs.tag_name }} steps: - name: Checkout repo uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 @@ -42,11 +47,21 @@ jobs: exit 1 fi - - name: Get version - id: version + - name: Version output + id: version-output run: | - VERSION=$(cat build.gradle | grep -Eo 'version = "[0-9]+\.[0-9]+\.[0-9]+"' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') - echo "version=$VERSION" >> $GITHUB_OUTPUT + if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then + TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("java")) | .tag_name' | head -1) + VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') + echo "Latest Released Version: $VERSION" + echo "version=$VERSION" >> $GITHUB_OUTPUT + + echo "Latest Released Tag name: $TAG_NAME" + echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT + else + echo "Release Version: ${{ inputs.version }}" + echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT + fi publish: name: Publish @@ -55,6 +70,8 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + with: + ref: ${{ needs.validate.outputs.tag_name }} - name: Azure login uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 diff --git a/.github/workflows/publish-napi.yml b/.github/workflows/publish-napi.yml new file mode 100644 index 000000000..6a284d4a4 --- /dev/null +++ b/.github/workflows/publish-napi.yml @@ -0,0 +1,155 @@ +--- +name: Publish @bitwarden/sdk-napi +run-name: Publish @bitwarden/sdk-napi ${{ inputs.release_type }} + +on: + workflow_dispatch: + inputs: + release_type: + description: "Release Options" + required: true + default: "Release" + type: choice + options: + - Release + - Dry Run + version: + description: "Release Version" + required: false + default: "latest" + +defaults: + run: + working-directory: crates/bitwarden-napi + +jobs: + setup: + name: Setup + runs-on: ubuntu-22.04 + outputs: + release-version: ${{ steps.version-output.outputs.version }} + tag-name: ${{ steps.version-output.outputs.tag_name }} + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Branch check + if: ${{ inputs.release_type != 'Dry Run' }} + run: | + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then + echo "===================================" + echo "[!] Can only release from the 'main' branch" + echo "===================================" + exit 1 + fi + + - name: Version output + id: version-output + run: | + if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then + TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("napi")) | .tag_name' | head -1) + VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') + echo "Latest Released Version: $VERSION" + echo "version=$VERSION" >> $GITHUB_OUTPUT + + echo "Latest Released Tag name: $TAG_NAME" + echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT + else + echo "Release Version: ${{ inputs.version }}" + echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT + fi + + npm: + name: Publish NPM + runs-on: ubuntu-22.04 + needs: setup + env: + _PKG_VERSION: ${{ needs.setup.outputs.release-version }} + _TAG_NAME: ${{ needs.setup.outputs.tag-name }} + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ env._TAG_NAME }} + + - name: Create GitHub deployment + if: ${{ inputs.release_type != 'Dry Run' }} + uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 + id: deployment + with: + token: "${{ secrets.GITHUB_TOKEN }}" + initial-status: "in_progress" + environment: "Bitwarden SDK NAPI - Production" + description: "Deployment ${{ env._PKG_VERSION }} from branch ${{ github.ref_name }}" + task: release + + - name: Setup Node + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + with: + node-version: 18 + cache: "npm" + cache-dependency-path: crates/bitwarden-napi/package-lock.json + + - name: Download schemas.ts artifact + run: | + wget https://github.com/bitwarden/sdk/releases/download/napi-v${{ env._PKG_VERSION }}/schemas.ts + mv schemas.ts ${{ github.workspace }}/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts + + - name: Install dependencies + run: npm ci + + - name: Run tsc + run: npm run tsc + + - name: Login to Azure + uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 + with: + creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} + + - name: Retrieve secrets + id: retrieve-secrets + uses: bitwarden/gh-actions/get-keyvault-secrets@main + with: + keyvault: "bitwarden-ci" + secrets: "npm-api-key" + + - name: Download sdk-napi artifacts + run: | + wget https://github.com/bitwarden/sdk/releases/download/napi-v${{ env._PKG_VERSION }}/sdk-napi.darwin-arm64.node + wget https://github.com/bitwarden/sdk/releases/download/napi-v${{ env._PKG_VERSION }}/sdk-napi.darwin-x64.node + wget https://github.com/bitwarden/sdk/releases/download/napi-v${{ env._PKG_VERSION }}/sdk-napi.win32-x64-msvc.node + wget https://github.com/bitwarden/sdk/releases/download/napi-v${{ env._PKG_VERSION }}/sdk-napi.linux-x64-gnu.node + mv sdk-napi.*.node ${{ github.workspace }}/crates/bitwarden-napi/artifacts + + - name: Move artifacts + run: npm run artifacts + + - name: Setup NPM + run: | + echo 'registry="https://registry.npmjs.org/"' > ./.npmrc + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ./.npmrc + + echo 'registry="https://registry.npmjs.org/"' > ~/.npmrc + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + env: + NPM_TOKEN: ${{ steps.retrieve-secrets.outputs.npm-api-key }} + + - name: Publish NPM + if: ${{ inputs.release_type != 'Dry Run' }} + run: npm publish --access public --registry=https://registry.npmjs.org/ --userconfig=./.npmrc + + - name: Update deployment status to Success + if: ${{ inputs.release_type != 'Dry Run' && success() }} + uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 + with: + token: "${{ secrets.GITHUB_TOKEN }}" + state: "success" + deployment-id: ${{ steps.deployment.outputs.deployment_id }} + + - name: Update deployment status to Failure + if: ${{ inputs.release_type != 'Dry Run' && failure() }} + uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 + with: + token: "${{ secrets.GITHUB_TOKEN }}" + state: "failure" + deployment-id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/.github/workflows/publish-python.yml b/.github/workflows/publish-python.yml index dcbfee22f..7e3395093 100644 --- a/.github/workflows/publish-python.yml +++ b/.github/workflows/publish-python.yml @@ -13,6 +13,10 @@ on: options: - Release - Dry Run + version: + description: "Release Version" + required: false + default: "latest" defaults: run: @@ -22,6 +26,9 @@ jobs: setup: name: Setup runs-on: ubuntu-22.04 + outputs: + version: ${{ steps.version-output.outputs.version }} + tag_name: ${{ steps.version-output.outputs.tag_name }} steps: - name: Checkout repo uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 @@ -29,18 +36,39 @@ jobs: - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} run: | - if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then echo "===================================" - echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" + echo "[!] Can only release from the 'main' branch" echo "===================================" exit 1 fi + - name: Version output + id: version-output + run: | + if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then + TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("python")) | .tag_name' | head -1) + VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') + echo "Latest Released Version: $VERSION" + echo "version=$VERSION" >> $GITHUB_OUTPUT + + echo "Latest Released Tag name: $TAG_NAME" + echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT + else + echo "Release Version: ${{ inputs.version }}" + echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT + fi + publish: name: Publish runs-on: ubuntu-22.04 needs: setup steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ needs.setup.outputs.tag_name }} + - name: Install Python uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 with: @@ -49,15 +77,20 @@ jobs: - name: Install twine run: pip install twine - - name: Download artifacts - uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6 - with: - workflow: build-python-wheels.yml - path: ${{ github.workspace }}/target/wheels/dist - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - name: bitwarden_sdk(.*) - name_is_regexp: true + - name: Get release assets + working-directory: ${{ github.workspace }}/target/wheels/dist + run: | + ARTIFACT_URLS=$(curl -sSL https://api.github.com/repos/bitwarden/sdk/releases/tags/${{ needs.setup.outputs.tag_name }} | jq -r '.assets[].browser_download_url') + for url in $ARTIFACT_URLS; do + wget $url + done + + - name: Unpack release assets + working-directory: ${{ github.workspace }}/target/wheels/dist + run: | + for file in *.zip; do + unzip $file + done - name: Move files working-directory: ${{ github.workspace }}/target/wheels/dist diff --git a/.github/workflows/publish-ruby.yml b/.github/workflows/publish-ruby.yml index 6184586a1..875def064 100644 --- a/.github/workflows/publish-ruby.yml +++ b/.github/workflows/publish-ruby.yml @@ -12,15 +12,22 @@ on: options: - Release - Dry Run + version: + description: "Release Version" + required: false + default: "latest" permissions: contents: read id-token: write jobs: - publish_ruby: - name: Publish Ruby + setup: + name: Setup runs-on: ubuntu-22.04 + outputs: + release-version: ${{ steps.version-output.outputs.version }} + tag-name: ${{ steps.version-output.outputs.tag_name }} steps: - name: Checkout Repository uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 @@ -35,69 +42,45 @@ jobs: exit 1 fi - - name: Set up Ruby - uses: ruby/setup-ruby@c04af2bb7258bb6a03df1d3c1865998ac9390972 # v1.194.0 - with: - ruby-version: 3.2 - - - name: Download artifacts - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: generate_schemas.yml - path: languages/ruby/bitwarden_sdk_secrets/lib - workflow_conclusion: success - branch: main - artifacts: schemas.rb - - - name: Download x86_64-apple-darwin artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - path: temp/macos-x64 - workflow_conclusion: success - branch: main - artifacts: libbitwarden_c_files-x86_64-apple-darwin - - - name: Download aarch64-apple-darwin artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: main - artifacts: libbitwarden_c_files-aarch64-apple-darwin - path: temp/macos-arm64 + - name: Version output + id: version-output + run: | + if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then + TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("ruby")) | .tag_name' | head -1) + VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') + echo "Latest Released Version: $VERSION" + echo "version=$VERSION" >> $GITHUB_OUTPUT + + echo "Latest Released Tag name: $TAG_NAME" + echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT + else + echo "Release Version: ${{ inputs.version }}" + echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT + fi - - name: Download x86_64-unknown-linux-gnu artifact - uses: bitwarden/gh-actions/download-artifacts@main + publish: + name: Publish + runs-on: ubuntu-22.04 + needs: setup + env: + _VERSION: ${{ needs.setup.outputs.release-version }} + _TAG_NAME: ${{ needs.setup.outputs.tag-name }} + steps: + - name: Checkout Repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: main - artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu - path: temp/linux-x64 + ref: ${{ env._TAG_NAME }} - - name: Download x86_64-pc-windows-msvc artifact - uses: bitwarden/gh-actions/download-artifacts@main + - name: Create GitHub deployment + if: ${{ inputs.release_type != 'Dry Run' }} + uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 + id: deployment with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: main - artifacts: libbitwarden_c_files-x86_64-pc-windows-msvc - path: temp/windows-x64 - - - name: Copy lib files - run: | - mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/macos-arm64 - mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/linux-x64 - mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/macos-x64 - mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/windows-x64 - - platforms=("macos-arm64" "linux-x64" "macos-x64" "windows-x64") - files=("libbitwarden_c.dylib" "libbitwarden_c.so" "libbitwarden_c.dylib" "bitwarden_c.dll") - - for ((i=0; i<${#platforms[@]}; i++)); do - cp "temp/${platforms[$i]}/${files[$i]}" "languages/ruby/bitwarden_sdk_secrets/lib/${platforms[$i]}/${files[$i]}" - done + token: "${{ secrets.GITHUB_TOKEN }}" + initial-status: "in_progress" + environment: "Bitwarden Ruby SDK - Production" + description: "Deployment ${{ env._VERSION }} from branch ${{ github.ref_name }}" + task: release - name: Login to Azure uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 @@ -111,13 +94,8 @@ jobs: keyvault: "bitwarden-ci" secrets: "rubygem-api-key" - - name: bundle install - run: bundle install - working-directory: languages/ruby/bitwarden_sdk_secrets - - - name: Build gem - run: gem build bitwarden-sdk-secrets.gemspec - working-directory: languages/ruby/bitwarden_sdk_secrets + - name: Download ruby artifact + run: wget https://github.com/bitwarden/sdk/releases/download/ruby-v${{ env._VERSION }}/bitwarden-sdk-secrets-${{ env._VERSION }}.gem - name: Push gem to Rubygems if: ${{ inputs.release_type != 'Dry Run' }} @@ -130,3 +108,19 @@ jobs: env: GEM_HOST_API_KEY: ${{ steps.retrieve-secrets.outputs.rubygem-api-key }} working-directory: languages/ruby/bitwarden_sdk_secrets + + - name: Update deployment status to Success + if: ${{ inputs.release_type != 'Dry Run' && success() }} + uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 + with: + token: "${{ secrets.GITHUB_TOKEN }}" + state: "success" + deployment-id: ${{ steps.deployment.outputs.deployment_id }} + + - name: Update deployment status to Failure + if: ${{ inputs.release_type != 'Dry Run' && failure() }} + uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 + with: + token: "${{ secrets.GITHUB_TOKEN }}" + state: "failure" + deployment-id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/.github/workflows/publish-rust-crates.yml b/.github/workflows/publish-rust-crates.yml index a614608f9..43f19323a 100644 --- a/.github/workflows/publish-rust-crates.yml +++ b/.github/workflows/publish-rust-crates.yml @@ -14,11 +14,19 @@ on: - Initial Release - Redeploy - Dry Run + version: + description: 'Version to publish (default: latest rust crates release)' + required: true + type: string + default: latest jobs: - publish: - name: Publish + setup: + name: setup runs-on: ubuntu-22.04 + outputs: + release-version: ${{ steps.version-output.outputs.version }} + release-tag: ${{ steps.version-output.outputs.tag_name }} steps: - name: Checkout uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 @@ -33,6 +41,32 @@ jobs: exit 1 fi + - name: Version output + id: version-output + run: | + if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then + TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("rust")) | .tag_name' | head -1) + VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') + echo "Latest Released Version: $VERSION" + echo "version=$VERSION" >> $GITHUB_OUTPUT + + echo "Latest Released Tag name: $TAG_NAME" + echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT + else + echo "Release Version: ${{ inputs.version }}" + echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT + fi + + publish: + name: Publish + runs-on: ubuntu-22.04 + needs: setup + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ needs.setup.outputs.release-tag }} + - name: Login to Azure uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 with: diff --git a/.github/workflows/publish-wasm.yml b/.github/workflows/publish-wasm.yml new file mode 100644 index 000000000..95a86a0c4 --- /dev/null +++ b/.github/workflows/publish-wasm.yml @@ -0,0 +1,138 @@ +--- +name: Publish @bitwarden/sdk-wasm +run-name: Publish @bitwarden/sdk-wasm ${{ inputs.release_type }} + +on: + workflow_dispatch: + inputs: + release_type: + description: "Release Options" + required: true + default: "Release" + type: choice + options: + - Release + - Dry Run + version: + description: "Release Version" + required: false + default: "latest" + +defaults: + run: + working-directory: languages/js/wasm + +jobs: + setup: + name: Setup + runs-on: ubuntu-22.04 + outputs: + release-version: ${{ steps.version-output.outputs.version }} + tag_name: ${{ steps.version-output.outputs.tag_name }} + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Branch check + if: ${{ inputs.release_type != 'Dry Run' }} + run: | + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then + echo "===================================" + echo "[!] Can only release from the 'main' branch" + echo "===================================" + exit 1 + fi + + - name: Version output + id: version-output + run: | + if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then + TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("napi")) | .tag_name' | head -1) + VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') + echo "Latest Released Version: $VERSION" + echo "version=$VERSION" >> $GITHUB_OUTPUT + + echo "Latest Released Tag name: $TAG_NAME" + echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT + else + echo "Release Version: ${{ inputs.version }}" + echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT + fi + + npm: + name: Publish NPM + runs-on: ubuntu-22.04 + needs: setup + env: + _VERSION: ${{ needs.setup.outputs.release-version }} + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ needs.setup.outputs.tag_name }} + + - name: Setup Node + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + with: + node-version: 18 + cache: "npm" + + - name: Login to Azure + uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 + with: + creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} + + - name: Retrieve secrets + id: retrieve-secrets + uses: bitwarden/gh-actions/get-keyvault-secrets@main + with: + keyvault: "bitwarden-ci" + secrets: "npm-api-key" + + - name: Download artifact + run: | + cd ${{ github.workspace }}/languages/js/wasm + wget https://github.com/bitwarden/sdk/releases/download/wasm-v${{ env._VERSION }}/sdk-bitwarden-wasm.zip + unzip sdk-bitwarden-wasm.zip + rm sdk-bitwarden-wasm.zip + + - name: Create GitHub deployment + if: ${{ inputs.release_type != 'Dry Run' }} + uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 + id: deployment + with: + token: "${{ secrets.GITHUB_TOKEN }}" + initial-status: "in_progress" + environment: "Bitwarden SDK WASM - Production" + description: "Deployment ${{ env._VERSION }} from branch ${{ github.ref_name }}" + task: release + + - name: Setup NPM + run: | + echo 'registry="https://registry.npmjs.org/"' > ./.npmrc + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ./.npmrc + + echo 'registry="https://registry.npmjs.org/"' > ~/.npmrc + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + env: + NPM_TOKEN: ${{ steps.retrieve-secrets.outputs.npm-api-key }} + + - name: Publish NPM + if: ${{ inputs.release_type != 'Dry Run' }} + run: npm publish --access public --registry=https://registry.npmjs.org/ --userconfig=./.npmrc + + - name: Update deployment status to Success + if: ${{ inputs.release_type != 'Dry Run' && success() }} + uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 + with: + token: "${{ secrets.GITHUB_TOKEN }}" + state: "success" + deployment-id: ${{ steps.deployment.outputs.deployment_id }} + + - name: Update deployment status to Failure + if: ${{ inputs.release_type != 'Dry Run' && failure() }} + uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 + with: + token: "${{ secrets.GITHUB_TOKEN }}" + state: "failure" + deployment-id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/.github/workflows/release-bws.yml b/.github/workflows/release-bws.yml new file mode 100644 index 000000000..92a8544b8 --- /dev/null +++ b/.github/workflows/release-bws.yml @@ -0,0 +1,77 @@ +--- +name: Release bws CLI +run-name: Release bws CLI ${{ inputs.release_type }} + +on: + workflow_dispatch: + inputs: + release_type: + description: "Release Options" + required: true + default: "Release" + type: choice + options: + - Release + - Dry Run + +jobs: + setup: + name: Setup + runs-on: ubuntu-22.04 + outputs: + release-version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Branch check + if: ${{ inputs.release_type != 'Dry Run' }} + run: | + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then + echo "===================================" + echo "[!] Can only release from the 'main' branch" + echo "===================================" + exit 1 + fi + + - name: Check Release Version + id: version + run: | + VERSION=$(grep -o '^version = ".*"' crates/bws/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: Download all Release artifacts + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-cli.yml + path: packages + workflow_conclusion: success + branch: ${{ github.ref_name }} + + - name: Get checksum files + uses: bitwarden/gh-actions/get-checksum@main + with: + packages_dir: "packages" + file_path: "packages/bws-sha256-checksums-${{ steps.version.outputs.version }}.txt" + + - name: Create release + if: ${{ inputs.release_type != 'Dry Run' }} + uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 + env: + PKG_VERSION: ${{ steps.version.outputs.version }} + with: + artifacts: "packages/bws-x86_64-apple-darwin-${{ env.PKG_VERSION }}.zip, + packages/bws-aarch64-apple-darwin-${{ env.PKG_VERSION }}.zip, + packages/bws-macos-universal-${{ env.PKG_VERSION }}.zip, + packages/bws-x86_64-pc-windows-msvc-${{ env.PKG_VERSION }}.zip, + packages/bws-aarch64-pc-windows-msvc-${{ env.PKG_VERSION }}.zip, + packages/bws-x86_64-unknown-linux-gnu-${{ env.PKG_VERSION }}.zip, + packages/bws-aarch64-unknown-linux-gnu-${{ env.PKG_VERSION }}.zip, + packages/THIRDPARTY.html, + packages/bws-sha256-checksums-${{ env.PKG_VERSION }}.txt" + commit: ${{ github.sha }} + tag: bws-v${{ env.PKG_VERSION }} + name: bws CLI v${{ env.PKG_VERSION }} + body: "" + token: ${{ secrets.GITHUB_TOKEN }} + draft: true diff --git a/.github/workflows/release-cpp.yml b/.github/workflows/release-cpp.yml index aa4d37f62..47199a99f 100644 --- a/.github/workflows/release-cpp.yml +++ b/.github/workflows/release-cpp.yml @@ -29,9 +29,9 @@ jobs: - name: Branch check if: ${{ inputs.release_type != 'Dry Run' }} run: | - if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then + if [[ "$GITHUB_REF" != "refs/heads/main" ]] ; then echo "===================================" - echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" + echo "[!] Can only release from the 'main' branches" echo "===================================" exit 1 fi @@ -45,9 +45,7 @@ jobs: github-release: name: GitHub Release runs-on: ubuntu-22.04 - needs: - - repo-sync - - validate + needs: validate env: _PKG_VERSION: ${{ needs.validate.outputs.version }} steps: diff --git a/.github/workflows/release-dotnet.yml b/.github/workflows/release-dotnet.yml new file mode 100644 index 000000000..2e08e8a76 --- /dev/null +++ b/.github/workflows/release-dotnet.yml @@ -0,0 +1,76 @@ +name: Release .NET NuGet +run-name: Release .NET NuGet Package ${{ inputs.release_type }} + +on: + workflow_dispatch: + inputs: + release_type: + description: "Release Options" + required: true + default: "Release" + type: choice + options: + - Release + - Dry Run + + +jobs: + setup: + name: Setup + runs-on: ubuntu-22.04 + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Branch check + if: ${{ inputs.release_type != 'Dry Run' }} + run: | + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then + echo "===================================" + echo "[!] Can only release from the 'main' branch" + echo "===================================" + exit 1 + fi + + - name: Install xmllint + run: sudo apt-get install -y libxml2-utils + + - name: Get version + id: version + run: | + VERSION=$(xmllint --xpath 'string(/Project/PropertyGroup/Version)' languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj) + echo "version=$VERSION" >> $GITHUB_OUTPUT + + release: + name: Create GitHub release + runs-on: ubuntu-22.04 + needs: setup + steps: + - name: Checkout Repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Download NuGet package + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-dotnet.yml + workflow_conclusion: success + branch: main + artifacts: Bitwarden.Sdk.${{ needs.setup.outputs.version }}.nupkg + path: ./nuget-output + + - name: Create release + if: ${{ inputs.release_type != 'Dry Run' }} + uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 + env: + PKG_VERSION: ${{ needs.setup.outputs.version }} + with: + commit: ${{ github.sha }} + tag: dotnet-v${{ env.PKG_VERSION }} + name: .NET NuGet v${{ env.PKG_VERSION }} + body: "" + token: ${{ secrets.GITHUB_TOKEN }} + draft: true + artifacts: | + ./nuget-output/Bitwarden.Sdk.${{ needs.setup.outputs.version }}.nupkg diff --git a/.github/workflows/release-java.yml b/.github/workflows/release-java.yml new file mode 100644 index 000000000..6898932d5 --- /dev/null +++ b/.github/workflows/release-java.yml @@ -0,0 +1,61 @@ +name: Release Java SDK +run-name: Release Java SDK ${{ inputs.release_type }} + +on: + workflow_dispatch: + inputs: + release_type: + description: "Release Options" + required: true + default: "Release" + type: choice + options: + - Release + - Dry Run + +jobs: + setup: + name: Setup + runs-on: ubuntu-22.04 + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Branch check + if: ${{ inputs.release_type != 'Dry Run' }} + run: | + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then + echo "===================================" + echo "[!] Can only release from the 'main' branch" + echo "===================================" + exit 1 + fi + + - name: Get version + id: version + run: | + VERSION=$(cat languages/java/build.gradle | grep -Eo 'version = "[0-9]+\.[0-9]+\.[0-9]+"' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') + echo "version=$VERSION" >> $GITHUB_OUTPUT + + release: + name: Release + runs-on: ubuntu-22.04 + needs: setup + steps: + - name: Checkout Repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Create release + if: ${{ inputs.release_type != 'Dry Run' }} + uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 + env: + PKG_VERSION: ${{ needs.setup.outputs.version }} + with: + commit: ${{ github.sha }} + tag: java-v${{ env.PKG_VERSION }} + name: Java SDK v${{ env.PKG_VERSION }} + body: "" + token: ${{ secrets.GITHUB_TOKEN }} + draft: true diff --git a/.github/workflows/release-napi.yml b/.github/workflows/release-napi.yml index fb99cc1cf..e8be69f99 100644 --- a/.github/workflows/release-napi.yml +++ b/.github/workflows/release-napi.yml @@ -30,17 +30,17 @@ jobs: name: Setup runs-on: ubuntu-22.04 outputs: - release-version: ${{ steps.version.outputs.version }} + version: ${{ steps.version.outputs.version }} steps: - name: Checkout repo uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Branch check - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} run: | - if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then echo "===================================" - echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" + echo "[!] Can only release from the 'main' branch" echo "===================================" exit 1 fi @@ -49,125 +49,47 @@ jobs: id: version uses: bitwarden/gh-actions/release-version-check@main with: - release-type: ${{ github.event.inputs.release_type }} + release-type: ${{ inputs.release_type }} project-type: ts file: crates/bitwarden-napi/package.json monorepo: false - - name: Create GitHub deployment - if: ${{ github.event.inputs.release_type != 'Dry Run' }} - uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 - id: deployment - with: - token: "${{ secrets.GITHUB_TOKEN }}" - initial-status: "in_progress" - environment: "Bitwarden SDK NAPI - Production" - description: "Deployment ${{ steps.version.outputs.version }} from branch ${{ github.ref_name }}" - task: release - - - name: Update deployment status to Success - if: ${{ github.event.inputs.release_type != 'Dry Run' && success() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "success" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} - - - name: Update deployment status to Failure - if: ${{ github.event.inputs.release_type != 'Dry Run' && failure() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "failure" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} - - npm: - name: Publish NPM + release: + name: Create GitHub release runs-on: ubuntu-22.04 needs: setup - if: inputs.npm_publish - env: - _PKG_VERSION: ${{ needs.setup.outputs.release-version }} steps: - - name: Checkout repo + - name: Checkout Repository uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - name: Setup Node - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - with: - node-version: 18 - cache: "npm" - cache-dependency-path: crates/bitwarden-napi/package-lock.json - - - name: Download schemas - if: ${{ github.event.inputs.release_type != 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-napi.yml - artifacts: schemas.ts - path: ${{ github.workspace }}/crates/bitwarden-napi/src-ts/bitwarden_client/ - workflow_conclusion: success - branch: ${{ github.ref_name }} - - - name: Dry Run - Download schemas - if: ${{ github.event.inputs.release_type == 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-napi.yml - artifacts: schemas.ts - path: ${{ github.workspace }}/crates/bitwarden-napi/src-ts/bitwarden_client/ - workflow_conclusion: success - branch: main - - - name: Install dependencies - run: npm ci - - - name: Run tsc - run: npm run tsc - - - name: Login to Azure - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "npm-api-key" - - name: Download artifacts - if: ${{ github.event.inputs.release_type != 'Dry Run' }} - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-napi.yml - path: ${{ github.workspace }}/crates/bitwarden-napi/artifacts - workflow_conclusion: success - branch: ${{ github.ref_name }} - - - name: Dry Run - Download artifacts - if: ${{ github.event.inputs.release_type == 'Dry Run' }} uses: bitwarden/gh-actions/download-artifacts@main with: workflow: build-napi.yml - path: ${{ github.workspace }}/crates/bitwarden-napi/artifacts workflow_conclusion: success branch: main - - - name: Move artifacts - run: npm run artifacts - - - name: Setup NPM - run: | - echo 'registry="https://registry.npmjs.org/"' > ./.npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ./.npmrc - - echo 'registry="https://registry.npmjs.org/"' > ~/.npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + artifacts: | + sdk-bitwarden-napi-aarch64-apple-darwin + sdk-bitwarden-napi-x86_64-apple-darwin + sdk-bitwarden-napi-x86_64-pc-windows-msvc + sdk-bitwarden-napi-x86_64-unknown-linux-gnu + schemas.ts + + - name: Create release + if: ${{ inputs.release_type != 'Dry Run' }} + uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 env: - NPM_TOKEN: ${{ steps.retrieve-secrets.outputs.npm-api-key }} - - - name: Publish NPM - if: ${{ github.event.inputs.release_type != 'Dry Run' }} - run: npm publish --access public --registry=https://registry.npmjs.org/ --userconfig=./.npmrc + _VERSION: ${{ needs.setup.outputs.version }} + with: + commit: ${{ github.sha }} + tag: napi-v${{ env._VERSION }} + name: napi v${{ env._VERSION }} + body: "" + token: ${{ secrets.GITHUB_TOKEN }} + draft: true + artifacts: | + sdk-napi.darwin-arm64.node + sdk-napi.darwin-x64.node + sdk-napi.win32-x64-msvc.node + sdk-napi.linux-x64-gnu.node + schemas.ts diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml new file mode 100644 index 000000000..10b451fc5 --- /dev/null +++ b/.github/workflows/release-python.yml @@ -0,0 +1,74 @@ +--- +name: Release Python SDK +run-name: Release Python SDK ${{ inputs.release_type }} + +on: + workflow_dispatch: + inputs: + release_type: + description: "Release Options" + required: true + default: "Release" + type: choice + options: + - Release + - Dry Run + +jobs: + setup: + name: Setup + runs-on: ubuntu-22.04 + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Branch check + if: ${{ inputs.release_type != 'Dry Run' }} + run: | + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then + echo "===================================" + echo "[!] Can only release from the 'main' branch" + echo "===================================" + exit 1 + fi + + - name: Get version + id: version + run: | + VERSION=$(cat languages/python/pyproject.toml | grep -Eo 'version = "[0-9]+\.[0-9]+\.[0-9]+"' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') + echo "version=$VERSION" >> $GITHUB_ENV + + release: + name: Release + runs-on: ubuntu-22.04 + needs: setup + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Download artifacts + uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6 + with: + workflow: build-python-wheels.yml + path: ${{ github.workspace }}/target/wheels/dist + workflow_conclusion: success + branch: main + name: bitwarden_sdk(.*) + name_is_regexp: true + + - name: Create GitHub release + if: ${{ inputs.release_type != 'Dry Run' }} + uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 + env: + PKG_VERSION: ${{ needs.setup.outputs.version }} + with: + commit: ${{ github.sha }} + tag: python-v${{ env.PKG_VERSION }} + name: Python v${{ env.PKG_VERSION }} + body: "" + token: ${{ secrets.GITHUB_TOKEN }} + draft: true + artifacts: | + ${{ github.workspace }}/target/wheels/dist/bitwarden_sdk-*.whl diff --git a/.github/workflows/release-ruby.yml b/.github/workflows/release-ruby.yml new file mode 100644 index 000000000..9c3e82b77 --- /dev/null +++ b/.github/workflows/release-ruby.yml @@ -0,0 +1,71 @@ +name: Release Ruby SDK +run-name: Release Ruby SDK ${{ inputs.release_type }} + +on: + workflow_dispatch: + inputs: + release_type: + description: "Release Options" + required: true + default: "Release" + type: choice + options: + - Release + - Dry Run + +jobs: + setup: + name: Setup + runs-on: ubuntu-22.04 + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Branch check + if: ${{ inputs.release_type != 'Dry Run' }} + run: | + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then + echo "===================================" + echo "[!] Can only release from the 'main' branch" + echo "===================================" + exit 1 + fi + + - name: Get version + id: version + run: | + VERSION=$(cat languages/ruby/lib/version.rb | grep -Eo 'VERSION = "[0-9]+\.[0-9]+\.[0-9]+"' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') + echo "version=$VERSION" >> $GITHUB_OUTPUT + + release: + name: Create GitHub release + runs-on: ubuntu-22.04 + needs: setup + steps: + - name: Checkout Repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Download ruby artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-ruby.yml + workflow_conclusion: success + branch: main + artifacts: bitwarden-sdk-secrets + + - name: Create release + if: ${{ inputs.release_type != 'Dry Run' }} + uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 + env: + PKG_VERSION: ${{ needs.setup.outputs.version }} + with: + commit: ${{ github.sha }} + tag: ruby-v${{ env.PKG_VERSION }} + name: Ruby v${{ env.PKG_VERSION }} + body: "" + token: ${{ secrets.GITHUB_TOKEN }} + draft: true + artifacts: | + bitwarden-sdk-secrets-${{ env.PKG_VERSION }}.gem diff --git a/.github/workflows/release-rust-crates.yml b/.github/workflows/release-rust-crates.yml new file mode 100644 index 000000000..54845e148 --- /dev/null +++ b/.github/workflows/release-rust-crates.yml @@ -0,0 +1,53 @@ +name: Release Rust crates +run-name: Release Rust crates ${{ inputs.release_type }} + +on: + workflow_dispatch: + inputs: + release_type: + description: "Release Options" + required: true + default: "Release" + type: choice + options: + - Release + - Dry Run + +jobs: + setup: + name: Setup + runs-on: ubuntu-22.04 + outputs: + release-version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Branch check + if: ${{ inputs.release_type != 'Dry Run' }} + run: | + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then + echo "===================================" + echo "[!] Can only release from the 'main' branch" + echo "===================================" + exit 1 + fi + + - name: Get version + id: version + run: | + VERSION=$(grep -o '^version = ".*"' Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: Create release + if: ${{ inputs.release_type != 'Dry Run' }} + uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 + env: + PKG_VERSION: ${{ steps.version.outputs.version }} + with: + commit: ${{ github.sha }} + tag: rust-v${{ env.PKG_VERSION }} + name: Rust crates v${{ env.PKG_VERSION }} + body: "" + token: ${{ secrets.GITHUB_TOKEN }} + draft: true diff --git a/.github/workflows/release-wasm.yml b/.github/workflows/release-wasm.yml index b6476e833..97b2c34dd 100644 --- a/.github/workflows/release-wasm.yml +++ b/.github/workflows/release-wasm.yml @@ -13,15 +13,9 @@ on: options: - Release - Dry Run - npm_publish: - description: "Publish to NPM registry" - required: true - default: true - type: boolean defaults: run: - shell: bash working-directory: languages/js/wasm jobs: @@ -35,11 +29,11 @@ jobs: uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Branch check - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} run: | - if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then echo "===================================" - echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" + echo "[!] Can only release from the 'main' branch" echo "===================================" exit 1 fi @@ -48,85 +42,37 @@ jobs: id: version uses: bitwarden/gh-actions/release-version-check@main with: - release-type: ${{ github.event.inputs.release_type }} + release-type: ${{ inputs.release_type }} project-type: ts file: languages/js/wasm/package.json monorepo: false - - name: Create GitHub deployment - if: ${{ github.event.inputs.release_type != 'Dry Run' }} - uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 - id: deployment - with: - token: "${{ secrets.GITHUB_TOKEN }}" - initial-status: "in_progress" - environment: "Bitwarden SDK WASM - Production" - description: "Deployment ${{ steps.version.outputs.version }} from branch ${{ github.ref_name }}" - task: release - - - name: Update deployment status to Success - if: ${{ github.event.inputs.release_type != 'Dry Run' && success() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "success" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} - - - name: Update deployment status to Failure - if: ${{ github.event.inputs.release_type != 'Dry Run' && failure() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "failure" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} - - npm: - name: Publish NPM + release: + name: Release runs-on: ubuntu-22.04 needs: setup - if: inputs.npm_publish - env: - _PKG_VERSION: ${{ needs.setup.outputs.release-version }} steps: - name: Checkout repo uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - name: Setup Node - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - with: - node-version: 18 - cache: "npm" - - - name: Login to Azure - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "npm-api-key" - - name: Download artifacts - uses: bitwarden/gh-actions/download-artifacts@main + uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6 with: workflow: build-wasm.yml - path: ${{ github.workspace }}/languages/js/wasm + skip_unpack: true workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + branch: main - - name: Setup NPM - run: | - echo 'registry="https://registry.npmjs.org/"' > ./.npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ./.npmrc - - echo 'registry="https://registry.npmjs.org/"' > ~/.npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + - name: Create GitHub release + if: ${{ inputs.release_type != 'Dry Run' }} + uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 env: - NPM_TOKEN: ${{ steps.retrieve-secrets.outputs.npm-api-key }} - - - name: Publish NPM - if: ${{ github.event.inputs.release_type != 'Dry Run' }} - run: npm publish --access public --registry=https://registry.npmjs.org/ --userconfig=./.npmrc + PKG_VERSION: ${{ needs.setup.outputs.release-version }} + with: + commit: ${{ github.sha }} + tag: wasm-v${{ env.PKG_VERSION }} + name: WASM v${{ env.PKG_VERSION }} + body: "" + token: ${{ secrets.GITHUB_TOKEN }} + draft: true + artifacts: sdk-bitwarden-wasm.zip From c33f82aec8e26e861830a4f65a7352dfc69f349c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Mon, 30 Sep 2024 17:27:01 +0200 Subject: [PATCH 59/77] Validate minimum KDF settings (#1100) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking ## 📔 Objective Previously we weren't validating the KDF settings that we got from the server prelogin message. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- crates/bitwarden-crypto/src/error.rs | 3 + crates/bitwarden-crypto/src/keys/utils.rs | 79 +++++++++++++++++++---- 2 files changed, 70 insertions(+), 12 deletions(-) diff --git a/crates/bitwarden-crypto/src/error.rs b/crates/bitwarden-crypto/src/error.rs index cd2ef9ac0..2f9a58b8b 100644 --- a/crates/bitwarden-crypto/src/error.rs +++ b/crates/bitwarden-crypto/src/error.rs @@ -24,6 +24,9 @@ pub enum CryptoError { #[error("The item was missing a required field: {0}")] MissingField(&'static str), + #[error("Insufficient KDF parameters")] + InsufficientKdfParameters, + #[error("EncString error, {0}")] EncString(#[from] EncStringParseError), diff --git a/crates/bitwarden-crypto/src/keys/utils.rs b/crates/bitwarden-crypto/src/keys/utils.rs index 8564a7c9f..4b2c4c8cd 100644 --- a/crates/bitwarden-crypto/src/keys/utils.rs +++ b/crates/bitwarden-crypto/src/keys/utils.rs @@ -3,30 +3,45 @@ use std::pin::Pin; use generic_array::{typenum::U32, GenericArray}; use sha2::Digest; -use crate::{util::hkdf_expand, Kdf, Result, SymmetricCryptoKey}; +use crate::{util::hkdf_expand, CryptoError, Kdf, Result, SymmetricCryptoKey}; + +const PBKDF2_MIN_ITERATIONS: u32 = 5000; + +const ARGON2ID_MIN_MEMORY: u32 = 16 * 1024; +const ARGON2ID_MIN_ITERATIONS: u32 = 2; +const ARGON2ID_MIN_PARALLELISM: u32 = 1; /// Derive a generic key from a secret and salt using the provided KDF. pub(super) fn derive_kdf_key(secret: &[u8], salt: &[u8], kdf: &Kdf) -> Result { let mut hash = match kdf { - Kdf::PBKDF2 { iterations } => crate::util::pbkdf2(secret, salt, iterations.get()), + Kdf::PBKDF2 { iterations } => { + let iterations = iterations.get(); + if iterations < PBKDF2_MIN_ITERATIONS { + return Err(CryptoError::InsufficientKdfParameters); + } + crate::util::pbkdf2(secret, salt, iterations) + } Kdf::Argon2id { iterations, memory, parallelism, } => { + let memory = memory.get() * 1024; // Convert MiB to KiB; + let iterations = iterations.get(); + let parallelism = parallelism.get(); + + if memory < ARGON2ID_MIN_MEMORY + || iterations < ARGON2ID_MIN_ITERATIONS + || parallelism < ARGON2ID_MIN_PARALLELISM + { + return Err(CryptoError::InsufficientKdfParameters); + } + use argon2::*; - let argon = Argon2::new( - Algorithm::Argon2id, - Version::V0x13, - Params::new( - memory.get() * 1024, // Convert MiB to KiB - iterations.get(), - parallelism.get(), - Some(32), - )?, - ); + let params = Params::new(memory, iterations, parallelism, Some(32))?; + let argon = Argon2::new(Algorithm::Argon2id, Version::V0x13, params); let salt_sha = sha2::Sha256::new().chain_update(salt).finalize(); @@ -57,6 +72,8 @@ pub(super) fn stretch_kdf_key(k: &SymmetricCryptoKey) -> Result NonZero { + NonZero::new(n).unwrap() + } + + let secret = [0u8; 32]; + let salt = [0u8; 32]; + + for kdf in [ + Kdf::PBKDF2 { + iterations: nz(4999), + }, + Kdf::Argon2id { + iterations: nz(1), + memory: nz(16), + parallelism: nz(1), + }, + Kdf::Argon2id { + iterations: nz(2), + memory: nz(15), + parallelism: nz(1), + }, + Kdf::Argon2id { + iterations: nz(1), + memory: nz(15), + parallelism: nz(1), + }, + ] { + assert_eq!( + derive_kdf_key(&secret, &salt, &kdf) + .unwrap_err() + .to_string(), + "Insufficient KDF parameters" + ); + } + } } From fa7a02c6131ecf674b8d6cb6fbd3adc79d6291aa Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:19:15 -0400 Subject: [PATCH 60/77] Release Python Workflow - Fix logic (#1102) --- .github/workflows/release-python.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml index 10b451fc5..5be1a12fc 100644 --- a/.github/workflows/release-python.yml +++ b/.github/workflows/release-python.yml @@ -38,7 +38,7 @@ jobs: id: version run: | VERSION=$(cat languages/python/pyproject.toml | grep -Eo 'version = "[0-9]+\.[0-9]+\.[0-9]+"' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') - echo "version=$VERSION" >> $GITHUB_ENV + echo "version=$VERSION" >> $GITHUB_OUTPUT release: name: Release @@ -58,6 +58,12 @@ jobs: name: bitwarden_sdk(.*) name_is_regexp: true + - name: Move all whl files to single directory + run: | + shopt -s globstar + mv **/*.whl . + working-directory: ${{ github.workspace }}/target/wheels/dist + - name: Create GitHub release if: ${{ inputs.release_type != 'Dry Run' }} uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 From 6c22e061c7d9e03906bbc24c3fdb1dccf53a2cef Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Tue, 1 Oct 2024 10:25:19 +0200 Subject: [PATCH 61/77] Move common dependencies to the root cargo.toml (#1090) To ensure we use consistent version ranges we should concentrate common dependencies to the root cargo.toml. This should make it easier to maintain the SM dependency ranges. --- Cargo.toml | 25 +++++++++++++++++ crates/bitwarden-api-api/Cargo.toml | 16 +++++++---- crates/bitwarden-api-identity/Cargo.toml | 16 +++++++---- crates/bitwarden-core/Cargo.toml | 35 +++++++++--------------- crates/bitwarden-crypto/Cargo.toml | 12 ++++---- crates/bitwarden-exporters/Cargo.toml | 18 +++++------- crates/bitwarden-fido/Cargo.toml | 19 ++++++------- crates/bitwarden-generators/Cargo.toml | 17 +++++------- crates/bitwarden-json/Cargo.toml | 6 ++-- crates/bitwarden-napi/Cargo.toml | 2 +- crates/bitwarden-py/Cargo.toml | 2 +- crates/bitwarden-send/Cargo.toml | 17 +++++------- crates/bitwarden-sm/Cargo.toml | 19 ++++++------- crates/bitwarden-uniffi/Cargo.toml | 17 +++++------- crates/bitwarden-vault/Cargo.toml | 21 ++++++-------- crates/bitwarden/Cargo.toml | 10 +++++-- crates/bw/Cargo.toml | 2 +- crates/bws/Cargo.toml | 2 +- crates/sdk-schemas/Cargo.toml | 2 +- crates/uniffi-bindgen/Cargo.toml | 2 +- 20 files changed, 133 insertions(+), 127 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8c978819b..190341a7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,31 @@ bitwarden-send = { path = "crates/bitwarden-send", version = "=1.0.0" } bitwarden-sm = { path = "crates/bitwarden-sm", version = "=1.0.0" } bitwarden-vault = { path = "crates/bitwarden-vault", version = "=1.0.0" } +# External crates that are expected to maintain a consistent version across all crates +chrono = { version = ">=0.4.26, <0.5", features = [ + "clock", + "serde", + "std", +], default-features = false } +log = "0.4.20" +reqwest = { version = ">=0.12.5, <0.13", features = [ + "json", + "multipart", + "http2", +], default-features = false } +schemars = { version = ">=0.8.9, <0.9", features = ["uuid1", "chrono"] } +serde = { version = ">=1.0, <2.0", features = ["derive"] } +serde_json = ">=1.0.96, <2.0" +serde_qs = ">=0.12.0, <0.14" +serde_repr = ">=0.1.12, <0.2" +thiserror = ">=1.0.40, <2.0" +tokio = { version = "1.36.0", features = ["macros"] } +uniffi = "=0.28.1" +uuid = { version = ">=1.3.3, <2.0", features = ["serde", "v4"] } +validator = { version = "0.18.1", features = ["derive"] } +wasm-bindgen = { version = "0.2.91", features = ["serde-serialize"] } +wasm-bindgen-futures = "0.4.41" + [workspace.lints.clippy] unused_async = "deny" unwrap_used = "deny" diff --git a/crates/bitwarden-api-api/Cargo.toml b/crates/bitwarden-api-api/Cargo.toml index bd4ec05c0..43ec79ff0 100644 --- a/crates/bitwarden-api-api/Cargo.toml +++ b/crates/bitwarden-api-api/Cargo.toml @@ -13,10 +13,14 @@ license-file.workspace = true keywords.workspace = true [dependencies] -serde = { version = ">=1.0.163, <2", features = ["derive"] } -serde_with = { version = ">=3.8, <4", default-features = false, features = ["base64", "std", "macros"] } -serde_json = ">=1.0.96, <2" -serde_repr = ">=0.1.12, <0.2" +serde = { workspace = true } +serde_with = { version = ">=3.8, <4", default-features = false, features = [ + "base64", + "std", + "macros", +] } +serde_json = { workspace = true } +serde_repr = { workspace = true } url = ">=2.5, <3" -uuid = { version = ">=1.3.3, <2", features = ["serde", "v4"] } -reqwest = { version = ">=0.12.5, <0.13", features = ["json", "multipart", "http2"], default-features = false } +uuid = { workspace = true } +reqwest = { workspace = true } diff --git a/crates/bitwarden-api-identity/Cargo.toml b/crates/bitwarden-api-identity/Cargo.toml index d101e9a9e..9d4d81a0d 100644 --- a/crates/bitwarden-api-identity/Cargo.toml +++ b/crates/bitwarden-api-identity/Cargo.toml @@ -13,10 +13,14 @@ license-file.workspace = true keywords.workspace = true [dependencies] -serde = { version = ">=1.0.163, <2", features = ["derive"] } -serde_with = { version = ">=3.8, <4", default-features = false, features = ["base64", "std", "macros"] } -serde_json = ">=1.0.96, <2" -serde_repr = ">=0.1.12, <0.2" +serde = { workspace = true } +serde_with = { version = ">=3.8, <4", default-features = false, features = [ + "base64", + "std", + "macros", +] } +serde_json = { workspace = true } +serde_repr = { workspace = true } url = ">=2.5, <3" -uuid = { version = ">=1.3.3, <2", features = ["serde", "v4"] } -reqwest = { version = ">=0.12.5, <0.13", features = ["json", "multipart", "http2"], default-features = false } +uuid = { workspace = true } +reqwest = { workspace = true } diff --git a/crates/bitwarden-core/Cargo.toml b/crates/bitwarden-core/Cargo.toml index 7059e26c3..f4b6ec423 100644 --- a/crates/bitwarden-core/Cargo.toml +++ b/crates/bitwarden-core/Cargo.toml @@ -26,46 +26,37 @@ base64 = ">=0.22.1, <0.23" bitwarden-api-api = { workspace = true } bitwarden-api-identity = { workspace = true } bitwarden-crypto = { workspace = true } -chrono = { version = ">=0.4.26, <0.5", features = [ - "clock", - "serde", - "std", -], default-features = false } +chrono = { workspace = true, features = ["std"] } # We don't use this directly (it's used by rand), but we need it here to enable WASM support getrandom = { version = ">=0.2.9, <0.3", features = ["js"] } hmac = ">=0.12.1, <0.13" log = ">=0.4.18, <0.5" rand = ">=0.8.5, <0.9" -reqwest = { version = ">=0.12.5, <0.13", features = [ - "http2", - "json", -], default-features = false } -schemars = { version = ">=0.8.9, <0.9", features = ["uuid1", "chrono"] } -serde = { version = ">=1.0, <2.0", features = ["derive"] } -serde_json = ">=1.0.96, <2.0" -serde_qs = ">=0.12.0, <0.14" -serde_repr = ">=0.1.12, <0.2" +reqwest = { workspace = true } +schemars = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +serde_qs = { workspace = true } +serde_repr = { workspace = true } sha1 = ">=0.10.5, <0.11" sha2 = ">=0.10.6, <0.11" -thiserror = ">=1.0.40, <2.0" -uniffi = { version = "=0.28.1", optional = true, features = ["tokio"] } -uuid = { version = ">=1.3.3, <2.0", features = ["serde"] } -validator = { version = "0.18.1", features = ["derive"] } +thiserror = { workspace = true } +uniffi = { workspace = true, optional = true, features = ["tokio"] } +uuid = { workspace = true } +validator = { workspace = true } zeroize = { version = ">=1.7.0, <2.0", features = ["derive", "aarch64"] } zxcvbn = { version = ">=3.0.1, <4.0", optional = true } [target.'cfg(not(target_arch="wasm32"))'.dependencies] # By default, we use rustls as the TLS stack and rust-platform-verifier to support user-installed root certificates # The only exception is WASM, as it just uses the browsers/node fetch -reqwest = { version = ">=0.12.5, <0.13", features = [ - "rustls-tls-manual-roots", -], default-features = false } +reqwest = { workspace = true, features = ["rustls-tls-manual-roots"] } rustls-platform-verifier = "0.3.4" [dev-dependencies] bitwarden-crypto = { workspace = true } rand_chacha = "0.3.1" -tokio = { version = "1.36.0", features = ["rt", "macros"] } +tokio = { workspace = true, features = ["rt"] } wiremock = "0.6.0" zeroize = { version = ">=1.7.0, <2.0", features = ["derive", "aarch64"] } diff --git a/crates/bitwarden-crypto/Cargo.toml b/crates/bitwarden-crypto/Cargo.toml index b071b4ee9..3254640fe 100644 --- a/crates/bitwarden-crypto/Cargo.toml +++ b/crates/bitwarden-crypto/Cargo.toml @@ -36,20 +36,20 @@ pbkdf2 = { version = ">=0.12.1, <0.13", default-features = false } rand = ">=0.8.5, <0.9" rayon = ">=1.8.1, <2.0" rsa = ">=0.9.2, <0.10" -schemars = { version = ">=0.8, <0.9", features = ["uuid1"] } -serde = { version = ">=1.0, <2.0", features = ["derive"] } +schemars = { workspace = true } +serde = { workspace = true } sha1 = ">=0.10.5, <0.11" sha2 = ">=0.10.6, <0.11" subtle = ">=2.5.0, <3.0" -thiserror = ">=1.0.40, <2.0" -uniffi = { version = "=0.28.1", optional = true } -uuid = { version = ">=1.3.3, <2.0", features = ["serde"] } +thiserror = { workspace = true } +uniffi = { workspace = true, optional = true } +uuid = { workspace = true } zeroize = { version = ">=1.7.0, <2.0", features = ["derive", "aarch64"] } [dev-dependencies] criterion = "0.5.1" rand_chacha = "0.3.1" -serde_json = ">=1.0.96, <2.0" +serde_json = { workspace = true } [[bench]] name = "default_allocator" diff --git a/crates/bitwarden-exporters/Cargo.toml b/crates/bitwarden-exporters/Cargo.toml index 858e9f522..38cf49953 100644 --- a/crates/bitwarden-exporters/Cargo.toml +++ b/crates/bitwarden-exporters/Cargo.toml @@ -22,18 +22,14 @@ base64 = ">=0.22.1, <0.23" bitwarden-core = { workspace = true } bitwarden-crypto = { workspace = true } bitwarden-vault = { workspace = true } -chrono = { version = ">=0.4.26, <0.5", features = [ - "clock", - "serde", - "std", -], default-features = false } +chrono = { workspace = true, features = ["std"] } csv = "1.3.0" -schemars = { version = ">=0.8.9, <0.9", features = ["uuid1", "chrono"] } -serde = { version = ">=1.0, <2.0", features = ["derive"] } -serde_json = ">=1.0.96, <2.0" -thiserror = ">=1.0.40, <2.0" -uniffi = { version = "=0.28.1", optional = true } -uuid = { version = ">=1.3.3, <2.0", features = ["serde", "v4"] } +schemars = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +thiserror = { workspace = true } +uniffi = { workspace = true, optional = true } +uuid = { workspace = true } [lints] workspace = true diff --git a/crates/bitwarden-fido/Cargo.toml b/crates/bitwarden-fido/Cargo.toml index 6b04bd796..20f5cdaf6 100644 --- a/crates/bitwarden-fido/Cargo.toml +++ b/crates/bitwarden-fido/Cargo.toml @@ -22,10 +22,7 @@ base64 = ">=0.22.1, <0.23" bitwarden-core = { workspace = true } bitwarden-crypto = { workspace = true } bitwarden-vault = { workspace = true } -chrono = { version = ">=0.4.26, <0.5", features = [ - "clock", - "serde", -], default-features = false } +chrono = { workspace = true } coset = { version = "0.3.7" } itertools = "0.13.0" log = ">=0.4.18, <0.5" @@ -34,13 +31,13 @@ passkey = { git = "https://github.com/bitwarden/passkey-rs", rev = "ff757604cd7b passkey-client = { git = "https://github.com/bitwarden/passkey-rs", rev = "ff757604cd7b4e8f321ed1616fef7e40e21ac5df", features = [ "android-asset-validation", ] } -reqwest = { version = ">=0.12.5, <0.13", default-features = false } -schemars = { version = "0.8.21", features = ["uuid1", "chrono"] } -serde = { version = ">=1.0, <2.0", features = ["derive"] } -serde_json = ">=1.0.96, <2.0" -thiserror = ">=1.0.40, <2.0" -uniffi = { version = "=0.28.1", optional = true } -uuid = { version = ">=1.3.3, <2.0", features = ["serde"] } +reqwest = { workspace = true } +schemars = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +thiserror = { workspace = true } +uniffi = { workspace = true, optional = true } +uuid = { workspace = true } [lints] workspace = true diff --git a/crates/bitwarden-generators/Cargo.toml b/crates/bitwarden-generators/Cargo.toml index 442e00c08..24e5d5ebc 100644 --- a/crates/bitwarden-generators/Cargo.toml +++ b/crates/bitwarden-generators/Cargo.toml @@ -20,19 +20,16 @@ uniffi = ["dep:uniffi"] # Uniffi bindings bitwarden-core = { workspace = true, features = ["internal"] } bitwarden-crypto = { workspace = true } rand = ">=0.8.5, <0.9" -reqwest = { version = ">=0.12.5, <0.13", features = [ - "http2", - "json", -], default-features = false } -schemars = { version = ">=0.8.9, <0.9", features = ["uuid1", "chrono"] } -serde = { version = ">=1.0, <2.0", features = ["derive"] } -serde_json = ">=1.0.96, <2.0" -thiserror = ">=1.0.40, <2.0" -uniffi = { version = "=0.28.1", optional = true } +reqwest = { workspace = true } +schemars = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +thiserror = { workspace = true } +uniffi = { workspace = true, optional = true } [dev-dependencies] rand_chacha = "0.3.1" -tokio = { version = "1.36.0", features = ["rt", "macros"] } +tokio = { workspace = true, features = ["rt"] } wiremock = "0.6.0" [lints] diff --git a/crates/bitwarden-json/Cargo.toml b/crates/bitwarden-json/Cargo.toml index 69ca8e6ab..ed1b39580 100644 --- a/crates/bitwarden-json/Cargo.toml +++ b/crates/bitwarden-json/Cargo.toml @@ -22,9 +22,9 @@ secrets = ["bitwarden/secrets"] # Secrets manager API [dependencies] bitwarden = { workspace = true } log = ">=0.4.18, <0.5" -schemars = ">=0.8.12, <0.9" -serde = { version = ">=1.0, <2.0", features = ["derive"] } -serde_json = ">=1.0.96, <2.0" +schemars = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } [lints] workspace = true diff --git a/crates/bitwarden-napi/Cargo.toml b/crates/bitwarden-napi/Cargo.toml index 59ca137aa..7a9deeb8f 100644 --- a/crates/bitwarden-napi/Cargo.toml +++ b/crates/bitwarden-napi/Cargo.toml @@ -22,7 +22,7 @@ bitwarden-json = { path = "../bitwarden-json", version = "0.3.0", features = [ "secrets", ] } env_logger = "0.11.1" -log = "0.4.20" +log = { workspace = true } napi = { version = "2", features = ["async"] } napi-derive = "2" diff --git a/crates/bitwarden-py/Cargo.toml b/crates/bitwarden-py/Cargo.toml index c66a35889..b637d5faa 100644 --- a/crates/bitwarden-py/Cargo.toml +++ b/crates/bitwarden-py/Cargo.toml @@ -24,7 +24,7 @@ pyo3-log = "0.11.0" pyo3-build-config = { version = "0.22.1" } [target.'cfg(not(target_arch="wasm32"))'.dependencies] -tokio = { version = "1.36.0", features = ["rt-multi-thread", "macros"] } +tokio = { workspace = true, features = ["rt-multi-thread"] } [lints] workspace = true diff --git a/crates/bitwarden-send/Cargo.toml b/crates/bitwarden-send/Cargo.toml index 417cac89e..33c0b76c6 100644 --- a/crates/bitwarden-send/Cargo.toml +++ b/crates/bitwarden-send/Cargo.toml @@ -25,16 +25,13 @@ base64 = ">=0.22.1, <0.23" bitwarden-api-api = { workspace = true } bitwarden-core = { workspace = true } bitwarden-crypto = { workspace = true } -chrono = { version = ">=0.4.26, <0.5", features = [ - "clock", - "serde", -], default-features = false } -schemars = { version = ">=0.8.9, <0.9", features = ["uuid1", "chrono"] } -serde = { version = ">=1.0, <2.0", features = ["derive"] } -serde_repr = ">=0.1.12, <0.2" -thiserror = ">=1.0.40, <2.0" -uniffi = { version = "=0.28.1", optional = true } -uuid = { version = ">=1.3.3, <2.0", features = ["serde"] } +chrono = { workspace = true } +schemars = { workspace = true } +serde = { workspace = true } +serde_repr = { workspace = true } +thiserror = { workspace = true } +uniffi = { workspace = true, optional = true } +uuid = { workspace = true } zeroize = { version = ">=1.7.0, <2.0" } [lints] diff --git a/crates/bitwarden-sm/Cargo.toml b/crates/bitwarden-sm/Cargo.toml index 882780001..77fa9d7c1 100644 --- a/crates/bitwarden-sm/Cargo.toml +++ b/crates/bitwarden-sm/Cargo.toml @@ -17,19 +17,16 @@ keywords.workspace = true bitwarden-api-api = { workspace = true } bitwarden-core = { workspace = true } bitwarden-crypto = { workspace = true } -chrono = { version = ">=0.4.26, <0.5", features = [ - "clock", - "serde", -], default-features = false } -schemars = { version = ">=0.8.9, <0.9", features = ["uuid1", "chrono"] } -serde = { version = ">=1.0, <2.0", features = ["derive"] } -serde_json = ">=1.0.96, <2.0" -thiserror = ">=1.0.40, <2.0" -uuid = { version = ">=1.3.3, <2.0", features = ["serde"] } -validator = { version = "0.18.1", features = ["derive"] } +chrono = { workspace = true } +schemars = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +thiserror = { workspace = true } +uuid = { workspace = true } +validator = { workspace = true } [dev-dependencies] -tokio = { version = "1.36.0", features = ["rt", "macros"] } +tokio = { workspace = true, features = ["rt"] } [lints] workspace = true diff --git a/crates/bitwarden-uniffi/Cargo.toml b/crates/bitwarden-uniffi/Cargo.toml index 5737d3559..822ed0d38 100644 --- a/crates/bitwarden-uniffi/Cargo.toml +++ b/crates/bitwarden-uniffi/Cargo.toml @@ -27,16 +27,13 @@ bitwarden-fido = { workspace = true, features = ["uniffi"] } bitwarden-generators = { workspace = true, features = ["uniffi"] } bitwarden-send = { workspace = true, features = ["uniffi"] } bitwarden-vault = { workspace = true, features = ["uniffi"] } -chrono = { version = ">=0.4.26, <0.5", features = [ - "serde", - "std", -], default-features = false } -log = "0.4.20" +chrono = { workspace = true, features = ["std"] } +log = { workspace = true } env_logger = "0.11.1" -schemars = { version = ">=0.8, <0.9", optional = true } -thiserror = ">=1.0.40, <2.0" -uniffi = "=0.28.1" -uuid = ">=1.3.3, <2" +schemars = { workspace = true, optional = true } +thiserror = { workspace = true } +uniffi = { workspace = true } +uuid = { workspace = true } [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.14" @@ -50,7 +47,7 @@ rustls-platform-verifier = "0.3.4" oslog = "0.2.0" [build-dependencies] -uniffi = { version = "=0.28.1", features = ["build"] } +uniffi = { workspace = true, features = ["build"] } [lints] workspace = true diff --git a/crates/bitwarden-vault/Cargo.toml b/crates/bitwarden-vault/Cargo.toml index 04a64078f..4c41e139c 100644 --- a/crates/bitwarden-vault/Cargo.toml +++ b/crates/bitwarden-vault/Cargo.toml @@ -25,25 +25,22 @@ base64 = ">=0.22.1, <0.23" bitwarden-api-api = { workspace = true } bitwarden-core = { workspace = true, features = ["internal"] } bitwarden-crypto = { workspace = true } -chrono = { version = ">=0.4.26, <0.5", features = [ - "clock", - "serde", -], default-features = false } +chrono = { workspace = true } rand = ">=0.8.5, <0.9" hmac = ">=0.12.1, <0.13" -reqwest = { version = ">=0.12.5, <0.13", default-features = false } -schemars = { version = ">=0.8.9, <0.9", features = ["uuid1", "chrono"] } -serde = { version = ">=1.0, <2.0", features = ["derive"] } -serde_json = ">=1.0.96, <2.0" -serde_repr = ">=0.1.12, <0.2" +reqwest = { workspace = true } +schemars = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +serde_repr = { workspace = true } sha1 = ">=0.10.5, <0.11" sha2 = ">=0.10.6, <0.11" -thiserror = ">=1.0.40, <2.0" +thiserror = { workspace = true } uniffi = { version = "=0.28.1", optional = true } -uuid = { version = ">=1.3.3, <2.0", features = ["serde"] } +uuid = { workspace = true } [dev-dependencies] -tokio = { version = "1.36.0", features = ["rt", "macros"] } +tokio = { workspace = true, features = ["rt"] } [lints] workspace = true diff --git a/crates/bitwarden/Cargo.toml b/crates/bitwarden/Cargo.toml index f927564cf..9fa5c0cb3 100644 --- a/crates/bitwarden/Cargo.toml +++ b/crates/bitwarden/Cargo.toml @@ -35,7 +35,11 @@ uniffi = [ "bitwarden-send/uniffi", "bitwarden-vault/uniffi", ] # Uniffi bindings -secrets = ["bitwarden-core/secrets", "dep:bitwarden-sm", "dep:bitwarden-generators"] # Secrets manager API +secrets = [ + "bitwarden-core/secrets", + "dep:bitwarden-sm", + "dep:bitwarden-generators", +] # Secrets manager API [dependencies] bitwarden-api-api = { workspace = true } @@ -48,10 +52,10 @@ bitwarden-generators = { workspace = true, optional = true } bitwarden-send = { workspace = true, optional = true } bitwarden-sm = { workspace = true, optional = true } bitwarden-vault = { workspace = true, optional = true } -thiserror = ">=1.0.40, <2.0" +thiserror = { workspace = true } [dev-dependencies] -uuid = { version = ">=1.3.3, <2.0" } +uuid = { workspace = true } [lints] workspace = true diff --git a/crates/bw/Cargo.toml b/crates/bw/Cargo.toml index 7361f15b6..cb8e02ba1 100644 --- a/crates/bw/Cargo.toml +++ b/crates/bw/Cargo.toml @@ -22,7 +22,7 @@ color-eyre = "0.6.3" env_logger = "0.11.1" inquire = "0.7.0" log = "0.4.20" -tokio = { version = "1.36.0", features = ["rt-multi-thread", "macros"] } +tokio = { workspace = true, features = ["rt-multi-thread"] } [dev-dependencies] tempfile = "3.10.0" diff --git a/crates/bws/Cargo.toml b/crates/bws/Cargo.toml index c6ef58396..08e3941f2 100644 --- a/crates/bws/Cargo.toml +++ b/crates/bws/Cargo.toml @@ -41,7 +41,7 @@ serde_json = "1.0.113" serde_yaml = "0.9" supports-color = "3.0.0" thiserror = "1.0.57" -tokio = { version = "1.36.0", features = ["rt-multi-thread", "macros"] } +tokio = { workspace = true, features = ["rt-multi-thread"] } toml = "0.8.10" uuid = { version = "1.7.0", features = ["serde"] } which = "6.0.1" diff --git a/crates/sdk-schemas/Cargo.toml b/crates/sdk-schemas/Cargo.toml index 9982e47fe..8d48cd691 100644 --- a/crates/sdk-schemas/Cargo.toml +++ b/crates/sdk-schemas/Cargo.toml @@ -24,5 +24,5 @@ bitwarden = { workspace = true } bitwarden-json = { path = "../bitwarden-json" } bitwarden-uniffi = { path = "../bitwarden-uniffi", optional = true } itertools = "0.13.0" -schemars = { version = "0.8.16", features = ["preserve_order"] } +schemars = { workspace = true, features = ["preserve_order"] } serde_json = "1.0.113" diff --git a/crates/uniffi-bindgen/Cargo.toml b/crates/uniffi-bindgen/Cargo.toml index 042ea8b65..b5401afb9 100644 --- a/crates/uniffi-bindgen/Cargo.toml +++ b/crates/uniffi-bindgen/Cargo.toml @@ -17,4 +17,4 @@ name = "uniffi-bindgen" path = "uniffi-bindgen.rs" [dependencies] -uniffi = { version = "=0.28.1", features = ["cli"] } +uniffi = { workspace = true, features = ["cli"] } From eb0d68308648233d1e0bcdc702d62d8c14d3d70f Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Tue, 1 Oct 2024 04:31:49 -0400 Subject: [PATCH 62/77] Release @bitwarden/sdk-napi workflow - Fix logic (#1104) --- .github/workflows/release-napi.yml | 35 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release-napi.yml b/.github/workflows/release-napi.yml index e8be69f99..761515c73 100644 --- a/.github/workflows/release-napi.yml +++ b/.github/workflows/release-napi.yml @@ -14,11 +14,6 @@ on: - Initial Release - Redeploy - Dry Run - npm_publish: - description: "Publish to NPM registry" - required: true - default: true - type: boolean defaults: run: @@ -63,17 +58,23 @@ jobs: uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - name: Download artifacts - uses: bitwarden/gh-actions/download-artifacts@main + uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6 with: workflow: build-napi.yml workflow_conclusion: success branch: main - artifacts: | - sdk-bitwarden-napi-aarch64-apple-darwin - sdk-bitwarden-napi-x86_64-apple-darwin - sdk-bitwarden-napi-x86_64-pc-windows-msvc - sdk-bitwarden-napi-x86_64-unknown-linux-gnu - schemas.ts + name: sdk-bitwarden-napi-(.*)|schemas.ts + name_is_regexp: true + path: dist + + - name: Move artifact files to single directory + run: | + ls -alhR + shopt -s globstar + mv **/*.node . + mv schemas.ts/ schemas/ + mv schemas/schemas.ts . + working-directory: dist - name: Create release if: ${{ inputs.release_type != 'Dry Run' }} @@ -88,8 +89,8 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} draft: true artifacts: | - sdk-napi.darwin-arm64.node - sdk-napi.darwin-x64.node - sdk-napi.win32-x64-msvc.node - sdk-napi.linux-x64-gnu.node - schemas.ts + dist/sdk-napi.darwin-arm64.node + dist/sdk-napi.darwin-x64.node + dist/sdk-napi.win32-x64-msvc.node + dist/sdk-napi.linux-x64-gnu.node + dist/schemas.ts From 66949afb5bb1f02012988b3839c1186a3c4eeca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Tue, 1 Oct 2024 12:47:14 +0200 Subject: [PATCH 63/77] Fix panic handling during memory testing (#1106) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 📔 Objective Previously the memory testing program wouldn't detect when the binary being executed panicked unexpectedly, which caused the program to run indefinitely while waiting for the binary to notify it to continue. This started appearing when adding the validation for KDF minimums, as one of the tests we run is under the minimum, which causes CI to run until timeout: https://github.com/bitwarden/sdk/actions/runs/11109271931 ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- crates/memory-testing/cases.json | 8 ++++---- crates/memory-testing/src/bin/capture-dumps.rs | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/memory-testing/cases.json b/crates/memory-testing/cases.json index 4205e3dce..5223d3671 100644 --- a/crates/memory-testing/cases.json +++ b/crates/memory-testing/cases.json @@ -72,7 +72,7 @@ "kdf": { "argon2id": { "iterations": 3, - "memory": 4, + "memory": 16, "parallelism": 1 } } @@ -80,15 +80,15 @@ "memory_lookups": [ { "name": "Key", - "hex": "3bc0520a0abff0097d521ce0ee5e5b1cee301939a84742623c0c1697d7a4bd46" + "hex": "59079cd7134409c6882c2701de8357a3d8aabb2dad2da19eea5f1b8081dfb51c" }, { "name": "Hash B64", - "string": "lHkprdORlICVJ4Umwi94Uz/nATK6Y7If7e+iFoabzh0=" + "string": "P1ZT6T80zOfEqXj/kPbtON3yszf7xLNGCxWjdO2xfjU=" }, { "name": "Hash bytes", - "hex": "947929add391948095278526c22f78533fe70132ba63b21fedefa216869bce1d" + "hex": "3f5653e93f34cce7c4a978ff90f6ed38ddf2b337fbc4b3460b15a374edb17e35" } ] }, diff --git a/crates/memory-testing/src/bin/capture-dumps.rs b/crates/memory-testing/src/bin/capture-dumps.rs index 1fe4eead1..5dddd7622 100644 --- a/crates/memory-testing/src/bin/capture-dumps.rs +++ b/crates/memory-testing/src/bin/capture-dumps.rs @@ -37,6 +37,11 @@ fn wait_dump_and_continue( loop { let mut buf = [0u8; 1024]; let read = stdout.read(&mut buf).unwrap(); + + if read == 0 { + panic!("Process exited unexpectedly"); + } + let buf_str = std::str::from_utf8(&buf[..read]).unwrap(); if buf_str.contains("Waiting for dump...") { break; From 8dde05e0caca144a1e1b99476d5d6e676ea5d59f Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:36:40 -0400 Subject: [PATCH 64/77] Fix Build Rust Cross Platform Upload (#1107) --- .github/workflows/build-rust-cross-platform.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index fab7df991..1748661b9 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -86,6 +86,10 @@ jobs: uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: libbitwarden_c_files-${{ matrix.settings.target }} - path: | - target/${{ matrix.settings.target }}/release/*bitwarden_c* - target/${{ matrix.settings.target }}/release-windows/*bitwarden_c* + path: target/${{ matrix.settings.target }}/release/*bitwarden_c* + + - name: Upload Artifact + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: libbitwarden_c_files-${{ matrix.settings.target }} + path: target/${{ matrix.settings.target }}/release-windows/*bitwarden_c* From 99f5c6bbdd5721116fe63c4c6e08a90f13db949d Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Thu, 3 Oct 2024 17:47:50 +0200 Subject: [PATCH 65/77] Format workflows (#1109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking ## 📔 Objective ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .github/workflows/publish-bws.yml | 3 +-- .github/workflows/publish-dotnet.yml | 16 ++++++++-------- .github/workflows/publish-rust-crates.yml | 2 +- .github/workflows/release-dotnet.yml | 1 - 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish-bws.yml b/.github/workflows/publish-bws.yml index 506427faa..dc939a5d6 100644 --- a/.github/workflows/publish-bws.yml +++ b/.github/workflows/publish-bws.yml @@ -14,7 +14,7 @@ on: - Release - Dry Run version: - description: 'Version to publish (default: latest bws cli release)' + description: "Version to publish (default: latest bws cli release)" required: true type: string default: latest @@ -71,7 +71,6 @@ jobs: description: "Deployment ${{ steps.version-output.outputs.version }} from branch ${{ github.ref_name }}" task: release - publish: name: Publish bws to crates.io runs-on: ubuntu-22.04 diff --git a/.github/workflows/publish-dotnet.yml b/.github/workflows/publish-dotnet.yml index baafcc522..1e2fc06f4 100644 --- a/.github/workflows/publish-dotnet.yml +++ b/.github/workflows/publish-dotnet.yml @@ -66,10 +66,10 @@ jobs: uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 id: deployment with: - token: '${{ secrets.GITHUB_TOKEN }}' - initial-status: 'in_progress' - environment: 'dotnet - Production' - description: 'Deployment ${{ needs.validate.outputs.version }} from branch ${{ github.ref_name }}' + token: "${{ secrets.GITHUB_TOKEN }}" + initial-status: "in_progress" + environment: "dotnet - Production" + description: "Deployment ${{ needs.validate.outputs.version }} from branch ${{ github.ref_name }}" task: release - name: Download artifact @@ -100,14 +100,14 @@ jobs: if: ${{ inputs.release_type != 'Dry Run' && success() }} uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 with: - token: '${{ secrets.GITHUB_TOKEN }}' - state: 'success' + token: "${{ secrets.GITHUB_TOKEN }}" + state: "success" deployment-id: ${{ steps.deployment.outputs.deployment_id }} - name: Update deployment status to Failure if: ${{ inputs.release_type != 'Dry Run' && failure() }} uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 with: - token: '${{ secrets.GITHUB_TOKEN }}' - state: 'failure' + token: "${{ secrets.GITHUB_TOKEN }}" + state: "failure" deployment-id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/.github/workflows/publish-rust-crates.yml b/.github/workflows/publish-rust-crates.yml index 43f19323a..bb79aad24 100644 --- a/.github/workflows/publish-rust-crates.yml +++ b/.github/workflows/publish-rust-crates.yml @@ -15,7 +15,7 @@ on: - Redeploy - Dry Run version: - description: 'Version to publish (default: latest rust crates release)' + description: "Version to publish (default: latest rust crates release)" required: true type: string default: latest diff --git a/.github/workflows/release-dotnet.yml b/.github/workflows/release-dotnet.yml index 2e08e8a76..dc8539271 100644 --- a/.github/workflows/release-dotnet.yml +++ b/.github/workflows/release-dotnet.yml @@ -13,7 +13,6 @@ on: - Release - Dry Run - jobs: setup: name: Setup From b74d969dab9502eb1365c79f9bac35ad3469646d Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 4 Oct 2024 10:16:13 +0200 Subject: [PATCH 66/77] [PM-12967] Create bitwarden-wasm-internal (#1089) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking https://bitwarden.atlassian.net/browse/PM-12967 ## 📔 Objective PM SDK. Based on the research spike in #1077 ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .github/workflows/build-wasm-internal.yml | 59 ++++++++ .github/workflows/publish-internal.yml | 136 ++++++++++++++++++ .prettierignore | 4 + Cargo.lock | 51 +++++++ Cargo.toml | 5 +- crates/bitwarden-core/Cargo.toml | 3 + .../src/client/client_settings.rs | 15 +- crates/bitwarden-wasm-internal/Cargo.toml | 28 ++++ crates/bitwarden-wasm-internal/README.md | 25 ++++ crates/bitwarden-wasm-internal/build.sh | 26 ++++ crates/bitwarden-wasm-internal/src/client.rs | 57 ++++++++ crates/bitwarden-wasm-internal/src/lib.rs | 1 + crates/bitwarden/Cargo.toml | 1 + languages/js/sdk-internal/.gitignore | 6 + languages/js/sdk-internal/index.js | 8 ++ languages/js/sdk-internal/package.json | 24 ++++ 16 files changed, 447 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-wasm-internal.yml create mode 100644 .github/workflows/publish-internal.yml create mode 100644 crates/bitwarden-wasm-internal/Cargo.toml create mode 100644 crates/bitwarden-wasm-internal/README.md create mode 100755 crates/bitwarden-wasm-internal/build.sh create mode 100644 crates/bitwarden-wasm-internal/src/client.rs create mode 100644 crates/bitwarden-wasm-internal/src/lib.rs create mode 100644 languages/js/sdk-internal/.gitignore create mode 100644 languages/js/sdk-internal/index.js create mode 100644 languages/js/sdk-internal/package.json diff --git a/.github/workflows/build-wasm-internal.yml b/.github/workflows/build-wasm-internal.yml new file mode 100644 index 000000000..99fe06c44 --- /dev/null +++ b/.github/workflows/build-wasm-internal.yml @@ -0,0 +1,59 @@ +--- +name: Build @bitwarden/sdk-internal + +on: + pull_request: + push: + branches: + - "main" + - "rc" + - "hotfix-rc" + workflow_dispatch: + +defaults: + run: + shell: bash + working-directory: crates/bitwarden-wasm-internal + +jobs: + build: + name: Building @bitwarden/sdk-wasm-internal + runs-on: ubuntu-22.04 + + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Setup Node + uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 + with: + node-version: 20 + registry-url: "https://npm.pkg.github.com" + cache: "npm" + + - name: Install dependencies + run: npm i -g binaryen + + - name: Install rust + uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable + with: + toolchain: stable + targets: wasm32-unknown-unknown + + - name: Cache cargo registry + uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 + with: + key: wasm-cargo-cache + + - name: Install wasm-bindgen-cli + run: cargo install wasm-bindgen-cli + + - name: Build + run: ./build.sh -r + + - name: Upload artifact + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: sdk-internal + path: ${{ github.workspace }}/languages/js/sdk-internal/* + if-no-files-found: error diff --git a/.github/workflows/publish-internal.yml b/.github/workflows/publish-internal.yml new file mode 100644 index 000000000..304fade43 --- /dev/null +++ b/.github/workflows/publish-internal.yml @@ -0,0 +1,136 @@ +--- +name: Publish @bitwarden/sdk-internal +run-name: Publish @bitwarden/sdk-internal ${{ inputs.release_type }} + +on: + workflow_dispatch: + inputs: + release_type: + description: "Release Options" + required: true + default: "Release" + type: choice + options: + - Release + - Dry Run + version: + description: "Release Version" + required: false + default: "latest" + +defaults: + run: + working-directory: languages/js/sdk-internal + +jobs: + setup: + name: Setup + runs-on: ubuntu-22.04 + outputs: + release-version: ${{ steps.version-output.outputs.version }} + tag_name: ${{ steps.version-output.outputs.tag_name }} + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Branch check + if: ${{ inputs.release_type != 'Dry Run' }} + run: | + if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then + echo "===================================" + echo "[!] Can only release from the 'main' branch" + echo "===================================" + exit 1 + fi + + - name: Version output + id: version-output + run: | + if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then + TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("sdk-internal")) | .tag_name' | head -1) + VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') + echo "Latest Released Version: $VERSION" + echo "version=$VERSION" >> $GITHUB_OUTPUT + + echo "Latest Released Tag name: $TAG_NAME" + echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT + else + echo "Release Version: ${{ inputs.version }}" + echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT + fi + + npm: + name: Publish NPM + runs-on: ubuntu-22.04 + needs: setup + env: + _VERSION: ${{ needs.setup.outputs.release-version }} + steps: + - name: Checkout repo + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ needs.setup.outputs.tag_name }} + + - name: Setup Node + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 + with: + node-version: 20 + + - name: Login to Azure + uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 + with: + creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} + + - name: Retrieve secrets + id: retrieve-secrets + uses: bitwarden/gh-actions/get-keyvault-secrets@main + with: + keyvault: "bitwarden-ci" + secrets: "npm-api-key" + + - name: Download artifact + run: | + wget https://github.com/bitwarden/sdk/releases/download/sdk-internal-v${{ env._VERSION }}/sdk-internal.zip + unzip sdk-internal.zip + rm sdk-internal.zip + + - name: Create GitHub deployment + if: ${{ inputs.release_type != 'Dry Run' }} + uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 + id: deployment + with: + token: "${{ secrets.GITHUB_TOKEN }}" + initial-status: "in_progress" + environment: "Bitwarden SDK Internal - Production" + description: "Deployment ${{ env._VERSION }} from branch ${{ github.ref_name }}" + task: release + + - name: Setup NPM + run: | + echo 'registry="https://registry.npmjs.org/"' > ./.npmrc + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ./.npmrc + + echo 'registry="https://registry.npmjs.org/"' > ~/.npmrc + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + env: + NPM_TOKEN: ${{ steps.retrieve-secrets.outputs.npm-api-key }} + + - name: Publish NPM + if: ${{ inputs.release_type != 'Dry Run' }} + run: npm publish --access public --registry=https://registry.npmjs.org/ --userconfig=./.npmrc + + - name: Update deployment status to Success + if: ${{ inputs.release_type != 'Dry Run' && success() }} + uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 + with: + token: "${{ secrets.GITHUB_TOKEN }}" + state: "success" + deployment-id: ${{ steps.deployment.outputs.deployment_id }} + + - name: Update deployment status to Failure + if: ${{ inputs.release_type != 'Dry Run' && failure() }} + uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 + with: + token: "${{ secrets.GITHUB_TOKEN }}" + state: "failure" + deployment-id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/.prettierignore b/.prettierignore index 36c418776..16243942f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,9 @@ target languages/* +!languages/js +languages/js/* +!languages/js/sdk-internal +languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm.js schemas /crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts about.hbs diff --git a/Cargo.lock b/Cargo.lock index 27eddfa65..4e0d14119 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -446,9 +446,11 @@ dependencies = [ "sha2", "thiserror", "tokio", + "tsify-next", "uniffi", "uuid", "validator", + "wasm-bindgen", "wiremock", "zeroize", "zxcvbn", @@ -683,6 +685,20 @@ dependencies = [ "wasm-bindgen-test", ] +[[package]] +name = "bitwarden-wasm-internal" +version = "0.1.0" +dependencies = [ + "bitwarden", + "console_error_panic_hook", + "console_log", + "js-sys", + "log", + "serde_json", + "wasm-bindgen", + "wasm-bindgen-futures", +] + [[package]] name = "blake2" version = "0.10.6" @@ -3509,6 +3525,17 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-wasm-bindgen" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + [[package]] name = "serde_derive" version = "1.0.210" @@ -4155,6 +4182,30 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "tsify-next" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4a645dca4ee0800f5ab60ce166deba2db6a0315de795a2691e138a3d55d756" +dependencies = [ + "serde", + "serde-wasm-bindgen", + "tsify-next-macros", + "wasm-bindgen", +] + +[[package]] +name = "tsify-next-macros" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d5c06f8a51d759bb58129e30b2631739e7e1e4579fad1f30ac09a6c88e488a6" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.79", +] + [[package]] name = "typenum" version = "1.17.0" diff --git a/Cargo.toml b/Cargo.toml index 190341a7e..ce01a7b7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,10 +49,13 @@ serde_qs = ">=0.12.0, <0.14" serde_repr = ">=0.1.12, <0.2" thiserror = ">=1.0.40, <2.0" tokio = { version = "1.36.0", features = ["macros"] } +tsify-next = { version = ">=0.5.4, <0.6", features = [ + "js", +], default-features = false } uniffi = "=0.28.1" uuid = { version = ">=1.3.3, <2.0", features = ["serde", "v4"] } validator = { version = "0.18.1", features = ["derive"] } -wasm-bindgen = { version = "0.2.91", features = ["serde-serialize"] } +wasm-bindgen = { version = ">=0.2.91, <0.3", features = ["serde-serialize"] } wasm-bindgen-futures = "0.4.41" [workspace.lints.clippy] diff --git a/crates/bitwarden-core/Cargo.toml b/crates/bitwarden-core/Cargo.toml index f4b6ec423..d212afb7a 100644 --- a/crates/bitwarden-core/Cargo.toml +++ b/crates/bitwarden-core/Cargo.toml @@ -20,6 +20,7 @@ no-memory-hardening = [ ] # Disable memory hardening features uniffi = ["bitwarden-crypto/uniffi", "dep:uniffi"] # Uniffi bindings secrets = [] # Secrets manager API +wasm = ["dep:wasm-bindgen", "dep:tsify-next"] # WASM support [dependencies] base64 = ">=0.22.1, <0.23" @@ -44,8 +45,10 @@ thiserror = { workspace = true } uniffi = { workspace = true, optional = true, features = ["tokio"] } uuid = { workspace = true } validator = { workspace = true } +wasm-bindgen = { workspace = true, optional = true } zeroize = { version = ">=1.7.0, <2.0", features = ["derive", "aarch64"] } zxcvbn = { version = ">=3.0.1, <4.0", optional = true } +tsify-next = { workspace = true, optional = true } [target.'cfg(not(target_arch="wasm32"))'.dependencies] # By default, we use rustls as the TLS stack and rust-platform-verifier to support user-installed root certificates diff --git a/crates/bitwarden-core/src/client/client_settings.rs b/crates/bitwarden-core/src/client/client_settings.rs index bd678d131..70e2e6839 100644 --- a/crates/bitwarden-core/src/client/client_settings.rs +++ b/crates/bitwarden-core/src/client/client_settings.rs @@ -19,6 +19,11 @@ use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, JsonSchema)] #[serde(default, rename_all = "camelCase", deny_unknown_fields)] #[cfg_attr(feature = "uniffi", derive(uniffi::Record))] +#[cfg_attr( + feature = "wasm", + derive(tsify_next::Tsify), + tsify(into_wasm_abi, from_wasm_abi) +)] pub struct ClientSettings { /// The identity url of the targeted Bitwarden instance. Defaults to `https://identity.bitwarden.com` pub identity_url: String, @@ -44,6 +49,11 @@ impl Default for ClientSettings { #[allow(non_camel_case_types)] #[derive(Serialize, Deserialize, Copy, Clone, Debug, JsonSchema)] #[cfg_attr(feature = "uniffi", derive(uniffi::Enum))] +#[cfg_attr( + feature = "wasm", + derive(tsify_next::Tsify), + tsify(into_wasm_abi, from_wasm_abi) +)] pub enum DeviceType { Android = 0, iOS = 1, @@ -66,6 +76,9 @@ pub enum DeviceType { VivaldiBrowser = 18, VivaldiExtension = 19, SafariExtension = 20, - SDK = 21, + Server = 22, + WindowsCLI = 23, + MacOsCLI = 24, + LinuxCLI = 25, } diff --git a/crates/bitwarden-wasm-internal/Cargo.toml b/crates/bitwarden-wasm-internal/Cargo.toml new file mode 100644 index 000000000..df69015cf --- /dev/null +++ b/crates/bitwarden-wasm-internal/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "bitwarden-wasm-internal" +version = "0.1.0" +publish = false + +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +homepage.workspace = true +repository.workspace = true +license-file.workspace = true +keywords.workspace = true + +[lib] +crate-type = ["cdylib"] + +[dependencies] +bitwarden = { workspace = true, features = ["internal", "wasm"] } +console_error_panic_hook = "0.1.7" +console_log = { version = "1.0.0", features = ["color"] } +js-sys = "0.3.68" +log = "0.4.20" +serde_json = ">=1.0.96, <2.0" +wasm-bindgen = { version = "0.2.91", features = ["serde-serialize"] } +wasm-bindgen-futures = "0.4.41" + +[lints] +workspace = true diff --git a/crates/bitwarden-wasm-internal/README.md b/crates/bitwarden-wasm-internal/README.md new file mode 100644 index 000000000..4db9847f5 --- /dev/null +++ b/crates/bitwarden-wasm-internal/README.md @@ -0,0 +1,25 @@ +# bitwarden-wasm-internal + +**Note:** This is only for internal use. Bitwarden will not provide any support for this crate. + +Requirements: + +- `wasm32-unknown-unknown` rust target. +- `wasm-bindgen-cli` installed. +- `binaryen` installed for `wasm-opt` and `wasm2js`. + +```bash +rustup target add wasm32-unknown-unknown +cargo install -f wasm-bindgen-cli +brew install binaryen +``` + +#### Build + +```bash +# dev +./build.sh + +# release +./build.sh -r +``` diff --git a/crates/bitwarden-wasm-internal/build.sh b/crates/bitwarden-wasm-internal/build.sh new file mode 100755 index 000000000..aa8426c59 --- /dev/null +++ b/crates/bitwarden-wasm-internal/build.sh @@ -0,0 +1,26 @@ +# Move to the root of the repository +cd "$(dirname "$0")" +cd ../../ + +if [ "$1" != "-r" ]; then + # Dev + cargo build -p bitwarden-wasm-internal --target wasm32-unknown-unknown + wasm-bindgen --target bundler --out-dir languages/js/sdk-internal ./target/wasm32-unknown-unknown/debug/bitwarden_wasm_internal.wasm + wasm-bindgen --target nodejs --out-dir languages/js/sdk-internal/node ./target/wasm32-unknown-unknown/debug/bitwarden_wasm_internal.wasm +else + # Release + cargo build -p bitwarden-wasm-internal --target wasm32-unknown-unknown --release + wasm-bindgen --target bundler --out-dir languages/js/sdk-internal ./target/wasm32-unknown-unknown/release/bitwarden_wasm_internal.wasm + wasm-bindgen --target nodejs --out-dir languages/js/sdk-internal/node ./target/wasm32-unknown-unknown/release/bitwarden_wasm_internal.wasm +fi + +# Format +npx prettier --write ./languages/js/sdk-internal + +# Optimize size +wasm-opt -Os ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm -o ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm +wasm-opt -Os ./languages/js/sdk-internal/node/bitwarden_wasm_internal_bg.wasm -o ./languages/js/sdk-internal/node/bitwarden_wasm_internal_bg.wasm + +# Transpile to JS +wasm2js ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm -o ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm.js +npx terser ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm.js -o ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm.js diff --git a/crates/bitwarden-wasm-internal/src/client.rs b/crates/bitwarden-wasm-internal/src/client.rs new file mode 100644 index 000000000..994af1fcf --- /dev/null +++ b/crates/bitwarden-wasm-internal/src/client.rs @@ -0,0 +1,57 @@ +extern crate console_error_panic_hook; +use std::rc::Rc; + +use bitwarden::{Client, ClientSettings}; +use log::{set_max_level, Level}; +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub enum LogLevel { + Trace, + Debug, + Info, + Warn, + Error, +} + +fn convert_level(level: LogLevel) -> Level { + match level { + LogLevel::Trace => Level::Trace, + LogLevel::Debug => Level::Debug, + LogLevel::Info => Level::Info, + LogLevel::Warn => Level::Warn, + LogLevel::Error => Level::Error, + } +} + +// Rc<...> is to avoid needing to take ownership of the Client during our async run_command +// function https://github.com/rustwasm/wasm-bindgen/issues/2195#issuecomment-799588401 +#[wasm_bindgen] +pub struct BitwardenClient(Rc); + +#[wasm_bindgen] +impl BitwardenClient { + #[wasm_bindgen(constructor)] + pub fn new(settings: Option, log_level: Option) -> Self { + console_error_panic_hook::set_once(); + let log_level = convert_level(log_level.unwrap_or(LogLevel::Info)); + if let Err(_e) = console_log::init_with_level(log_level) { + set_max_level(log_level.to_level_filter()) + } + + Self(Rc::new(Client::new(settings))) + } + + /// Test method, echoes back the input + pub fn echo(&self, msg: String) -> String { + msg + } + + /// Test method, calls http endpoint + pub async fn http_get(&self, url: String) -> Result { + let client = self.0.internal.get_http_client(); + let res = client.get(&url).send().await.map_err(|e| e.to_string())?; + + res.text().await.map_err(|e| e.to_string()) + } +} diff --git a/crates/bitwarden-wasm-internal/src/lib.rs b/crates/bitwarden-wasm-internal/src/lib.rs new file mode 100644 index 000000000..b79c47fca --- /dev/null +++ b/crates/bitwarden-wasm-internal/src/lib.rs @@ -0,0 +1 @@ +mod client; diff --git a/crates/bitwarden/Cargo.toml b/crates/bitwarden/Cargo.toml index 9fa5c0cb3..1d09377cf 100644 --- a/crates/bitwarden/Cargo.toml +++ b/crates/bitwarden/Cargo.toml @@ -40,6 +40,7 @@ secrets = [ "dep:bitwarden-sm", "dep:bitwarden-generators", ] # Secrets manager API +wasm = ["bitwarden-core/wasm"] # WASM support [dependencies] bitwarden-api-api = { workspace = true } diff --git a/languages/js/sdk-internal/.gitignore b/languages/js/sdk-internal/.gitignore new file mode 100644 index 000000000..ef69b9de9 --- /dev/null +++ b/languages/js/sdk-internal/.gitignore @@ -0,0 +1,6 @@ +bitwarden_wasm_internal_bg.js +bitwarden_wasm_internal_bg.wasm +bitwarden_wasm_internal_bg.wasm.d.ts +bitwarden_wasm_internal_bg.wasm.js +bitwarden_wasm_internal.d.ts +bitwarden_wasm_internal.js diff --git a/languages/js/sdk-internal/index.js b/languages/js/sdk-internal/index.js new file mode 100644 index 000000000..0525f7aa4 --- /dev/null +++ b/languages/js/sdk-internal/index.js @@ -0,0 +1,8 @@ +import { __wbg_set_wasm } from "./bitwarden_wasm_internal_bg.js"; + +// In order to support a fallback strategy for web we need to conditionally load the wasm file +export function init(wasm) { + __wbg_set_wasm(wasm); +} + +export * from "./bitwarden_wasm_internal_bg.js"; diff --git a/languages/js/sdk-internal/package.json b/languages/js/sdk-internal/package.json new file mode 100644 index 000000000..94b678141 --- /dev/null +++ b/languages/js/sdk-internal/package.json @@ -0,0 +1,24 @@ +{ + "name": "@bitwarden/sdk-internal", + "version": "0.1.0", + "files": [ + "bitwarden_wasm_internal_bg.js", + "bitwarden_wasm_internal_bg.wasm", + "bitwarden_wasm_internal_bg.wasm.d.ts", + "bitwarden_wasm_internal_bg.wasm.js", + "bitwarden_wasm_internal.d.ts", + "bitwarden_wasm_internal.js", + "index.js", + "node/bitwarden_wasm_internal.wasm", + "node/bitwarden_wasm_internal.wasm.d.ts", + "node/bitwarden_wasm_internal.d.ts", + "node/bitwarden_wasm_internal.js" + ], + "main": "node/bitwarden_wasm_internal.js", + "module": "index.js", + "types": "bitwarden_wasm_internal.d.ts", + "scripts": {}, + "sideEffects": [ + "./bitwarden_wasm_internal.js" + ] +} From 3f023405e8a31fc68dd1c78af96e652ef1af203e Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 4 Oct 2024 11:19:11 +0200 Subject: [PATCH 67/77] Fix publish internal (#1111) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking [bitwarden.atlassian.net/browse/PM-12967](https://bitwarden.atlassian.net/browse/PM-12967) ## 📔 Objective We expect to automate this so that every merge to main will publish a new sdk-internal release. Therefore we want to: - Not create github releases - Publish to GH packages ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .github/workflows/publish-internal.yml | 89 +++---------------------- crates/bitwarden-wasm-internal/build.sh | 3 - 2 files changed, 11 insertions(+), 81 deletions(-) diff --git a/.github/workflows/publish-internal.yml b/.github/workflows/publish-internal.yml index 304fade43..7d0ceb198 100644 --- a/.github/workflows/publish-internal.yml +++ b/.github/workflows/publish-internal.yml @@ -15,8 +15,7 @@ on: - Dry Run version: description: "Release Version" - required: false - default: "latest" + required: true defaults: run: @@ -26,9 +25,6 @@ jobs: setup: name: Setup runs-on: ubuntu-22.04 - outputs: - release-version: ${{ steps.version-output.outputs.version }} - tag_name: ${{ steps.version-output.outputs.tag_name }} steps: - name: Checkout repo uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 @@ -43,94 +39,31 @@ jobs: exit 1 fi - - name: Version output - id: version-output - run: | - if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then - TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("sdk-internal")) | .tag_name' | head -1) - VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') - echo "Latest Released Version: $VERSION" - echo "version=$VERSION" >> $GITHUB_OUTPUT - - echo "Latest Released Tag name: $TAG_NAME" - echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT - else - echo "Release Version: ${{ inputs.version }}" - echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT - fi - npm: name: Publish NPM runs-on: ubuntu-22.04 needs: setup - env: - _VERSION: ${{ needs.setup.outputs.release-version }} steps: - name: Checkout repo uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - ref: ${{ needs.setup.outputs.tag_name }} - name: Setup Node uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 - - - name: Login to Azure - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "npm-api-key" + registry-url: "https://npm.pkg.github.com" - name: Download artifact - run: | - wget https://github.com/bitwarden/sdk/releases/download/sdk-internal-v${{ env._VERSION }}/sdk-internal.zip - unzip sdk-internal.zip - rm sdk-internal.zip - - - name: Create GitHub deployment - if: ${{ inputs.release_type != 'Dry Run' }} - uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 - id: deployment + uses: bitwarden/gh-actions/download-artifacts@main with: - token: "${{ secrets.GITHUB_TOKEN }}" - initial-status: "in_progress" - environment: "Bitwarden SDK Internal - Production" - description: "Deployment ${{ env._VERSION }} from branch ${{ github.ref_name }}" - task: release - - - name: Setup NPM - run: | - echo 'registry="https://registry.npmjs.org/"' > ./.npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ./.npmrc - - echo 'registry="https://registry.npmjs.org/"' > ~/.npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - env: - NPM_TOKEN: ${{ steps.retrieve-secrets.outputs.npm-api-key }} + workflow: build-wasm-internal.yml + workflow_conclusion: success + branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + artifacts: sdk-internal - name: Publish NPM if: ${{ inputs.release_type != 'Dry Run' }} - run: npm publish --access public --registry=https://registry.npmjs.org/ --userconfig=./.npmrc - - - name: Update deployment status to Success - if: ${{ inputs.release_type != 'Dry Run' && success() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "success" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} - - - name: Update deployment status to Failure - if: ${{ inputs.release_type != 'Dry Run' && failure() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "failure" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + working-directory: languages/js/sdk-internal diff --git a/crates/bitwarden-wasm-internal/build.sh b/crates/bitwarden-wasm-internal/build.sh index aa8426c59..b02ee1ea1 100755 --- a/crates/bitwarden-wasm-internal/build.sh +++ b/crates/bitwarden-wasm-internal/build.sh @@ -6,12 +6,10 @@ if [ "$1" != "-r" ]; then # Dev cargo build -p bitwarden-wasm-internal --target wasm32-unknown-unknown wasm-bindgen --target bundler --out-dir languages/js/sdk-internal ./target/wasm32-unknown-unknown/debug/bitwarden_wasm_internal.wasm - wasm-bindgen --target nodejs --out-dir languages/js/sdk-internal/node ./target/wasm32-unknown-unknown/debug/bitwarden_wasm_internal.wasm else # Release cargo build -p bitwarden-wasm-internal --target wasm32-unknown-unknown --release wasm-bindgen --target bundler --out-dir languages/js/sdk-internal ./target/wasm32-unknown-unknown/release/bitwarden_wasm_internal.wasm - wasm-bindgen --target nodejs --out-dir languages/js/sdk-internal/node ./target/wasm32-unknown-unknown/release/bitwarden_wasm_internal.wasm fi # Format @@ -19,7 +17,6 @@ npx prettier --write ./languages/js/sdk-internal # Optimize size wasm-opt -Os ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm -o ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm -wasm-opt -Os ./languages/js/sdk-internal/node/bitwarden_wasm_internal_bg.wasm -o ./languages/js/sdk-internal/node/bitwarden_wasm_internal_bg.wasm # Transpile to JS wasm2js ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm -o ./languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm.js From e0a4c2e14f4353a89ba81de407eacb628cf24394 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 4 Oct 2024 11:29:31 +0200 Subject: [PATCH 68/77] Set version when publishing (#1112) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking ## 📔 Objective ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .github/workflows/publish-internal.yml | 7 ++++++- languages/js/sdk-internal/package.json | 7 +------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-internal.yml b/.github/workflows/publish-internal.yml index 7d0ceb198..915b0bfe4 100644 --- a/.github/workflows/publish-internal.yml +++ b/.github/workflows/publish-internal.yml @@ -61,9 +61,14 @@ jobs: branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} artifacts: sdk-internal + - name: Set version + run: | + npm version --no-git-tag-version ${{ inputs.version }} + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Publish NPM if: ${{ inputs.release_type != 'Dry Run' }} run: npm publish --access public env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - working-directory: languages/js/sdk-internal diff --git a/languages/js/sdk-internal/package.json b/languages/js/sdk-internal/package.json index 94b678141..4ce87a3c1 100644 --- a/languages/js/sdk-internal/package.json +++ b/languages/js/sdk-internal/package.json @@ -8,13 +8,8 @@ "bitwarden_wasm_internal_bg.wasm.js", "bitwarden_wasm_internal.d.ts", "bitwarden_wasm_internal.js", - "index.js", - "node/bitwarden_wasm_internal.wasm", - "node/bitwarden_wasm_internal.wasm.d.ts", - "node/bitwarden_wasm_internal.d.ts", - "node/bitwarden_wasm_internal.js" + "index.js" ], - "main": "node/bitwarden_wasm_internal.js", "module": "index.js", "types": "bitwarden_wasm_internal.d.ts", "scripts": {}, From bb93c233314b889c1b53fb3b9b62a106ef68578f Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 4 Oct 2024 13:40:45 +0200 Subject: [PATCH 69/77] Switch to using npm for sdk-internal (#1113) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking ## 📔 Objective It's a hassle to consume an package published on GitHub Packages in GitHub Actions as you need a PAT. Proposing we switch to publishing on npm instead. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .github/workflows/publish-internal.yml | 27 ++- languages/js/sdk-internal/LICENSE | 295 +++++++++++++++++++++++++ languages/js/sdk-internal/README.md | 3 + languages/js/sdk-internal/package.json | 1 + 4 files changed, 322 insertions(+), 4 deletions(-) create mode 100644 languages/js/sdk-internal/LICENSE create mode 100644 languages/js/sdk-internal/README.md diff --git a/.github/workflows/publish-internal.yml b/.github/workflows/publish-internal.yml index 915b0bfe4..6df0b844c 100644 --- a/.github/workflows/publish-internal.yml +++ b/.github/workflows/publish-internal.yml @@ -51,7 +51,18 @@ jobs: uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 - registry-url: "https://npm.pkg.github.com" + + - name: Login to Azure + uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 + with: + creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} + + - name: Retrieve secrets + id: retrieve-secrets + uses: bitwarden/gh-actions/get-keyvault-secrets@main + with: + keyvault: "bitwarden-ci" + secrets: "npm-api-key" - name: Download artifact uses: bitwarden/gh-actions/download-artifacts@main @@ -67,8 +78,16 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Setup NPM + run: | + echo 'registry="https://registry.npmjs.org/"' > ./.npmrc + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ./.npmrc + + echo 'registry="https://registry.npmjs.org/"' > ~/.npmrc + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + env: + NPM_TOKEN: ${{ steps.retrieve-secrets.outputs.npm-api-key }} + - name: Publish NPM if: ${{ inputs.release_type != 'Dry Run' }} - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npm publish --access public --registry=https://registry.npmjs.org/ --userconfig=./.npmrc diff --git a/languages/js/sdk-internal/LICENSE b/languages/js/sdk-internal/LICENSE new file mode 100644 index 000000000..e9d496ff7 --- /dev/null +++ b/languages/js/sdk-internal/LICENSE @@ -0,0 +1,295 @@ +BITWARDEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT +Version 1, 17 March 2023 + +1. Introduction + +1.1 The Bitwarden Software Development Kit (referred to in the License Agreement +as the "SDK" and available for download at the following URL +https://github.com/bitwarden/sdk) is licensed to you subject to the terms of +this License Agreement. The License Agreement forms a legally binding contract +between you and the Company in relation to your use of the SDK. + +1.2 "Bitwarden" means the Bitwarden software made available by the Company, +available for download at the following URL, as updated from time to time. + +1.3 A "Compatible Application" means any software program or service that (i) +connects to and interoperates with a current version of the Bitwarden server +products distributed by the Company; and (ii) complies with the Company’s +acceptable use policy available at the following URL: +https://bitwarden.com/terms/#acceptable_use. + +1.4 "Company" means Bitwarden Inc., organized under the laws of the State of +Delaware. + +2. Accepting this License Agreement + +2.1 In order to access or use the SDK, you must first agree to the License +Agreement. You may not access or use the SDK if you do not accept the License +Agreement. + +2.2 By clicking to accept and/or accessing or using the SDK, you hereby agree to +the terms of the License Agreement. + +2.3 You may not access or use the SDK and may not accept the License Agreement +if you are a person barred from receiving the SDK under the laws of the United +States or other countries, including the country in which you are resident or +from which you access or use the SDK. + +2.4 If you are agreeing to be bound by the License Agreement on behalf of your +employer or any other entity, you represent and warrant that you have full legal +authority to bind your employer or such other entity to the License Agreement. +If you do not have the requisite authority, you may not accept the License +Agreement or you may not access or use the SDK on behalf of your employer or +other entity. + +3. SDK License from Bitwarden + +3.1 Subject to the terms of this License Agreement, Bitwarden grants you a +limited, worldwide, royalty-free, non-assignable, non-exclusive, and +non-sublicensable license to use the SDK solely (a) to develop, test, and +demonstrate a Compatible Application; (b) to develop, test, and run a Compatible +Application for personal use by your family; or (c) to to develop, test, and run +a Compatible Application for the internal business operations of your +organization in connection with a paid license for a Bitwarden server product, +provided that in no case above may the Compatible Application be offered, +licensed, or sold to a third party. + +3.2 You agree that Bitwarden or third parties own all legal right, title and +interest in and to the SDK, including any Intellectual Property Rights that +subsist in the SDK. "Intellectual Property Rights" means any and all rights +under patent law, copyright law, trade secret law, trademark law, and any and +all other proprietary rights. Bitwarden reserves all rights not expressly +granted to you. + +3.3 You may not use this SDK to develop applications for use with software other +than Bitwarden (including non-compatible implementations of Bitwarden) or to +develop another SDK. + +3.4 You may not use the SDK for any purpose not expressly permitted by the +License Agreement. Except for contributions to Bitwarden pursuant to the +Contribution License Agreement available at this URL: +https://cla-assistant.io/bitwarden/clients, or to the extent required by +applicable third party licenses, you may not copy modify, adapt, redistribute, +decompile, reverse engineer, disassemble, or create derivative works of the SDK +or any part of the SDK. + +3.5 Use, reproduction, and distribution of a component of the SDK licensed under +an open source software license are governed solely by the terms of that open +source software license and not the License Agreement. + +3.6 You agree that the form and nature of the SDK that the Company provides may +change without prior notice to you and that future versions of the SDK may be +incompatible with applications developed on previous versions of the SDK. You +agree that the Company may stop (permanently or temporarily) providing the SDK +or any features within the SDK to you or to users generally at the Company’s +sole discretion, without prior notice to you. + +3.7 Nothing in the License Agreement gives you a right to use any of the +Company’s trade names, trademarks, service marks, logos, domain names, or other +distinctive brand features. + +3.8 You agree that you will not remove, obscure, or alter any proprietary rights +notices (including copyright and trademark notices) that may be affixed to or +contained within the SDK. + +4. Use of the SDK by You + +4.1 The Company agrees that it obtains no right, title, or interest from you (or +your licensors) under the License Agreement in or to any software applications +that you develop using the SDK, including any Intellectual Property Rights that +subsist in those applications. + +4.2 You agree to use the SDK and write applications only for purposes that are +permitted by (a) the License Agreement and (b) any applicable law, regulation or +generally accepted practices or guidelines in the relevant jurisdictions +(including any laws regarding the export of data or software to and from the +United States or other relevant countries). + +4.3 You agree that if you use the SDK to develop applications for other users, +you will protect the privacy and legal rights of those users. If the users +provide you with user names, passwords, or other login information or personal +information, you must make the users aware that the information will be +available to your application, and you must provide legally adequate privacy +notice and protection for those users. If your application stores personal or +sensitive information provided by users, it must do so securely. If the user +provides your application with Bitwarden Account information, your application +may only use that information to access the user's Bitwarden Account when, and +for the limited purposes for which, the user has given you permission to do so. + +4.4 You agree that you will not engage in any activity with the SDK, including +the development or distribution of an application, that interferes with, +disrupts, damages, or accesses in an unauthorized manner the servers, networks, +or other properties or services of any third party including, but not limited +to, the Company, or any mobile communications carrier or public cloud service. + +4.5 If you use the SDK to retrieve a user's data from Bitwarden, you acknowledge +and agree that you shall retrieve data only with the user's explicit consent and +only when, and for the limited purposes for which, the user has given you +permission to do so. + +4.6 You agree that you are solely responsible for, and that the Company has no +responsibility to you or to any third party for, any data, content, or resources +that you create, transmit or display through Bitwarden and/or applications for +Bitwarden, and for the consequences of your actions (including any loss or +damage which Bitwarden may suffer) by doing so. + +4.7 You agree that you are solely responsible for, and that the Company has no +responsibility to you or to any third party for, any breach of your obligations +under the License Agreement, any applicable third party contract or Terms of +Service, or any applicable law or regulation, and for the consequences +(including any loss or damage which the Company or any third party may suffer) +of any such breach. + +5. Third Party Applications + +5.1 If you use the SDK to integrate or run applications developed by a third +party or that access data, content or resources provided by a third party, you +agree that the Company is not responsible for those applications, data, content, +or resources. You understand that all data, content or resources which you may +access through such third party applications are the sole responsibility of the +person from which they originated and that the Company is not liable for any +loss or damage that you may experience as a result of the use or access of any +of those third party applications, data, content, or resources. + +5.2 You should be aware that the data, content, and resources presented to you +through such a third party application may be protected by intellectual property +rights which are owned by the providers (or by other persons or companies on +their behalf). You acknowledge that your use of such third party applications, +data, content, or resources may be subject to separate terms between you and the +relevant third party. In that case, the License Agreement does not affect your +legal relationship with these third parties. + +6. Use of Bitwarden Server + +You acknowledge and agree that the Bitwarden server products to which any +Compatible Application must connect is protected by intellectual property rights +which are owned by the Company and your use of the Bitwarden server products is +subject to additional terms not set forth in this License Agreement. + +7. Terminating this License Agreement + +7.1 The License Agreement will continue to apply until terminated by either you +or the Company as set out below. + +7.2 If you want to terminate the License Agreement, you may do so by ceasing +your use of the SDK and any relevant developer credentials. + +7.3 The Company may at any time, terminate the License Agreement with you if: + +(a) you have breached any provision of the License Agreement; or + +(b) the Company is required to do so by law; or + +(c) a third party with whom the Company offered certain parts of the SDK to you +has terminated its relationship with the Company or ceased to offer certain +parts of the SDK to either the Company or to you; or + +(d) the Company decides to no longer provide the SDK or certain parts of the SDK +to users in the country in which you are resident or from which you use the +service, or the provision of the SDK or certain SDK services to you by the +Company is, in the Company’'s sole discretion, no longer commercially viable or +technically practicable. + +7.4 When the License Agreement comes to an end, all of the legal rights, +obligations and liabilities that you and the Company have benefited from, been +subject to (or which have accrued over time whilst the License Agreement has +been in force) or which are expressed to continue indefinitely, shall be +unaffected by this cessation, and the provisions of paragraph 12.8 shall +continue to apply to such rights, obligations and liabilities indefinitely. + +8. NO SUPPORT + +The Company is not obligated under this License Agreement to provide you any +support services for the SDK. Any support provided is at the Company’s sole +discretion and provided on an "as is" basis and without warranty of any kind. + +9. DISCLAIMER OF WARRANTIES + +9.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE +RISK AND THAT THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF +ANY KIND FROM Bitwarden. + +9.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED +THROUGH THE USE OF THE SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY +RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF +DATA THAT RESULTS FROM SUCH USE. + +9.3 THE COMPANY FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY +KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED +WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE +AND NON-INFRINGEMENT. + +10. LIMITATION OF LIABILITY + +YOU EXPRESSLY UNDERSTAND AND AGREE THAT THE COMPANY, ITS SUBSIDIARIES AND +AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF +LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, +STATUTORY, OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY LOSS +OF DATA, WHETHER OR NOT THE COMPANY OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF +OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING. + +11. Indemnification + +To the maximum extent permitted by law, you agree to defend, indemnify and hold +harmless the Company, its affiliates and their respective directors, officers, +employees and agents from and against any and all claims, actions, suits or +proceedings, as well as any and all losses, liabilities, damages, costs and +expenses (including reasonable attorneys fees) arising out of or accruing from +(a) your use of the SDK, (b) any application you develop on the SDK that +infringes any copyright, trademark, trade secret, trade dress, patent or other +intellectual property right of any person or defames any person or violates +their rights of publicity or privacy, and (c) any non-compliance by you with the +License Agreement. + +12. General Legal Terms + +12.1 The Company may make changes to the License Agreement as it distributes new +versions of the SDK. When these changes are made, the Company will make a new +version of the License Agreement available on the website where the SDK is made +available. + +12.2 The License Agreement constitutes the whole legal agreement between you and +the Company and governs your use of the SDK (excluding any services or software +which the Company may provide to you under a separate written agreement), and +completely replaces any prior agreements between you and the Company in relation +to the SDK. + +12.3 You agree that if the Company does not exercise or enforce any legal right +or remedy which is contained in the License Agreement (or which the Company has +the benefit of under any applicable law), this will not be taken to be a formal +waiver of the Company's rights and that those rights or remedies will still be +available to the Company. + +12.4 If any court of law, having the jurisdiction to decide on this matter, +rules that any provision of the License Agreement is invalid, then that +provision will be removed from the License Agreement without affecting the rest +of the License Agreement. The remaining provisions of the License Agreement will +continue to be valid and enforceable. + +12.5 You acknowledge and agree that each member of the group of companies of +which the Company is the parent shall be third party beneficiaries to the +License Agreement and that such other companies shall be entitled to directly +enforce, and rely upon, any provision of the License Agreement that confers a +benefit on them or rights in favor of them. Other than this, no other person or +company shall be third party beneficiaries to the License Agreement. + +12.6 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND +REGULATIONS. YOU MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND +REGULATIONS THAT APPLY TO THE SDK. THESE LAWS INCLUDE RESTRICTIONS ON +DESTINATIONS, END USERS, AND END USE. + +12.7 The rights granted in the License Agreement may not be assigned or +transferred by either you or the Company without the prior written approval of +the other party, provided that the Company may assign this License Agreement +upon notice to you in connection with an acquisition, merger, sale of assets, or +similar corporate change in control for the Company or the Intellectual Property +Rights in the SDK. + +12.8 The License Agreement, and any dispute relating to or arising out of this +License Agreement, shall be governed by the laws of the State of California +without regard to its conflict of laws provisions. You and the Company agree to +submit to the exclusive jurisdiction of the courts located within the county of +Los Angeles, California to resolve any dispute or legal matter arising from the +License Agreement. Notwithstanding this, you agree that the Company shall be +allowed to apply for injunctive remedies, or any equivalent type of urgent legal +relief, in any forum or jurisdiction. diff --git a/languages/js/sdk-internal/README.md b/languages/js/sdk-internal/README.md new file mode 100644 index 000000000..9391aa071 --- /dev/null +++ b/languages/js/sdk-internal/README.md @@ -0,0 +1,3 @@ +# @bitwarden/sdk-internal + +**Note:** This is only for internal use. Bitwarden will not provide any support for this package. diff --git a/languages/js/sdk-internal/package.json b/languages/js/sdk-internal/package.json index 4ce87a3c1..51cfa577c 100644 --- a/languages/js/sdk-internal/package.json +++ b/languages/js/sdk-internal/package.json @@ -1,6 +1,7 @@ { "name": "@bitwarden/sdk-internal", "version": "0.1.0", + "license": "SEE LICENSE IN LICENSE", "files": [ "bitwarden_wasm_internal_bg.js", "bitwarden_wasm_internal_bg.wasm", From 5dd990954004e4e0e2c04553f632a1d1d6c02cd4 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 4 Oct 2024 14:24:14 +0200 Subject: [PATCH 70/77] Ensure the built files are added to published (#1114) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking ## 📔 Objective ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .github/workflows/publish-internal.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-internal.yml b/.github/workflows/publish-internal.yml index 6df0b844c..13f3a9d97 100644 --- a/.github/workflows/publish-internal.yml +++ b/.github/workflows/publish-internal.yml @@ -71,6 +71,7 @@ jobs: workflow_conclusion: success branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} artifacts: sdk-internal + path: languages/js/sdk-internal - name: Set version run: | From 16a8496bfb62d78c9692a44515f63e73248e7aab Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 4 Oct 2024 17:04:39 +0200 Subject: [PATCH 71/77] Publish node compatible sdk (#1115) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking ## 📔 Objective ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- crates/bitwarden-wasm-internal/build.sh | 2 ++ languages/js/sdk-internal/package.json | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/bitwarden-wasm-internal/build.sh b/crates/bitwarden-wasm-internal/build.sh index b02ee1ea1..109037e89 100755 --- a/crates/bitwarden-wasm-internal/build.sh +++ b/crates/bitwarden-wasm-internal/build.sh @@ -6,10 +6,12 @@ if [ "$1" != "-r" ]; then # Dev cargo build -p bitwarden-wasm-internal --target wasm32-unknown-unknown wasm-bindgen --target bundler --out-dir languages/js/sdk-internal ./target/wasm32-unknown-unknown/debug/bitwarden_wasm_internal.wasm + wasm-bindgen --target nodejs --out-dir languages/js/sdk-internal/node ./target/wasm32-unknown-unknown/debug/bitwarden_wasm_internal.wasm else # Release cargo build -p bitwarden-wasm-internal --target wasm32-unknown-unknown --release wasm-bindgen --target bundler --out-dir languages/js/sdk-internal ./target/wasm32-unknown-unknown/release/bitwarden_wasm_internal.wasm + wasm-bindgen --target nodejs --out-dir languages/js/sdk-internal/node ./target/wasm32-unknown-unknown/release/bitwarden_wasm_internal.wasm fi # Format diff --git a/languages/js/sdk-internal/package.json b/languages/js/sdk-internal/package.json index 51cfa577c..29e5c5a54 100644 --- a/languages/js/sdk-internal/package.json +++ b/languages/js/sdk-internal/package.json @@ -9,8 +9,13 @@ "bitwarden_wasm_internal_bg.wasm.js", "bitwarden_wasm_internal.d.ts", "bitwarden_wasm_internal.js", - "index.js" + "index.js", + "node/bitwarden_wasm_internal_bg.wasm", + "node/bitwarden_wasm_internal_bg.wasm.d.ts", + "node/bitwarden_wasm_internal.d.ts", + "node/bitwarden_wasm_internal.js" ], + "main": "node/bitwarden_wasm_internal.js", "module": "index.js", "types": "bitwarden_wasm_internal.d.ts", "scripts": {}, From 3db0850ad83b802745251cfd25d42cb43a8b601f Mon Sep 17 00:00:00 2001 From: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:27:11 -0600 Subject: [PATCH 72/77] Bump go-sdk version to 1.0.2 (#1118) ## Type of change - [ ] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [X] Other ## Objective Automated go-sdk version bump to 1.0.2 --- languages/go/.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/go/.version b/languages/go/.version index 7f207341d..e6d5cb833 100644 --- a/languages/go/.version +++ b/languages/go/.version @@ -1 +1 @@ -1.0.1 \ No newline at end of file +1.0.2 \ No newline at end of file From a76013c44829874ab0f8e20ba733693c3d9256ca Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:46:50 -0400 Subject: [PATCH 73/77] [deps]: Update System.Text.Json to 8.0.5 [SECURITY] (#1121) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [System.Text.Json](https://dot.net/) ([source](https://redirect.github.com/dotnet/runtime)) | `8.0.4` -> `8.0.5` | [![age](https://developer.mend.io/api/mc/badges/age/nuget/System.Text.Json/8.0.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/nuget/System.Text.Json/8.0.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/nuget/System.Text.Json/8.0.4/8.0.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/System.Text.Json/8.0.4/8.0.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | ### GitHub Vulnerability Alerts #### [CVE-2024-43485](https://redirect.github.com/dotnet/runtime/security/advisories/GHSA-8g4q-xg66-9fp4) # Microsoft Security Advisory CVE-2024-43485 | .NET Denial of Service Vulnerability ## Executive summary Microsoft is releasing this security advisory to provide information about a vulnerability in System.Text.Json 6.0.x and 8.0.x. This advisory also provides guidance on what developers can do to update their applications to remove this vulnerability. In System.Text.Json 6.0.x and 8.0.x, applications which deserialize input to a model with an `[ExtensionData]` property can be vulnerable to an algorithmic complexity attack resulting in Denial of Service. ## Announcement Announcement for this issue can be found at [https://github.com/dotnet/announcements/issues/329](https://redirect.github.com/dotnet/announcements/issues/329) ## Mitigation factors JSON models which do not utilize the `[ExtensionData]` feature are not impacted by this vulnerability. ## Affected software * Any .NET 8.0 application running on .NET 8.0.8 or earlier. * Any .NET 6.0 aplication running on .NET 6.0.33 or earlier. * Any application consuming one of the [vulnerable packages](affected-packages). ## Affected Packages The vulnerability affects any Microsoft .NET Core project if it uses any of affected packages versions listed below ### .NET 8 Package name | Affected version | Patched version ------------ | ---------------- | ------------------------- [System.Text.Json](https://www.nuget.org/packages/System.Text.Json) | >= 8.0.0, <= 8.0.4 | 8.0.5 ### .NET 6 Package name | Affected version | Patched version ------------ | ---------------- | ------------------------- [System.Text.Json](https://www.nuget.org/packages/System.Text.Json) | >= 6.0.0, <= 6.0.9 | 6.0.10 ## Advisory FAQ ### How do I know if I am affected? If you have a runtime or SDK with a version listed, or an affected package listed in [affected software](#affected-packages) or [affected packages](#affected-software), you're exposed to the vulnerability. ### How do I fix the issue? * To fix the issue please install the latest version of .NET 8.0 or .NET 6.0. If you have installed one or more .NET SDKs through Visual Studio, Visual Studio will prompt you to update Visual Studio, which will also update your .NET SDKs. * .NET Framework-based applications and other application types need to perform a package update. * If you have .NET 6.0 or greater installed, you can list the versions you have installed by running the `dotnet --info` command. You will see output like the following; ``` .NET Core SDK (reflecting any global.json): Version: 8.0.200 Commit: 8473146e7d Runtime Environment: OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.300\ Host (useful for support): Version: 8.0.3 Commit: 8473146e7d .NET Core SDKs installed: 8.0.200 [C:\Program Files\dotnet\sdk] .NET Core runtimes installed: Microsoft.AspAspNetCore.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspAspNetCore.App] Microsoft.AspNetCore.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.WindowsDesktop.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download ``` * If you're using .NET 6.0, you should download and install .NET 6.0.35 Runtime or .NET 6.0.135 SDK (for Visual Studio 2022 v17.6) from https://dotnet.microsoft.com/download/dotnet-core/6.0. * If you're using .NET 8.0, you should download and install .NET 8.0.10 Runtime or .NET 8.0.110 SDK (for Visual Studio 2022 v17.8) from https://dotnet.microsoft.com/download/dotnet-core/8.0. .NET 8.0 and .NET 6.0 updates are also available from Microsoft Update. To access this either type "Check for updates" in your Windows search, or open Settings, choose Update & Security and then click Check for Updates. Once you have installed the updated runtime or SDK, restart your apps for the update to take effect. Additionally, if you've deployed [self-contained applications](https://docs.microsoft.com/dotnet/core/deploying/#self-contained-deployments-scd) targeting any of the impacted versions, these applications are also vulnerable and must be recompiled and redeployed. ## Other Information ### Reporting Security Issues If you have found a potential security issue in .NET 8.0 or .NET 6.0, please email details to secure@microsoft.com. Reports may qualify for the Microsoft .NET Core & .NET 5 Bounty. Details of the Microsoft .NET Bounty Program including terms and conditions are at . ### Support You can ask questions about this issue on GitHub in the .NET GitHub organization. The main repos are located at https://github.com/dotnet/runtime and https://github.com/dotnet/aspnet/. The Announcements repo (https://github.com/dotnet/Announcements) will contain this bulletin as an issue and will include a link to a discussion issue. You can ask questions in the linked discussion issue. ### Disclaimer The information provided in this advisory is provided "as is" without warranty of any kind. Microsoft disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Microsoft Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Microsoft Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply. ### External Links [CVE-2024-43485]( https://www.cve.org/CVERecord?id=CVE-2024-43485) ### Revisions V1.0 (October 08, 2024): Advisory published. _Version 1.0_ _Last Updated 2024-10-08_ --- ### Release Notes
dotnet/runtime (System.Text.Json) ### [`v8.0.5`](https://redirect.github.com/dotnet/runtime/releases/tag/v8.0.5): .NET 8.0.5 [Release](https://redirect.github.com/dotnet/core/releases/tag/v8.0.5) #### What's Changed - \[release/8.0-staging] Fix AsyncVoidMethodBuilder race condition around SynchronizationContext by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99640](https://redirect.github.com/dotnet/runtime/pull/99640) - \[release/8.0-staging] Always keep global symbols on ApplePlatforms by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99650](https://redirect.github.com/dotnet/runtime/pull/99650) - \[release/8.0-staging] Delete Decrypt_Pkcs1\_ErrorsForInvalidPadding by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99653](https://redirect.github.com/dotnet/runtime/pull/99653) - \[8.0] Rename MSBuild property MicrosoftNativeQuicMsQuicVersion -> MicrosoftNativeQuicMsQuicSchannelVersion by [@​carlossanlop](https://redirect.github.com/carlossanlop) in [https://github.com/dotnet/runtime/pull/99714](https://redirect.github.com/dotnet/runtime/pull/99714) - \[release/8.0] Fixing SignedXml.CheckSignature for enveloped signature with `#xpointer(/)` Reference by [@​bartonjs](https://redirect.github.com/bartonjs) in [https://github.com/dotnet/runtime/pull/99651](https://redirect.github.com/dotnet/runtime/pull/99651) - \[release/8.0-staging] disable optimizations for PopCount by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99832](https://redirect.github.com/dotnet/runtime/pull/99832) - \[release/8.0-staging] Handle NativeOverlapped\* coming from both the Windows or Portable thread pool in NativeRuntimeEventSource by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99656](https://redirect.github.com/dotnet/runtime/pull/99656) - \[release/8.0-staging] Fix exporting certificate keys on macOS 14.4. by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99776](https://redirect.github.com/dotnet/runtime/pull/99776) - \[release/8.0] Upgrade zlib to 1.3.1 by [@​carlossanlop](https://redirect.github.com/carlossanlop) in [https://github.com/dotnet/runtime/pull/99473](https://redirect.github.com/dotnet/runtime/pull/99473) - \[release/8.0] Fix failing CertificateValidationRemoteServer.ConnectWithRevocation_WithCallback test ([#​99915](https://redirect.github.com/dotnet/runtime/issues/99915)) by [@​rzikm](https://redirect.github.com/rzikm) in [https://github.com/dotnet/runtime/pull/99950](https://redirect.github.com/dotnet/runtime/pull/99950) - \[mono] Stop exporting ICU symbols from Mono by [@​matouskozak](https://redirect.github.com/matouskozak) in [https://github.com/dotnet/runtime/pull/99449](https://redirect.github.com/dotnet/runtime/pull/99449) - \[release/8.0-staging] Fix AV in HttpTelemetry.WriteEvent by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99607](https://redirect.github.com/dotnet/runtime/pull/99607) - \[release/8.0-staging] \[HTTP/2] Fix handling of effectively empty DATA frame ([#​99502](https://redirect.github.com/dotnet/runtime/issues/99502)) by [@​ManickaP](https://redirect.github.com/ManickaP) in [https://github.com/dotnet/runtime/pull/99677](https://redirect.github.com/dotnet/runtime/pull/99677) - \[release/8.0-staging] \[HttpStress] \[SslStress] Workaround image bug in 1es-windows-2022-open by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100303](https://redirect.github.com/dotnet/runtime/pull/100303) - \[release/8.0-staging] Support building against clang 18 by [@​omajid](https://redirect.github.com/omajid) in [https://github.com/dotnet/runtime/pull/100258](https://redirect.github.com/dotnet/runtime/pull/100258) - \[release/8.0]\[browser] WebSocket works differently depending on if we look up its state or not by [@​ilonatommy](https://redirect.github.com/ilonatommy) in [https://github.com/dotnet/runtime/pull/99673](https://redirect.github.com/dotnet/runtime/pull/99673) - \[release/8.0-staging] Call the Copy Constructor for stack arguments in C++/CLI on x86 by [@​AaronRobinsonMSFT](https://redirect.github.com/AaronRobinsonMSFT) in [https://github.com/dotnet/runtime/pull/100221](https://redirect.github.com/dotnet/runtime/pull/100221) - \[release/8.0] Don't unset ALPN list pointer during ALPN selection callback. by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99670](https://redirect.github.com/dotnet/runtime/pull/99670) - \[release/8.0-staging]\[mono]\[debugger] Fix inspect Span by [@​thaystg](https://redirect.github.com/thaystg) in [https://github.com/dotnet/runtime/pull/99844](https://redirect.github.com/dotnet/runtime/pull/99844) - Update branding to 8.0.5 by [@​vseanreesermsft](https://redirect.github.com/vseanreesermsft) in [https://github.com/dotnet/runtime/pull/100547](https://redirect.github.com/dotnet/runtime/pull/100547) - \[release/8.0-staging] Ensure that Sse3.MoveAndDuplicate correctly tracks supporting SIMD scalar loads by [@​tannergooding](https://redirect.github.com/tannergooding) in [https://github.com/dotnet/runtime/pull/100417](https://redirect.github.com/dotnet/runtime/pull/100417) - \[release/8.0] Avoid allocating collectible instances in the frozen heap ([#​100444](https://redirect.github.com/dotnet/runtime/issues/100444)) by [@​jkotas](https://redirect.github.com/jkotas) in [https://github.com/dotnet/runtime/pull/100509](https://redirect.github.com/dotnet/runtime/pull/100509) - \[release/8.0-staging] Use clang --version to get Apple toolset version by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100199](https://redirect.github.com/dotnet/runtime/pull/100199) - \[release/8.0-staging] Azure Linux 3.0 deps package by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100684](https://redirect.github.com/dotnet/runtime/pull/100684) - \[release/8.0-staging] Fix Http2 deadlock by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100086](https://redirect.github.com/dotnet/runtime/pull/100086) - Merging internal commits for release/8.0 by [@​vseanreesermsft](https://redirect.github.com/vseanreesermsft) in [https://github.com/dotnet/runtime/pull/100835](https://redirect.github.com/dotnet/runtime/pull/100835) - \[release/8.0-staging] Update CI builds to not use VS Previews by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100622](https://redirect.github.com/dotnet/runtime/pull/100622) - \[release/8.0-staging] Update dependencies from dotnet/hotreload-utils by [@​dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/100892](https://redirect.github.com/dotnet/runtime/pull/100892) - \[release/8.0-staging] Update dependencies from dotnet/runtime-assets by [@​dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/100073](https://redirect.github.com/dotnet/runtime/pull/100073) - \[automated] Merge branch 'release/8.0' => 'release/8.0-staging' by [@​dotnet-maestro-bot](https://redirect.github.com/dotnet-maestro-bot) in [https://github.com/dotnet/runtime/pull/99585](https://redirect.github.com/dotnet/runtime/pull/99585) - \[release/8.0-staging] Update dependencies from dotnet/source-build-externals by [@​dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/99601](https://redirect.github.com/dotnet/runtime/pull/99601) - \[release/8.0-staging] Update dependencies from dotnet/xharness by [@​dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/100883](https://redirect.github.com/dotnet/runtime/pull/100883) - \[release/8.0-staging] Update dependencies from dotnet/source-build-reference-packages by [@​dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/99902](https://redirect.github.com/dotnet/runtime/pull/99902) - \[release/8.0-staging] Update dependencies from dotnet/source-build-externals by [@​dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/100015](https://redirect.github.com/dotnet/runtime/pull/100015) - \[release/8.0-staging] Update dependencies from dotnet/runtime-assets by [@​dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/100958](https://redirect.github.com/dotnet/runtime/pull/100958) - \[release/8.0-staging] Update dependencies from dotnet/arcade by [@​dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/100885](https://redirect.github.com/dotnet/runtime/pull/100885) - \[release/8.0-staging] Fix native leak in CryptoNative_GetX509nameInfo by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100793](https://redirect.github.com/dotnet/runtime/pull/100793) - \[release/8.0-staging] Update dependencies from dotnet/emsdk by [@​dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/99696](https://redirect.github.com/dotnet/runtime/pull/99696) - \[release/8.0-staging] \[mono]\[debugger] Search for seqpoints directly from jitinfo if it's not find on get_default_jit_mm by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100978](https://redirect.github.com/dotnet/runtime/pull/100978) - \[release/8.0]\[browser] fix emscripten out/err overrides by [@​pavelsavara](https://redirect.github.com/pavelsavara) in [https://github.com/dotnet/runtime/pull/100818](https://redirect.github.com/dotnet/runtime/pull/100818) - \[release/8.0-staging] \[mono]\[eventpipe] Fix firing dynamic method wrappers crash by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99712](https://redirect.github.com/dotnet/runtime/pull/99712) - Update Alpine versions for `release/8.0-staging` by [@​richlander](https://redirect.github.com/richlander) in [https://github.com/dotnet/runtime/pull/99849](https://redirect.github.com/dotnet/runtime/pull/99849) - \[release/8.0-staging] Guard against -1 Returned from sysconf for the Cache Sizes Causing Large Gen0 Sizes and Budgets for Certain Linux Distributions. by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100575](https://redirect.github.com/dotnet/runtime/pull/100575) - \[Release/8.0] Remove preventing EH at shutdown by [@​janvorli](https://redirect.github.com/janvorli) in [https://github.com/dotnet/runtime/pull/100836](https://redirect.github.com/dotnet/runtime/pull/100836) - \[release/8.8] Add metadata for workload automation by [@​joeloff](https://redirect.github.com/joeloff) in [https://github.com/dotnet/runtime/pull/100649](https://redirect.github.com/dotnet/runtime/pull/100649) - \[8.0] Reset OOB packages enabled in the April release by [@​carlossanlop](https://redirect.github.com/carlossanlop) in [https://github.com/dotnet/runtime/pull/99583](https://redirect.github.com/dotnet/runtime/pull/99583) - \[release/8.0-staging] Always zero-init if object contains pointers by [@​VSadov](https://redirect.github.com/VSadov) in [https://github.com/dotnet/runtime/pull/100426](https://redirect.github.com/dotnet/runtime/pull/100426) - \[release/8.0-staging] JIT: Fixed incorrect reversed condition for GT by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100372](https://redirect.github.com/dotnet/runtime/pull/100372) - \[manual] Merge release/8.0-staging into release/8.0 by [@​directhex](https://redirect.github.com/directhex) in [https://github.com/dotnet/runtime/pull/101091](https://redirect.github.com/dotnet/runtime/pull/101091) - \[release/8.0] \[release/8.0] Update MicrosoftBuildVersion to latest by [@​github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/101145](https://redirect.github.com/dotnet/runtime/pull/101145) **Full Changelog**: https://github.com/dotnet/runtime/compare/v8.0.4...v8.0.5
--- ### Configuration 📅 **Schedule**: Branch creation - "" (UTC), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/bitwarden/sdk). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj b/languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj index d2363f4a9..a7c82e4b5 100644 --- a/languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj +++ b/languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj @@ -25,7 +25,7 @@ - + From 89b23bd85ea09f3af43a41e216cfd7fe9917b188 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:02:59 +0200 Subject: [PATCH 74/77] [deps]: Lock file maintenance (#1125) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Update | Change | |---|---| | lockFileMaintenance | All locks refreshed | 🔧 This Pull Request updates lock files to use the latest dependency versions. --- ### Configuration 📅 **Schedule**: Branch creation - "every 2nd week starting on the 2 week of the year before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). đŸšĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. â™ģ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. đŸ‘ģ **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/bitwarden/sdk). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 190 +++++++++++----------- languages/js/sdk-client/package-lock.json | 12 +- package-lock.json | 18 +- 3 files changed, 111 insertions(+), 109 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4e0d14119..5397271ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -861,9 +861,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.22" +version = "1.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9540e661f81799159abee814118cc139a2004b3a3aa3ea37724a1b66530b90e0" +checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" dependencies = [ "shlex", ] @@ -935,9 +935,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.18" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -945,9 +945,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.18" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -957,9 +957,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.29" +version = "4.5.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8937760c3f4c60871870b8c3ee5f9b30771f792a7045c48bcbba999d7d6b3b8e" +checksum = "9646e2e245bf62f45d39a0f3f36f1171ad1ea0d6967fd114bca72cb02a8fcdfb" dependencies = [ "clap", ] @@ -984,9 +984,9 @@ checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "clap_mangen" -version = "0.2.23" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17415fd4dfbea46e3274fcd8d368284519b358654772afb700dc2e8d2b24eeb" +checksum = "fbae9cbfdc5d4fa8711c09bd7b83f644cb48281ac35bf97af3e47b0675864bdf" dependencies = [ "clap", "roff", @@ -1414,18 +1414,18 @@ dependencies = [ [[package]] name = "derive_builder" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd33f37ee6a119146a1781d3356a7c26028f83d779b2e04ecd45fdc75c76877b" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" dependencies = [ "derive_builder_macro", ] [[package]] name = "derive_builder_core" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7431fa049613920234f22c47fdc33e6cf3ee83067091ea4277a3f8c4587aae38" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" dependencies = [ "darling", "proc-macro2", @@ -1435,9 +1435,9 @@ dependencies = [ [[package]] name = "derive_builder_macro" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4abae7035bf79b9877b779505d8cf3749285b80c43941eda66604841889451dc" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", "syn 2.0.79", @@ -1652,9 +1652,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1667,9 +1667,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1677,15 +1677,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1694,15 +1694,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", @@ -1711,21 +1711,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1840,7 +1840,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.5.0", + "indexmap 2.6.0", "slab", "tokio", "tokio-util", @@ -1869,6 +1869,12 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + [[package]] name = "heck" version = "0.4.1" @@ -1962,9 +1968,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -2093,12 +2099,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.0", "serde", ] @@ -2137,9 +2143,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "is-terminal" @@ -2210,9 +2216,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "0cb94a0ffd3f3ee755c20f7d8752f45cac88605a4dcf808abcff72873296ec7b" dependencies = [ "wasm-bindgen", ] @@ -2551,12 +2557,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.1" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" -dependencies = [ - "portable-atomic", -] +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "onig" @@ -2706,7 +2709,7 @@ dependencies = [ "coset", "data-encoding", "getrandom", - "indexmap 2.5.0", + "indexmap 2.6.0", "rand", "serde", "serde_json", @@ -2816,7 +2819,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016" dependencies = [ "base64", - "indexmap 2.5.0", + "indexmap 2.6.0", "quick-xml", "serde", "time", @@ -2906,9 +2909,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -3110,9 +3113,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355ae415ccd3a04315d3f8246e86d67689ea74d88d915576e1589a351062a13b" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] @@ -3159,9 +3162,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.7" +version = "0.12.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" +checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" dependencies = [ "base64", "bytes", @@ -3287,9 +3290,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.13" +version = "0.23.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" +checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" dependencies = [ "once_cell", "ring", @@ -3314,11 +3317,10 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64", "rustls-pki-types", ] @@ -3389,9 +3391,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" +checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" dependencies = [ "windows-sys 0.59.0", ] @@ -3564,7 +3566,7 @@ version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.6.0", "itoa", "memchr", "ryu", @@ -3616,15 +3618,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.9.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" +checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" dependencies = [ "base64", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.5.0", + "indexmap 2.6.0", "serde", "serde_derive", "serde_json", @@ -3634,9 +3636,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.9.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" +checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" dependencies = [ "darling", "proc-macro2", @@ -3650,7 +3652,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.6.0", "itoa", "ryu", "serde", @@ -4122,7 +4124,7 @@ version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.6.0", "serde", "serde_spanned", "toml_datetime", @@ -4223,9 +4225,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" @@ -4313,9 +4315,9 @@ dependencies = [ [[package]] name = "uniffi_checksum_derive" -version = "0.28.1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a22dbe67c1c957ac6e7611bdf605a6218aa86b0eebeb8be58b70ae85ad7d73dc" +checksum = "d2c801f0f05b06df456a2da4c41b9c2c4fdccc6b9916643c6c67275c4c9e4d07" dependencies = [ "quote", "syn 2.0.79", @@ -4507,9 +4509,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "ef073ced962d62984fb38a36e5fdc1a2b23c9e0e1fa0689bb97afa4202ef6887" dependencies = [ "cfg-if", "once_cell", @@ -4520,9 +4522,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "c4bfab14ef75323f4eb75fa52ee0a3fb59611977fd3240da19b2cf36ff85030e" dependencies = [ "bumpalo", "log", @@ -4535,9 +4537,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "65471f79c1022ffa5291d33520cbbb53b7687b01c2f8e83b57d102eed7ed479d" dependencies = [ "cfg-if", "js-sys", @@ -4547,9 +4549,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "a7bec9830f60924d9ceb3ef99d55c155be8afa76954edffbb5936ff4509474e7" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4557,9 +4559,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "4c74f6e152a76a2ad448e223b0fc0b6b5747649c3d769cc6bf45737bf97d0ed6" dependencies = [ "proc-macro2", "quote", @@ -4570,15 +4572,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "a42f6c679374623f295a8623adfe63d9284091245c3504bde47c17a3ce2777d9" [[package]] name = "wasm-bindgen-test" -version = "0.3.43" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68497a05fb21143a08a7d24fc81763384a3072ee43c44e86aad1744d6adef9d9" +checksum = "a93d2a9ae98f1af8953f6415397299d808cce0a24f6d7c613d27bd83edf98da8" dependencies = [ "console_error_panic_hook", "js-sys", @@ -4591,9 +4593,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.43" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8220be1fa9e4c889b30fd207d4906657e7e90b12e0e6b0c8b8d8709f5de021" +checksum = "fb8b294691f640bad8f2bb35a11bb28272701b1d687bd5fd661a27684e894d4d" dependencies = [ "proc-macro2", "quote", @@ -4602,9 +4604,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "44188d185b5bdcae1052d08bcbcf9091a5524038d4572cc4f4f2bb9d5554ddd9" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/languages/js/sdk-client/package-lock.json b/languages/js/sdk-client/package-lock.json index f5b6f590b..5911a3331 100644 --- a/languages/js/sdk-client/package-lock.json +++ b/languages/js/sdk-client/package-lock.json @@ -30,9 +30,9 @@ } }, "node_modules/@types/node": { - "version": "20.16.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.10.tgz", - "integrity": "sha512-vQUKgWTjEIRFCvK6CyriPH3MZYiYlNy0fKiEYHWbcoWLEgs4opurGGKlebrTLqdSMIbXImH6XExNiIyNUv3WpA==", + "version": "20.16.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.11.tgz", + "integrity": "sha512-y+cTCACu92FyA5fgQSAI8A1H429g7aSK2HsO7K4XYUWc4dY5IUz55JSDIYT6/VsOLfGy8vmvQYC2hfb0iF16Uw==", "dev": true, "license": "MIT", "dependencies": { @@ -436,9 +436,9 @@ } }, "node_modules/typescript": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", - "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/package-lock.json b/package-lock.json index 9ceb5ffed..3d3e16698 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.25.6", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.6.tgz", - "integrity": "sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==", + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.7.tgz", + "integrity": "sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w==", "dev": true, "license": "MIT", "dependencies": { @@ -359,9 +359,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.7.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.4.tgz", - "integrity": "sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==", + "version": "22.7.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz", + "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", "dev": true, "license": "MIT", "peer": true, @@ -1069,9 +1069,9 @@ } }, "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", "dev": true, "license": "MIT", "dependencies": { From 4e341e55541f9c9f70c765c4a2d9ac8e98d3a750 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Thu, 10 Oct 2024 05:46:39 -0400 Subject: [PATCH 75/77] BRE-359 - Update Build C++ workflow (#1123) --- .github/workflows/build-cpp.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-cpp.yml b/.github/workflows/build-cpp.yml index 01222aac9..686369366 100644 --- a/.github/workflows/build-cpp.yml +++ b/.github/workflows/build-cpp.yml @@ -95,7 +95,6 @@ jobs: working-directory: languages/cpp shell: bash run: | - mv include/release/* include/ if [[ '${{ runner.os }}' == 'macOS' || '${{ runner.os }}' == 'Linux' ]]; then ls include/libbitwarden_c.* || { echo "Missing libbitwarden_c.*"; exit 1; } fi @@ -103,7 +102,6 @@ jobs: ls include/bitwarden_c.dll || { echo "Missing bitwarden_c.dll"; exit 1; } ls include/bitwarden_c.dll.lib || { echo "Missing bitwarden_c.dll.lib"; exit 1; } fi - rmdir include/release - name: Build unix working-directory: languages/cpp From 7e663e9cfa88782ccb45376690c5dca41c0b1711 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Thu, 10 Oct 2024 13:36:42 +0200 Subject: [PATCH 76/77] Remove the old doc script (#1126) --- crates/bitwarden-uniffi/README.md | 12 --- crates/bitwarden-uniffi/src/docs.rs | 49 ---------- crates/bitwarden-uniffi/src/lib.rs | 3 - crates/sdk-schemas/Cargo.toml | 6 +- crates/sdk-schemas/src/main.rs | 3 - package-lock.json | 64 ------------- package.json | 1 - support/docs/docs.ts | 139 ---------------------------- support/docs/rustdoc.ts | 12 --- support/docs/template.hbs | 91 ------------------ 10 files changed, 1 insertion(+), 379 deletions(-) delete mode 100644 crates/bitwarden-uniffi/src/docs.rs delete mode 100644 support/docs/docs.ts delete mode 100644 support/docs/rustdoc.ts delete mode 100644 support/docs/template.hbs diff --git a/crates/bitwarden-uniffi/README.md b/crates/bitwarden-uniffi/README.md index 4b2e61714..c2e4d6c45 100644 --- a/crates/bitwarden-uniffi/README.md +++ b/crates/bitwarden-uniffi/README.md @@ -1,13 +1 @@ # Bitwarden-uniffi - -## Generating documentation - -If desired we have some scripts that generates markdown documentation from the rustdoc output. - -```bash -cargo +nightly rustdoc -p bitwarden -- -Zunstable-options --output-format json -cargo +nightly rustdoc -p bitwarden-uniffi -- -Zunstable-options --output-format json -npm run schemas - -npx ts-node ./support/docs/docs.ts > doc.md -``` diff --git a/crates/bitwarden-uniffi/src/docs.rs b/crates/bitwarden-uniffi/src/docs.rs deleted file mode 100644 index 5edbc7144..000000000 --- a/crates/bitwarden-uniffi/src/docs.rs +++ /dev/null @@ -1,49 +0,0 @@ -use bitwarden::{ - auth::password::MasterPasswordPolicyOptions, - exporters::ExportFormat, - generators::{PassphraseGeneratorRequest, PasswordGeneratorRequest}, - mobile::crypto::{InitOrgCryptoRequest, InitUserCryptoRequest}, - platform::FingerprintRequest, - send::{Send, SendListView, SendView}, - vault::{Cipher, CipherView, Collection, Folder, FolderView, TotpResponse}, -}; -use bitwarden_crypto::{HashPurpose, Kdf}; -use schemars::JsonSchema; - -#[derive(JsonSchema)] -#[allow(clippy::large_enum_variant)] -pub enum DocRef { - // Vault - Cipher(Cipher), - CipherView(CipherView), - Collection(Collection), - Folder(Folder), - FolderView(FolderView), - Send(Send), - SendView(SendView), - SendListView(SendListView), - - // Crypto - InitUserCryptoRequest(InitUserCryptoRequest), - InitOrgCryptoRequest(InitOrgCryptoRequest), - HashPurpose(HashPurpose), - - // Generators - PasswordGeneratorRequest(PasswordGeneratorRequest), - PassphraseGeneratorRequest(PassphraseGeneratorRequest), - - // Exporters - ExportFormat(ExportFormat), - - // Platform - FingerprintRequest(FingerprintRequest), - - // Auth - MasterPasswordPolicyOptions(MasterPasswordPolicyOptions), - - // Kdf - Kdf(Kdf), - - /// TOTP - TotpResponse(TotpResponse), -} diff --git a/crates/bitwarden-uniffi/src/lib.rs b/crates/bitwarden-uniffi/src/lib.rs index 0d89ffdb8..a9eb6a3e0 100644 --- a/crates/bitwarden-uniffi/src/lib.rs +++ b/crates/bitwarden-uniffi/src/lib.rs @@ -13,9 +13,6 @@ pub mod tool; mod uniffi_support; pub mod vault; -#[cfg(feature = "docs")] -pub mod docs; - #[cfg(target_os = "android")] mod android_support; diff --git a/crates/sdk-schemas/Cargo.toml b/crates/sdk-schemas/Cargo.toml index 8d48cd691..b4dd496a4 100644 --- a/crates/sdk-schemas/Cargo.toml +++ b/crates/sdk-schemas/Cargo.toml @@ -12,11 +12,7 @@ license-file.workspace = true keywords.workspace = true [features] -internal = [ - "bitwarden/internal", - "bitwarden-json/internal", - "bitwarden-uniffi/docs", -] +internal = ["bitwarden/internal", "bitwarden-json/internal"] [dependencies] anyhow = "1.0.82" diff --git a/crates/sdk-schemas/src/main.rs b/crates/sdk-schemas/src/main.rs index 94959fa69..66683256b 100644 --- a/crates/sdk-schemas/src/main.rs +++ b/crates/sdk-schemas/src/main.rs @@ -121,8 +121,5 @@ struct SchemaTypes { fn main() -> Result<()> { write_schema_for!("schema_types", SchemaTypes); - #[cfg(feature = "internal")] - write_schema_for!(bitwarden_uniffi::docs::DocRef); - Ok(()) } diff --git a/package-lock.json b/package-lock.json index 3d3e16698..894ec74eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "license": "SEE LICENSE IN LICENSE", "devDependencies": { "@openapitools/openapi-generator-cli": "2.13.4", - "handlebars": "^4.7.8", "prettier": "3.3.3", "quicktype-core": "23.0.170", "rimraf": "6.0.1", @@ -1144,28 +1143,6 @@ "dev": true, "license": "ISC" }, - "node_modules/handlebars": { - "version": "4.7.8", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", - "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5", - "neo-async": "^2.6.2", - "source-map": "^0.6.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "handlebars": "bin/handlebars" - }, - "engines": { - "node": ">=0.4.7" - }, - "optionalDependencies": { - "uglify-js": "^3.1.4" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1450,16 +1427,6 @@ "node": "*" } }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/minipass": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", @@ -1484,13 +1451,6 @@ "dev": true, "license": "ISC" }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true, - "license": "MIT" - }, "node_modules/node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", @@ -1939,16 +1899,6 @@ "dev": true, "license": "ISC" }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/spawn-command": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2.tgz", @@ -2158,20 +2108,6 @@ "node": ">=14.17" } }, - "node_modules/uglify-js": { - "version": "3.19.3", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", - "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", - "dev": true, - "license": "BSD-2-Clause", - "optional": true, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/uid": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz", diff --git a/package.json b/package.json index 8f40e36ab..e7e419467 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ }, "devDependencies": { "@openapitools/openapi-generator-cli": "2.13.4", - "handlebars": "^4.7.8", "prettier": "3.3.3", "quicktype-core": "23.0.170", "rimraf": "6.0.1", diff --git a/support/docs/docs.ts b/support/docs/docs.ts deleted file mode 100644 index 067ff0827..000000000 --- a/support/docs/docs.ts +++ /dev/null @@ -1,139 +0,0 @@ -// Quick script that parses the rustdoc json output and generates a basic markdown documentation. -// -// Do note that this script follows no best practices and will not handle anything many edge cases. - -import fs from "fs"; -import path from "path"; -import Handlebars from "handlebars"; - -import { Input, InputType } from "./rustdoc"; - -const doc = JSON.parse(fs.readFileSync("./target/doc/bitwarden_uniffi.json", "utf8")); -const command = JSON.parse( - fs.readFileSync("./support/schemas/bitwarden_uniffi/DocRef.json", "utf8"), -); - -const template = Handlebars.compile( - fs.readFileSync(path.resolve(__dirname, "template.hbs"), "utf8"), -); - -// Modify this to include more root elements -const rootElements = [ - "Client", - "ClientAuth", - "ClientAttachments", - "ClientCiphers", - "ClientCollections", - "ClientCrypto", - "ClientExporters", - "ClientFolders", - "ClientGenerators", - "ClientPasswordHistory", - "ClientPlatform", - "ClientSends", - "ClientVault", -]; - -const localIndexArray = Object.values(doc.index).filter((entry: any) => entry.crate_id == 0); -const localIndex = localIndexArray.reduce((map: any, obj: any) => { - map[obj.id] = obj; - return map; -}, {}) as Record; - -let usedDefinitions: any[] = []; - -const out = rootElements.map((rootElement) => { - const root: any = localIndexArray.find((entry: any) => entry.name == rootElement); - const impls = root.inner.struct.impls; - - const elements = impls - .flatMap((e: any) => localIndex[e]) - .flatMap((e: any) => e.inner.impl.items) - .map((e: any) => localIndex[e]) - .filter((e: any) => e?.docs != null); - - return { - name: rootElement, - elements: elements.map((e: any) => { - return { - name: e.name, - docs: e.docs, - args: e.inner.function.decl.inputs.map((e: any) => map_input(e)), - output: map_type(e.inner.function.decl.output), - }; - }), - }; -}); - -function stripDef(str: string) { - return str.replace(/#\/definitions\//g, ""); -} - -Handlebars.registerHelper("stripDef", (str: string) => { - return stripDef(str); -}); - -// Add references -for (let i = 0; i < usedDefinitions.length; i++) { - const key = usedDefinitions[i]; - const cmd = command.definitions[key]; - if (cmd == null) { - continue; - } - - Object.entries(cmd.properties ?? {}).forEach((prop: any) => { - prop[1].allOf?.forEach((e: any) => { - usedDefinitions.push(stripDef(e["$ref"] as string)); - }); - }); -} - -const filteredDefinitions = [...new Set(usedDefinitions)] - .sort() - .map((key) => [key, command.definitions[key]]) - .filter((e) => e[1] != null) - .reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {}); - -console.log(template({ sections: out, commands: filteredDefinitions })); - -/// -/// Implementation details below. -/// - -// Format -function map_input(input: Input) { - return { - name: input[0], - type: map_type(input[1]), - }; -} - -function map_type(t: InputType) { - const args = t.resolved_path?.args; - const name = t.resolved_path?.name; - - let out = ""; - - if (name) { - usedDefinitions.push(name); - - if (command.definitions[name] != null) { - out += `[${name}](#${name.toLowerCase()})`; - } else { - out += name; - } - } - - if (args != null && args.angle_bracketed.args.length > 0) { - out += "<"; - out += args.angle_bracketed.args.map((t: any) => { - if (t.type.generic) { - return t.type.generic; - } else if (t.type.resolved_path) { - return t.type.resolved_path.name; - } - }); - out += ">"; - } - return out; -} diff --git a/support/docs/rustdoc.ts b/support/docs/rustdoc.ts deleted file mode 100644 index 2622b711e..000000000 --- a/support/docs/rustdoc.ts +++ /dev/null @@ -1,12 +0,0 @@ -export type Input = [string, InputType]; - -export type InputType = { - resolved_path?: { - name: string; - args: { - angle_bracketed: { - args: any[]; - }; - }; - }; -}; diff --git a/support/docs/template.hbs b/support/docs/template.hbs deleted file mode 100644 index bd78d138a..000000000 --- a/support/docs/template.hbs +++ /dev/null @@ -1,91 +0,0 @@ -# Bitwarden Mobile SDK - -Auto generated documentation for the Bitwarden Mobile SDK. For more information please refer to -the rust crates `bitwarden` and `bitwarden-uniffi`. For code samples check the -`languages/kotlin/app` and `languages/swift/app` directories. - -{{#each sections}} - -## {{name}} - -{{#each elements}} -### `{{name}}` -{{docs}} - -**Arguments**: -{{#each args}} -- {{name}}: {{{type}}} -{{/each}} - -**Output**: {{{output}}} - -{{/each}} -{{/each}} - -# References - -References are generated from the JSON schemas and should mostly match the kotlin and swift -implementations. - -{{#each commands}} - -## `{{@key}}` - -{{#if oneOf}} - - - - - - -{{#each oneOf}} -{{#each properties}} - - - - - -{{#if properties}} - - - -{{/if}} -{{/each}} -{{/each}} -
KeyTypeDescription
{{@key}}{{type}}
- - - - - - - {{#each properties}} - - - - - - {{/each}} -
KeyTypeDescription
{{@key}}{{type}}{{{description}}}
-
- -{{/if}} - -{{#unless oneOf}} - - - - - - -{{#each properties}} - - - - - -{{/each}} -
KeyTypeDescription
{{@key}}{{type}}{{description}}
-{{/unless}} - -{{/each}} From 0ae6d73e6b066bac69dd3769e643137a2bec119c Mon Sep 17 00:00:00 2001 From: Andreas Coroiu Date: Thu, 10 Oct 2024 17:00:06 +0200 Subject: [PATCH 77/77] fix: .editorconfig not being applied properly (#1127) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 🎟ī¸ Tracking ## 📔 Objective `[*.{ts}]` -> `[*.ts]` ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đŸĻŽ Reviewer guidelines - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹī¸ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠ī¸ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or â™ģī¸ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes --- .editorconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.editorconfig b/.editorconfig index 28ef180e8..33fa272b4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,10 +12,10 @@ insert_final_newline = true indent_style = space indent_size = 2 -[*.{ts}] -quote_type = single +[*.ts] +quote_type = double -[*.{rs}] +[*.rs] indent_style = space indent_size = 4 @@ -23,6 +23,6 @@ indent_size = 4 indent_style = space indent_size = 4 -[*.{xml}] +[*.xml] # VS Code XML extension removes the final newline insert_final_newline = false