team-ljyzipelo

공개

TAR.BZ2와 TAR.XZ의 안전한 압축 해제를 추가함

작성자
시로사키 하나
작성 시각
커밋
8c5d69b7befb3e1e0f09ee53556f5d7eb7c4fe0f
부모
2091e25
이 시점의 파일 보기

변경된 파일 15개

+1,350-57
수정experiments/rust-archive-worker/Cargo.lock+101-11
@@ -10,7 +10,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
1010dependencies = [
1111 "cfg-if",
1212 "cipher",
13삭제: "cpufeatures",
13추가: "cpufeatures 0.2.17",
1414 "zeroize",
1515]
1616
@@ -23,6 +23,24 @@ dependencies = [
2323 "generic-array",
2424]
2525
26추가: [[package]]
27추가: name = "block-buffer"
28추가: version = "0.12.1"
29추가: source = "registry+https://github.com/rust-lang/crates.io-index"
30추가: checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa"
31추가: dependencies = [
32추가: "hybrid-array",
33추가: ]
34추가:
35추가: [[package]]
36추가: name = "bzip2"
37추가: version = "0.6.1"
38추가: source = "registry+https://github.com/rust-lang/crates.io-index"
39추가: checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c"
40추가: dependencies = [
41추가: "libbz2-rs-sys",
42추가: ]
43추가:
2644[[package]]
2745name = "cfg-if"
2846version = "1.0.5"
@@ -35,10 +53,16 @@ version = "0.4.4"
3553source = "registry+https://github.com/rust-lang/crates.io-index"
3654checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
3755dependencies = [
38삭제: "crypto-common",
56추가: "crypto-common 0.1.7",
3957 "inout",
4058]
4159
60추가: [[package]]
61추가: name = "const-oid"
62추가: version = "0.10.3"
63추가: source = "registry+https://github.com/rust-lang/crates.io-index"
64추가: checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a"
65추가:
4266[[package]]
4367name = "cpufeatures"
4468version = "0.2.17"
@@ -48,6 +72,15 @@ dependencies = [
4872 "libc",
4973]
5074
75추가: [[package]]
76추가: name = "cpufeatures"
77추가: version = "0.3.1"
78추가: source = "registry+https://github.com/rust-lang/crates.io-index"
79추가: checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"
80추가: dependencies = [
81추가: "libc",
82추가: ]
83추가:
5184[[package]]
5285name = "crypto-common"
5386version = "0.1.7"
@@ -58,17 +91,37 @@ dependencies = [
5891 "typenum",
5992]
6093
94추가: [[package]]
95추가: name = "crypto-common"
96추가: version = "0.2.2"
97추가: source = "registry+https://github.com/rust-lang/crates.io-index"
98추가: checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
99추가: dependencies = [
100추가: "hybrid-array",
101추가: ]
102추가:
61103[[package]]
62104name = "digest"
63105version = "0.10.7"
64106source = "registry+https://github.com/rust-lang/crates.io-index"
65107checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
66108dependencies = [
67삭제: "block-buffer",
68삭제: "crypto-common",
109추가: "block-buffer 0.10.4",
110추가: "crypto-common 0.1.7",
69111 "subtle",
70112]
71113
114추가: [[package]]
115추가: name = "digest"
116추가: version = "0.11.3"
117추가: source = "registry+https://github.com/rust-lang/crates.io-index"
118추가: checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
119추가: dependencies = [
120추가: "block-buffer 0.12.1",
121추가: "const-oid",
122추가: "crypto-common 0.2.2",
123추가: ]
124추가:
72125[[package]]
73126name = "generic-array"
74127version = "0.14.7"
@@ -85,7 +138,16 @@ version = "0.12.1"
85138source = "registry+https://github.com/rust-lang/crates.io-index"
86139checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
87140dependencies = [
88삭제: "digest",
141추가: "digest 0.10.7",
142추가: ]
143추가:
144추가: [[package]]
145추가: name = "hybrid-array"
146추가: version = "0.4.15"
147추가: source = "registry+https://github.com/rust-lang/crates.io-index"
148추가: checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17"
149추가: dependencies = [
150추가: "typenum",
89151]
90152
91153[[package]]
@@ -97,19 +159,34 @@ dependencies = [
97159 "generic-array",
98160]
99161
162추가: [[package]]
163추가: name = "libbz2-rs-sys"
164추가: version = "0.2.6"
165추가: source = "registry+https://github.com/rust-lang/crates.io-index"
166추가: checksum = "32f454fd6831a29c0e827ed075bca2a15be201bd57f4168f0fd1041124eab17e"
167추가:
100168[[package]]
101169name = "libc"
102170version = "0.2.191"
103171source = "registry+https://github.com/rust-lang/crates.io-index"
104172checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
105173
174추가: [[package]]
175추가: name = "lzma-rust2"
176추가: version = "0.25.0"
177추가: source = "registry+https://github.com/rust-lang/crates.io-index"
178추가: checksum = "ef1d73c59a56771343712b22ea5615092c612c16ba291c0979e3105dfeec4890"
179추가: dependencies = [
180추가: "sha2 0.11.1",
181추가: ]
182추가:
106183[[package]]
107184name = "pbkdf2"
108185version = "0.12.2"
109186source = "registry+https://github.com/rust-lang/crates.io-index"
110187checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
111188dependencies = [
112삭제: "digest",
189추가: "digest 0.10.7",
113190 "hmac",
114191]
115192
@@ -120,8 +197,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
120197checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
121198dependencies = [
122199 "cfg-if",
123삭제: "cpufeatures",
124삭제: "digest",
200추가: "cpufeatures 0.2.17",
201추가: "digest 0.10.7",
125202]
126203
127204[[package]]
@@ -131,8 +208,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
131208checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
132209dependencies = [
133210 "cfg-if",
134삭제: "cpufeatures",
135삭제: "digest",
211추가: "cpufeatures 0.2.17",
212추가: "digest 0.10.7",
213추가: ]
214추가:
215추가: [[package]]
216추가: name = "sha2"
217추가: version = "0.11.1"
218추가: source = "registry+https://github.com/rust-lang/crates.io-index"
219추가: checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
220추가: dependencies = [
221추가: "cfg-if",
222추가: "cpufeatures 0.3.1",
223추가: "digest 0.11.3",
136224]
137225
138226[[package]]
@@ -164,10 +252,12 @@ name = "zipelo-archive-worker"
164252version = "0.1.0"
165253dependencies = [
166254 "aes",
255추가: "bzip2",
167256 "hmac",
257추가: "lzma-rust2",
168258 "pbkdf2",
169259 "sha1",
170삭제: "sha2",
260추가: "sha2 0.10.9",
171261 "subtle",
172262 "zeroize",
173263 "zlib-rs",
수정experiments/rust-archive-worker/Cargo.toml+8-0
@@ -7,6 +7,8 @@ publish = false
77autotests = false
88
99[dependencies]
10추가: bzip2 = "=0.6.1"
11추가: lzma-rust2 = { version = "=0.25.0", default-features = false, features = ["std", "xz"] }
1012aes = { version = "=0.8.4", features = ["zeroize"] }
1113hmac = "=0.12.1"
1214pbkdf2 = { version = "=0.12.2", default-features = false, features = ["hmac"] }
@@ -25,3 +27,9 @@ path = "../../tests/rust-archive-worker/main.rs"
2527# 대용량 시험의 CRC와 Deflate에도 배포판의 최적화를 적용함.
2628[profile.dev.package.zlib-rs]
2729opt-level = 3
30추가:
31추가: [profile.dev.package.libbz2-rs-sys]
32추가: opt-level = 3
33추가:
34추가: [profile.dev.package.lzma-rust2]
35추가: opt-level = 3
수정experiments/rust-archive-worker/README.md+20-1
@@ -2,7 +2,7 @@
22
33별도 프로세스의 stdin/stdout으로 revision 3 요청을 처리합니다. 제품 앱이 공유 codec으로 연결하며 프로세스 분리는 OS sandbox를 뜻하지 않습니다. 암호 기능은 capability=true이며 ZipCrypto 해제, WinZip AES-256 AE-1/AE-2 해제와 AE-2 생성을 지원합니다.
44
5삭제: - ZIP32/ZIP64 Store/Deflate 목록과 해제, ZIP32/ZIP64 생성, 기본 TAR/USTAR, GZ, TAR.GZ, 비암호화 7z 해제를 지원합니다. GZ 연결 멤버는 하나의 논리 스트림으로 합칩니다. 다중 볼륨, UTF-8로 해석할 수 없는 ZIP 이름, PAX/GNU 확장과 특수 항목 해제는 미지원입니다.
5추가: - ZIP32/ZIP64 Store/Deflate 목록과 해제, ZIP32/ZIP64 생성, 기본 TAR/USTAR, GZ, TAR.GZ, TAR.BZ2, TAR.XZ, 비암호화 7z 해제를 지원합니다. GZ 연결 멤버는 하나의 논리 스트림으로 합칩니다. 다중 볼륨, UTF-8로 해석할 수 없는 ZIP 이름, PAX/GNU 확장과 특수 항목 해제는 미지원입니다.
66- ZIP 이름: UTF-8 플래그(비트 11)가 있으면 이름이 UTF-8이어야 하며 아니면 Integrity입니다. 플래그가 없으면 CRC가 원래 이름과 맞는 Info-ZIP Unicode Path 확장 필드(0x7075, 버전 1)를 우선 쓰고, 다음으로 UTF-8로 유효한 이름 바이트를 그대로 씁니다(Linux/macOS 도구의 기본 동작). CRC가 다르거나 버전이 다른 확장 필드는 무시합니다. 그 밖의 CP437/CP949 등 레거시 이름은 코드 페이지를 추측하지 않고 UnsupportedFeature로 거부합니다. 어느 경로로 얻은 이름이든 같은 경로 안전성 검사와 충돌 검사를 거칩니다.
77- ZIP/TAR/GZ/TAR.GZ/7z 목록과 해제는 입력 기본 한도 u64::MAX, 해제 총량 16 GiB, 항목 10,000개입니다. 요청 limits는 이 값을 낮출 수 있습니다. 64 KiB 버퍼와 임시 파일로 입력과 검증 완료 payload를 처리해 모든 출력의 CRC, 크기와 경로를 게시 전에 검사합니다. checkpoint마다 취소, 부모 프로세스 생존과 300초 한도를 확인합니다. ZIP 생성은 원본을 하나씩 스냅샷으로 읽어 스트리밍으로 압축하며 원본 크기 합계에 16 GiB 한도를 적용합니다. ZIP64 크기와 오프셋은 필요한 항목에만 기록합니다. slice 기반 archive parser는 입력 64 MiB/출력 128 MiB, slice ZIP builder는 원본 및 결과 128 MiB 한도를 유지합니다.
88- 경로 깊이는 64개 구성 요소, 이름/출력 계획 메타데이터 예산은 8 MiB, 출력 계획 노드는 32,768개로 제한합니다. 이름 복제와 인덱스 비용을 보수적으로 계산해 할당 전에 Limit으로 거부합니다.
@@ -35,6 +35,25 @@ revision 2의 기존 필드와 오류 tag 0~12 및 입력/출력 기본 한도
3535- 합성 표본은 Python 표준 lzma로 생성합니다. 별도로 시스템 libarchive가 만든 LZMA1/LZMA2 표본을 해제하고, 합성 표본도 libarchive 읽기 API로 검사합니다. libarchive는 Linux 시험의 독립 참조 도구이며 제품 의존성이 아닙니다. 시험 도구와 표본은 tests/rust-archive-worker 아래에 있습니다.
3636- 형식 확장은 히나타 님과 합의한 Format::SevenZip=4입니다. 기존 값 0~3과 필드, 메시지 tag, 프레임 version은 유지합니다. 구버전 앱은 값 4를 거부하므로 앱 Format과 양방향 변환도 갱신해야 합니다. 이 백엔드 변경은 frontend 코드를 수정하지 않습니다.
3737
38추가: ## 압축 TAR 해제
39추가:
40추가: TAR.BZ2와 TAR.XZ는 확장자가 아닌 BZh 및 XZ 매직으로 판별하고 비공개 임시 파일로 먼저 해제합니다. 연결된 BZip2/XZ 스트림은 하나의 TAR로 합치며 XZ의 4바이트 정렬 스트림 패딩도 허용합니다. 빈 TAR, USTAR 이름과 빈 폴더를 지원하지만 독립 BZ2/XZ 데이터 파일은 TAR가 아니면 거부합니다.
41추가:
42추가: 해제 총량은 TAR 헤더와 패딩을 포함해 기존 16 GiB 이하이며 요청으로 낮출 수 있습니다. 64 KiB씩 실제 해제량을 확인하고 기록 전에 임시 저장소의 공간을 검사합니다. XZ는 블록별 LZMA2 디코더 메모리 32 MiB, 인덱스 8 MiB, 스트림 수와 스트림당 블록 수 각각 32,768을 상한으로 둡니다. 이 상한을 넘는 정상 파일도 Limit로 거부합니다. 해제 전체와 TAR 경로, 항목 종류 및 이름 충돌을 검증하기 전에는 목적지에 게시하지 않습니다. 출력 공간 검사, 안전한 충돌 처리, 취소와 300초 시간 제한도 기존 흐름을 사용합니다.
43추가:
44추가: XZ의 헤더, 인덱스, 푸터 CRC와 역방향 크기 및 전체 선언 해제량을 확인하고 실제 해제량과 비교합니다. 라이브러리는 데이터 블록의 지원되는 CRC32/CRC64/SHA256 검사를 수행합니다. XZ의 Check=None도 형식대로 허용하므로 데이터 체크섬이 없는 파일의 내용 무결성을 보장하지 않습니다. TAR의 PAX/GNU 확장, 링크와 특수 항목의 기존 제한도 유지합니다.
45추가:
46추가: 통신에는 기존 Format::Tar=1을 사용합니다. 압축 방식별 새 형식 값이나 메시지 변경은 없으며 목록 식별자는 원본 객체, 길이와 SHA256을 계속 포함합니다. 화면의 파일 선택 필터와 지원 안내, 새 형식의 UI 상황 추가는 frontend 연동 범위입니다.
47추가:
48추가: 의존성 선택 근거는 다음과 같습니다.
49추가:
50추가: - [bzip2 0.6.1](https://docs.rs/crate/bzip2/0.6.1/source/Cargo.toml)은 MIT OR Apache-2.0이며 기본 백엔드가 Rust 구현인 libbz2-rs-sys입니다. 고정 lockfile은 libbz2-rs-sys 0.2.6(bzip2-1.0.6 자유 라이선스)을 선택하고 Rust 할당자를 사용합니다. C 구현인 bzip2-sys 기능과 stdio/C 할당자는 활성화하지 않습니다.
51추가: - [lzma-rust2 0.25.0](https://docs.rs/lzma-rust2/latest/lzma_rust2/struct.XzReader.html)은 Apache-2.0의 Rust 구현입니다. std와 xz만 활성화해 인코더와 다중 스레드 구현을 제외하고 사전 할당 전 메모리 제한을 적용합니다. CRC와 인덱스를 검증하며 연결 스트림을 끝까지 읽습니다.
52추가: - 두 라이브러리와 새 전이 의존성의 원문은 Cargo 체크섬을 대조하는 기존 packaging/licenses.py가 고지에 자동 포함합니다. tests/release-packages/test_compressed_tar_licenses.py는 실제 고지에 세 압축 라이브러리의 원문과 해시가 포함되고 C 압축 백엔드가 없는지 확인합니다.
53추가: - 2026-11-13 [RustSec 공개 목록](https://rustsec.org/advisories/)에서 bzip2, libbz2-rs-sys, lzma-rust2 이름의 항목은 찾지 못했습니다. 새 전이 sha2 0.11.1은 RUSTSEC-2021-0100의 수정 범위(>=0.9.8)에 해당합니다. 전체 최신 DB 자동 감사와 취약점 부재를 보장하는 확인은 수행하지 않았습니다.
54추가:
55추가: Python 표준 bz2, lzma와 tarfile로 독립 생성 및 해제한 결과의 SHA256과 실제 작업자 결과를 비교합니다. tests/rust-archive-worker/compressed_tar.rs는 정상, 빈 TAR, 연결 스트림, XZ 필터와 체크 방식, 잘림과 손상, 푸터/인덱스 크기, 큰 사전, 작은 출력 한도의 압축 폭탄, 한도 경계, 경로 이탈, 링크, 목록 식별자와 선택, 취소 및 디코더 임시 공간 실패를 검증합니다.
56추가:
3857## 암호 ZIP
3958
4059- AES는 [WinZip AE-1/AE-2 명세](https://www.winzip.com/en/support/aes-encryption/)의 method 99, 0x9901 추가 필드, PBKDF2-HMAC-SHA1 1000회, 16바이트 salt, AES-256 CTR와 HMAC-SHA1-80 형식을 사용합니다. 새 파일은 CRC를 노출하지 않는 AE-2입니다. AE-1은 인증과 CRC를 모두 검증합니다. AES-128/192와 PKWARE Strong Encryption은 미지원입니다.
추가experiments/rust-archive-worker/src/compressed_tar.rs+237-0
@@ -0,0 +1,237 @@
1추가: use crate::{protocol::ErrorCode, space, spool};
2추가: use std::{
3추가: cell::RefCell,
4추가: fs::File,
5추가: io::{self, BufReader, Read, Seek, Write},
6추가: };
7추가: use zeroize::Zeroizing;
8추가:
9추가: type Result<T> = std::result::Result<T, ErrorCode>;
10추가: const CHUNK: usize = 65_536;
11추가: const XZ_MEMORY_KIB: u32 = 32 * 1024;
12추가:
13추가: #[derive(Clone, Copy)]
14추가: pub(crate) enum Compression {
15추가: Bzip2,
16추가: Xz,
17추가: }
18추가:
19추가: #[derive(Debug)]
20추가: struct InputError(ErrorCode);
21추가:
22추가: impl std::fmt::Display for InputError {
23추가: fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24추가: write!(formatter, "{:?}", self.0)
25추가: }
26추가: }
27추가:
28추가: impl std::error::Error for InputError {}
29추가:
30추가: struct CheckedInput<'a, F> {
31추가: file: &'a mut File,
32추가: check: &'a RefCell<&'a mut F>,
33추가: }
34추가:
35추가: impl<F: FnMut() -> Result<()>> Read for CheckedInput<'_, F> {
36추가: fn read(&mut self, buffer: &mut [u8]) -> io::Result<usize> {
37추가: (self.check.borrow_mut())().map_err(|error| io::Error::other(InputError(error)))?;
38추가: let count = buffer.len().min(CHUNK);
39추가: self.file
40추가: .read(&mut buffer[..count])
41추가: .map_err(|_| io::Error::other(InputError(ErrorCode::Io)))
42추가: }
43추가: }
44추가:
45추가: fn decode_error(error: io::Error) -> ErrorCode {
46추가: if let Some(error) = error
47추가: .get_ref()
48추가: .and_then(|error| error.downcast_ref::<InputError>())
49추가: {
50추가: return error.0;
51추가: }
52추가: match error.kind() {
53추가: io::ErrorKind::OutOfMemory => ErrorCode::Limit,
54추가: io::ErrorKind::Unsupported => ErrorCode::UnsupportedFeature,
55추가: _ => ErrorCode::Integrity,
56추가: }
57추가: }
58추가:
59추가: pub(crate) fn decode(
60추가: source: &mut File,
61추가: compression: Compression,
62추가: limit: u64,
63추가: check: &mut impl FnMut() -> Result<()>,
64추가: ) -> Result<(File, u64)> {
65추가: check()?;
66추가: let expected = if matches!(compression, Compression::Xz) {
67추가: Some(xz_layout(source, limit, check)?)
68추가: } else {
69추가: None
70추가: };
71추가: source.rewind().map_err(space::io_error)?;
72추가: let mut output = spool::temporary()?;
73추가: let check = RefCell::new(check);
74추가: let input = CheckedInput {
75추가: file: source,
76추가: check: &check,
77추가: };
78추가: let mut reader: Box<dyn Read + '_> = match compression {
79추가: Compression::Bzip2 => Box::new(bzip2::bufread::MultiBzDecoder::new(
80추가: BufReader::with_capacity(CHUNK, input),
81추가: )),
82추가: Compression::Xz => Box::new(lzma_rust2::XzReader::new_mem_limit(
83추가: input,
84추가: true,
85추가: XZ_MEMORY_KIB,
86추가: )),
87추가: };
88추가: let mut buffer = Zeroizing::new([0; CHUNK]);
89추가: let mut total = 0u64;
90추가: loop {
91추가: (check.borrow_mut())()?;
92추가: let count = reader.read(&mut buffer[..]).map_err(decode_error)?;
93추가: if count == 0 {
94추가: break;
95추가: }
96추가: total = total
97추가: .checked_add(count as u64)
98추가: .filter(|total| *total <= limit)
99추가: .ok_or(ErrorCode::Limit)?;
100추가: // 전체 검증 전에는 비공개 임시 파일에만 기록함.
101추가: space::ensure(&output, count as u64)?;
102추가: output
103추가: .write_all(&buffer[..count])
104추가: .map_err(space::io_error)?;
105추가: }
106추가: (check.borrow_mut())()?;
107추가: if expected.is_some_and(|expected| expected != total) {
108추가: return Err(ErrorCode::Integrity);
109추가: }
110추가: Ok((output, total))
111추가: }
112추가:
113추가: fn read_at(
114추가: source: &mut File,
115추가: offset: u64,
116추가: bytes: &mut [u8],
117추가: check: &mut impl FnMut() -> Result<()>,
118추가: ) -> Result<()> {
119추가: check()?;
120추가: source
121추가: .seek(std::io::SeekFrom::Start(offset))
122추가: .map_err(space::io_error)?;
123추가: source.read_exact(bytes).map_err(|error| {
124추가: if error.kind() == io::ErrorKind::UnexpectedEof {
125추가: ErrorCode::Integrity
126추가: } else {
127추가: ErrorCode::Io
128추가: }
129추가: })
130추가: }
131추가:
132추가: fn vli(bytes: &[u8], cursor: &mut usize) -> Result<u64> {
133추가: let mut value = 0u64;
134추가: for shift in (0..63).step_by(7) {
135추가: let byte = *bytes.get(*cursor).ok_or(ErrorCode::Integrity)?;
136추가: *cursor += 1;
137추가: value |= u64::from(byte & 127) << shift;
138추가: if byte & 128 == 0 {
139추가: if shift != 0 && byte == 0 {
140추가: return Err(ErrorCode::Integrity);
141추가: }
142추가: return Ok(value);
143추가: }
144추가: }
145추가: Err(ErrorCode::Integrity)
146추가: }
147추가:
148추가: // 역방향 인덱스 검사는 디코더의 할당과 실제 해제량 검사보다 먼저 수행함.
149추가: fn xz_layout(source: &mut File, limit: u64, check: &mut impl FnMut() -> Result<()>) -> Result<u64> {
150추가: use zlib_rs::crc32::crc32;
151추가: let mut end = source.metadata().map_err(space::io_error)?.len();
152추가: let mut total = 0u64;
153추가: let mut streams = 0usize;
154추가: while end != 0 {
155추가: let mut tail = [0; 4];
156추가: loop {
157추가: let at = end.checked_sub(4).ok_or(ErrorCode::Integrity)?;
158추가: read_at(source, at, &mut tail, check)?;
159추가: if tail != [0; 4] {
160추가: break;
161추가: }
162추가: end = at;
163추가: }
164추가: streams += 1;
165추가: if streams > crate::archive::MAX_OUTPUT_NODES {
166추가: return Err(ErrorCode::Limit);
167추가: }
168추가: let footer_at = end.checked_sub(12).ok_or(ErrorCode::Integrity)?;
169추가: let mut footer = [0; 12];
170추가: read_at(source, footer_at, &mut footer, check)?;
171추가: if &footer[10..] != b"YZ"
172추가: || crc32(0, &footer[4..10]) != u32::from_le_bytes(footer[..4].try_into().unwrap())
173추가: {
174추가: return Err(ErrorCode::Integrity);
175추가: }
176추가: let index_len = (u64::from(u32::from_le_bytes(footer[4..8].try_into().unwrap())) + 1) * 4;
177추가: if index_len > crate::archive::MAX_METADATA_BYTES as u64 {
178추가: return Err(ErrorCode::Limit);
179추가: }
180추가: if index_len < 8 {
181추가: return Err(ErrorCode::Integrity);
182추가: }
183추가: let index_at = footer_at
184추가: .checked_sub(index_len)
185추가: .ok_or(ErrorCode::Integrity)?;
186추가: let mut index = vec![0; index_len as usize];
187추가: read_at(source, index_at, &mut index, check)?;
188추가: let data_end = index.len() - 4;
189추가: if index[0] != 0
190추가: || crc32(0, &index[..data_end])
191추가: != u32::from_le_bytes(index[data_end..].try_into().unwrap())
192추가: {
193추가: return Err(ErrorCode::Integrity);
194추가: }
195추가: let mut cursor = 1;
196추가: let count = vli(&index[..data_end], &mut cursor)?;
197추가: if count > crate::archive::MAX_OUTPUT_NODES as u64 {
198추가: return Err(ErrorCode::Limit);
199추가: }
200추가: let mut blocks = 0u64;
201추가: for _ in 0..count {
202추가: check()?;
203추가: let unpadded = vli(&index[..data_end], &mut cursor)?;
204추가: let size = vli(&index[..data_end], &mut cursor)?;
205추가: if unpadded == 0 {
206추가: return Err(ErrorCode::Integrity);
207추가: }
208추가: blocks = blocks
209추가: .checked_add(unpadded.checked_add(3).ok_or(ErrorCode::Integrity)? & !3)
210추가: .ok_or(ErrorCode::Integrity)?;
211추가: total = total
212추가: .checked_add(size)
213추가: .filter(|total| *total <= limit)
214추가: .ok_or(ErrorCode::Limit)?;
215추가: }
216추가: if data_end - cursor > 3 || index[cursor..data_end].iter().any(|byte| *byte != 0) {
217추가: return Err(ErrorCode::Integrity);
218추가: }
219추가: let start = index_at
220추가: .checked_sub(blocks)
221추가: .and_then(|at| at.checked_sub(12))
222추가: .ok_or(ErrorCode::Integrity)?;
223추가: let mut header = [0; 12];
224추가: read_at(source, start, &mut header, check)?;
225추가: if &header[..6] != b"\xfd7zXZ\0"
226추가: || header[6..8] != footer[8..10]
227추가: || crc32(0, &header[6..8]) != u32::from_le_bytes(header[8..].try_into().unwrap())
228추가: {
229추가: return Err(ErrorCode::Integrity);
230추가: }
231추가: end = start;
232추가: }
233추가: if streams == 0 {
234추가: return Err(ErrorCode::Integrity);
235추가: }
236추가: Ok(total)
237추가: }
수정experiments/rust-archive-worker/src/lib.rs+1-0
@@ -1,4 +1,5 @@
11pub mod archive;
2추가: mod compressed_tar;
23mod create;
34mod create_sources;
45mod crypto;
수정experiments/rust-archive-worker/src/streaming.rs+15-0
@@ -66,6 +66,21 @@ impl Catalog {
6666 {
6767 return zip(source, len, limits, decode, password, check);
6868 }
69추가: let compression = if magic.starts_with(b"BZh") {
70추가: Some(crate::compressed_tar::Compression::Bzip2)
71추가: } else if &magic == b"\xfd7zXZ\0" {
72추가: Some(crate::compressed_tar::Compression::Xz)
73추가: } else {
74추가: None
75추가: };
76추가: if let Some(compression) = compression {
77추가: let (data, expanded) =
78추가: crate::compressed_tar::decode(source, compression, limits.output, check)?;
79추가: if expanded < 1024 {
80추가: return Err(ErrorCode::Integrity);
81추가: }
82추가: return tar(data, expanded, limits, Format::Tar, check);
83추가: }
6984 if magic.starts_with(&[31, 139]) {
7085 let mut data = spool::temporary()?;
7186 io(source.rewind())?;
수정experiments/rust-ui-memory-app/Cargo.lock+102-12
@@ -124,7 +124,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
124124dependencies = [
125125 "cfg-if",
126126 "cipher",
127삭제: "cpufeatures",
127추가: "cpufeatures 0.2.17",
128128 "zeroize",
129129]
130130
@@ -462,6 +462,15 @@ dependencies = [
462462 "generic-array",
463463]
464464
465추가: [[package]]
466추가: name = "block-buffer"
467추가: version = "0.12.1"
468추가: source = "registry+https://github.com/rust-lang/crates.io-index"
469추가: checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa"
470추가: dependencies = [
471추가: "hybrid-array",
472추가: ]
473추가:
465474[[package]]
466475name = "block2"
467476version = "0.5.1"
@@ -531,6 +540,15 @@ version = "1.12.1"
531540source = "registry+https://github.com/rust-lang/crates.io-index"
532541checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
533542
543추가: [[package]]
544추가: name = "bzip2"
545추가: version = "0.6.1"
546추가: source = "registry+https://github.com/rust-lang/crates.io-index"
547추가: checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c"
548추가: dependencies = [
549추가: "libbz2-rs-sys",
550추가: ]
551추가:
534552[[package]]
535553name = "calloop"
536554version = "0.13.0"
@@ -620,7 +638,7 @@ version = "0.4.4"
620638source = "registry+https://github.com/rust-lang/crates.io-index"
621639checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
622640dependencies = [
623삭제: "crypto-common",
641추가: "crypto-common 0.1.7",
624642 "inout",
625643]
626644
@@ -670,6 +688,12 @@ dependencies = [
670688 "crossbeam-utils",
671689]
672690
691추가: [[package]]
692추가: name = "const-oid"
693추가: version = "0.10.3"
694추가: source = "registry+https://github.com/rust-lang/crates.io-index"
695추가: checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a"
696추가:
673697[[package]]
674698name = "constant_time_eq"
675699version = "0.6.1"
@@ -728,6 +752,15 @@ dependencies = [
728752 "libc",
729753]
730754
755추가: [[package]]
756추가: name = "cpufeatures"
757추가: version = "0.3.1"
758추가: source = "registry+https://github.com/rust-lang/crates.io-index"
759추가: checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"
760추가: dependencies = [
761추가: "libc",
762추가: ]
763추가:
731764[[package]]
732765name = "crc32fast"
733766version = "1.5.5"
@@ -759,6 +792,15 @@ dependencies = [
759792 "typenum",
760793]
761794
795추가: [[package]]
796추가: name = "crypto-common"
797추가: version = "0.2.2"
798추가: source = "registry+https://github.com/rust-lang/crates.io-index"
799추가: checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
800추가: dependencies = [
801추가: "hybrid-array",
802추가: ]
803추가:
762804[[package]]
763805name = "cursor-icon"
764806version = "1.2.0"
@@ -771,11 +813,22 @@ version = "0.10.7"
771813source = "registry+https://github.com/rust-lang/crates.io-index"
772814checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
773815dependencies = [
774삭제: "block-buffer",
775삭제: "crypto-common",
816추가: "block-buffer 0.10.4",
817추가: "crypto-common 0.1.7",
776818 "subtle",
777819]
778820
821추가: [[package]]
822추가: name = "digest"
823추가: version = "0.11.3"
824추가: source = "registry+https://github.com/rust-lang/crates.io-index"
825추가: checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
826추가: dependencies = [
827추가: "block-buffer 0.12.1",
828추가: "const-oid",
829추가: "crypto-common 0.2.2",
830추가: ]
831추가:
779832[[package]]
780833name = "dispatch"
781834version = "0.2.0"
@@ -1533,7 +1586,16 @@ version = "0.12.1"
15331586source = "registry+https://github.com/rust-lang/crates.io-index"
15341587checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
15351588dependencies = [
1536삭제: "digest",
1589추가: "digest 0.10.7",
1590추가: ]
1591추가:
1592추가: [[package]]
1593추가: name = "hybrid-array"
1594추가: version = "0.4.15"
1595추가: source = "registry+https://github.com/rust-lang/crates.io-index"
1596추가: checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17"
1597추가: dependencies = [
1598추가: "typenum",
15371599]
15381600
15391601[[package]]
@@ -1779,6 +1841,12 @@ dependencies = [
17791841 "smallvec",
17801842]
17811843
1844추가: [[package]]
1845추가: name = "libbz2-rs-sys"
1846추가: version = "0.2.6"
1847추가: source = "registry+https://github.com/rust-lang/crates.io-index"
1848추가: checksum = "32f454fd6831a29c0e827ed075bca2a15be201bd57f4168f0fd1041124eab17e"
1849추가:
17821850[[package]]
17831851name = "libc"
17841852version = "0.2.191"
@@ -1858,6 +1926,15 @@ version = "0.4.35"
18581926source = "registry+https://github.com/rust-lang/crates.io-index"
18591927checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c"
18601928
1929추가: [[package]]
1930추가: name = "lzma-rust2"
1931추가: version = "0.25.0"
1932추가: source = "registry+https://github.com/rust-lang/crates.io-index"
1933추가: checksum = "ef1d73c59a56771343712b22ea5615092c612c16ba291c0979e3105dfeec4890"
1934추가: dependencies = [
1935추가: "sha2 0.11.1",
1936추가: ]
1937추가:
18611938[[package]]
18621939name = "memchr"
18631940version = "2.8.3"
@@ -2419,7 +2496,7 @@ version = "0.12.2"
24192496source = "registry+https://github.com/rust-lang/crates.io-index"
24202497checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
24212498dependencies = [
2422삭제: "digest",
2499추가: "digest 0.10.7",
24232500 "hmac",
24242501]
24252502
@@ -2966,8 +3043,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
29663043checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
29673044dependencies = [
29683045 "cfg-if",
2969삭제: "cpufeatures",
2970삭제: "digest",
3046추가: "cpufeatures 0.2.17",
3047추가: "digest 0.10.7",
29713048]
29723049
29733050[[package]]
@@ -2977,8 +3054,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
29773054checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
29783055dependencies = [
29793056 "cfg-if",
2980삭제: "cpufeatures",
2981삭제: "digest",
3057추가: "cpufeatures 0.2.17",
3058추가: "digest 0.10.7",
3059추가: ]
3060추가:
3061추가: [[package]]
3062추가: name = "sha2"
3063추가: version = "0.11.1"
3064추가: source = "registry+https://github.com/rust-lang/crates.io-index"
3065추가: checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
3066추가: dependencies = [
3067추가: "cfg-if",
3068추가: "cpufeatures 0.3.1",
3069추가: "digest 0.11.3",
29823070]
29833071
29843072[[package]]
@@ -4564,10 +4652,12 @@ name = "zipelo-archive-worker"
45644652version = "0.1.0"
45654653dependencies = [
45664654 "aes",
4655추가: "bzip2",
45674656 "hmac",
4657추가: "lzma-rust2",
45684658 "pbkdf2",
45694659 "sha1",
4570삭제: "sha2",
4660추가: "sha2 0.10.9",
45714661 "subtle",
45724662 "zeroize",
45734663 "zlib-rs",
@@ -4584,7 +4674,7 @@ dependencies = [
45844674name = "zipelo-memory-ustar-reader"
45854675version = "0.1.0"
45864676dependencies = [
4587삭제: "sha2",
4677추가: "sha2 0.10.9",
45884678 "subtle",
45894679]
45904680
추가tests/release-packages/test_compressed_tar_licenses.py+39-0
@@ -0,0 +1,39 @@
1추가: """압축 TAR 의존성의 원문 고지와 Rust 백엔드를 검증함."""
2추가:
3추가: import importlib.util
4추가: from pathlib import Path
5추가: import unittest
6추가:
7추가:
8추가: ROOT = Path(__file__).resolve().parents[2]
9추가: SPEC = importlib.util.spec_from_file_location("compressed_tar_licenses", ROOT / "packaging/licenses.py")
10추가: LICENSES = importlib.util.module_from_spec(SPEC)
11추가: SPEC.loader.exec_module(LICENSES)
12추가:
13추가:
14추가: class CompressedTarLicenses(unittest.TestCase):
15추가: def test_registry_originals_are_in_generated_worker_notice(self):
16추가: manifest = ROOT / "experiments/rust-archive-worker/Cargo.toml"
17추가: records = LICENSES.inventory([manifest])
18추가: selected = {record["name"]: record for record in records}
19추가: expected = {
20추가: "bzip2": ("0.6.1", "MIT OR Apache-2.0"),
21추가: "libbz2-rs-sys": ("0.2.6", "bzip2-1.0.6"),
22추가: "lzma-rust2": ("0.25.0", "Apache-2.0"),
23추가: }
24추가: notice = LICENSES.render(records)
25추가: for name, (version, license_id) in expected.items():
26추가: with self.subTest(name=name):
27추가: record = selected[name]
28추가: self.assertEqual(record["version"], version)
29추가: self.assertEqual(record["license"], license_id)
30추가: self.assertTrue(record["files"])
31추가: self.assertIn(f"Crate: {name} {version}\n", notice)
32추가: for original in record["files"]:
33추가: self.assertIn(original["text"], notice)
34추가: self.assertIn(original["sha256"], notice)
35추가: self.assertTrue({"bzip2-sys", "lzma-sys", "liblzma-sys", "xz2"}.isdisjoint(selected))
36추가:
37추가:
38추가: if __name__ == "__main__":
39추가: unittest.main()
수정tests/rust-app-real-worker/Cargo.lock+101-11
@@ -10,7 +10,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
1010dependencies = [
1111 "cfg-if",
1212 "cipher",
13삭제: "cpufeatures",
13추가: "cpufeatures 0.2.17",
1414 "zeroize",
1515]
1616
@@ -23,6 +23,24 @@ dependencies = [
2323 "generic-array",
2424]
2525
26추가: [[package]]
27추가: name = "block-buffer"
28추가: version = "0.12.1"
29추가: source = "registry+https://github.com/rust-lang/crates.io-index"
30추가: checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa"
31추가: dependencies = [
32추가: "hybrid-array",
33추가: ]
34추가:
35추가: [[package]]
36추가: name = "bzip2"
37추가: version = "0.6.1"
38추가: source = "registry+https://github.com/rust-lang/crates.io-index"
39추가: checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c"
40추가: dependencies = [
41추가: "libbz2-rs-sys",
42추가: ]
43추가:
2644[[package]]
2745name = "cfg-if"
2846version = "1.0.5"
@@ -35,10 +53,16 @@ version = "0.4.4"
3553source = "registry+https://github.com/rust-lang/crates.io-index"
3654checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
3755dependencies = [
38삭제: "crypto-common",
56추가: "crypto-common 0.1.7",
3957 "inout",
4058]
4159
60추가: [[package]]
61추가: name = "const-oid"
62추가: version = "0.10.3"
63추가: source = "registry+https://github.com/rust-lang/crates.io-index"
64추가: checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a"
65추가:
4266[[package]]
4367name = "cpufeatures"
4468version = "0.2.17"
@@ -48,6 +72,15 @@ dependencies = [
4872 "libc",
4973]
5074
75추가: [[package]]
76추가: name = "cpufeatures"
77추가: version = "0.3.1"
78추가: source = "registry+https://github.com/rust-lang/crates.io-index"
79추가: checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"
80추가: dependencies = [
81추가: "libc",
82추가: ]
83추가:
5184[[package]]
5285name = "crypto-common"
5386version = "0.1.7"
@@ -58,17 +91,37 @@ dependencies = [
5891 "typenum",
5992]
6093
94추가: [[package]]
95추가: name = "crypto-common"
96추가: version = "0.2.2"
97추가: source = "registry+https://github.com/rust-lang/crates.io-index"
98추가: checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
99추가: dependencies = [
100추가: "hybrid-array",
101추가: ]
102추가:
61103[[package]]
62104name = "digest"
63105version = "0.10.7"
64106source = "registry+https://github.com/rust-lang/crates.io-index"
65107checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
66108dependencies = [
67삭제: "block-buffer",
68삭제: "crypto-common",
109추가: "block-buffer 0.10.4",
110추가: "crypto-common 0.1.7",
69111 "subtle",
70112]
71113
114추가: [[package]]
115추가: name = "digest"
116추가: version = "0.11.3"
117추가: source = "registry+https://github.com/rust-lang/crates.io-index"
118추가: checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
119추가: dependencies = [
120추가: "block-buffer 0.12.1",
121추가: "const-oid",
122추가: "crypto-common 0.2.2",
123추가: ]
124추가:
72125[[package]]
73126name = "generic-array"
74127version = "0.14.7"
@@ -85,7 +138,16 @@ version = "0.12.1"
85138source = "registry+https://github.com/rust-lang/crates.io-index"
86139checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
87140dependencies = [
88삭제: "digest",
141추가: "digest 0.10.7",
142추가: ]
143추가:
144추가: [[package]]
145추가: name = "hybrid-array"
146추가: version = "0.4.15"
147추가: source = "registry+https://github.com/rust-lang/crates.io-index"
148추가: checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17"
149추가: dependencies = [
150추가: "typenum",
89151]
90152
91153[[package]]
@@ -97,19 +159,34 @@ dependencies = [
97159 "generic-array",
98160]
99161
162추가: [[package]]
163추가: name = "libbz2-rs-sys"
164추가: version = "0.2.6"
165추가: source = "registry+https://github.com/rust-lang/crates.io-index"
166추가: checksum = "32f454fd6831a29c0e827ed075bca2a15be201bd57f4168f0fd1041124eab17e"
167추가:
100168[[package]]
101169name = "libc"
102170version = "0.2.191"
103171source = "registry+https://github.com/rust-lang/crates.io-index"
104172checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
105173
174추가: [[package]]
175추가: name = "lzma-rust2"
176추가: version = "0.25.0"
177추가: source = "registry+https://github.com/rust-lang/crates.io-index"
178추가: checksum = "ef1d73c59a56771343712b22ea5615092c612c16ba291c0979e3105dfeec4890"
179추가: dependencies = [
180추가: "sha2 0.11.1",
181추가: ]
182추가:
106183[[package]]
107184name = "pbkdf2"
108185version = "0.12.2"
109186source = "registry+https://github.com/rust-lang/crates.io-index"
110187checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
111188dependencies = [
112삭제: "digest",
189추가: "digest 0.10.7",
113190 "hmac",
114191]
115192
@@ -120,8 +197,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
120197checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
121198dependencies = [
122199 "cfg-if",
123삭제: "cpufeatures",
124삭제: "digest",
200추가: "cpufeatures 0.2.17",
201추가: "digest 0.10.7",
125202]
126203
127204[[package]]
@@ -131,8 +208,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
131208checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
132209dependencies = [
133210 "cfg-if",
134삭제: "cpufeatures",
135삭제: "digest",
211추가: "cpufeatures 0.2.17",
212추가: "digest 0.10.7",
213추가: ]
214추가:
215추가: [[package]]
216추가: name = "sha2"
217추가: version = "0.11.1"
218추가: source = "registry+https://github.com/rust-lang/crates.io-index"
219추가: checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
220추가: dependencies = [
221추가: "cfg-if",
222추가: "cpufeatures 0.3.1",
223추가: "digest 0.11.3",
136224]
137225
138226[[package]]
@@ -164,10 +252,12 @@ name = "zipelo-archive-worker"
164252version = "0.1.0"
165253dependencies = [
166254 "aes",
255추가: "bzip2",
167256 "hmac",
257추가: "lzma-rust2",
168258 "pbkdf2",
169259 "sha1",
170삭제: "sha2",
260추가: "sha2 0.10.9",
171261 "subtle",
172262 "zeroize",
173263 "zlib-rs",
추가tests/rust-archive-worker/compressed_fault.c+29-0
@@ -0,0 +1,29 @@
1추가: #define _GNU_SOURCE
2추가: #include <dlfcn.h>
3추가: #include <errno.h>
4추가: #include <fcntl.h>
5추가: #include <stdlib.h>
6추가: #include <string.h>
7추가: #include <sys/stat.h>
8추가: #include <sys/statvfs.h>
9추가: #include <unistd.h>
10추가:
11추가: static int regular_calls;
12추가:
13추가: int fstatvfs(int fd, struct statvfs *value) {
14추가: int (*original)(int, struct statvfs *) = dlsym(RTLD_NEXT, "fstatvfs");
15추가: int result = original(fd, value);
16추가: const char *mode = getenv("ZIPELO_COMPRESSED_FAULT");
17추가: struct stat info;
18추가: if (result || !mode || fstat(fd, &info) || !S_ISREG(info.st_mode)) return result;
19추가: if (++regular_calls != 2) return result;
20추가: int marker = open(getenv("ZIPELO_COMPRESSED_MARKER"), O_CREAT | O_EXCL | O_WRONLY, 0600);
21추가: if (marker < 0) { errno = EIO; return -1; }
22추가: close(marker);
23추가: if (!strcmp(mode, "full")) { value->f_bavail = 0; return 0; }
24추가: if (!strcmp(mode, "io")) { errno = EIO; return -1; }
25추가: const char *release = getenv("ZIPELO_COMPRESSED_RELEASE");
26추가: for (int i = 0; i < 1000 && access(release, F_OK); i++) usleep(10000);
27추가: if (access(release, F_OK)) { errno = EIO; return -1; }
28추가: return result;
29추가: }
추가tests/rust-archive-worker/compressed_tar.rs+375-0
@@ -0,0 +1,375 @@
1추가: use super::*;
2추가:
3추가: fn fixture(kind: &str, case: &str) -> Scratch {
4추가: let scratch = Scratch::new();
5추가: let output = Command::new("python3")
6추가: .arg(
7추가: PathBuf::from(env!("CARGO_MANIFEST_DIR"))
8추가: .join("../../tests/rust-archive-worker/compressed_tar_cases.py"),
9추가: )
10추가: .arg(&scratch.0)
11추가: .arg(kind)
12추가: .arg(case)
13추가: .output()
14추가: .unwrap();
15추가: assert!(
16추가: output.status.success(),
17추가: "{kind}/{case}: {}",
18추가: String::from_utf8_lossy(&output.stderr)
19추가: );
20추가: scratch
21추가: }
22추가:
23추가: fn run_case(s: &Scratch, limits: Limits) -> Vec<Message> {
24추가: extract(
25추가: s,
26추가: &fs::read(s.0.join("input")).unwrap(),
27추가: None,
28추가: Selection::All,
29추가: None,
30추가: limits,
31추가: )
32추가: }
33추가:
34추가: fn no_output(s: &Scratch, events: &[Message], error: ErrorCode) {
35추가: let result = terminal(events);
36추가: assert_eq!(result.outcome, Outcome::Failed, "{events:?}");
37추가: assert_eq!(result.error, error, "{events:?}");
38추가: assert_eq!(result.created_count, 0);
39추가: assert_eq!(result.publication, Publication::None);
40추가: assert!(
41추가: !events
42추가: .iter()
43추가: .any(|event| matches!(event, Message::Output { .. }))
44추가: );
45추가: assert_eq!(fs::read_dir(s.0.join("output")).unwrap().count(), 0);
46추가: assert!(!s.0.join("escape").exists());
47추가: }
48추가:
49추가: fn normal(kind: &str, case: &str) {
50추가: let s = fixture(kind, case);
51추가: let events = run_case(&s, Limits::default());
52추가: assert_eq!(terminal(&events).outcome, Outcome::Completed, "{events:?}");
53추가: assert_eq!(
54추가: fs::read(s.0.join("output/folder/payload.bin")).unwrap(),
55추가: fs::read(s.0.join("expected")).unwrap()
56추가: );
57추가: assert_eq!(fs::read(s.0.join("output/한글.txt")).unwrap(), b"end");
58추가: assert!(s.0.join("output/empty").is_dir());
59추가: }
60추가:
61추가: #[test]
62추가: fn bzip2_reference_tar_and_concatenated_streams() {
63추가: for case in ["normal", "multi"] {
64추가: normal("bz2", case);
65추가: }
66추가: }
67추가:
68추가: #[test]
69추가: fn xz_reference_tar_checks_filters_and_concatenated_streams() {
70추가: for case in [
71추가: "normal", "multi", "padding", "crc32", "sha256", "no-check", "filters",
72추가: ] {
73추가: normal("xz", case);
74추가: }
75추가: }
76추가:
77추가: #[test]
78추가: fn compressed_empty_tar_is_valid() {
79추가: for kind in ["bz2", "xz"] {
80추가: let s = fixture(kind, "empty");
81추가: let events = run_case(&s, Limits::default());
82추가: assert_eq!(
83추가: terminal(&events).outcome,
84추가: Outcome::Completed,
85추가: "{kind}: {events:?}"
86추가: );
87추가: assert_eq!(terminal(&events).created_count, 0);
88추가: assert_eq!(fs::read_dir(s.0.join("output")).unwrap().count(), 0);
89추가: }
90추가: }
91추가:
92추가: #[test]
93추가: fn bzip2_truncation_corruption_and_trailing_data_never_publish() {
94추가: for case in [
95추가: "truncated",
96추가: "corrupt",
97추가: "trailing",
98추가: "multi-bad",
99추가: "bad-tar",
100추가: "raw",
101추가: "empty-stream",
102추가: ] {
103추가: let s = fixture("bz2", case);
104추가: let events = run_case(&s, Limits::default());
105추가: no_output(&s, &events, ErrorCode::Integrity);
106추가: }
107추가: }
108추가:
109추가: #[test]
110추가: fn xz_truncation_corruption_and_trailing_data_never_publish() {
111추가: for case in [
112추가: "truncated",
113추가: "corrupt",
114추가: "trailing",
115추가: "multi-bad",
116추가: "bad-tar",
117추가: "raw",
118추가: "empty-stream",
119추가: "bad-padding",
120추가: ] {
121추가: let s = fixture("xz", case);
122추가: let events = run_case(&s, Limits::default());
123추가: no_output(&s, &events, ErrorCode::Integrity);
124추가: }
125추가: }
126추가:
127추가: #[test]
128추가: fn compressed_tar_bombs_stop_before_publication() {
129추가: for kind in ["bz2", "xz"] {
130추가: let s = fixture(kind, "bomb");
131추가: let events = run_case(
132추가: &s,
133추가: Limits {
134추가: output: 256 * 1024,
135추가: ..Limits::default()
136추가: },
137추가: );
138추가: no_output(&s, &events, ErrorCode::Limit);
139추가: }
140추가: }
141추가:
142추가: #[test]
143추가: fn xz_huge_dictionary_is_rejected_before_allocation() {
144추가: let s = fixture("xz", "dictionary");
145추가: let events = run_case(&s, Limits::default());
146추가: no_output(&s, &events, ErrorCode::Limit);
147추가: }
148추가:
149추가: #[test]
150추가: fn compressed_tar_paths_and_links_keep_existing_guards() {
151추가: for kind in ["bz2", "xz"] {
152추가: for (case, error) in [
153추가: ("unsafe", ErrorCode::UnsafePath),
154추가: ("link", ErrorCode::UnsafePath),
155추가: ] {
156추가: let s = fixture(kind, case);
157추가: let events = run_case(&s, Limits::default());
158추가: no_output(&s, &events, error);
159추가: }
160추가: }
161추가: }
162추가:
163추가: #[test]
164추가: fn compressed_tar_list_identity_and_selection() {
165추가: for kind in ["bz2", "xz"] {
166추가: let s = fixture(kind, "normal");
167추가: let events = execute(Start {
168추가: action: Action::List {
169추가: archive: s.path("input"),
170추가: },
171추가: limits: Limits::default(),
172추가: });
173추가: assert_eq!(terminal(&events).outcome, Outcome::Completed, "{events:?}");
174추가: let token = events
175추가: .iter()
176추가: .find_map(|event| match event {
177추가: Message::ListEnd { list_id, .. } => Some(list_id.clone()),
178추가: _ => None,
179추가: })
180추가: .unwrap();
181추가: assert_eq!(token.format, Format::Tar);
182추가: let bytes = fs::read(s.0.join("input")).unwrap();
183추가: let events = extract(
184추가: &s,
185추가: &bytes,
186추가: None,
187추가: Selection::EntryIds(vec![2]),
188추가: Some(token),
189추가: Limits::default(),
190추가: );
191추가: assert_eq!(terminal(&events).outcome, Outcome::Completed, "{events:?}");
192추가: assert_eq!(fs::read(s.0.join("output/한글.txt")).unwrap(), b"end");
193추가: assert!(!s.0.join("output/folder").exists());
194추가: }
195추가: }
196추가:
197추가: #[test]
198추가: fn compressed_tar_entry_quota_is_preserved() {
199추가: for kind in ["bz2", "xz"] {
200추가: let s = fixture(kind, "normal");
201추가: let events = run_case(
202추가: &s,
203추가: Limits {
204추가: entries: 1,
205추가: ..Limits::default()
206추가: },
207추가: );
208추가: no_output(&s, &events, ErrorCode::Limit);
209추가: }
210추가: }
211추가:
212추가: #[cfg(target_os = "linux")]
213추가: mod linux {
214추가: use super::*;
215추가: use std::{
216추가: io::Read,
217추가: time::{Duration, Instant},
218추가: };
219추가:
220추가: struct Running(std::process::Child);
221추가: impl Drop for Running {
222추가: fn drop(&mut self) {
223추가: let _ = self.0.kill();
224추가: let _ = self.0.wait();
225추가: }
226추가: }
227추가:
228추가: fn inject(s: &Scratch, mode: &str) -> (Running, Writer<std::process::ChildStdin>) {
229추가: let library = s.0.join("compressed_fault.so");
230추가: assert!(
231추가: Command::new("cc")
232추가: .args(["-shared", "-fPIC", "-O2", "-Wall", "-Wextra", "-Werror"])
233추가: .arg(
234추가: PathBuf::from(env!("CARGO_MANIFEST_DIR"))
235추가: .join("../../tests/rust-archive-worker/compressed_fault.c")
236추가: )
237추가: .arg("-ldl")
238추가: .arg("-o")
239추가: .arg(&library)
240추가: .status()
241추가: .unwrap()
242추가: .success()
243추가: );
244추가: let bytes = fs::read(s.0.join("input")).unwrap();
245추가: let preparation = extract(
246추가: s,
247추가: &bytes,
248추가: None,
249추가: Selection::EntryIds(vec![999]),
250추가: None,
251추가: Limits::default(),
252추가: );
253추가: assert_ne!(terminal(&preparation).outcome, Outcome::Completed);
254추가: let mut command = s.worker();
255추가: command
256추가: .env("LD_PRELOAD", library)
257추가: .env("ZIPELO_COMPRESSED_FAULT", mode)
258추가: .env("ZIPELO_COMPRESSED_MARKER", s.0.join("paused"))
259추가: .env("ZIPELO_COMPRESSED_RELEASE", s.0.join("release"))
260추가: .stdin(Stdio::piped())
261추가: .stdout(Stdio::piped())
262추가: .stderr(Stdio::piped());
263추가: let mut child = command.spawn().unwrap();
264추가: let mut writer = Writer::new(child.stdin.take().unwrap(), 17);
265추가: writer
266추가: .send(&Message::Start(Start {
267추가: action: Action::Extract {
268추가: archive: s.path("input"),
269추가: destination: s.path("output"),
270추가: selection: Selection::All,
271추가: list_id: None,
272추가: gzip_output_name: None,
273추가: },
274추가: limits: Limits::default(),
275추가: }))
276추가: .unwrap();
277추가: (Running(child), writer)
278추가: }
279추가:
280추가: fn finish(child: &mut Running) -> Vec<Message> {
281추가: drop(child.0.stdin.take());
282추가: let mut out = child.0.stdout.take().unwrap();
283추가: let mut err = child.0.stderr.take().unwrap();
284추가: let mut bytes = Vec::new();
285추가: out.read_to_end(&mut bytes).unwrap();
286추가: let mut errors = Vec::new();
287추가: err.read_to_end(&mut errors).unwrap();
288추가: assert!(child.0.wait().unwrap().success());
289추가: assert!(errors.is_empty(), "{errors:?}");
290추가: let mut reader = Reader::new(bytes.as_slice());
291추가: let mut events = Vec::new();
292추가: while let Some((_, _, event)) = reader.read().unwrap() {
293추가: events.push(event);
294추가: }
295추가: events
296추가: }
297추가:
298추가: #[test]
299추가: fn compressed_tar_codec_space_failure_never_publishes() {
300추가: for kind in ["bz2", "xz"] {
301추가: for (mode, error) in [("full", ErrorCode::DiskFull), ("io", ErrorCode::Io)] {
302추가: let s = fixture(kind, "normal");
303추가: let (mut child, writer) = inject(&s, mode);
304추가: drop(writer);
305추가: let events = finish(&mut child);
306추가: assert!(s.0.join("paused").exists());
307추가: no_output(&s, &events, error);
308추가: }
309추가: }
310추가: }
311추가:
312추가: #[test]
313추가: fn compressed_tar_cancels_during_decode_and_cleans_staging() {
314추가: for kind in ["bz2", "xz"] {
315추가: let s = fixture(kind, "normal");
316추가: let (mut child, mut writer) = inject(&s, "pause");
317추가: let deadline = Instant::now() + Duration::from_secs(10);
318추가: while !s.0.join("paused").exists() {
319추가: assert!(Instant::now() < deadline, "decoder did not pause");
320추가: std::thread::sleep(Duration::from_millis(5));
321추가: }
322추가: writer.send(&Message::Cancel).unwrap();
323추가: drop(writer);
324추가: std::thread::sleep(Duration::from_millis(25));
325추가: fs::write(s.0.join("release"), b"").unwrap();
326추가: let events = finish(&mut child);
327추가: assert_eq!(terminal(&events).outcome, Outcome::Cancelled, "{events:?}");
328추가: assert_eq!(terminal(&events).created_count, 0);
329추가: assert_eq!(fs::read_dir(s.0.join("output")).unwrap().count(), 0);
330추가: assert!(
331추가: !events
332추가: .iter()
333추가: .any(|event| matches!(event, Message::Output { .. }))
334추가: );
335추가: }
336추가: }
337추가: }
338추가:
339추가: #[test]
340추가: fn xz_index_and_footer_claims_are_checked_before_publication() {
341추가: for (case, error) in [
342추가: ("index-size", ErrorCode::Integrity),
343추가: ("footer-offset", ErrorCode::Integrity),
344추가: ("index-huge", ErrorCode::Limit),
345추가: ] {
346추가: let s = fixture("xz", case);
347추가: let events = run_case(&s, Limits::default());
348추가: no_output(&s, &events, error);
349추가: }
350추가: }
351추가:
352추가: #[test]
353추가: fn compressed_tar_output_quota_boundary() {
354추가: for kind in ["bz2", "xz"] {
355추가: for below in [false, true] {
356추가: let s = fixture(kind, "normal");
357추가: let size: u64 = fs::read_to_string(s.0.join("plain-size"))
358추가: .unwrap()
359추가: .parse()
360추가: .unwrap();
361추가: let events = run_case(
362추가: &s,
363추가: Limits {
364추가: output: size - u64::from(below),
365추가: ..Limits::default()
366추가: },
367추가: );
368추가: if below {
369추가: no_output(&s, &events, ErrorCode::Limit);
370추가: } else {
371추가: assert_eq!(terminal(&events).outcome, Outcome::Completed, "{events:?}");
372추가: }
373추가: }
374추가: }
375추가: }
추가tests/rust-archive-worker/compressed_tar_cases.py+118-0
@@ -0,0 +1,118 @@
1추가: import bz2
2추가: import hashlib
3추가: import io
4추가: import lzma
5추가: from pathlib import Path
6추가: import sys
7추가: import tarfile
8추가: import zlib
9추가:
10추가:
11추가: root = Path(sys.argv[1])
12추가: kind = sys.argv[2]
13추가: case = sys.argv[3]
14추가: payload = bytes(range(251)) * 1800
15추가: if case == "bomb":
16추가: payload = bytes(8 * 1024 * 1024)
17추가: buffer = io.BytesIO()
18추가: with tarfile.open(fileobj=buffer, mode="w", format=tarfile.USTAR_FORMAT) as archive:
19추가: if case != "empty":
20추가: name = "../escape" if case == "unsafe" else "folder/payload.bin"
21추가: member = tarfile.TarInfo(name)
22추가: member.size = len(payload)
23추가: archive.addfile(member, io.BytesIO(payload))
24추가: if case == "link":
25추가: member = tarfile.TarInfo("link")
26추가: member.type = tarfile.SYMTYPE
27추가: member.linkname = "folder/payload.bin"
28추가: archive.addfile(member)
29추가: member = tarfile.TarInfo("empty/")
30추가: member.type = tarfile.DIRTYPE
31추가: archive.addfile(member)
32추가: member = tarfile.TarInfo("한글.txt")
33추가: member.size = 3
34추가: archive.addfile(member, io.BytesIO(b"end"))
35추가: plain = buffer.getvalue()
36추가: if case == "bad-tar":
37추가: plain = bytes([plain[0] ^ 1]) + plain[1:]
38추가: if case == "raw":
39추가: plain = b"not a tar archive"
40추가: if case == "empty-stream":
41추가: plain = b""
42추가:
43추가: def compress(data):
44추가: if kind == "bz2":
45추가: return bz2.compress(data)
46추가: check = {
47추가: "crc32": lzma.CHECK_CRC32,
48추가: "sha256": lzma.CHECK_SHA256,
49추가: "no-check": lzma.CHECK_NONE,
50추가: }.get(case, lzma.CHECK_CRC64)
51추가: filters = None
52추가: if case == "filters":
53추가: filters = [
54추가: {"id": lzma.FILTER_X86},
55추가: {"id": lzma.FILTER_DELTA, "dist": 3},
56추가: {"id": lzma.FILTER_LZMA2, "dict_size": 1 << 20},
57추가: ]
58추가: return lzma.compress(data, check=check, filters=filters)
59추가:
60추가: if case in ("multi", "multi-bad", "padding"):
61추가: half = len(plain) // 2
62추가: padding = bytes(4) if kind == "xz" and case == "padding" else b""
63추가: packed = compress(plain[:half]) + padding + compress(plain[half:]) + padding
64추가: else:
65추가: packed = compress(plain)
66추가: if case == "truncated":
67추가: packed = packed[:-5]
68추가: elif case == "multi-bad":
69추가: packed = packed[:-5]
70추가: elif case == "corrupt":
71추가: at = len(packed) // 2
72추가: packed = packed[:at] + bytes([packed[at] ^ 128]) + packed[at + 1:]
73추가: elif case == "trailing":
74추가: packed += b"garbage"
75추가: elif case == "dictionary":
76추가: packed = bytearray(packed)
77추가: header_end = 12 + (packed[12] + 1) * 4
78추가: assert packed[14:16] == b"\x21\x01"
79추가: packed[16] = 40
80추가: packed[header_end - 4:header_end] = zlib.crc32(packed[12:header_end - 4]).to_bytes(4, "little")
81추가: packed = bytes(packed)
82추가: elif case == "bad-padding":
83추가: packed += b"\0"
84추가: if case in ("index-size", "footer-offset", "index-huge"):
85추가: packed = bytearray(packed)
86추가: if case == "index-size":
87추가: length = (int.from_bytes(packed[-8:-4], "little") + 1) * 4
88추가: index = len(packed) - 12 - length
89추가: cursor = index + 2
90추가: while packed[cursor] & 128:
91추가: cursor += 1
92추가: cursor += 1
93추가: packed[cursor] ^= 1
94추가: packed[-16:-12] = zlib.crc32(packed[index:-16]).to_bytes(4, "little")
95추가: else:
96추가: size = int.from_bytes(packed[-8:-4], "little") + 1
97추가: if case == "index-huge":
98추가: size = (8 * 1024 * 1024) // 4
99추가: packed[-8:-4] = size.to_bytes(4, "little")
100추가: packed[-12:-8] = zlib.crc32(packed[-8:-2]).to_bytes(4, "little")
101추가: packed = bytes(packed)
102추가: (root / "plain-size").write_text(str(len(plain)))
103추가: (root / "input").write_bytes(packed)
104추가: if case in ("normal", "multi", "padding", "crc32", "sha256", "no-check", "filters"):
105추가: decoded = bz2.decompress(packed) if kind == "bz2" else lzma.decompress(packed)
106추가: if case == "padding":
107추가: decoded = b""
108추가: remaining = packed
109추가: while remaining:
110추가: part = lzma.LZMADecompressor()
111추가: decoded += part.decompress(remaining)
112추가: assert part.eof
113추가: remaining = part.unused_data.lstrip(bytes(1))
114추가: assert decoded == plain, case
115추가: with tarfile.open(fileobj=io.BytesIO(decoded), mode="r:") as archive:
116추가: actual = archive.extractfile("folder/payload.bin").read()
117추가: assert hashlib.sha256(actual).digest() == hashlib.sha256(payload).digest()
118추가: (root / "expected").write_bytes(actual)
수정tests/rust-archive-worker/main.rs+2-0
@@ -1613,3 +1613,5 @@ mod zip_names;
16131613mod conflict_wire;
16141614
16151615mod conflicts;
1616추가:
1617추가: mod compressed_tar;
수정tests/rust-large-archive-fixtures/Cargo.lock+101-11
@@ -10,7 +10,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
1010dependencies = [
1111 "cfg-if",
1212 "cipher",
13삭제: "cpufeatures",
13추가: "cpufeatures 0.2.17",
1414 "zeroize",
1515]
1616
@@ -23,6 +23,24 @@ dependencies = [
2323 "generic-array",
2424]
2525
26추가: [[package]]
27추가: name = "block-buffer"
28추가: version = "0.12.1"
29추가: source = "registry+https://github.com/rust-lang/crates.io-index"
30추가: checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa"
31추가: dependencies = [
32추가: "hybrid-array",
33추가: ]
34추가:
35추가: [[package]]
36추가: name = "bzip2"
37추가: version = "0.6.1"
38추가: source = "registry+https://github.com/rust-lang/crates.io-index"
39추가: checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c"
40추가: dependencies = [
41추가: "libbz2-rs-sys",
42추가: ]
43추가:
2644[[package]]
2745name = "cfg-if"
2846version = "1.0.5"
@@ -35,10 +53,16 @@ version = "0.4.4"
3553source = "registry+https://github.com/rust-lang/crates.io-index"
3654checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
3755dependencies = [
38삭제: "crypto-common",
56추가: "crypto-common 0.1.7",
3957 "inout",
4058]
4159
60추가: [[package]]
61추가: name = "const-oid"
62추가: version = "0.10.3"
63추가: source = "registry+https://github.com/rust-lang/crates.io-index"
64추가: checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a"
65추가:
4266[[package]]
4367name = "cpufeatures"
4468version = "0.2.17"
@@ -48,6 +72,15 @@ dependencies = [
4872 "libc",
4973]
5074
75추가: [[package]]
76추가: name = "cpufeatures"
77추가: version = "0.3.1"
78추가: source = "registry+https://github.com/rust-lang/crates.io-index"
79추가: checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"
80추가: dependencies = [
81추가: "libc",
82추가: ]
83추가:
5184[[package]]
5285name = "crypto-common"
5386version = "0.1.7"
@@ -58,17 +91,37 @@ dependencies = [
5891 "typenum",
5992]
6093
94추가: [[package]]
95추가: name = "crypto-common"
96추가: version = "0.2.2"
97추가: source = "registry+https://github.com/rust-lang/crates.io-index"
98추가: checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
99추가: dependencies = [
100추가: "hybrid-array",
101추가: ]
102추가:
61103[[package]]
62104name = "digest"
63105version = "0.10.7"
64106source = "registry+https://github.com/rust-lang/crates.io-index"
65107checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
66108dependencies = [
67삭제: "block-buffer",
68삭제: "crypto-common",
109추가: "block-buffer 0.10.4",
110추가: "crypto-common 0.1.7",
69111 "subtle",
70112]
71113
114추가: [[package]]
115추가: name = "digest"
116추가: version = "0.11.3"
117추가: source = "registry+https://github.com/rust-lang/crates.io-index"
118추가: checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
119추가: dependencies = [
120추가: "block-buffer 0.12.1",
121추가: "const-oid",
122추가: "crypto-common 0.2.2",
123추가: ]
124추가:
72125[[package]]
73126name = "generic-array"
74127version = "0.14.7"
@@ -85,7 +138,16 @@ version = "0.12.1"
85138source = "registry+https://github.com/rust-lang/crates.io-index"
86139checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
87140dependencies = [
88삭제: "digest",
141추가: "digest 0.10.7",
142추가: ]
143추가:
144추가: [[package]]
145추가: name = "hybrid-array"
146추가: version = "0.4.15"
147추가: source = "registry+https://github.com/rust-lang/crates.io-index"
148추가: checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17"
149추가: dependencies = [
150추가: "typenum",
89151]
90152
91153[[package]]
@@ -97,19 +159,34 @@ dependencies = [
97159 "generic-array",
98160]
99161
162추가: [[package]]
163추가: name = "libbz2-rs-sys"
164추가: version = "0.2.6"
165추가: source = "registry+https://github.com/rust-lang/crates.io-index"
166추가: checksum = "32f454fd6831a29c0e827ed075bca2a15be201bd57f4168f0fd1041124eab17e"
167추가:
100168[[package]]
101169name = "libc"
102170version = "0.2.191"
103171source = "registry+https://github.com/rust-lang/crates.io-index"
104172checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
105173
174추가: [[package]]
175추가: name = "lzma-rust2"
176추가: version = "0.25.0"
177추가: source = "registry+https://github.com/rust-lang/crates.io-index"
178추가: checksum = "ef1d73c59a56771343712b22ea5615092c612c16ba291c0979e3105dfeec4890"
179추가: dependencies = [
180추가: "sha2 0.11.1",
181추가: ]
182추가:
106183[[package]]
107184name = "pbkdf2"
108185version = "0.12.2"
109186source = "registry+https://github.com/rust-lang/crates.io-index"
110187checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
111188dependencies = [
112삭제: "digest",
189추가: "digest 0.10.7",
113190 "hmac",
114191]
115192
@@ -120,8 +197,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
120197checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
121198dependencies = [
122199 "cfg-if",
123삭제: "cpufeatures",
124삭제: "digest",
200추가: "cpufeatures 0.2.17",
201추가: "digest 0.10.7",
125202]
126203
127204[[package]]
@@ -131,8 +208,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
131208checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
132209dependencies = [
133210 "cfg-if",
134삭제: "cpufeatures",
135삭제: "digest",
211추가: "cpufeatures 0.2.17",
212추가: "digest 0.10.7",
213추가: ]
214추가:
215추가: [[package]]
216추가: name = "sha2"
217추가: version = "0.11.1"
218추가: source = "registry+https://github.com/rust-lang/crates.io-index"
219추가: checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
220추가: dependencies = [
221추가: "cfg-if",
222추가: "cpufeatures 0.3.1",
223추가: "digest 0.11.3",
136224]
137225
138226[[package]]
@@ -164,10 +252,12 @@ name = "zipelo-archive-worker"
164252version = "0.1.0"
165253dependencies = [
166254 "aes",
255추가: "bzip2",
167256 "hmac",
257추가: "lzma-rust2",
168258 "pbkdf2",
169259 "sha1",
170삭제: "sha2",
260추가: "sha2 0.10.9",
171261 "subtle",
172262 "zeroize",
173263 "zlib-rs",
수정tests/rust-zip64-compat/Cargo.lock+101-11
@@ -10,7 +10,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
1010dependencies = [
1111 "cfg-if",
1212 "cipher",
13삭제: "cpufeatures",
13추가: "cpufeatures 0.2.17",
1414 "zeroize",
1515]
1616
@@ -23,6 +23,24 @@ dependencies = [
2323 "generic-array",
2424]
2525
26추가: [[package]]
27추가: name = "block-buffer"
28추가: version = "0.12.1"
29추가: source = "registry+https://github.com/rust-lang/crates.io-index"
30추가: checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa"
31추가: dependencies = [
32추가: "hybrid-array",
33추가: ]
34추가:
35추가: [[package]]
36추가: name = "bzip2"
37추가: version = "0.6.1"
38추가: source = "registry+https://github.com/rust-lang/crates.io-index"
39추가: checksum = "f3a53fac24f34a81bc9954b5d6cfce0c21e18ec6959f44f56e8e90e4bb7c346c"
40추가: dependencies = [
41추가: "libbz2-rs-sys",
42추가: ]
43추가:
2644[[package]]
2745name = "cfg-if"
2846version = "1.0.5"
@@ -35,10 +53,16 @@ version = "0.4.4"
3553source = "registry+https://github.com/rust-lang/crates.io-index"
3654checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
3755dependencies = [
38삭제: "crypto-common",
56추가: "crypto-common 0.1.7",
3957 "inout",
4058]
4159
60추가: [[package]]
61추가: name = "const-oid"
62추가: version = "0.10.3"
63추가: source = "registry+https://github.com/rust-lang/crates.io-index"
64추가: checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a"
65추가:
4266[[package]]
4367name = "cpufeatures"
4468version = "0.2.17"
@@ -48,6 +72,15 @@ dependencies = [
4872 "libc",
4973]
5074
75추가: [[package]]
76추가: name = "cpufeatures"
77추가: version = "0.3.1"
78추가: source = "registry+https://github.com/rust-lang/crates.io-index"
79추가: checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"
80추가: dependencies = [
81추가: "libc",
82추가: ]
83추가:
5184[[package]]
5285name = "crypto-common"
5386version = "0.1.7"
@@ -58,17 +91,37 @@ dependencies = [
5891 "typenum",
5992]
6093
94추가: [[package]]
95추가: name = "crypto-common"
96추가: version = "0.2.2"
97추가: source = "registry+https://github.com/rust-lang/crates.io-index"
98추가: checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
99추가: dependencies = [
100추가: "hybrid-array",
101추가: ]
102추가:
61103[[package]]
62104name = "digest"
63105version = "0.10.7"
64106source = "registry+https://github.com/rust-lang/crates.io-index"
65107checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
66108dependencies = [
67삭제: "block-buffer",
68삭제: "crypto-common",
109추가: "block-buffer 0.10.4",
110추가: "crypto-common 0.1.7",
69111 "subtle",
70112]
71113
114추가: [[package]]
115추가: name = "digest"
116추가: version = "0.11.3"
117추가: source = "registry+https://github.com/rust-lang/crates.io-index"
118추가: checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
119추가: dependencies = [
120추가: "block-buffer 0.12.1",
121추가: "const-oid",
122추가: "crypto-common 0.2.2",
123추가: ]
124추가:
72125[[package]]
73126name = "generic-array"
74127version = "0.14.7"
@@ -85,7 +138,16 @@ version = "0.12.1"
85138source = "registry+https://github.com/rust-lang/crates.io-index"
86139checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
87140dependencies = [
88삭제: "digest",
141추가: "digest 0.10.7",
142추가: ]
143추가:
144추가: [[package]]
145추가: name = "hybrid-array"
146추가: version = "0.4.15"
147추가: source = "registry+https://github.com/rust-lang/crates.io-index"
148추가: checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17"
149추가: dependencies = [
150추가: "typenum",
89151]
90152
91153[[package]]
@@ -97,19 +159,34 @@ dependencies = [
97159 "generic-array",
98160]
99161
162추가: [[package]]
163추가: name = "libbz2-rs-sys"
164추가: version = "0.2.6"
165추가: source = "registry+https://github.com/rust-lang/crates.io-index"
166추가: checksum = "32f454fd6831a29c0e827ed075bca2a15be201bd57f4168f0fd1041124eab17e"
167추가:
100168[[package]]
101169name = "libc"
102170version = "0.2.191"
103171source = "registry+https://github.com/rust-lang/crates.io-index"
104172checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
105173
174추가: [[package]]
175추가: name = "lzma-rust2"
176추가: version = "0.25.0"
177추가: source = "registry+https://github.com/rust-lang/crates.io-index"
178추가: checksum = "ef1d73c59a56771343712b22ea5615092c612c16ba291c0979e3105dfeec4890"
179추가: dependencies = [
180추가: "sha2 0.11.1",
181추가: ]
182추가:
106183[[package]]
107184name = "pbkdf2"
108185version = "0.12.2"
109186source = "registry+https://github.com/rust-lang/crates.io-index"
110187checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
111188dependencies = [
112삭제: "digest",
189추가: "digest 0.10.7",
113190 "hmac",
114191]
115192
@@ -120,8 +197,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
120197checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8"
121198dependencies = [
122199 "cfg-if",
123삭제: "cpufeatures",
124삭제: "digest",
200추가: "cpufeatures 0.2.17",
201추가: "digest 0.10.7",
125202]
126203
127204[[package]]
@@ -131,8 +208,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
131208checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
132209dependencies = [
133210 "cfg-if",
134삭제: "cpufeatures",
135삭제: "digest",
211추가: "cpufeatures 0.2.17",
212추가: "digest 0.10.7",
213추가: ]
214추가:
215추가: [[package]]
216추가: name = "sha2"
217추가: version = "0.11.1"
218추가: source = "registry+https://github.com/rust-lang/crates.io-index"
219추가: checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"
220추가: dependencies = [
221추가: "cfg-if",
222추가: "cpufeatures 0.3.1",
223추가: "digest 0.11.3",
136224]
137225
138226[[package]]
@@ -164,10 +252,12 @@ name = "zipelo-archive-worker"
164252version = "0.1.0"
165253dependencies = [
166254 "aes",
255추가: "bzip2",
167256 "hmac",
257추가: "lzma-rust2",
168258 "pbkdf2",
169259 "sha1",
170삭제: "sha2",
260추가: "sha2 0.10.9",
171261 "subtle",
172262 "zeroize",
173263 "zlib-rs",