Merge pull request #96 from Team-LJY/fix/aes-stream-io
작업자 AES 스트리밍 시험의 임시 경로를 격리
- 작성자
- LeeJunyoung
- 작성 시각
- 커밋
29527d672c8c2b840ae5fbf58cbe787bb3a3b4a5
변경된 파일 2개
+40-2| @@ -310,6 +310,32 @@ fn streamed_aes_counter_survives_many_read_chunks() { | ||
| 310 | 310 | ); |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 추가: #[cfg(target_os = "linux")] | |
| 314 | 추가: #[test] | |
| 315 | 추가: fn worker_temp_isolated_from_unusable_inherited_directory() { | |
| 316 | 추가: let s = Scratch::new(); | |
| 317 | 추가: let invalid = s.0.join("not-a-directory"); | |
| 318 | 추가: fs::write(&invalid, b"preserve inherited path").unwrap(); | |
| 319 | 추가: let output = Command::new(std::env::current_exe().unwrap()) | |
| 320 | 추가: .args([ | |
| 321 | 추가: "--exact", | |
| 322 | 추가: "hardening::streamed_aes_counter_survives_many_read_chunks", | |
| 323 | 추가: "--nocapture", | |
| 324 | 추가: ]) | |
| 325 | 추가: .env("TMPDIR", &invalid) | |
| 326 | 추가: .env("TMP", &invalid) | |
| 327 | 추가: .env("TEMP", &invalid) | |
| 328 | 추가: .output() | |
| 329 | 추가: .unwrap(); | |
| 330 | 추가: assert!( | |
| 331 | 추가: output.status.success(), | |
| 332 | 추가: "{}\n{}", | |
| 333 | 추가: String::from_utf8_lossy(&output.stdout), | |
| 334 | 추가: String::from_utf8_lossy(&output.stderr) | |
| 335 | 추가: ); | |
| 336 | 추가: assert_eq!(fs::read(&invalid).unwrap(), b"preserve inherited path"); | |
| 337 | 추가: } | |
| 338 | 추가: | |
| 313 | 339 | #[test] |
| 314 | 340 | fn seven_zip_output_total_rejects_before_decode() { |
| 315 | 341 | let s = Scratch::new(); |
| @@ -40,6 +40,15 @@ impl Scratch { | ||
| 40 | 40 | fn path(&self, name: &str) -> NativePath { |
| 41 | 41 | NativePath::from_path(&self.0.join(name)) |
| 42 | 42 | } |
| 43 | 추가: fn worker(&self) -> Command { | |
| 44 | 추가: let mut command = Command::new(env!("CARGO_BIN_EXE_zipelo-archive-worker")); | |
| 45 | 추가: // 공유 임시 폴더의 할당량과 다른 시험의 사용량에 의존하지 않음. | |
| 46 | 추가: command | |
| 47 | 추가: .env("TMPDIR", &self.0) | |
| 48 | 추가: .env("TMP", &self.0) | |
| 49 | 추가: .env("TEMP", &self.0); | |
| 50 | 추가: command | |
| 51 | 추가: } | |
| 43 | 52 | } |
| 44 | 53 | impl Drop for Scratch { |
| 45 | 54 | fn drop(&mut self) { |
| @@ -51,7 +60,8 @@ fn execute(start: Start) -> Vec<Message> { | ||
| 51 | 60 | Writer::new(&mut data, 17) |
| 52 | 61 | .send(&Message::Start(start)) |
| 53 | 62 | .unwrap(); |
| 54 | 삭제: let mut command = Command::new(env!("CARGO_BIN_EXE_zipelo-archive-worker")); | |
| 63 | 추가: let temporary = Scratch::new(); | |
| 64 | 추가: let mut command = temporary.worker(); | |
| 55 | 65 | command |
| 56 | 66 | .stdin(Stdio::piped()) |
| 57 | 67 | .stdout(Stdio::piped()) |
| @@ -810,7 +820,9 @@ fn interactive( | ||
| 810 | 820 | mut respond: impl FnMut(u64, u32, PasswordPurpose) -> Vec<Message>, |
| 811 | 821 | ) -> Vec<Message> { |
| 812 | 822 | use std::{io::Read, sync::mpsc, time::Duration}; |
| 813 | 삭제: let mut child = Command::new(env!("CARGO_BIN_EXE_zipelo-archive-worker")) | |
| 823 | 추가: let temporary = Scratch::new(); | |
| 824 | 추가: let mut child = temporary | |
| 825 | 추가: .worker() | |
| 814 | 826 | .stdin(Stdio::piped()) |
| 815 | 827 | .stdout(Stdio::piped()) |
| 816 | 828 | .stderr(Stdio::piped()) |