From a06493366485c881450e3329a7a340ed5799393e Mon Sep 17 00:00:00 2001
From: Berend Sliedrecht <sliedrecht@berend.io>
Date: Tue, 21 Nov 2023 12:31:52 +0100
Subject: [PATCH] fix where lists were not logged

Signed-off-by: Berend Sliedrecht <sliedrecht@berend.io>
---
 .github/workflows/check.yml          |  2 +-
 Cargo.lock                           | 72 ++++++++--------------------
 crates/afj-rest/Cargo.toml           |  8 ++--
 crates/agent/Cargo.toml              |  6 +--
 crates/automations/Cargo.toml        |  4 +-
 crates/cli/Cargo.toml                | 16 +++----
 crates/cli/src/modules/connection.rs | 10 ++--
 crates/cli/src/modules/oob.rs        |  6 ++-
 crates/logger/Cargo.toml             |  8 ++--
 crates/logger/src/macros.rs          |  4 +-
 10 files changed, 54 insertions(+), 82 deletions(-)

diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index 49c7da0f..9bf9fcaf 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -4,7 +4,7 @@ permissions:
   contents: read
 
 env:
-  RUST_VERSION: "1.65.0"
+  RUST_VERSION: "1.70.0"
 
 on:
   pull_request:
diff --git a/Cargo.lock b/Cargo.lock
index 4a709ffc..70c7a187 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -106,12 +106,6 @@ dependencies = [
  "rustc-demangle",
 ]
 
-[[package]]
-name = "base64"
-version = "0.13.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
-
 [[package]]
 name = "base64"
 version = "0.21.5"
@@ -299,9 +293,9 @@ dependencies = [
 
 [[package]]
 name = "crossterm"
-version = "0.23.2"
+version = "0.25.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a2102ea4f781910f8a5b98dd061f4c2023f479ce7bb1236330099ceb5a93cf17"
+checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67"
 dependencies = [
  "bitflags 1.3.2",
  "crossterm_winapi",
@@ -542,19 +536,13 @@ dependencies = [
  "futures-sink",
  "futures-util",
  "http",
- "indexmap 2.1.0",
+ "indexmap",
  "slab",
  "tokio",
  "tokio-util",
  "tracing",
 ]
 
-[[package]]
-name = "hashbrown"
-version = "0.12.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
-
 [[package]]
 name = "hashbrown"
 version = "0.14.2"
@@ -654,16 +642,6 @@ dependencies = [
  "unicode-normalization",
 ]
 
-[[package]]
-name = "indexmap"
-version = "1.9.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
-dependencies = [
- "autocfg",
- "hashbrown 0.12.3",
-]
-
 [[package]]
 name = "indexmap"
 version = "2.1.0"
@@ -671,7 +649,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
 dependencies = [
  "equivalent",
- "hashbrown 0.14.2",
+ "hashbrown",
 ]
 
 [[package]]
@@ -718,12 +696,6 @@ version = "0.2.150"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
 
-[[package]]
-name = "linked-hash-map"
-version = "0.5.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
-
 [[package]]
 name = "linux-raw-sys"
 version = "0.4.11"
@@ -1063,7 +1035,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9"
 dependencies = [
  "fixedbitset",
- "indexmap 2.1.0",
+ "indexmap",
 ]
 
 [[package]]
@@ -1101,9 +1073,9 @@ dependencies = [
 
 [[package]]
 name = "qr2term"
-version = "0.2.3"
+version = "0.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d9ed66d596477e4a04d2ebdbc9b657c417e8316ae7cc504f82ace5a786d4d7d"
+checksum = "4c2a1e77b5cd714b04247ad912b7c8fe9a1fe1d58425048249def91bcf690e4c"
 dependencies = [
  "crossterm",
  "qrcode",
@@ -1210,7 +1182,7 @@ version = "0.11.22"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b"
 dependencies = [
- "base64 0.21.5",
+ "base64",
  "bytes",
  "encoding_rs",
  "futures-core",
@@ -1350,14 +1322,15 @@ dependencies = [
 
 [[package]]
 name = "serde_yaml"
-version = "0.8.26"
+version = "0.9.27"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b"
+checksum = "3cc7a1570e38322cfe4154732e5110f887ea57e22b76f4bfd32b5bdd3368666c"
 dependencies = [
- "indexmap 1.9.3",
+ "indexmap",
+ "itoa",
  "ryu",
  "serde",
- "yaml-rust",
+ "unsafe-libyaml",
 ]
 
 [[package]]
@@ -1375,7 +1348,7 @@ dependencies = [
 name = "siera"
 version = "0.1.0"
 dependencies = [
- "base64 0.13.1",
+ "base64",
  "clap",
  "colored",
  "qr2term",
@@ -1636,9 +1609,7 @@ dependencies = [
  "libc",
  "mio",
  "num_cpus",
- "parking_lot",
  "pin-project-lite",
- "signal-hook-registry",
  "socket2 0.5.5",
  "tokio-macros",
  "windows-sys",
@@ -1771,6 +1742,12 @@ dependencies = [
  "tinyvec",
 ]
 
+[[package]]
+name = "unsafe-libyaml"
+version = "0.2.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa"
+
 [[package]]
 name = "url"
 version = "2.4.1"
@@ -2128,12 +2105,3 @@ name = "xml-rs"
 version = "0.8.19"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a"
-
-[[package]]
-name = "yaml-rust"
-version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
-dependencies = [
- "linked-hash-map",
-]
diff --git a/crates/afj-rest/Cargo.toml b/crates/afj-rest/Cargo.toml
index 723909a2..5ff3c7f7 100644
--- a/crates/afj-rest/Cargo.toml
+++ b/crates/afj-rest/Cargo.toml
@@ -14,7 +14,7 @@ readme.workspace = true
 [dependencies]
 siera-agent = { path = "../agent", version = "0.*" }
 siera-logger = { path = "../logger", version = "0.*" }
-async-trait = "0.1.51"
-reqwest = { version = "0.11", features = ["json"] }
-serde = { version = "1.0.130", features = ["derive"] }
-serde_json = "1.0.68"
+async-trait = "0.1.74"
+reqwest = { version = "0.11.22", features = ["json"] }
+serde = { version = "1.0.193", features = ["derive"] }
+serde_json = "1.0.108"
diff --git a/crates/agent/Cargo.toml b/crates/agent/Cargo.toml
index 3d2f6677..ebb347bc 100644
--- a/crates/agent/Cargo.toml
+++ b/crates/agent/Cargo.toml
@@ -12,6 +12,6 @@ license.workspace = true
 readme.workspace = true
 
 [dependencies]
-async-trait = "0.1.51"
-serde = { version = "1.0.130", features = ["derive"] }
-serde_json = "1.0.68"
+async-trait = "0.1.74"
+serde = { version = "1.0.193", features = ["derive"] }
+serde_json = "1.0.108"
diff --git a/crates/automations/Cargo.toml b/crates/automations/Cargo.toml
index 0a032dd9..7e1713a7 100644
--- a/crates/automations/Cargo.toml
+++ b/crates/automations/Cargo.toml
@@ -15,6 +15,6 @@ readme.workspace = true
 siera-cloudagent-python = { path = "../cloudagent-python", version = "0.*" }
 siera-logger = { path = "../logger", version = "0.*" }
 siera-agent = { path = "../agent", version = "0.*" }
-colored = "2.0.0"
-async-trait = "0.1.51"
+colored = "2.0.4"
+async-trait = "0.1.74"
 rand = "0.8.5"
diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml
index 504750bd..65d45266 100644
--- a/crates/cli/Cargo.toml
+++ b/crates/cli/Cargo.toml
@@ -17,11 +17,11 @@ siera-automations = { path = "../automations", version = "0.*" }
 siera-afj-rest = { path = "../afj-rest", version = "0.*" }
 siera-cloudagent-python = { path = "../cloudagent-python", version = "0.*" }
 siera-logger = { path = "../logger", version = "0.*" }
-base64 = "0.13.0"
-clap = { version = "4.2.5", features = ["derive"] }
-colored = "2.0.0"
-qr2term = "0.2.2"
-serde = { version = "1.0.130", features = ["derive"] }
-serde_json = "1.0.68"
-serde_yaml = "0.8.23"
-tokio = { version = "1", features = ["full"] }
+base64 = "0.21.5"
+clap = { version = "4.4.8", features = ["derive"] }
+colored = "2.0.4"
+qr2term = "0.3.1"
+serde = { version = "1.0.193", features = ["derive"] }
+serde_json = "1.0.108"
+serde_yaml = "0.9.27"
+tokio = { version = "1.34.0", features = ["rt-multi-thread"] }
diff --git a/crates/cli/src/modules/connection.rs b/crates/cli/src/modules/connection.rs
index 1e120aff..af31b10b 100644
--- a/crates/cli/src/modules/connection.rs
+++ b/crates/cli/src/modules/connection.rs
@@ -2,6 +2,7 @@ use crate::error::{Error, Result};
 use crate::help_strings::HelpStrings;
 use crate::utils::loader::{Loader, LoaderVariant};
 use crate::utils::qr::print_qr_code;
+use base64::{engine::general_purpose, Engine as _};
 use clap::{Args, Subcommand};
 use siera_agent::modules::connection::{
     ConnectionCreateInvitationOptions, ConnectionGetAllOptions, ConnectionModule,
@@ -116,8 +117,8 @@ pub async fn parse_connection_args(
             };
             agent.create_invitation(options).await.map(|response| {
                 loader.stop();
-                info!({ "message": "Created invititation"});
-                log!({ "connection_id": response.id});
+                info!({ "message": "Created invititation" });
+                log!({ "connection_id": response.id });
                 if *qr {
                     info!({"message": "Scan this QR code to accept the invitation"});
                     print_qr_code(&response.invitation_url).unwrap();
@@ -199,8 +200,9 @@ pub fn invite_url_to_struct(url: impl AsRef<str>) -> Result<ConnectionReceiveInv
         .ok_or(Error::InvalidAgentInvitation)?;
 
     // Base64 decode the invitation to a Vec<u8>
-    let decoded =
-        base64::decode(serialized_invitation).map_err(|_| Error::InvalidAgentInvitation)?;
+    let decoded = general_purpose::STANDARD
+        .decode(serialized_invitation)
+        .map_err(|_| Error::InvalidAgentInvitation)?;
 
     // Convert the vec to a valid string
     let decoded_str = str::from_utf8(&decoded)?;
diff --git a/crates/cli/src/modules/oob.rs b/crates/cli/src/modules/oob.rs
index d8b70559..c9a6ecfe 100644
--- a/crates/cli/src/modules/oob.rs
+++ b/crates/cli/src/modules/oob.rs
@@ -2,6 +2,7 @@ use crate::error::{Error, Result};
 use crate::help_strings::HelpStrings;
 use crate::utils::loader::{Loader, LoaderVariant};
 use crate::utils::qr::print_qr_code;
+use base64::{engine::general_purpose, Engine as _};
 use clap::{Args, Subcommand};
 use siera_agent::modules::oob::{
     OobConnectionCreateInvitationOptions, OobConnectionReceiveInvitationOptions, OobModule,
@@ -126,8 +127,9 @@ pub fn invite_url_to_struct(url: impl AsRef<str>) -> Result<OobConnectionReceive
         .ok_or(Error::InvalidAgentInvitation)?;
 
     // Base64 decode the invitation to a Vec<u8>
-    let decoded =
-        base64::decode(serialized_invitation).map_err(|_| Error::InvalidAgentInvitation)?;
+    let decoded = general_purpose::STANDARD
+        .decode(serialized_invitation)
+        .map_err(|_| Error::InvalidAgentInvitation)?;
 
     // Convert the vec to a valid string
     let decoded_str = str::from_utf8(&decoded)?;
diff --git a/crates/logger/Cargo.toml b/crates/logger/Cargo.toml
index ca0b13ad..50cdaf4e 100644
--- a/crates/logger/Cargo.toml
+++ b/crates/logger/Cargo.toml
@@ -13,8 +13,8 @@ readme.workspace = true
 
 [dependencies]
 cli-clipboard = "0.4.0"
-xcb = "1.2.0"
-serde = { version = "1.0.130", features = ["derive"] }
+colored = "2.0.4"
 lazy_static = "1.4.0"
-serde_json = "1.0.68"
-colored = "2.0.0"
+serde = { version = "1.0.193", features = ["derive"] }
+serde_json = "1.0.108"
+xcb = "1.2.2"
diff --git a/crates/logger/src/macros.rs b/crates/logger/src/macros.rs
index 5d564297..bcc063a3 100644
--- a/crates/logger/src/macros.rs
+++ b/crates/logger/src/macros.rs
@@ -48,8 +48,8 @@ macro_rules! internal_log {
                         let values = o.values();
                         for value in values {
                             let s = match value {
-                                $crate::serde_json::Value::Object(o) => {
-                                    if let Some(value) = $crate::serde_json::to_string_pretty(value).ok() {
+                                $crate::serde_json::Value::Object(_) | $crate::serde_json::Value::Array(_) => {
+                                    if let Ok(value) = $crate::serde_json::to_string_pretty(value) {
                                         if $level == ::siera_logger::LogLevel::None {
                                             value.to_owned()
                                         } else {