TAR.BZ2와 TAR.XZ의 안전한 압축 해제를 추가함
- 작성자
- 시로사키 하나
- 작성 시각
- 커밋
8c5d69b7befb3e1e0f09ee53556f5d7eb7c4fe0f- 부모
- 2091e25
변경된 파일 15개
+1,350-57| @@ -10,7 +10,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" | ||
| 10 | 10 | dependencies = [ |
| 11 | 11 | "cfg-if", |
| 12 | 12 | "cipher", |
| 13 | 삭제: "cpufeatures", | |
| 13 | 추가: "cpufeatures 0.2.17", | |
| 14 | 14 | "zeroize", |
| 15 | 15 | ] |
| 16 | 16 | |
| @@ -23,6 +23,24 @@ dependencies = [ | ||
| 23 | 23 | "generic-array", |
| 24 | 24 | ] |
| 25 | 25 | |
| 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 | 추가: | |
| 26 | 44 | [[package]] |
| 27 | 45 | name = "cfg-if" |
| 28 | 46 | version = "1.0.5" |
| @@ -35,10 +53,16 @@ version = "0.4.4" | ||
| 35 | 53 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 36 | 54 | checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" |
| 37 | 55 | dependencies = [ |
| 38 | 삭제: "crypto-common", | |
| 56 | 추가: "crypto-common 0.1.7", | |
| 39 | 57 | "inout", |
| 40 | 58 | ] |
| 41 | 59 | |
| 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 | 추가: | |
| 42 | 66 | [[package]] |
| 43 | 67 | name = "cpufeatures" |
| 44 | 68 | version = "0.2.17" |
| @@ -48,6 +72,15 @@ dependencies = [ | ||
| 48 | 72 | "libc", |
| 49 | 73 | ] |
| 50 | 74 | |
| 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 | 추가: | |
| 51 | 84 | [[package]] |
| 52 | 85 | name = "crypto-common" |
| 53 | 86 | version = "0.1.7" |
| @@ -58,17 +91,37 @@ dependencies = [ | ||
| 58 | 91 | "typenum", |
| 59 | 92 | ] |
| 60 | 93 | |
| 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 | 추가: | |
| 61 | 103 | [[package]] |
| 62 | 104 | name = "digest" |
| 63 | 105 | version = "0.10.7" |
| 64 | 106 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 65 | 107 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" |
| 66 | 108 | dependencies = [ |
| 67 | 삭제: "block-buffer", | |
| 68 | 삭제: "crypto-common", | |
| 109 | 추가: "block-buffer 0.10.4", | |
| 110 | 추가: "crypto-common 0.1.7", | |
| 69 | 111 | "subtle", |
| 70 | 112 | ] |
| 71 | 113 | |
| 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 | 추가: | |
| 72 | 125 | [[package]] |
| 73 | 126 | name = "generic-array" |
| 74 | 127 | version = "0.14.7" |
| @@ -85,7 +138,16 @@ version = "0.12.1" | ||
| 85 | 138 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 86 | 139 | checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" |
| 87 | 140 | dependencies = [ |
| 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", | |
| 89 | 151 | ] |
| 90 | 152 | |
| 91 | 153 | [[package]] |
| @@ -97,19 +159,34 @@ dependencies = [ | ||
| 97 | 159 | "generic-array", |
| 98 | 160 | ] |
| 99 | 161 | |
| 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 | 추가: | |
| 100 | 168 | [[package]] |
| 101 | 169 | name = "libc" |
| 102 | 170 | version = "0.2.191" |
| 103 | 171 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 104 | 172 | checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" |
| 105 | 173 | |
| 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 | 추가: | |
| 106 | 183 | [[package]] |
| 107 | 184 | name = "pbkdf2" |
| 108 | 185 | version = "0.12.2" |
| 109 | 186 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 110 | 187 | checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" |
| 111 | 188 | dependencies = [ |
| 112 | 삭제: "digest", | |
| 189 | 추가: "digest 0.10.7", | |
| 113 | 190 | "hmac", |
| 114 | 191 | ] |
| 115 | 192 | |
| @@ -120,8 +197,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 120 | 197 | checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" |
| 121 | 198 | dependencies = [ |
| 122 | 199 | "cfg-if", |
| 123 | 삭제: "cpufeatures", | |
| 124 | 삭제: "digest", | |
| 200 | 추가: "cpufeatures 0.2.17", | |
| 201 | 추가: "digest 0.10.7", | |
| 125 | 202 | ] |
| 126 | 203 | |
| 127 | 204 | [[package]] |
| @@ -131,8 +208,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 131 | 208 | checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" |
| 132 | 209 | dependencies = [ |
| 133 | 210 | "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", | |
| 136 | 224 | ] |
| 137 | 225 | |
| 138 | 226 | [[package]] |
| @@ -164,10 +252,12 @@ name = "zipelo-archive-worker" | ||
| 164 | 252 | version = "0.1.0" |
| 165 | 253 | dependencies = [ |
| 166 | 254 | "aes", |
| 255 | 추가: "bzip2", | |
| 167 | 256 | "hmac", |
| 257 | 추가: "lzma-rust2", | |
| 168 | 258 | "pbkdf2", |
| 169 | 259 | "sha1", |
| 170 | 삭제: "sha2", | |
| 260 | 추가: "sha2 0.10.9", | |
| 171 | 261 | "subtle", |
| 172 | 262 | "zeroize", |
| 173 | 263 | "zlib-rs", |
| @@ -7,6 +7,8 @@ publish = false | ||
| 7 | 7 | autotests = false |
| 8 | 8 | |
| 9 | 9 | [dependencies] |
| 10 | 추가: bzip2 = "=0.6.1" | |
| 11 | 추가: lzma-rust2 = { version = "=0.25.0", default-features = false, features = ["std", "xz"] } | |
| 10 | 12 | aes = { version = "=0.8.4", features = ["zeroize"] } |
| 11 | 13 | hmac = "=0.12.1" |
| 12 | 14 | pbkdf2 = { version = "=0.12.2", default-features = false, features = ["hmac"] } |
| @@ -25,3 +27,9 @@ path = "../../tests/rust-archive-worker/main.rs" | ||
| 25 | 27 | # 대용량 시험의 CRC와 Deflate에도 배포판의 최적화를 적용함. |
| 26 | 28 | [profile.dev.package.zlib-rs] |
| 27 | 29 | opt-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 |
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | |
| 3 | 3 | 별도 프로세스의 stdin/stdout으로 revision 3 요청을 처리합니다. 제품 앱이 공유 codec으로 연결하며 프로세스 분리는 OS sandbox를 뜻하지 않습니다. 암호 기능은 capability=true이며 ZipCrypto 해제, WinZip AES-256 AE-1/AE-2 해제와 AE-2 생성을 지원합니다. |
| 4 | 4 | |
| 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 확장과 특수 항목 해제는 미지원입니다. | |
| 6 | 6 | - ZIP 이름: UTF-8 플래그(비트 11)가 있으면 이름이 UTF-8이어야 하며 아니면 Integrity입니다. 플래그가 없으면 CRC가 원래 이름과 맞는 Info-ZIP Unicode Path 확장 필드(0x7075, 버전 1)를 우선 쓰고, 다음으로 UTF-8로 유효한 이름 바이트를 그대로 씁니다(Linux/macOS 도구의 기본 동작). CRC가 다르거나 버전이 다른 확장 필드는 무시합니다. 그 밖의 CP437/CP949 등 레거시 이름은 코드 페이지를 추측하지 않고 UnsupportedFeature로 거부합니다. 어느 경로로 얻은 이름이든 같은 경로 안전성 검사와 충돌 검사를 거칩니다. |
| 7 | 7 | - 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 한도를 유지합니다. |
| 8 | 8 | - 경로 깊이는 64개 구성 요소, 이름/출력 계획 메타데이터 예산은 8 MiB, 출력 계획 노드는 32,768개로 제한합니다. 이름 복제와 인덱스 비용을 보수적으로 계산해 할당 전에 Limit으로 거부합니다. |
| @@ -35,6 +35,25 @@ revision 2의 기존 필드와 오류 tag 0~12 및 입력/출력 기본 한도 | ||
| 35 | 35 | - 합성 표본은 Python 표준 lzma로 생성합니다. 별도로 시스템 libarchive가 만든 LZMA1/LZMA2 표본을 해제하고, 합성 표본도 libarchive 읽기 API로 검사합니다. libarchive는 Linux 시험의 독립 참조 도구이며 제품 의존성이 아닙니다. 시험 도구와 표본은 tests/rust-archive-worker 아래에 있습니다. |
| 36 | 36 | - 형식 확장은 히나타 님과 합의한 Format::SevenZip=4입니다. 기존 값 0~3과 필드, 메시지 tag, 프레임 version은 유지합니다. 구버전 앱은 값 4를 거부하므로 앱 Format과 양방향 변환도 갱신해야 합니다. 이 백엔드 변경은 frontend 코드를 수정하지 않습니다. |
| 37 | 37 | |
| 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 | 추가: | |
| 38 | 57 | ## 암호 ZIP |
| 39 | 58 | |
| 40 | 59 | - 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은 미지원입니다. |
| @@ -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 | 추가: } |
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | pub mod archive; |
| 2 | 추가: mod compressed_tar; | |
| 2 | 3 | mod create; |
| 3 | 4 | mod create_sources; |
| 4 | 5 | mod crypto; |
| @@ -66,6 +66,21 @@ impl Catalog { | ||
| 66 | 66 | { |
| 67 | 67 | return zip(source, len, limits, decode, password, check); |
| 68 | 68 | } |
| 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 | 추가: } | |
| 69 | 84 | if magic.starts_with(&[31, 139]) { |
| 70 | 85 | let mut data = spool::temporary()?; |
| 71 | 86 | io(source.rewind())?; |
| @@ -124,7 +124,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" | ||
| 124 | 124 | dependencies = [ |
| 125 | 125 | "cfg-if", |
| 126 | 126 | "cipher", |
| 127 | 삭제: "cpufeatures", | |
| 127 | 추가: "cpufeatures 0.2.17", | |
| 128 | 128 | "zeroize", |
| 129 | 129 | ] |
| 130 | 130 | |
| @@ -462,6 +462,15 @@ dependencies = [ | ||
| 462 | 462 | "generic-array", |
| 463 | 463 | ] |
| 464 | 464 | |
| 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 | 추가: | |
| 465 | 474 | [[package]] |
| 466 | 475 | name = "block2" |
| 467 | 476 | version = "0.5.1" |
| @@ -531,6 +540,15 @@ version = "1.12.1" | ||
| 531 | 540 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 532 | 541 | checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" |
| 533 | 542 | |
| 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 | 추가: | |
| 534 | 552 | [[package]] |
| 535 | 553 | name = "calloop" |
| 536 | 554 | version = "0.13.0" |
| @@ -620,7 +638,7 @@ version = "0.4.4" | ||
| 620 | 638 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 621 | 639 | checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" |
| 622 | 640 | dependencies = [ |
| 623 | 삭제: "crypto-common", | |
| 641 | 추가: "crypto-common 0.1.7", | |
| 624 | 642 | "inout", |
| 625 | 643 | ] |
| 626 | 644 | |
| @@ -670,6 +688,12 @@ dependencies = [ | ||
| 670 | 688 | "crossbeam-utils", |
| 671 | 689 | ] |
| 672 | 690 | |
| 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 | 추가: | |
| 673 | 697 | [[package]] |
| 674 | 698 | name = "constant_time_eq" |
| 675 | 699 | version = "0.6.1" |
| @@ -728,6 +752,15 @@ dependencies = [ | ||
| 728 | 752 | "libc", |
| 729 | 753 | ] |
| 730 | 754 | |
| 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 | 추가: | |
| 731 | 764 | [[package]] |
| 732 | 765 | name = "crc32fast" |
| 733 | 766 | version = "1.5.5" |
| @@ -759,6 +792,15 @@ dependencies = [ | ||
| 759 | 792 | "typenum", |
| 760 | 793 | ] |
| 761 | 794 | |
| 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 | 추가: | |
| 762 | 804 | [[package]] |
| 763 | 805 | name = "cursor-icon" |
| 764 | 806 | version = "1.2.0" |
| @@ -771,11 +813,22 @@ version = "0.10.7" | ||
| 771 | 813 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 772 | 814 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" |
| 773 | 815 | dependencies = [ |
| 774 | 삭제: "block-buffer", | |
| 775 | 삭제: "crypto-common", | |
| 816 | 추가: "block-buffer 0.10.4", | |
| 817 | 추가: "crypto-common 0.1.7", | |
| 776 | 818 | "subtle", |
| 777 | 819 | ] |
| 778 | 820 | |
| 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 | 추가: | |
| 779 | 832 | [[package]] |
| 780 | 833 | name = "dispatch" |
| 781 | 834 | version = "0.2.0" |
| @@ -1533,7 +1586,16 @@ version = "0.12.1" | ||
| 1533 | 1586 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1534 | 1587 | checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" |
| 1535 | 1588 | dependencies = [ |
| 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", | |
| 1537 | 1599 | ] |
| 1538 | 1600 | |
| 1539 | 1601 | [[package]] |
| @@ -1779,6 +1841,12 @@ dependencies = [ | ||
| 1779 | 1841 | "smallvec", |
| 1780 | 1842 | ] |
| 1781 | 1843 | |
| 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 | 추가: | |
| 1782 | 1850 | [[package]] |
| 1783 | 1851 | name = "libc" |
| 1784 | 1852 | version = "0.2.191" |
| @@ -1858,6 +1926,15 @@ version = "0.4.35" | ||
| 1858 | 1926 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 1859 | 1927 | checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" |
| 1860 | 1928 | |
| 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 | 추가: | |
| 1861 | 1938 | [[package]] |
| 1862 | 1939 | name = "memchr" |
| 1863 | 1940 | version = "2.8.3" |
| @@ -2419,7 +2496,7 @@ version = "0.12.2" | ||
| 2419 | 2496 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 2420 | 2497 | checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" |
| 2421 | 2498 | dependencies = [ |
| 2422 | 삭제: "digest", | |
| 2499 | 추가: "digest 0.10.7", | |
| 2423 | 2500 | "hmac", |
| 2424 | 2501 | ] |
| 2425 | 2502 | |
| @@ -2966,8 +3043,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 2966 | 3043 | checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" |
| 2967 | 3044 | dependencies = [ |
| 2968 | 3045 | "cfg-if", |
| 2969 | 삭제: "cpufeatures", | |
| 2970 | 삭제: "digest", | |
| 3046 | 추가: "cpufeatures 0.2.17", | |
| 3047 | 추가: "digest 0.10.7", | |
| 2971 | 3048 | ] |
| 2972 | 3049 | |
| 2973 | 3050 | [[package]] |
| @@ -2977,8 +3054,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 2977 | 3054 | checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" |
| 2978 | 3055 | dependencies = [ |
| 2979 | 3056 | "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", | |
| 2982 | 3070 | ] |
| 2983 | 3071 | |
| 2984 | 3072 | [[package]] |
| @@ -4564,10 +4652,12 @@ name = "zipelo-archive-worker" | ||
| 4564 | 4652 | version = "0.1.0" |
| 4565 | 4653 | dependencies = [ |
| 4566 | 4654 | "aes", |
| 4655 | 추가: "bzip2", | |
| 4567 | 4656 | "hmac", |
| 4657 | 추가: "lzma-rust2", | |
| 4568 | 4658 | "pbkdf2", |
| 4569 | 4659 | "sha1", |
| 4570 | 삭제: "sha2", | |
| 4660 | 추가: "sha2 0.10.9", | |
| 4571 | 4661 | "subtle", |
| 4572 | 4662 | "zeroize", |
| 4573 | 4663 | "zlib-rs", |
| @@ -4584,7 +4674,7 @@ dependencies = [ | ||
| 4584 | 4674 | name = "zipelo-memory-ustar-reader" |
| 4585 | 4675 | version = "0.1.0" |
| 4586 | 4676 | dependencies = [ |
| 4587 | 삭제: "sha2", | |
| 4677 | 추가: "sha2 0.10.9", | |
| 4588 | 4678 | "subtle", |
| 4589 | 4679 | ] |
| 4590 | 4680 |
| @@ -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() |
| @@ -10,7 +10,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" | ||
| 10 | 10 | dependencies = [ |
| 11 | 11 | "cfg-if", |
| 12 | 12 | "cipher", |
| 13 | 삭제: "cpufeatures", | |
| 13 | 추가: "cpufeatures 0.2.17", | |
| 14 | 14 | "zeroize", |
| 15 | 15 | ] |
| 16 | 16 | |
| @@ -23,6 +23,24 @@ dependencies = [ | ||
| 23 | 23 | "generic-array", |
| 24 | 24 | ] |
| 25 | 25 | |
| 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 | 추가: | |
| 26 | 44 | [[package]] |
| 27 | 45 | name = "cfg-if" |
| 28 | 46 | version = "1.0.5" |
| @@ -35,10 +53,16 @@ version = "0.4.4" | ||
| 35 | 53 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 36 | 54 | checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" |
| 37 | 55 | dependencies = [ |
| 38 | 삭제: "crypto-common", | |
| 56 | 추가: "crypto-common 0.1.7", | |
| 39 | 57 | "inout", |
| 40 | 58 | ] |
| 41 | 59 | |
| 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 | 추가: | |
| 42 | 66 | [[package]] |
| 43 | 67 | name = "cpufeatures" |
| 44 | 68 | version = "0.2.17" |
| @@ -48,6 +72,15 @@ dependencies = [ | ||
| 48 | 72 | "libc", |
| 49 | 73 | ] |
| 50 | 74 | |
| 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 | 추가: | |
| 51 | 84 | [[package]] |
| 52 | 85 | name = "crypto-common" |
| 53 | 86 | version = "0.1.7" |
| @@ -58,17 +91,37 @@ dependencies = [ | ||
| 58 | 91 | "typenum", |
| 59 | 92 | ] |
| 60 | 93 | |
| 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 | 추가: | |
| 61 | 103 | [[package]] |
| 62 | 104 | name = "digest" |
| 63 | 105 | version = "0.10.7" |
| 64 | 106 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 65 | 107 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" |
| 66 | 108 | dependencies = [ |
| 67 | 삭제: "block-buffer", | |
| 68 | 삭제: "crypto-common", | |
| 109 | 추가: "block-buffer 0.10.4", | |
| 110 | 추가: "crypto-common 0.1.7", | |
| 69 | 111 | "subtle", |
| 70 | 112 | ] |
| 71 | 113 | |
| 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 | 추가: | |
| 72 | 125 | [[package]] |
| 73 | 126 | name = "generic-array" |
| 74 | 127 | version = "0.14.7" |
| @@ -85,7 +138,16 @@ version = "0.12.1" | ||
| 85 | 138 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 86 | 139 | checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" |
| 87 | 140 | dependencies = [ |
| 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", | |
| 89 | 151 | ] |
| 90 | 152 | |
| 91 | 153 | [[package]] |
| @@ -97,19 +159,34 @@ dependencies = [ | ||
| 97 | 159 | "generic-array", |
| 98 | 160 | ] |
| 99 | 161 | |
| 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 | 추가: | |
| 100 | 168 | [[package]] |
| 101 | 169 | name = "libc" |
| 102 | 170 | version = "0.2.191" |
| 103 | 171 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 104 | 172 | checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" |
| 105 | 173 | |
| 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 | 추가: | |
| 106 | 183 | [[package]] |
| 107 | 184 | name = "pbkdf2" |
| 108 | 185 | version = "0.12.2" |
| 109 | 186 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 110 | 187 | checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" |
| 111 | 188 | dependencies = [ |
| 112 | 삭제: "digest", | |
| 189 | 추가: "digest 0.10.7", | |
| 113 | 190 | "hmac", |
| 114 | 191 | ] |
| 115 | 192 | |
| @@ -120,8 +197,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 120 | 197 | checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" |
| 121 | 198 | dependencies = [ |
| 122 | 199 | "cfg-if", |
| 123 | 삭제: "cpufeatures", | |
| 124 | 삭제: "digest", | |
| 200 | 추가: "cpufeatures 0.2.17", | |
| 201 | 추가: "digest 0.10.7", | |
| 125 | 202 | ] |
| 126 | 203 | |
| 127 | 204 | [[package]] |
| @@ -131,8 +208,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 131 | 208 | checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" |
| 132 | 209 | dependencies = [ |
| 133 | 210 | "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", | |
| 136 | 224 | ] |
| 137 | 225 | |
| 138 | 226 | [[package]] |
| @@ -164,10 +252,12 @@ name = "zipelo-archive-worker" | ||
| 164 | 252 | version = "0.1.0" |
| 165 | 253 | dependencies = [ |
| 166 | 254 | "aes", |
| 255 | 추가: "bzip2", | |
| 167 | 256 | "hmac", |
| 257 | 추가: "lzma-rust2", | |
| 168 | 258 | "pbkdf2", |
| 169 | 259 | "sha1", |
| 170 | 삭제: "sha2", | |
| 260 | 추가: "sha2 0.10.9", | |
| 171 | 261 | "subtle", |
| 172 | 262 | "zeroize", |
| 173 | 263 | "zlib-rs", |
| @@ -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 | 추가: } |
| @@ -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 | 추가: } |
| @@ -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) |
| @@ -1613,3 +1613,5 @@ mod zip_names; | ||
| 1613 | 1613 | mod conflict_wire; |
| 1614 | 1614 | |
| 1615 | 1615 | mod conflicts; |
| 1616 | 추가: | |
| 1617 | 추가: mod compressed_tar; |
| @@ -10,7 +10,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" | ||
| 10 | 10 | dependencies = [ |
| 11 | 11 | "cfg-if", |
| 12 | 12 | "cipher", |
| 13 | 삭제: "cpufeatures", | |
| 13 | 추가: "cpufeatures 0.2.17", | |
| 14 | 14 | "zeroize", |
| 15 | 15 | ] |
| 16 | 16 | |
| @@ -23,6 +23,24 @@ dependencies = [ | ||
| 23 | 23 | "generic-array", |
| 24 | 24 | ] |
| 25 | 25 | |
| 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 | 추가: | |
| 26 | 44 | [[package]] |
| 27 | 45 | name = "cfg-if" |
| 28 | 46 | version = "1.0.5" |
| @@ -35,10 +53,16 @@ version = "0.4.4" | ||
| 35 | 53 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 36 | 54 | checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" |
| 37 | 55 | dependencies = [ |
| 38 | 삭제: "crypto-common", | |
| 56 | 추가: "crypto-common 0.1.7", | |
| 39 | 57 | "inout", |
| 40 | 58 | ] |
| 41 | 59 | |
| 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 | 추가: | |
| 42 | 66 | [[package]] |
| 43 | 67 | name = "cpufeatures" |
| 44 | 68 | version = "0.2.17" |
| @@ -48,6 +72,15 @@ dependencies = [ | ||
| 48 | 72 | "libc", |
| 49 | 73 | ] |
| 50 | 74 | |
| 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 | 추가: | |
| 51 | 84 | [[package]] |
| 52 | 85 | name = "crypto-common" |
| 53 | 86 | version = "0.1.7" |
| @@ -58,17 +91,37 @@ dependencies = [ | ||
| 58 | 91 | "typenum", |
| 59 | 92 | ] |
| 60 | 93 | |
| 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 | 추가: | |
| 61 | 103 | [[package]] |
| 62 | 104 | name = "digest" |
| 63 | 105 | version = "0.10.7" |
| 64 | 106 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 65 | 107 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" |
| 66 | 108 | dependencies = [ |
| 67 | 삭제: "block-buffer", | |
| 68 | 삭제: "crypto-common", | |
| 109 | 추가: "block-buffer 0.10.4", | |
| 110 | 추가: "crypto-common 0.1.7", | |
| 69 | 111 | "subtle", |
| 70 | 112 | ] |
| 71 | 113 | |
| 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 | 추가: | |
| 72 | 125 | [[package]] |
| 73 | 126 | name = "generic-array" |
| 74 | 127 | version = "0.14.7" |
| @@ -85,7 +138,16 @@ version = "0.12.1" | ||
| 85 | 138 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 86 | 139 | checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" |
| 87 | 140 | dependencies = [ |
| 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", | |
| 89 | 151 | ] |
| 90 | 152 | |
| 91 | 153 | [[package]] |
| @@ -97,19 +159,34 @@ dependencies = [ | ||
| 97 | 159 | "generic-array", |
| 98 | 160 | ] |
| 99 | 161 | |
| 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 | 추가: | |
| 100 | 168 | [[package]] |
| 101 | 169 | name = "libc" |
| 102 | 170 | version = "0.2.191" |
| 103 | 171 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 104 | 172 | checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" |
| 105 | 173 | |
| 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 | 추가: | |
| 106 | 183 | [[package]] |
| 107 | 184 | name = "pbkdf2" |
| 108 | 185 | version = "0.12.2" |
| 109 | 186 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 110 | 187 | checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" |
| 111 | 188 | dependencies = [ |
| 112 | 삭제: "digest", | |
| 189 | 추가: "digest 0.10.7", | |
| 113 | 190 | "hmac", |
| 114 | 191 | ] |
| 115 | 192 | |
| @@ -120,8 +197,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 120 | 197 | checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" |
| 121 | 198 | dependencies = [ |
| 122 | 199 | "cfg-if", |
| 123 | 삭제: "cpufeatures", | |
| 124 | 삭제: "digest", | |
| 200 | 추가: "cpufeatures 0.2.17", | |
| 201 | 추가: "digest 0.10.7", | |
| 125 | 202 | ] |
| 126 | 203 | |
| 127 | 204 | [[package]] |
| @@ -131,8 +208,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 131 | 208 | checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" |
| 132 | 209 | dependencies = [ |
| 133 | 210 | "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", | |
| 136 | 224 | ] |
| 137 | 225 | |
| 138 | 226 | [[package]] |
| @@ -164,10 +252,12 @@ name = "zipelo-archive-worker" | ||
| 164 | 252 | version = "0.1.0" |
| 165 | 253 | dependencies = [ |
| 166 | 254 | "aes", |
| 255 | 추가: "bzip2", | |
| 167 | 256 | "hmac", |
| 257 | 추가: "lzma-rust2", | |
| 168 | 258 | "pbkdf2", |
| 169 | 259 | "sha1", |
| 170 | 삭제: "sha2", | |
| 260 | 추가: "sha2 0.10.9", | |
| 171 | 261 | "subtle", |
| 172 | 262 | "zeroize", |
| 173 | 263 | "zlib-rs", |
| @@ -10,7 +10,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" | ||
| 10 | 10 | dependencies = [ |
| 11 | 11 | "cfg-if", |
| 12 | 12 | "cipher", |
| 13 | 삭제: "cpufeatures", | |
| 13 | 추가: "cpufeatures 0.2.17", | |
| 14 | 14 | "zeroize", |
| 15 | 15 | ] |
| 16 | 16 | |
| @@ -23,6 +23,24 @@ dependencies = [ | ||
| 23 | 23 | "generic-array", |
| 24 | 24 | ] |
| 25 | 25 | |
| 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 | 추가: | |
| 26 | 44 | [[package]] |
| 27 | 45 | name = "cfg-if" |
| 28 | 46 | version = "1.0.5" |
| @@ -35,10 +53,16 @@ version = "0.4.4" | ||
| 35 | 53 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 36 | 54 | checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" |
| 37 | 55 | dependencies = [ |
| 38 | 삭제: "crypto-common", | |
| 56 | 추가: "crypto-common 0.1.7", | |
| 39 | 57 | "inout", |
| 40 | 58 | ] |
| 41 | 59 | |
| 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 | 추가: | |
| 42 | 66 | [[package]] |
| 43 | 67 | name = "cpufeatures" |
| 44 | 68 | version = "0.2.17" |
| @@ -48,6 +72,15 @@ dependencies = [ | ||
| 48 | 72 | "libc", |
| 49 | 73 | ] |
| 50 | 74 | |
| 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 | 추가: | |
| 51 | 84 | [[package]] |
| 52 | 85 | name = "crypto-common" |
| 53 | 86 | version = "0.1.7" |
| @@ -58,17 +91,37 @@ dependencies = [ | ||
| 58 | 91 | "typenum", |
| 59 | 92 | ] |
| 60 | 93 | |
| 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 | 추가: | |
| 61 | 103 | [[package]] |
| 62 | 104 | name = "digest" |
| 63 | 105 | version = "0.10.7" |
| 64 | 106 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 65 | 107 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" |
| 66 | 108 | dependencies = [ |
| 67 | 삭제: "block-buffer", | |
| 68 | 삭제: "crypto-common", | |
| 109 | 추가: "block-buffer 0.10.4", | |
| 110 | 추가: "crypto-common 0.1.7", | |
| 69 | 111 | "subtle", |
| 70 | 112 | ] |
| 71 | 113 | |
| 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 | 추가: | |
| 72 | 125 | [[package]] |
| 73 | 126 | name = "generic-array" |
| 74 | 127 | version = "0.14.7" |
| @@ -85,7 +138,16 @@ version = "0.12.1" | ||
| 85 | 138 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 86 | 139 | checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" |
| 87 | 140 | dependencies = [ |
| 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", | |
| 89 | 151 | ] |
| 90 | 152 | |
| 91 | 153 | [[package]] |
| @@ -97,19 +159,34 @@ dependencies = [ | ||
| 97 | 159 | "generic-array", |
| 98 | 160 | ] |
| 99 | 161 | |
| 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 | 추가: | |
| 100 | 168 | [[package]] |
| 101 | 169 | name = "libc" |
| 102 | 170 | version = "0.2.191" |
| 103 | 171 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 104 | 172 | checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" |
| 105 | 173 | |
| 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 | 추가: | |
| 106 | 183 | [[package]] |
| 107 | 184 | name = "pbkdf2" |
| 108 | 185 | version = "0.12.2" |
| 109 | 186 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 110 | 187 | checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" |
| 111 | 188 | dependencies = [ |
| 112 | 삭제: "digest", | |
| 189 | 추가: "digest 0.10.7", | |
| 113 | 190 | "hmac", |
| 114 | 191 | ] |
| 115 | 192 | |
| @@ -120,8 +197,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 120 | 197 | checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" |
| 121 | 198 | dependencies = [ |
| 122 | 199 | "cfg-if", |
| 123 | 삭제: "cpufeatures", | |
| 124 | 삭제: "digest", | |
| 200 | 추가: "cpufeatures 0.2.17", | |
| 201 | 추가: "digest 0.10.7", | |
| 125 | 202 | ] |
| 126 | 203 | |
| 127 | 204 | [[package]] |
| @@ -131,8 +208,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 131 | 208 | checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" |
| 132 | 209 | dependencies = [ |
| 133 | 210 | "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", | |
| 136 | 224 | ] |
| 137 | 225 | |
| 138 | 226 | [[package]] |
| @@ -164,10 +252,12 @@ name = "zipelo-archive-worker" | ||
| 164 | 252 | version = "0.1.0" |
| 165 | 253 | dependencies = [ |
| 166 | 254 | "aes", |
| 255 | 추가: "bzip2", | |
| 167 | 256 | "hmac", |
| 257 | 추가: "lzma-rust2", | |
| 168 | 258 | "pbkdf2", |
| 169 | 259 | "sha1", |
| 170 | 삭제: "sha2", | |
| 260 | 추가: "sha2 0.10.9", | |
| 171 | 261 | "subtle", |
| 172 | 262 | "zeroize", |
| 173 | 263 | "zlib-rs", |