From db7765edad14e8fb860c436a0de4fe5cd1e86992 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 26 Jan 2023 11:23:08 -0300 Subject: [PATCH] chore(deps) Update Tauri Codegen (#6034) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Lucas Nogueira --- core/tauri-codegen/Cargo.toml | 4 ++-- core/tauri-codegen/src/context.rs | 13 +++++++++---- core/tauri-codegen/src/embedded_assets.rs | 8 +++++--- core/tauri/Cargo.toml | 2 +- core/tauri/src/updater/core.rs | 4 ++-- tooling/cli/Cargo.lock | 20 +++++++++++++------- tooling/cli/Cargo.toml | 2 +- tooling/cli/src/build.rs | 4 +++- tooling/cli/src/helpers/updater_signature.rs | 11 ++++++----- tooling/cli/src/signer/sign.rs | 3 ++- 10 files changed, 44 insertions(+), 27 deletions(-) diff --git a/core/tauri-codegen/Cargo.toml b/core/tauri-codegen/Cargo.toml index ee2ea125c..19e1ae31b 100644 --- a/core/tauri-codegen/Cargo.toml +++ b/core/tauri-codegen/Cargo.toml @@ -14,7 +14,7 @@ readme = "README.md" [dependencies] sha2 = "0.10" -base64 = "0.20" +base64 = "0.21" proc-macro2 = "1" quote = "1" serde = { version = "1", features = [ "derive" ] } @@ -23,7 +23,7 @@ tauri-utils = { version = "1.2.1", path = "../tauri-utils", features = [ "build" thiserror = "1" walkdir = "2" brotli = { version = "3", optional = true, default-features = false, features = [ "std" ] } -regex = { version = "1.7.0", optional = true } +regex = { version = "1.7.1", optional = true } uuid = { version = "1", features = [ "v4" ] } semver = "1" ico = "0.3" diff --git a/core/tauri-codegen/src/context.rs b/core/tauri-codegen/src/context.rs index 8f8492c40..858048033 100644 --- a/core/tauri-codegen/src/context.rs +++ b/core/tauri-codegen/src/context.rs @@ -5,6 +5,7 @@ use std::path::{Path, PathBuf}; use std::{ffi::OsStr, str::FromStr}; +use base64::Engine; use proc_macro2::TokenStream; use quote::quote; use sha2::{Digest, Sha256}; @@ -57,7 +58,10 @@ fn map_core_assets( let mut hasher = Sha256::new(); hasher.update(&script); let hash = hasher.finalize(); - scripts.push(format!("'sha256-{}'", base64::encode(hash))); + scripts.push(format!( + "'sha256-{}'", + base64::engine::general_purpose::STANDARD.encode(hash) + )); } csp_hashes .inline_scripts @@ -74,9 +78,10 @@ fn map_core_assets( let mut hasher = Sha256::new(); hasher.update(tauri_utils::pattern::isolation::IFRAME_STYLE); let hash = hasher.finalize(); - csp_hashes - .styles - .push(format!("'sha256-{}'", base64::encode(hash))); + csp_hashes.styles.push(format!( + "'sha256-{}'", + base64::engine::general_purpose::STANDARD.encode(hash) + )); } } diff --git a/core/tauri-codegen/src/embedded_assets.rs b/core/tauri-codegen/src/embedded_assets.rs index b897500e2..207cc4d9a 100644 --- a/core/tauri-codegen/src/embedded_assets.rs +++ b/core/tauri-codegen/src/embedded_assets.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +use base64::Engine; use proc_macro2::TokenStream; use quote::{quote, ToTokens, TokenStreamExt}; use sha2::{Digest, Sha256}; @@ -181,9 +182,10 @@ impl CspHashes { })?, ); let hash = hasher.finalize(); - self - .scripts - .push(format!("'sha256-{}'", base64::encode(hash))); + self.scripts.push(format!( + "'sha256-{}'", + base64::engine::general_purpose::STANDARD.encode(hash) + )); } } diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index e16eacc71..c53e095c7 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -65,7 +65,7 @@ flate2 = "1.0" http = "0.2" dirs-next = "2.0" percent-encoding = "2.2" -base64 = { version = "0.13", optional = true } +base64 = { version = "0.21", optional = true } clap = { version = "3", optional = true } reqwest = { version = "0.11", features = [ "json", "stream" ], optional = true } bytes = { version = "1", features = [ "serde" ], optional = true } diff --git a/core/tauri/src/updater/core.rs b/core/tauri/src/updater/core.rs index 361e6f481..ca9b05d0b 100644 --- a/core/tauri/src/updater/core.rs +++ b/core/tauri/src/updater/core.rs @@ -9,7 +9,7 @@ use crate::{ api::http::{ClientBuilder, HttpRequestBuilder}, AppHandle, Manager, Runtime, }; -use base64::decode; +use base64::Engine; use http::{ header::{HeaderName, HeaderValue}, HeaderMap, StatusCode, @@ -978,7 +978,7 @@ pub fn extract_path_from_executable(env: &Env, executable_path: &Path) -> PathBu // Convert base64 to string and prevent failing fn base64_to_string(base64_string: &str) -> Result { - let decoded_string = &decode(base64_string)?; + let decoded_string = &base64::engine::general_purpose::STANDARD.decode(base64_string)?; let result = from_utf8(decoded_string) .map_err(|_| Error::SignatureUtf8(base64_string.into()))? .to_string(); diff --git a/tooling/cli/Cargo.lock b/tooling/cli/Cargo.lock index 0fd6930aa..9f2c7865a 100644 --- a/tooling/cli/Cargo.lock +++ b/tooling/cli/Cargo.lock @@ -152,7 +152,7 @@ checksum = "c9e3356844c4d6a6d6467b8da2cffb4a2820be256f50a3a386c9d152bab31043" dependencies = [ "async-trait", "axum-core", - "base64", + "base64 0.13.0", "bitflags", "bytes", "futures-util", @@ -200,6 +200,12 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + [[package]] name = "base64ct" version = "1.0.1" @@ -1495,7 +1501,7 @@ checksum = "4ebd40599e7f1230ce296f73b88c022b98ed66689f97eaa54bbeadc337a2ffa6" dependencies = [ "ahash", "anyhow", - "base64", + "base64 0.13.0", "bytecount", "fancy-regex", "fraction", @@ -2329,7 +2335,7 @@ version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225" dependencies = [ - "base64", + "base64 0.13.0", "indexmap", "line-wrap", "serde", @@ -2578,7 +2584,7 @@ version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc" dependencies = [ - "base64", + "base64 0.13.0", "bytes", "encoding_rs", "futures-core", @@ -3197,7 +3203,7 @@ version = "1.2.3" dependencies = [ "anyhow", "axum", - "base64", + "base64 0.21.0", "clap 4.0.9", "colored", "common-path", @@ -3605,7 +3611,7 @@ version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" dependencies = [ - "base64", + "base64 0.13.0", "byteorder", "bytes", "http", @@ -3694,7 +3700,7 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97acb4c28a254fd7a4aeec976c46a7fa404eac4d7c134b30c75144846d7cb8f" dependencies = [ - "base64", + "base64 0.13.0", "chunked_transfer", "flate2", "log", diff --git a/tooling/cli/Cargo.toml b/tooling/cli/Cargo.toml index 89c1b3b14..d8c703069 100644 --- a/tooling/cli/Cargo.toml +++ b/tooling/cli/Cargo.toml @@ -57,7 +57,7 @@ jsonschema = "0.16" handlebars = "4.3" include_dir = "0.7" minisign = "0.7" -base64 = "0.13.0" +base64 = "0.21.0" ureq = "2.5" os_info = "3.5" semver = "1.0" diff --git a/tooling/cli/src/build.rs b/tooling/cli/src/build.rs index f34c004e3..29baf2d96 100644 --- a/tooling/cli/src/build.rs +++ b/tooling/cli/src/build.rs @@ -13,6 +13,7 @@ use crate::{ CommandExt, Result, }; use anyhow::{bail, Context}; +use base64::Engine; use clap::{ArgAction, Parser}; use log::{debug, error, info, warn}; use std::{ @@ -305,7 +306,8 @@ pub fn command(mut options: Options, verbosity: u8) -> Result<()> { Err(anyhow::anyhow!("A public key has been found, but no private key. Make sure to set `TAURI_PRIVATE_KEY` environment variable.")) }?; - let pubkey = base64::decode(&config_.tauri.updater.pubkey)?; + let pubkey = + base64::engine::general_purpose::STANDARD.decode(&config_.tauri.updater.pubkey)?; let pub_key_decoded = String::from_utf8_lossy(&pubkey); let public_key = minisign::PublicKeyBox::from_string(&pub_key_decoded)?.into_public_key()?; diff --git a/tooling/cli/src/helpers/updater_signature.rs b/tooling/cli/src/helpers/updater_signature.rs index 6b8609214..1cd1f1c38 100644 --- a/tooling/cli/src/helpers/updater_signature.rs +++ b/tooling/cli/src/helpers/updater_signature.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: MIT use anyhow::Context; -use base64::{decode, encode}; +use base64::Engine; use minisign::{sign, KeyPair as KP, SecretKey, SecretKeyBox, SignatureBox}; use std::{ fs::{self, File, OpenOptions}, @@ -35,8 +35,8 @@ pub fn generate_key(password: Option) -> crate::Result { let pk_box_str = pk.to_box().unwrap().to_string(); let sk_box_str = sk.to_box(None).unwrap().to_string(); - let encoded_pk = encode(pk_box_str); - let encoded_sk = encode(sk_box_str); + let encoded_pk = base64::engine::general_purpose::STANDARD.encode(pk_box_str); + let encoded_sk = base64::engine::general_purpose::STANDARD.encode(sk_box_str); Ok(KeyPair { pk: encoded_pk, @@ -46,7 +46,7 @@ pub fn generate_key(password: Option) -> crate::Result { /// Transform a base64 String to readable string for the main signer pub fn decode_key(base64_key: String) -> crate::Result { - let decoded_str = &decode(base64_key)?[..]; + let decoded_str = &base64::engine::general_purpose::STANDARD.decode(base64_key)?[..]; Ok(String::from(str::from_utf8(decoded_str)?)) } @@ -128,7 +128,8 @@ where Some("signature from tauri secret key"), )?; - let encoded_signature = encode(signature_box.to_string()); + let encoded_signature = + base64::engine::general_purpose::STANDARD.encode(signature_box.to_string()); signature_box_writer.write_all(encoded_signature.as_bytes())?; signature_box_writer.flush()?; Ok((fs::canonicalize(&signature_path)?, signature_box)) diff --git a/tooling/cli/src/signer/sign.rs b/tooling/cli/src/signer/sign.rs index 927e617dc..84e2ab3fb 100644 --- a/tooling/cli/src/signer/sign.rs +++ b/tooling/cli/src/signer/sign.rs @@ -9,6 +9,7 @@ use crate::{ Result, }; use anyhow::Context; +use base64::Engine; use clap::Parser; use tauri_utils::display_path; @@ -53,7 +54,7 @@ pub fn command(mut options: Options) -> Result<()> { println!( "\nYour file was signed successfully, You can find the signature here:\n{}\n\nPublic signature:\n{}\n\nMake sure to include this into the signature field of your update server.", display_path(manifest_dir), - base64::encode(signature.to_string()) + base64::engine::general_purpose::STANDARD.encode(signature.to_string()) ); Ok(())