Skip to content

Commit f708797

Browse files
committed
chore(deps): preserve Rust compatibility and update rustls
1 parent 7ab7026 commit f708797

3 files changed

Lines changed: 47 additions & 9 deletions

File tree

‎Cargo.lock‎

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

‎Cargo.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,15 @@ reqwest = { version = "0.13", default-features = false }
259259
rolldown-notify = "11.0.0"
260260
rolldown-notify-debouncer-full = "0.8.0"
261261
rustc-hash = "2.1.1"
262-
rustls = { version = "0.23.45", default-features = false, features = ["ring", "std", "tls12"] }
262+
rustls = { version = "0.23.46", default-features = false, features = ["ring", "std", "tls12"] }
263263
same-file = "1.0.6"
264264
saphyr = { version = "0.2.1", default-features = false }
265265
schemars = "1.0.0"
266266
self_cell = "1.2.0"
267267
semver = "1.0.26"
268268
serde = { version = "1.0.219", features = ["derive"] }
269269
serde_json = "1.0.140"
270-
serial_test = "4.0.0"
270+
serial_test = "3.2.0"
271271
sha1 = "0.11.0"
272272
sha2 = "0.11.0"
273273
shell-escape = "0.1.5"

‎crates/vp_js_runtime/src/download.rs‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,44 @@ mod tests {
494494
AbsolutePathBuf::new(dir.path().join("archive.tar.gz")).unwrap()
495495
}
496496

497+
#[tokio::test]
498+
async fn extracts_zip_runtime_archives() {
499+
use std::io::Write;
500+
501+
use zip::{CompressionMethod, ZipWriter, write::SimpleFileOptions};
502+
503+
for compression in [CompressionMethod::Stored, CompressionMethod::Deflated] {
504+
let temp = TempDir::new().unwrap();
505+
let root = AbsolutePathBuf::new(temp.path().to_path_buf()).unwrap();
506+
let archive_path = root.join("node.zip");
507+
let target = root.join("extracted");
508+
let contents = b"mock node binary";
509+
let mut archive = ZipWriter::new(File::create(&archive_path).unwrap());
510+
let options = SimpleFileOptions::default().compression_method(compression);
511+
archive.add_directory("node-win-x64/", options).unwrap();
512+
archive.start_file("node-win-x64/node.exe", options).unwrap();
513+
archive.write_all(contents).unwrap();
514+
archive.finish().unwrap();
515+
516+
extract_archive(&archive_path, &target, ArchiveFormat::Zip).await.unwrap();
517+
518+
assert_eq!(std::fs::read(target.join("node-win-x64/node.exe")).unwrap(), contents);
519+
}
520+
}
521+
522+
#[tokio::test]
523+
async fn rejects_invalid_zip_runtime_archives() {
524+
let temp = TempDir::new().unwrap();
525+
let root = AbsolutePathBuf::new(temp.path().to_path_buf()).unwrap();
526+
let archive_path = root.join("node.zip");
527+
std::fs::write(&archive_path, b"not a ZIP archive").unwrap();
528+
529+
let result =
530+
extract_archive(&archive_path, &root.join("extracted"), ArchiveFormat::Zip).await;
531+
532+
assert!(matches!(result, Err(Error::ExtractionFailed { .. })));
533+
}
534+
497535
async fn read_request(socket: &mut TcpStream) -> String {
498536
let mut request = Vec::new();
499537
let mut buffer = [0; 1024];

0 commit comments

Comments
 (0)