Skip to content

Commit 8a13a4c

Browse files
authored
chore: bump dependencies (#152)
- bumped dependencies to fix CVE's - fixed clippy warnings - bumped to 0.27.1 Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
1 parent 5bd9698 commit 8a13a4c

9 files changed

Lines changed: 1023 additions & 1270 deletions

File tree

Cargo.lock

Lines changed: 945 additions & 1206 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
77
name = "omnect-cli"
88
readme = "README.md"
99
repository = "https://github.com/omnect/omnect-cli"
10-
version = "0.27.0"
10+
version = "0.27.1"
1111

1212
[dependencies]
1313
actix-web = "4.11"
@@ -26,9 +26,7 @@ azure_identity = { git = "https://github.com/omnect/azure-sdk-for-rust.git", def
2626
azure_storage = { git = "https://github.com/omnect/azure-sdk-for-rust.git", default-features = false }
2727
azure_storage_blobs = { git = "https://github.com/omnect/azure-sdk-for-rust.git", default-features = false }
2828
base64 = { version = "0.22", default-features = false }
29-
bzip2 = { version = "0.5", default-features = false, features = [
30-
"libbz2-rs-sys",
31-
] }
29+
bzip2 = { version = "0.6", default-features = true }
3230
clap = { version = "4.5", default-features = false, features = [
3331
"derive",
3432
"std",
@@ -41,28 +39,34 @@ filemagic = { version = "0.13", default-features = false, features = [
4139
flate2 = { version = "1.1", default-features = false }
4240
omnect-crypto = { git = "https://github.com/omnect/omnect-crypto.git", tag = "0.4.0" }
4341
keyring = { version = "3.6", default-features = false }
44-
libfs = { version = "0.8", default-features = false }
42+
libfs = { version = "0.9", default-features = false }
4543
log = { version = "0.4", default-features = false }
4644
num_cpus = { version = "1.17", default-features = false }
4745
oauth2 = { version = "5.0", default-features = false, features = ["reqwest"] }
4846
open = { version = "5.3", default-features = false }
4947
regex = { version = "1.11", default-features = false }
50-
reqwest = { version = "0.12", default-features = false, features = ["json", "native-tls"] }
48+
reqwest = { version = "0.13", default-features = false, features = [
49+
"json",
50+
"native-tls",
51+
] }
5152
serde = { version = "1.0", default-features = false, features = ["derive"] }
5253
serde_json = { version = "1.0", default-features = false }
5354
serde_path_to_error = { version = "0.1", default-features = false }
5455
sha2 = { version = "0.10", default-features = false }
5556
stdext = { version = "0.3", default-features = false }
56-
strum = { version = "0.27", default-features = false }
57-
strum_macros = { version = "0.27", default-features = false }
57+
strum = { version = "0.28", default-features = false }
58+
strum_macros = { version = "0.28", default-features = false }
5859
tempfile = { version = "3.20", default-features = false }
5960
time = { version = "0.3", default-features = false }
6061
tokio = { version = "1", default-features = false, features = [
6162
"macros",
6263
"fs",
6364
"rt-multi-thread",
6465
] }
65-
toml = { version = "0.8", default-features = false, features = ["parse"] }
66+
toml = { version = "1.0", default-features = false, features = [
67+
"parse",
68+
"serde",
69+
] }
6670
uuid = { version = "1.17", default-features = false, features = ["v4"] }
6771
url = { version = "2.5", default-features = false }
6872
validator = { version = "0.20", default-features = false, features = [
@@ -75,7 +79,7 @@ assert_cmd = "2.0"
7579
assert-json-diff = "2.0"
7680
data-encoding = "2.9"
7781
file_diff = "1.0"
78-
httpmock = "0.7"
82+
httpmock = "0.8"
7983
ring = "0.17"
8084
tar = "0.4"
8185

src/auth.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ async fn request_access_token(auth_info: &AuthInfo) -> Result<Token> {
176176
let _ = open::that(auth_url.to_string());
177177

178178
let async_http_client = oauth2::reqwest::ClientBuilder::new()
179-
.redirect(reqwest::redirect::Policy::none())
179+
.redirect(oauth2::reqwest::redirect::Policy::none())
180180
.build()
181181
.expect("Failed to request access token: could not create client.");
182182

@@ -198,7 +198,7 @@ async fn refresh_access_token(auth_info: &AuthInfo) -> Option<Token> {
198198
.set_token_uri(TokenUrl::new(auth_info.token_url.clone()).unwrap());
199199

200200
let async_http_client = oauth2::reqwest::ClientBuilder::new()
201-
.redirect(reqwest::redirect::Policy::none())
201+
.redirect(oauth2::reqwest::redirect::Policy::none())
202202
.build()
203203
.expect("Failed to refresh access token: could not create client.");
204204

src/device_update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ pub async fn remove_update(
305305
Ok(())
306306
}
307307

308-
fn get_file_attributes(file: &Path) -> Result<File> {
308+
fn get_file_attributes(file: &Path) -> Result<File<'_>> {
309309
debug!("get file attributes for {file:#?}");
310310

311311
let filename = file.file_name().unwrap().to_string_lossy();

src/file/compression.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,11 @@ impl Compression {
129129
pub fn decompress(image_file_name: &PathBuf, compression: &Compression) -> Result<PathBuf> {
130130
let mut new_image_file = PathBuf::from(image_file_name);
131131

132-
if let Some(extension) = new_image_file.extension() {
133-
if extension == compression.extension() {
134-
new_image_file.set_extension("");
135-
}
132+
if new_image_file
133+
.extension()
134+
.is_some_and(|ext| ext == compression.extension())
135+
{
136+
new_image_file.set_extension("");
136137
}
137138

138139
let mut destination = File::create(&new_image_file)?;

src/file/mod.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,14 @@ fn configure_hostname(
234234
let hosts_file = get_file_path(image_file, "hosts")?;
235235

236236
// get hostname from identity_config_file
237-
let identity: IdentityConfig = serde_path_to_error::deserialize(toml::Deserializer::new(
238-
fs::read_to_string(identity_config_file.to_str().unwrap())
239-
.context("configure_hostname: cannot read identity file")?
240-
.as_str(),
241-
))
237+
let identity: IdentityConfig = serde_path_to_error::deserialize(
238+
toml::Deserializer::parse(
239+
fs::read_to_string(identity_config_file.to_str().unwrap())
240+
.context("configure_hostname: cannot read identity file")?
241+
.as_str(),
242+
)
243+
.context("configure_hostname: couldn't parse identity toml")?,
244+
)
242245
.context("configure_hostname: couldn't read identity")?;
243246

244247
fs::write(&hostname_file, &identity.hostname)

src/lib.rs

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,17 @@ pub fn run() -> Result<()> {
251251
generate_bmap,
252252
compress_image,
253253
}) => {
254-
let cert_info = create_image_cert(&image, CertificateOptions {
255-
intermediate_full_chain_cert: &intermediate_full_chain_cert,
256-
intermediate_key: &intermediate_key,
257-
target_cert: "device_cert_path.pem",
258-
target_key: "device_key_path.key.pem",
259-
subject: &device_id,
260-
validity_days: days,
261-
})
254+
let cert_info = create_image_cert(
255+
&image,
256+
CertificateOptions {
257+
intermediate_full_chain_cert: &intermediate_full_chain_cert,
258+
intermediate_key: &intermediate_key,
259+
target_cert: "device_cert_path.pem",
260+
target_key: "device_key_path.key.pem",
261+
subject: &device_id,
262+
validity_days: days,
263+
},
264+
)
262265
.context("set_device_certificate: could not create certificate")?;
263266

264267
run_image_command(image, generate_bmap, compress_image, |img| {
@@ -279,14 +282,17 @@ pub fn run() -> Result<()> {
279282
generate_bmap,
280283
compress_image,
281284
}) => {
282-
let cert_info = create_image_cert(&image, CertificateOptions {
283-
intermediate_full_chain_cert: &intermediate_full_chain_cert,
284-
intermediate_key: &intermediate_key,
285-
target_cert: "edge_ca_cert_path.pem",
286-
target_key: "edge_ca_key_path.key.pem",
287-
subject: &device_id,
288-
validity_days: days,
289-
})
285+
let cert_info = create_image_cert(
286+
&image,
287+
CertificateOptions {
288+
intermediate_full_chain_cert: &intermediate_full_chain_cert,
289+
intermediate_key: &intermediate_key,
290+
target_cert: "edge_ca_cert_path.pem",
291+
target_key: "edge_ca_key_path.key.pem",
292+
subject: &device_id,
293+
validity_days: days,
294+
},
295+
)
290296
.context("set_edge_ca_certificate: could not create certificate")?;
291297

292298
run_image_command(image, generate_bmap, compress_image, |img| {

src/ssh.rs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -95,37 +95,36 @@ impl Config {
9595
};
9696

9797
// if user wants to use existing key pair, check that it exists
98-
if let Some(key_path) = &priv_key_path {
99-
if !key_path.try_exists().is_ok_and(|exists| exists)
98+
if let Some(key_path) = &priv_key_path
99+
&& (!key_path.try_exists().is_ok_and(|exists| exists)
100100
|| !key_path
101101
.with_extension("pub")
102102
.try_exists()
103-
.is_ok_and(|exists| exists)
104-
{
105-
anyhow::bail!("Missing private/public ssh key.");
106-
}
103+
.is_ok_and(|exists| exists))
104+
{
105+
anyhow::bail!("Missing private/public ssh key.");
107106
}
108107

109108
// if user wants specific config file path, check whether an existing
110109
// config file would be overwritten. If so, query, whether this is
111110
// intended.
112-
if let Some(ref config_path) = config_path {
113-
if config_path.exists() {
114-
if query_yes_no(
115-
format!(
116-
r#"Config file "{}" would be overwritten by operation. Continue? [y/N]"#,
117-
config_path.to_string_lossy(),
118-
),
119-
std::io::BufReader::new(std::io::stdin()),
120-
std::io::stderr(),
121-
)? {
122-
log::info!(
123-
"Overwriting existing config: {}",
124-
config_path.to_string_lossy()
125-
);
126-
} else {
127-
anyhow::bail!("Not overwriting config.");
128-
}
111+
if let Some(ref config_path) = config_path
112+
&& config_path.exists()
113+
{
114+
if query_yes_no(
115+
format!(
116+
r#"Config file "{}" would be overwritten by operation. Continue? [y/N]"#,
117+
config_path.to_string_lossy(),
118+
),
119+
std::io::BufReader::new(std::io::stdin()),
120+
std::io::stderr(),
121+
)? {
122+
log::info!(
123+
"Overwriting existing config: {}",
124+
config_path.to_string_lossy()
125+
);
126+
} else {
127+
anyhow::bail!("Not overwriting config.");
129128
}
130129
}
131130

src/validators/identity.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ pub fn validate_identity(
210210
let file_content = std::fs::read_to_string(config_file_name)
211211
.context("validate_identity: cannot read identity file")?;
212212
debug!("validate identity for:\n{}", file_content);
213-
let des = toml::Deserializer::new(&file_content);
213+
let des = toml::Deserializer::parse(&file_content)
214+
.context("validate_identity: cannot parse identity toml")?;
214215
let body: Result<IdentityConfig, _> = serde_path_to_error::deserialize(des);
215216
let body = match body {
216217
Err(e) => {
@@ -256,8 +257,8 @@ pub fn validate_identity(
256257
}
257258
}
258259
}
259-
if p.payload.is_some() {
260-
if p.payload.unwrap().uri.ne(PAYLOAD_FILEPATH) {
260+
if let Some(p_payload) = p.payload {
261+
if p_payload.uri.ne(PAYLOAD_FILEPATH) {
261262
out.push(WARN_UNEXPECTED_PATH);
262263
} else if payload.is_none() {
263264
out.push(WARN_PAYLOAD_FILEPATH_MISSING);

0 commit comments

Comments
 (0)