Исправление критической уязвимости

This commit is contained in:
2024-06-15 18:57:46 +07:00
parent 0e2937effb
commit 6e04a42056
4 changed files with 12 additions and 3 deletions
+7
View File
@@ -681,6 +681,12 @@ dependencies = [
"syn 2.0.66", "syn 2.0.66",
] ]
[[package]]
name = "dotenv"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
[[package]] [[package]]
name = "dtoa" name = "dtoa"
version = "1.0.9" version = "1.0.9"
@@ -3200,6 +3206,7 @@ dependencies = [
name = "to-do-app" name = "to-do-app"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"dotenv",
"magic-crypt", "magic-crypt",
"rust-fuzzy-search", "rust-fuzzy-search",
"serde", "serde",
+1
View File
@@ -16,6 +16,7 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
magic-crypt = "3.1.13" magic-crypt = "3.1.13"
rust-fuzzy-search = "0.1.1" rust-fuzzy-search = "0.1.1"
dotenv = "0.15.0"
[features] [features]
# This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!! # This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!!
+2 -1
View File
@@ -1,10 +1,11 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!! // Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use dotenv::dotenv;
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command // Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
#[path="tasks_functions.rs"] mod tasks; #[path="tasks_functions.rs"] mod tasks;
fn main() { fn main() {
dotenv().ok();
tauri::Builder::default() tauri::Builder::default()
.invoke_handler(tauri::generate_handler![ .invoke_handler(tauri::generate_handler![
tasks::check_or_create_tasks_file, tasks::check_or_create_tasks_file,
+2 -2
View File
@@ -7,7 +7,7 @@ use serde_json::{Value, json};
use rust_fuzzy_search::fuzzy_search_best_n; use rust_fuzzy_search::fuzzy_search_best_n;
pub fn encrypt_n_save_file(path: PathBuf, content: String){ pub fn encrypt_n_save_file(path: PathBuf, content: String){
let mc = new_magic_crypt!("7J?VKYJib`=NIOpapW+zP8wD_#lPjP77Z)Q:4QUlH4`0rpMz7]>EIC%$RV-9*iW9AZ>Qk!OmAuH`8GzJ93xR4`KTl*-#fuCKzDfrPe&-A0?^Mz<F8IJ((oe+X,73iG", 256); let mc = new_magic_crypt!(std::env::var("ENC_KEY").unwrap(), 256);
let mut encrypted: String = String::new(); let mut encrypted: String = String::new();
@@ -22,7 +22,7 @@ pub fn encrypt_n_save_file(path: PathBuf, content: String){
} }
pub fn decrypt_file(path: PathBuf) -> String { pub fn decrypt_file(path: PathBuf) -> String {
let mc = new_magic_crypt!("7J?VKYJib`=NIOpapW+zP8wD_#lPjP77Z)Q:4QUlH4`0rpMz7]>EIC%$RV-9*iW9AZ>Qk!OmAuH`8GzJ93xR4`KTl*-#fuCKzDfrPe&-A0?^Mz<F8IJ((oe+X,73iG", 256); let mc = new_magic_crypt!(std::env::var("ENC_KEY").unwrap(), 256);
let mut decrypted: String = String::new(); let mut decrypted: String = String::new();