압축 작업 코어와 안전 계약을 추가함
- 작성자
- 시로사키 하나
- 작성 시각
- 커밋
ee24354859974c03f28d44b85a4fb9530947dca3- 부모
- ee76385
변경된 파일 7개
+639-0| @@ -0,0 +1,51 @@ | ||
| 1 | 추가: # Core 경합과 종료 처리 수정 | |
| 2 | 추가: | |
| 3 | 추가: ## 범위와 검증 상태 | |
| 4 | 추가: | |
| 5 | 추가: 2026-11-09의 [보안 검토](SECURITY_REVIEW.md) 4~6장을 기준으로 암호 요청 경합과 초기화 실패 시 출력 정리 누락을 수정했다. src/Zipelo.Core의 ArchiveJob.cs, EngineContext.cs와 ArchiveContracts.cs만 수정했으며 tests/와 Desktop은 수정하지 않았다. 공개 타입, 메서드 시그니처, enum 값과 결과 필드는 그대로다. | |
| 6 | 추가: | |
| 7 | 추가: 로컬 PATH에서 dotnet과 C# 컴파일러를 찾지 못했다. 이번 확인은 소스 흐름과 기존 테스트 대역 대조, 공백 및 프로젝트 XML 검사뿐이며 C# 컴파일이나 회귀 실행 통과를 뜻하지 않는다. Windows 스냅샷의 이전 결과는 이번 수정의 검증 근거가 아니다. Windows 복사와 재검증은 총괄이 별도로 조율한다. | |
| 8 | 추가: | |
| 9 | 추가: ## 암호 요청과 상태 | |
| 10 | 추가: | |
| 11 | 추가: [EngineContext](../src/Zipelo.Core/EngineContext.cs)의 전용 SemaphoreSlim이 작업별 PasswordProvider 호출을 직렬화한다. 시도 번호는 잠금 안에서 증가시킨 지역값으로 전달하며 제한 확인을 증가보다 먼저 해 정수 넘침도 피한다. 대기 중 취소된 요청은 제공자를 호출하거나 시도 횟수를 소비하지 않는다. FIFO 순서는 보장하지 않는다. | |
| 12 | 추가: | |
| 13 | 추가: WaitingForPassword는 실제 제공자가 응답을 기다리는 동안만 유지한다. 다른 항목의 목록 및 복사 진행이 이 상태를 Running으로 덮지 못하도록 상태 잠금을 사용한다. 제공자가 반환하면 상태와 잠금을 복원하고 소비 콜백은 잠금 밖에서 실행한다. 따라서 소비 콜백의 추가 암호 요청은 가능하지만 제공자 자체가 같은 작업의 암호 요청을 재진입하고 기다리는 동작은 금지한다. | |
| 14 | 추가: | |
| 15 | 추가: 암호는 소비 종료까지 요청별로 소유하며 성공, 소비 예외, 취소와 늦은 제공자 응답 모두에서 finally로 폐기한다. 취소 뒤 반환된 암호는 소비 전에 예산 및 취소 검사에 걸려 폐기된다. 제공자가 영원히 반환하지 않으면 Core가 아직 받지 못한 암호를 폐기할 수 없으며, 이 수정은 강제 종료를 구현하지 않는다. 서로 다른 소비 콜백이 동시에 실행될 수 있으므로 엔진은 시작한 작업을 전부 await해야 한다. | |
| 16 | 추가: | |
| 17 | 추가: UI 연결 시 제공자 중복 호출은 없어지고 WaitingForPassword의 의미가 제공자 응답 대기로 좁아진다. 진행 이벤트는 Sequence 순서를 기준으로 적용해야 한다. 비동기 IProgress 구현의 큐 처리 순서까지 Core가 보장하지 않는다. | |
| 18 | 추가: | |
| 19 | 추가: ## 초기화와 출력 소유권 | |
| 20 | 추가: | |
| 21 | 추가: [ArchiveJob](../src/Zipelo.Core/ArchiveJob.cs)은 필수 인자의 null 검사와 일회 실행 확인이 끝난 시점부터 출력 소유권을 받는다. 이 사전 검사에서 거부된 호출의 출력은 호출자가 소유한다. 그 뒤 JobBudget 생성, 연결 취소 토큰 생성, 입력 목록 복사와 문맥 초기화는 모두 출력 DisposeAsync를 호출하는 try/finally 안에서 수행한다. | |
| 22 | 추가: | |
| 23 | 추가: 제한값 오류 등 문맥 생성 전 ArgumentException은 Failed/UnsupportedOperation 결과와 빈 항목 목록으로 반환한다. 초기화 전에 실패한 예산의 진행량은 0이다. 입력 목록 복사 등 그 밖의 예외도 정리를 거친 뒤 오류 결과를 반환한다. 실패한 작업 인스턴스는 재사용하지 않는다. 출력 정리는 정확히 한 번 시도하며 정리가 반환해야 종료 이벤트를 보낸다. | |
| 24 | 추가: | |
| 25 | 추가: 정리도 실패하면 작업 상태는 Failed로 한다. 기존 주 오류가 있으면 보존하고, 주 오류가 없을 때만 OutputUnavailable을 기록한다. 공개 JobResult에는 별도 정리 오류 필드가 없어 두 오류를 독립적으로 표현하지 못한다. 이 제약을 숨기거나 오류 원문에 암호 또는 경로를 넣지 않는다. 특히 Failed/Cancelled는 취소 뒤 정리 실패가 있었을 수 있으므로 정상 취소 완료로 표시하면 안 된다. | |
| 26 | 추가: | |
| 27 | 추가: ## 게시 실패와 취소 완료 계약 | |
| 28 | 추가: | |
| 29 | 추가: [IOutputTransaction](../src/Zipelo.Core/ArchiveContracts.cs)은 전체 게시 성공 또는 실패 시 작업 소유 출력 원복을 요구한다. 두 번째 파일에서 실패했다면 이미 게시한 첫 번째 파일도 원복해야 하며, 원본과 작업 전부터 있던 파일은 건드리지 않아야 한다. 부분 게시 결과를 돌려줄 수 없는 현재 인터페이스에 부분 성공 저장 계층을 그대로 연결하지 않는다. | |
| 30 | 추가: | |
| 31 | 추가: 이것은 저장 구현의 의무를 명확히 한 것이며 원자적인 Windows 파일시스템 동작을 구현한 것이 아니다. 현재 실제 구현은 UnavailableOutput뿐이다. 기존 메모리 테스트 대역도 일반적인 부분 게시 후 실패와 원복을 입증하지 않는다. 저장 계층이 원복에 실패하거나 프로세스가 중단되면 현재 결과만으로 남은 파일을 정확히 나열할 수 없다. 그런 저장 방식을 채택하려면 별도의 항목별 게시 결과 및 복구 계약이 먼저 필요하다. | |
| 32 | 추가: | |
| 33 | 추가: - CommitAsync 정상 반환: Staged는 Extracted로 변환한다. 반환 직전이나 직후의 늦은 취소로 실제 게시 성공을 Cancelled로 덮지 않는다. 이후 정리가 실패하면 작업은 Failed여도 항목의 Extracted를 유지한다. | |
| 34 | 추가: - CommitAsync 실패 또는 취소: Staged는 Failed로 변환한다. 이는 게시 성공을 확인하지 못했다는 의미다. 저장 계층의 원복 및 정리 성공 근거 없이 파일이 없다고 안내하면 안 된다. Partial 값은 예약 상태이며 이번 구현에서 실제 부분 성공 판정에 사용하지 않는다. | |
| 35 | 추가: - 출력 없는 작업: 엔진과 모든 문맥 작업이 끝난 뒤 마지막 예산 및 취소 검사를 통과하면 완료 경계를 지난 것으로 본다. 이후의 취소는 이미 끝난 결과를 되돌리지 않는다. | |
| 36 | 추가: - Cancelled 종료: 협력하는 엔진 호출이 반환하고 출력 정리가 성공한 뒤에만 보고한다. 정리가 실패하면 Failed다. 취소 등록을 해제한 뒤 최종 이벤트를 보내며 취소가 확인된 상태에서 Running이나 WaitingForPassword를 새로 보고하지 않는다. | |
| 37 | 추가: | |
| 38 | 추가: 비협력 엔진, 멈춘 암호 제공자 또는 DisposeAsync를 강제로 종료하지 않는다. Windows 링크/junction 방어, 실제 안전 출력, 별도 작업 프로세스, 메모리 및 시간 강제 제한은 여전히 미구현이다. Completed는 CRC 또는 인증 검증 통과와 동의어가 아니며 항목의 Verification을 별도로 유지한다. | |
| 39 | 추가: | |
| 40 | 추가: ## 필요한 회귀 사례 | |
| 41 | 추가: | |
| 42 | 추가: 다음은 테스트 담당자가 기존 29개 컴파일 및 실행 확인 이후 추가할 사례다. 이번 라운드에서는 테스트를 작성하거나 실행하지 않았다. | |
| 43 | 추가: | |
| 44 | 추가: 1. 두 암호 요청을 겹치고 첫 제공자 응답을 지연한다. 제공자 동시 실행 최대값 1, 서로 다른 RequestId와 시도 번호 1/2, 다른 항목 진행 중 WaitingForPassword 유지, 각 소비자에게 자기 암호 전달을 확인한다. | |
| 45 | 추가: 2. 첫 암호 요청 대기 중 두 번째 요청과 작업을 취소한다. 두 번째 제공자 미호출, 늦게 반환된 첫 SecureString 폐기, 소비자 미호출, 최종 취소 뒤 비종료 이벤트가 없음을 확인한다. | |
| 46 | 추가: 3. 제공자 예외, 소비자 예외와 재요청 뒤에도 게이트가 풀리는지 확인한다. 소비자 안의 재요청이 교착하지 않는지와 시도 상한 뒤 추가 제공자 호출이 없는지도 확인한다. | |
| 47 | 추가: 4. null 또는 잘못된 JobLimits와 입력 목록 복사 예외를 주입한다. 엔진 미실행, 출력 정리 한 번, 빈 항목 또는 기존 항목 보존, 최종 오류 이벤트를 확인한다. 재사용 및 사전 null 인자 거부는 출력 소유권 이전 전인 점도 구분한다. | |
| 48 | 추가: 5. IntegrityFailure 뒤 정리 실패에서는 주 오류를 보존하며 Failed를 반환하는지 확인한다. 취소 뒤 정리 실패도 Cancelled 종료가 아닌 Failed인지 확인한다. | |
| 49 | 추가: 6. 두 항목의 첫 게시 뒤 실패하거나 취소되는 저장 대역에서 작업 소유 게시의 원복과 기존 파일 불변을 확인한다. 원복 실패는 성공으로 숨기지 않으며 결과만으로 파일 부재를 주장하지 않는다. 실제 Windows 저장 구현에서도 별도 검증이 필요하다. | |
| 50 | 추가: 7. CommitAsync가 게시를 완료하고 토큰을 취소한 뒤 정상 반환하면 Completed/Extracted를 유지하는지 확인한다. 게시 성공 뒤 DisposeAsync 실패는 Failed/Extracted를 유지해야 한다. | |
| 51 | 추가: 8. 출력 정리를 지연하면 정리가 끝나기 전 최종 이벤트와 ExecuteAsync 완료가 없는지 확인한다. 멈추는 대역 검사는 외부 실행 시간 제한이 있는 환경에서만 수행한다. |
| @@ -0,0 +1,83 @@ | ||
| 1 | 추가: using System.Security; | |
| 2 | 추가: | |
| 3 | 추가: namespace Zipelo.Core; | |
| 4 | 추가: | |
| 5 | 추가: public enum ArchiveAction { List, Extract, Create, Verify, Preview, Recover } | |
| 6 | 추가: public enum JobState { Created, Running, WaitingForPassword, Cancelling, Completed, Partial, Cancelled, Failed } | |
| 7 | 추가: public enum EntryKind { File, Directory, SymbolicLink, HardLink, Other } | |
| 8 | 추가: public enum EntryOutcome { Listed, Staged, Extracted, Skipped, Failed } | |
| 9 | 추가: public enum VerificationState { NotChecked, Passed, Failed, Unavailable } | |
| 10 | 추가: public enum ArchiveError | |
| 11 | 추가: { | |
| 12 | 추가: None, | |
| 13 | 추가: EngineUnavailable, | |
| 14 | 추가: UnsupportedOperation, | |
| 15 | 추가: UnsafePath, | |
| 16 | 추가: UnsupportedEntry, | |
| 17 | 추가: OutputUnavailable, | |
| 18 | 추가: OutputConflict, | |
| 19 | 추가: BudgetExceeded, | |
| 20 | 추가: PasswordAttemptsExceeded, | |
| 21 | 추가: InvalidPasswordResponse, | |
| 22 | 추가: IntegrityFailure, | |
| 23 | 추가: Cancelled, | |
| 24 | 추가: EngineFailure | |
| 25 | 추가: } | |
| 26 | 추가: | |
| 27 | 추가: public sealed class ArchiveException(ArchiveError code) : Exception(code.ToString()) | |
| 28 | 추가: { | |
| 29 | 추가: public ArchiveError Code { get; } = code; | |
| 30 | 추가: } | |
| 31 | 추가: | |
| 32 | 추가: public sealed record EngineCapability(string Format, ArchiveAction Action); | |
| 33 | 추가: public sealed record ArchiveEntry(string Id, string Name, EntryKind Kind, long? DeclaredSize); | |
| 34 | 추가: public sealed record EntryResult(ArchiveEntry Entry, EntryOutcome Outcome, VerificationState Verification, ArchiveError Error) | |
| 35 | 추가: { | |
| 36 | 추가: public string EntryId => Entry.Id; | |
| 37 | 추가: } | |
| 38 | 추가: public sealed record JobEvent(Guid JobId, long Sequence, JobState State, long ProcessedBytes); | |
| 39 | 추가: public sealed record PasswordChallenge(Guid JobId, Guid RequestId, int Attempt); | |
| 40 | 추가: public sealed record JobResult(Guid JobId, JobState State, IReadOnlyList<EntryResult> Entries, ArchiveError Error); | |
| 41 | 추가: | |
| 42 | 추가: // 호출자는 반환된 암호의 소유권을 코어에 넘김. 코어가 소비 종료 시 폐기함. | |
| 43 | 추가: // 제공자는 작업별로 한 번에 하나만 호출됨. 같은 작업의 암호 제공자를 재진입하지 않음. | |
| 44 | 추가: public delegate ValueTask<SecureString?> PasswordProvider(PasswordChallenge challenge, CancellationToken cancellationToken); | |
| 45 | 추가: | |
| 46 | 추가: public interface IArchiveEngine | |
| 47 | 추가: { | |
| 48 | 추가: IReadOnlyCollection<EngineCapability> Capabilities { get; } | |
| 49 | 추가: | |
| 50 | 추가: // 원본 경로나 출력 경로를 받지 않고 제한된 스트림과 작업 문맥만 사용함. | |
| 51 | 추가: // 시작한 문맥 작업을 모두 await하고 실패를 숨기지 않아야 함. 입력 스트림은 폐기하지 않음. | |
| 52 | 추가: Task ExecuteAsync(ArchiveAction action, IReadOnlyList<Stream> inputs, EngineContext context, CancellationToken cancellationToken); | |
| 53 | 추가: } | |
| 54 | 추가: | |
| 55 | 추가: public sealed class UnavailableEngine : IArchiveEngine | |
| 56 | 추가: { | |
| 57 | 추가: public IReadOnlyCollection<EngineCapability> Capabilities => Array.Empty<EngineCapability>(); | |
| 58 | 추가: | |
| 59 | 추가: public Task ExecuteAsync(ArchiveAction action, IReadOnlyList<Stream> inputs, EngineContext context, CancellationToken cancellationToken) | |
| 60 | 추가: => Task.FromException(new ArchiveException(ArchiveError.EngineUnavailable)); | |
| 61 | 추가: } | |
| 62 | 추가: | |
| 63 | 추가: // 저장 계층은 링크와 junction, 경로 교체 경쟁, 기존 파일 충돌을 실제 핸들 기준으로 차단해야 함. | |
| 64 | 추가: // 원본과 기존 파일은 수정하지 않으며 작업 소유 임시 출력만 폐기해야 함. | |
| 65 | 추가: // CommitAsync는 전체 게시 성공에만 정상 반환함. 실패나 취소 시 이미 게시한 작업 소유 출력도 원복해야 함. | |
| 66 | 추가: // 게시 성공 뒤에는 늦은 취소로 예외를 던지지 않음. 부분 게시만 가능한 저장 계층은 이 계약에 연결하지 않음. | |
| 67 | 추가: // DisposeAsync는 성공한 게시를 유지하고 미확정 출력을 정리함. 원복이나 정리 실패를 숨기지 않음. | |
| 68 | 추가: public interface IOutputTransaction : IAsyncDisposable | |
| 69 | 추가: { | |
| 70 | 추가: ValueTask<Stream> CreateFileAsync(IReadOnlyList<string> relativeSegments, CancellationToken cancellationToken); | |
| 71 | 추가: ValueTask CommitAsync(CancellationToken cancellationToken); | |
| 72 | 추가: } | |
| 73 | 추가: | |
| 74 | 추가: public sealed class UnavailableOutput : IOutputTransaction | |
| 75 | 추가: { | |
| 76 | 추가: public ValueTask<Stream> CreateFileAsync(IReadOnlyList<string> relativeSegments, CancellationToken cancellationToken) | |
| 77 | 추가: => ValueTask.FromException<Stream>(new ArchiveException(ArchiveError.OutputUnavailable)); | |
| 78 | 추가: | |
| 79 | 추가: public ValueTask CommitAsync(CancellationToken cancellationToken) | |
| 80 | 추가: => ValueTask.FromException(new ArchiveException(ArchiveError.OutputUnavailable)); | |
| 81 | 추가: | |
| 82 | 추가: public ValueTask DisposeAsync() => ValueTask.CompletedTask; | |
| 83 | 추가: } |
| @@ -0,0 +1,125 @@ | ||
| 1 | 추가: namespace Zipelo.Core; | |
| 2 | 추가: | |
| 3 | 추가: public sealed class ArchiveJob | |
| 4 | 추가: { | |
| 5 | 추가: private readonly Guid id; | |
| 6 | 추가: private readonly JobLimits limits; | |
| 7 | 추가: private int started; | |
| 8 | 추가: | |
| 9 | 추가: public ArchiveJob(Guid id, JobLimits limits) | |
| 10 | 추가: { | |
| 11 | 추가: if (id == Guid.Empty) { throw new ArgumentException("작업 ID가 필요함", nameof(id)); } | |
| 12 | 추가: this.id = id; | |
| 13 | 추가: this.limits = limits; | |
| 14 | 추가: } | |
| 15 | 추가: | |
| 16 | 추가: // 입력 수명은 호출자가 소유함. 출력 트랜잭션은 작업이 소유하여 종료 전에 정리함. | |
| 17 | 추가: public async Task<JobResult> ExecuteAsync(ArchiveAction action, string format, IArchiveEngine engine, | |
| 18 | 추가: IReadOnlyList<Stream> readOnlyInputs, IOutputTransaction output, PasswordProvider passwords, | |
| 19 | 추가: IProgress<JobEvent>? progress, CancellationToken cancellationToken) | |
| 20 | 추가: { | |
| 21 | 추가: ArgumentNullException.ThrowIfNull(engine); | |
| 22 | 추가: ArgumentNullException.ThrowIfNull(readOnlyInputs); | |
| 23 | 추가: ArgumentNullException.ThrowIfNull(output); | |
| 24 | 추가: ArgumentNullException.ThrowIfNull(passwords); | |
| 25 | 추가: if (Interlocked.Exchange(ref started, 1) != 0) | |
| 26 | 추가: { | |
| 27 | 추가: throw new InvalidOperationException("작업 인스턴스는 재사용할 수 없음"); | |
| 28 | 추가: } | |
| 29 | 추가: | |
| 30 | 추가: JobBudget? budget = null; | |
| 31 | 추가: EngineContext? context = null; | |
| 32 | 추가: CancellationTokenSource? linked = null; | |
| 33 | 추가: CancellationTokenRegistration cancellationRegistration = default; | |
| 34 | 추가: var eventGate = new object(); | |
| 35 | 추가: long sequence = 0; | |
| 36 | 추가: void Report(JobState reportedState) | |
| 37 | 추가: { | |
| 38 | 추가: lock (eventGate) | |
| 39 | 추가: { | |
| 40 | 추가: if ((reportedState is JobState.Running or JobState.WaitingForPassword) && | |
| 41 | 추가: (cancellationToken.IsCancellationRequested || linked?.IsCancellationRequested == true)) | |
| 42 | 추가: { | |
| 43 | 추가: reportedState = JobState.Cancelling; | |
| 44 | 추가: } | |
| 45 | 추가: | |
| 46 | 추가: // 관찰자 오류가 정리나 실제 작업 결과를 바꾸지 않도록 함. | |
| 47 | 추가: try { progress?.Report(new(id, ++sequence, reportedState, budget?.Usage.ProcessedBytes ?? 0)); } | |
| 48 | 추가: catch { } | |
| 49 | 추가: } | |
| 50 | 추가: } | |
| 51 | 추가: | |
| 52 | 추가: var state = JobState.Failed; | |
| 53 | 추가: var error = ArchiveError.None; | |
| 54 | 추가: var committed = false; | |
| 55 | 추가: try | |
| 56 | 추가: { | |
| 57 | 추가: // 출력 소유권을 받은 뒤의 초기화도 정리 범위에 포함함. | |
| 58 | 추가: budget = new JobBudget(limits); | |
| 59 | 추가: linked = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); | |
| 60 | 추가: cancellationRegistration = linked.Token.Register(() => Report(JobState.Cancelling)); | |
| 61 | 추가: var inputs = readOnlyInputs.ToArray(); | |
| 62 | 추가: context = new EngineContext(id, action, budget, output, passwords, Report, linked, limits.MaxPasswordAttempts); | |
| 63 | 추가: budget.Check(linked.Token); | |
| 64 | 추가: if (inputs.Length == 0 || inputs.Any(input => input is null || !input.CanRead || input.CanWrite)) | |
| 65 | 추가: { | |
| 66 | 추가: throw new ArchiveException(ArchiveError.UnsupportedOperation); | |
| 67 | 추가: } | |
| 68 | 추가: if (!engine.Capabilities.Any(capability => capability.Action == action && | |
| 69 | 추가: string.Equals(capability.Format, format, StringComparison.OrdinalIgnoreCase))) | |
| 70 | 추가: { | |
| 71 | 추가: throw new ArchiveException(engine is UnavailableEngine ? ArchiveError.EngineUnavailable : ArchiveError.UnsupportedOperation); | |
| 72 | 추가: } | |
| 73 | 추가: | |
| 74 | 추가: Report(JobState.Running); | |
| 75 | 추가: await engine.ExecuteAsync(action, Array.AsReadOnly(inputs), context, linked.Token).ConfigureAwait(false); | |
| 76 | 추가: budget.Check(linked.Token); | |
| 77 | 추가: if (context.Failure != ArchiveError.None) | |
| 78 | 추가: { | |
| 79 | 추가: throw new ArchiveException(context.Failure); | |
| 80 | 추가: } | |
| 81 | 추가: if (context.Results.Any(result => result.Error != ArchiveError.None || result.Verification == VerificationState.Failed)) | |
| 82 | 추가: { | |
| 83 | 추가: throw new ArchiveException(ArchiveError.IntegrityFailure); | |
| 84 | 추가: } | |
| 85 | 추가: | |
| 86 | 추가: if (context.HasOutput) | |
| 87 | 추가: { | |
| 88 | 추가: await output.CommitAsync(linked.Token).ConfigureAwait(false); | |
| 89 | 추가: committed = true; | |
| 90 | 추가: } | |
| 91 | 추가: // 게시 성공 뒤의 늦은 취소로 실제 출력을 취소 결과로 바꾸지 않음. | |
| 92 | 추가: state = JobState.Completed; | |
| 93 | 추가: } | |
| 94 | 추가: catch (OperationCanceledException) when (linked?.IsCancellationRequested == true || cancellationToken.IsCancellationRequested) | |
| 95 | 추가: { | |
| 96 | 추가: state = JobState.Cancelled; | |
| 97 | 추가: error = ArchiveError.Cancelled; | |
| 98 | 추가: } | |
| 99 | 추가: catch (ArgumentException) when (context is null) { error = ArchiveError.UnsupportedOperation; } | |
| 100 | 추가: catch (ArchiveException failure) { error = failure.Code; } | |
| 101 | 추가: catch { error = ArchiveError.EngineFailure; } | |
| 102 | 추가: finally | |
| 103 | 추가: { | |
| 104 | 추가: try { await output.DisposeAsync().ConfigureAwait(false); } | |
| 105 | 추가: catch | |
| 106 | 추가: { | |
| 107 | 추가: state = JobState.Failed; | |
| 108 | 추가: if (error == ArchiveError.None) { error = ArchiveError.OutputUnavailable; } | |
| 109 | 추가: } | |
| 110 | 추가: finally | |
| 111 | 추가: { | |
| 112 | 추가: // 종료 이벤트 뒤에 취소 이벤트가 나오지 않도록 등록을 먼저 해제함. | |
| 113 | 추가: cancellationRegistration.Dispose(); | |
| 114 | 추가: linked?.Dispose(); | |
| 115 | 추가: } | |
| 116 | 추가: } | |
| 117 | 추가: | |
| 118 | 추가: var results = (context?.Results ?? Array.Empty<EntryResult>()).Select(result => result.Outcome == EntryOutcome.Staged | |
| 119 | 추가: ? result with { Outcome = committed ? EntryOutcome.Extracted : EntryOutcome.Failed, | |
| 120 | 추가: Error = committed ? ArchiveError.None : error } | |
| 121 | 추가: : result).ToArray(); | |
| 122 | 추가: Report(state); | |
| 123 | 추가: return new(id, state, Array.AsReadOnly(results), error); | |
| 124 | 추가: } | |
| 125 | 추가: } |
| @@ -0,0 +1,215 @@ | ||
| 1 | 추가: using System.Security; | |
| 2 | 추가: | |
| 3 | 추가: namespace Zipelo.Core; | |
| 4 | 추가: | |
| 5 | 추가: public sealed class EngineContext | |
| 6 | 추가: { | |
| 7 | 추가: private readonly Guid jobId; | |
| 8 | 추가: private readonly ArchiveAction action; | |
| 9 | 추가: private readonly IOutputTransaction output; | |
| 10 | 추가: private readonly PasswordProvider passwords; | |
| 11 | 추가: private readonly Action<JobState> reportState; | |
| 12 | 추가: private readonly CancellationTokenSource cancellation; | |
| 13 | 추가: private readonly int maxPasswordAttempts; | |
| 14 | 추가: private readonly SemaphoreSlim serial = new(1, 1); | |
| 15 | 추가: private readonly SemaphoreSlim passwordSerial = new(1, 1); | |
| 16 | 추가: private readonly object passwordStateGate = new(); | |
| 17 | 추가: private bool waitingForPassword; | |
| 18 | 추가: private readonly HashSet<string> entryIds = new(StringComparer.Ordinal); | |
| 19 | 추가: private readonly HashSet<string> paths = new(OutputPathPolicy.Comparer(OutputPathPolicy.CurrentPolicy)); | |
| 20 | 추가: private readonly List<EntryResult> results = []; | |
| 21 | 추가: private int passwordAttempts; | |
| 22 | 추가: private ArchiveError failure; | |
| 23 | 추가: | |
| 24 | 추가: internal EngineContext(Guid jobId, ArchiveAction action, JobBudget budget, IOutputTransaction output, | |
| 25 | 추가: PasswordProvider passwords, Action<JobState> reportState, CancellationTokenSource cancellation, int maxPasswordAttempts) | |
| 26 | 추가: { | |
| 27 | 추가: this.jobId = jobId; | |
| 28 | 추가: this.action = action; | |
| 29 | 추가: Budget = budget; | |
| 30 | 추가: this.output = output; | |
| 31 | 추가: this.passwords = passwords; | |
| 32 | 추가: this.reportState = reportState; | |
| 33 | 추가: this.cancellation = cancellation; | |
| 34 | 추가: this.maxPasswordAttempts = maxPasswordAttempts; | |
| 35 | 추가: } | |
| 36 | 추가: | |
| 37 | 추가: public JobBudget Budget { get; } | |
| 38 | 추가: public CancellationToken CancellationToken => cancellation.Token; | |
| 39 | 추가: internal IReadOnlyList<EntryResult> Results => results.AsReadOnly(); | |
| 40 | 추가: internal bool HasOutput => paths.Count != 0; | |
| 41 | 추가: internal ArchiveError Failure => failure; | |
| 42 | 추가: | |
| 43 | 추가: public async ValueTask ListEntryAsync(ArchiveEntry entry) | |
| 44 | 추가: { | |
| 45 | 추가: await serial.WaitAsync(CancellationToken).ConfigureAwait(false); | |
| 46 | 추가: try | |
| 47 | 추가: { | |
| 48 | 추가: Register(entry); | |
| 49 | 추가: results.Add(new(entry, EntryOutcome.Listed, VerificationState.NotChecked, ArchiveError.None)); | |
| 50 | 추가: ReportRunning(); | |
| 51 | 추가: } | |
| 52 | 추가: catch (ArchiveException error) | |
| 53 | 추가: { | |
| 54 | 추가: failure = error.Code; | |
| 55 | 추가: throw; | |
| 56 | 추가: } | |
| 57 | 추가: finally { serial.Release(); } | |
| 58 | 추가: } | |
| 59 | 추가: | |
| 60 | 추가: // 해제된 바이트를 직접 복사하여 헤더 크기와 무관하게 예산을 적용함. | |
| 61 | 추가: // 검증 콜백은 스트림 끝에서 CRC 또는 인증 결과를 반환해야 함. | |
| 62 | 추가: public async Task WriteEntryAsync(ArchiveEntry entry, Stream decoded, | |
| 63 | 추가: Func<CancellationToken, ValueTask<VerificationState>> verify) | |
| 64 | 추가: { | |
| 65 | 추가: ArgumentNullException.ThrowIfNull(decoded); | |
| 66 | 추가: ArgumentNullException.ThrowIfNull(verify); | |
| 67 | 추가: await serial.WaitAsync(CancellationToken).ConfigureAwait(false); | |
| 68 | 추가: try | |
| 69 | 추가: { | |
| 70 | 추가: if (action is not (ArchiveAction.Extract or ArchiveAction.Create or ArchiveAction.Recover)) | |
| 71 | 추가: { | |
| 72 | 추가: throw new ArchiveException(ArchiveError.UnsupportedOperation); | |
| 73 | 추가: } | |
| 74 | 추가: | |
| 75 | 추가: Register(entry); | |
| 76 | 추가: if (entry.Kind != EntryKind.File) | |
| 77 | 추가: { | |
| 78 | 추가: throw new ArchiveException(ArchiveError.UnsupportedEntry); | |
| 79 | 추가: } | |
| 80 | 추가: | |
| 81 | 추가: var segments = OutputPathPolicy.Validate(entry.Name, OutputPathPolicy.CurrentPolicy); | |
| 82 | 추가: var key = string.Join('/', segments); | |
| 83 | 추가: if (paths.Any(existing => existing.Equals(key, OutputPathPolicy.Comparison(OutputPathPolicy.CurrentPolicy)) || | |
| 84 | 추가: existing.StartsWith(key + "/", OutputPathPolicy.Comparison(OutputPathPolicy.CurrentPolicy)) || | |
| 85 | 추가: key.StartsWith(existing + "/", OutputPathPolicy.Comparison(OutputPathPolicy.CurrentPolicy)))) | |
| 86 | 추가: { | |
| 87 | 추가: throw new ArchiveException(ArchiveError.OutputConflict); | |
| 88 | 추가: } | |
| 89 | 추가: | |
| 90 | 추가: paths.Add(key); | |
| 91 | 추가: await using (var destination = await output.CreateFileAsync(segments, CancellationToken).ConfigureAwait(false)) | |
| 92 | 추가: { | |
| 93 | 추가: var buffer = new byte[65536]; | |
| 94 | 추가: try | |
| 95 | 추가: { | |
| 96 | 추가: while (true) | |
| 97 | 추가: { | |
| 98 | 추가: Budget.Check(CancellationToken); | |
| 99 | 추가: var count = await decoded.ReadAsync(buffer.AsMemory(), CancellationToken).ConfigureAwait(false); | |
| 100 | 추가: if (count == 0) { break; } | |
| 101 | 추가: Budget.ChargeProcessed(count, CancellationToken); | |
| 102 | 추가: Budget.ReserveOutput(count, CancellationToken); | |
| 103 | 추가: await destination.WriteAsync(buffer.AsMemory(0, count), CancellationToken).ConfigureAwait(false); | |
| 104 | 추가: ReportRunning(); | |
| 105 | 추가: } | |
| 106 | 추가: await destination.FlushAsync(CancellationToken).ConfigureAwait(false); | |
| 107 | 추가: } | |
| 108 | 추가: finally { System.Security.Cryptography.CryptographicOperations.ZeroMemory(buffer); } | |
| 109 | 추가: } | |
| 110 | 추가: | |
| 111 | 추가: var verification = await verify(CancellationToken).ConfigureAwait(false); | |
| 112 | 추가: Budget.Check(CancellationToken); | |
| 113 | 추가: if (verification == VerificationState.Failed) | |
| 114 | 추가: { | |
| 115 | 추가: results.Add(new(entry, EntryOutcome.Failed, verification, ArchiveError.IntegrityFailure)); | |
| 116 | 추가: throw new ArchiveException(ArchiveError.IntegrityFailure); | |
| 117 | 추가: } | |
| 118 | 추가: | |
| 119 | 추가: results.Add(new(entry, EntryOutcome.Staged, verification, ArchiveError.None)); | |
| 120 | 추가: } | |
| 121 | 추가: catch (ArchiveException error) | |
| 122 | 추가: { | |
| 123 | 추가: failure = error.Code; | |
| 124 | 추가: if (entryIds.Contains(entry.Id) && results.All(result => result.EntryId != entry.Id)) | |
| 125 | 추가: { | |
| 126 | 추가: results.Add(new(entry, EntryOutcome.Failed, VerificationState.NotChecked, error.Code)); | |
| 127 | 추가: } | |
| 128 | 추가: throw; | |
| 129 | 추가: } | |
| 130 | 추가: catch (Exception error) | |
| 131 | 추가: { | |
| 132 | 추가: failure = error is OperationCanceledException && CancellationToken.IsCancellationRequested | |
| 133 | 추가: ? ArchiveError.Cancelled : ArchiveError.EngineFailure; | |
| 134 | 추가: if (entry is not null && entryIds.Contains(entry.Id) && results.All(result => result.EntryId != entry.Id)) | |
| 135 | 추가: { | |
| 136 | 추가: results.Add(new(entry, EntryOutcome.Failed, VerificationState.NotChecked, failure)); | |
| 137 | 추가: } | |
| 138 | 추가: throw; | |
| 139 | 추가: } | |
| 140 | 추가: finally { serial.Release(); } | |
| 141 | 추가: } | |
| 142 | 추가: | |
| 143 | 추가: // 제공자 호출을 직렬화함. 소비자는 잠금 밖에서 암호를 사용하고 재요청할 수 있음. | |
| 144 | 추가: public async ValueTask<T> UsePasswordAsync<T>(Func<SecureString, CancellationToken, ValueTask<T>> consume) | |
| 145 | 추가: { | |
| 146 | 추가: ArgumentNullException.ThrowIfNull(consume); | |
| 147 | 추가: await passwordSerial.WaitAsync(CancellationToken).ConfigureAwait(false); | |
| 148 | 추가: SecureString? password = null; | |
| 149 | 추가: var waiting = false; | |
| 150 | 추가: try | |
| 151 | 추가: { | |
| 152 | 추가: try | |
| 153 | 추가: { | |
| 154 | 추가: Budget.Check(CancellationToken); | |
| 155 | 추가: if (passwordAttempts >= maxPasswordAttempts) | |
| 156 | 추가: { | |
| 157 | 추가: failure = ArchiveError.PasswordAttemptsExceeded; | |
| 158 | 추가: throw new ArchiveException(ArchiveError.PasswordAttemptsExceeded); | |
| 159 | 추가: } | |
| 160 | 추가: | |
| 161 | 추가: var attempt = ++passwordAttempts; | |
| 162 | 추가: waiting = true; | |
| 163 | 추가: SetPasswordWaiting(true); | |
| 164 | 추가: password = await passwords(new(jobId, Guid.NewGuid(), attempt), CancellationToken).ConfigureAwait(false); | |
| 165 | 추가: if (password is null) | |
| 166 | 추가: { | |
| 167 | 추가: cancellation.Cancel(); | |
| 168 | 추가: throw new OperationCanceledException(CancellationToken); | |
| 169 | 추가: } | |
| 170 | 추가: Budget.Check(CancellationToken); | |
| 171 | 추가: } | |
| 172 | 추가: finally | |
| 173 | 추가: { | |
| 174 | 추가: if (waiting) { SetPasswordWaiting(false); } | |
| 175 | 추가: passwordSerial.Release(); | |
| 176 | 추가: } | |
| 177 | 추가: | |
| 178 | 추가: Budget.Check(CancellationToken); | |
| 179 | 추가: return await consume(password, CancellationToken).ConfigureAwait(false); | |
| 180 | 추가: } | |
| 181 | 추가: finally { password?.Dispose(); } | |
| 182 | 추가: } | |
| 183 | 추가: | |
| 184 | 추가: private void SetPasswordWaiting(bool waiting) | |
| 185 | 추가: { | |
| 186 | 추가: lock (passwordStateGate) | |
| 187 | 추가: { | |
| 188 | 추가: waitingForPassword = waiting; | |
| 189 | 추가: reportState(CancellationToken.IsCancellationRequested ? JobState.Cancelling : | |
| 190 | 추가: waiting ? JobState.WaitingForPassword : JobState.Running); | |
| 191 | 추가: } | |
| 192 | 추가: } | |
| 193 | 추가: | |
| 194 | 추가: private void ReportRunning() | |
| 195 | 추가: { | |
| 196 | 추가: lock (passwordStateGate) | |
| 197 | 추가: { | |
| 198 | 추가: // 다른 항목의 진행 보고가 활성 암호 요청 상태를 덮지 않도록 함. | |
| 199 | 추가: if (!waitingForPassword) | |
| 200 | 추가: { | |
| 201 | 추가: reportState(CancellationToken.IsCancellationRequested ? JobState.Cancelling : JobState.Running); | |
| 202 | 추가: } | |
| 203 | 추가: } | |
| 204 | 추가: } | |
| 205 | 추가: | |
| 206 | 추가: private void Register(ArchiveEntry entry) | |
| 207 | 추가: { | |
| 208 | 추가: ArgumentNullException.ThrowIfNull(entry); | |
| 209 | 추가: Budget.AddEntry(CancellationToken); | |
| 210 | 추가: if (string.IsNullOrWhiteSpace(entry.Id) || !entryIds.Add(entry.Id) || entry.DeclaredSize < 0) | |
| 211 | 추가: { | |
| 212 | 추가: throw new ArchiveException(ArchiveError.UnsupportedEntry); | |
| 213 | 추가: } | |
| 214 | 추가: } | |
| 215 | 추가: } |
| @@ -0,0 +1,75 @@ | ||
| 1 | 추가: namespace Zipelo.Core; | |
| 2 | 추가: | |
| 3 | 추가: // 제한값은 호스트가 정함. 아래 값은 제품 기본값이나 성능 약속이 아님. | |
| 4 | 추가: public sealed record JobLimits(long MaxEntries, long MaxProcessedBytes, long MaxOutputBytes, TimeSpan MaxDuration, int MaxPasswordAttempts); | |
| 5 | 추가: public sealed record BudgetUsage(long Entries, long ProcessedBytes, long OutputBytes); | |
| 6 | 추가: | |
| 7 | 추가: public sealed class JobBudget | |
| 8 | 추가: { | |
| 9 | 추가: private readonly object gate = new(); | |
| 10 | 추가: private readonly JobLimits limits; | |
| 11 | 추가: private readonly TimeProvider time; | |
| 12 | 추가: private readonly long started; | |
| 13 | 추가: private long entries; | |
| 14 | 추가: private long processedBytes; | |
| 15 | 추가: private long outputBytes; | |
| 16 | 추가: private int exhausted; | |
| 17 | 추가: | |
| 18 | 추가: public JobBudget(JobLimits limits, TimeProvider? timeProvider = null) | |
| 19 | 추가: { | |
| 20 | 추가: ArgumentNullException.ThrowIfNull(limits); | |
| 21 | 추가: if (limits.MaxEntries <= 0 || limits.MaxProcessedBytes <= 0 || limits.MaxOutputBytes <= 0 || | |
| 22 | 추가: limits.MaxDuration <= TimeSpan.Zero || limits.MaxPasswordAttempts <= 0) | |
| 23 | 추가: { | |
| 24 | 추가: throw new ArgumentOutOfRangeException(nameof(limits)); | |
| 25 | 추가: } | |
| 26 | 추가: | |
| 27 | 추가: this.limits = limits; | |
| 28 | 추가: time = timeProvider ?? TimeProvider.System; | |
| 29 | 추가: started = time.GetTimestamp(); | |
| 30 | 추가: } | |
| 31 | 추가: | |
| 32 | 추가: public BudgetUsage Usage | |
| 33 | 추가: { | |
| 34 | 추가: get { lock (gate) { return new(entries, processedBytes, outputBytes); } } | |
| 35 | 추가: } | |
| 36 | 추가: | |
| 37 | 추가: public void Check(CancellationToken cancellationToken) | |
| 38 | 추가: { | |
| 39 | 추가: cancellationToken.ThrowIfCancellationRequested(); | |
| 40 | 추가: if (Volatile.Read(ref exhausted) != 0 || time.GetElapsedTime(started) >= limits.MaxDuration) | |
| 41 | 추가: { | |
| 42 | 추가: Interlocked.Exchange(ref exhausted, 1); | |
| 43 | 추가: throw new ArchiveException(ArchiveError.BudgetExceeded); | |
| 44 | 추가: } | |
| 45 | 추가: } | |
| 46 | 추가: | |
| 47 | 추가: public void AddEntry(CancellationToken cancellationToken) => Charge(1, 0, 0, cancellationToken); | |
| 48 | 추가: | |
| 49 | 추가: // 중간 TAR, 솔리드 선행 처리, 복구 재시도도 같은 인스턴스에 누적함. | |
| 50 | 추가: public void ChargeProcessed(long bytes, CancellationToken cancellationToken) => Charge(0, bytes, 0, cancellationToken); | |
| 51 | 추가: public void ReserveOutput(long bytes, CancellationToken cancellationToken) => Charge(0, 0, bytes, cancellationToken); | |
| 52 | 추가: | |
| 53 | 추가: private void Charge(long entryCount, long processed, long output, CancellationToken cancellationToken) | |
| 54 | 추가: { | |
| 55 | 추가: if (entryCount < 0 || processed < 0 || output < 0) | |
| 56 | 추가: { | |
| 57 | 추가: throw new ArgumentOutOfRangeException(nameof(processed)); | |
| 58 | 추가: } | |
| 59 | 추가: | |
| 60 | 추가: lock (gate) | |
| 61 | 추가: { | |
| 62 | 추가: Check(cancellationToken); | |
| 63 | 추가: if (entryCount > limits.MaxEntries - entries || processed > limits.MaxProcessedBytes - processedBytes || | |
| 64 | 추가: output > limits.MaxOutputBytes - outputBytes) | |
| 65 | 추가: { | |
| 66 | 추가: Interlocked.Exchange(ref exhausted, 1); | |
| 67 | 추가: throw new ArchiveException(ArchiveError.BudgetExceeded); | |
| 68 | 추가: } | |
| 69 | 추가: | |
| 70 | 추가: entries += entryCount; | |
| 71 | 추가: processedBytes += processed; | |
| 72 | 추가: outputBytes += output; | |
| 73 | 추가: } | |
| 74 | 추가: } | |
| 75 | 추가: } |
| @@ -0,0 +1,82 @@ | ||
| 1 | 추가: using System.Text; | |
| 2 | 추가: | |
| 3 | 추가: namespace Zipelo.Core; | |
| 4 | 추가: | |
| 5 | 추가: public enum FileNamePolicy { Windows, Linux } | |
| 6 | 추가: | |
| 7 | 추가: public static class OutputPathPolicy | |
| 8 | 추가: { | |
| 9 | 추가: public static FileNamePolicy CurrentPolicy => OperatingSystem.IsWindows() ? FileNamePolicy.Windows : | |
| 10 | 추가: OperatingSystem.IsLinux() ? FileNamePolicy.Linux : throw new PlatformNotSupportedException(); | |
| 11 | 추가: | |
| 12 | 추가: public static StringComparison Comparison(FileNamePolicy policy) => policy switch | |
| 13 | 추가: { | |
| 14 | 추가: FileNamePolicy.Windows => StringComparison.OrdinalIgnoreCase, | |
| 15 | 추가: FileNamePolicy.Linux => StringComparison.Ordinal, | |
| 16 | 추가: _ => throw new ArgumentOutOfRangeException(nameof(policy)) | |
| 17 | 추가: }; | |
| 18 | 추가: | |
| 19 | 추가: public static StringComparer Comparer(FileNamePolicy policy) => policy switch | |
| 20 | 추가: { | |
| 21 | 추가: FileNamePolicy.Windows => StringComparer.OrdinalIgnoreCase, | |
| 22 | 추가: FileNamePolicy.Linux => StringComparer.Ordinal, | |
| 23 | 추가: _ => throw new ArgumentOutOfRangeException(nameof(policy)) | |
| 24 | 추가: }; | |
| 25 | 추가: | |
| 26 | 추가: public static IReadOnlyList<string> Validate(string path, FileNamePolicy policy) | |
| 27 | 추가: { | |
| 28 | 추가: if (policy == FileNamePolicy.Windows) { return Validate(path); } | |
| 29 | 추가: if (policy != FileNamePolicy.Linux) { throw new ArgumentOutOfRangeException(nameof(policy)); } | |
| 30 | 추가: if (string.IsNullOrEmpty(path) || path.Length > 4096 || path.Contains('\0')) | |
| 31 | 추가: { | |
| 32 | 추가: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 33 | 추가: } | |
| 34 | 추가: var segments = path.Split('/'); | |
| 35 | 추가: var encoding = new UTF8Encoding(false, true); | |
| 36 | 추가: foreach (var segment in segments) | |
| 37 | 추가: { | |
| 38 | 추가: if (segment.Length == 0 || segment is "." or "..") | |
| 39 | 추가: { | |
| 40 | 추가: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 41 | 추가: } | |
| 42 | 추가: try | |
| 43 | 추가: { | |
| 44 | 추가: if (encoding.GetByteCount(segment) > 255) { throw new ArchiveException(ArchiveError.UnsafePath); } | |
| 45 | 추가: } | |
| 46 | 추가: catch (EncoderFallbackException) { throw new ArchiveException(ArchiveError.UnsafePath); } | |
| 47 | 추가: } | |
| 48 | 추가: return Array.AsReadOnly(segments); | |
| 49 | 추가: } | |
| 50 | 추가: | |
| 51 | 추가: // 기존 단일 인수 API는 Windows 사전 정책을 유지함. | |
| 52 | 추가: // 문자열 검사는 사전 정책임. 파일시스템의 링크나 경쟁 상태를 검사한 결과가 아님. | |
| 53 | 추가: public static IReadOnlyList<string> Validate(string path) | |
| 54 | 추가: { | |
| 55 | 추가: if (string.IsNullOrWhiteSpace(path) || path.Length > 4096) | |
| 56 | 추가: { | |
| 57 | 추가: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 58 | 추가: } | |
| 59 | 추가: | |
| 60 | 추가: var segments = path.Replace('\\', '/').Split('/'); | |
| 61 | 추가: foreach (var segment in segments) | |
| 62 | 추가: { | |
| 63 | 추가: if (segment.Length is 0 or > 255 || segment is "." or ".." || | |
| 64 | 추가: segment.EndsWith(' ') || segment.EndsWith('.') || | |
| 65 | 추가: !segment.IsNormalized(NormalizationForm.FormC) || | |
| 66 | 추가: segment.Any(c => char.IsControl(c) || "<>:\"|?*".Contains(c))) | |
| 67 | 추가: { | |
| 68 | 추가: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 69 | 추가: } | |
| 70 | 추가: | |
| 71 | 추가: var stem = segment.Split('.')[0].TrimEnd(' ').ToUpperInvariant(); | |
| 72 | 추가: if (stem is "CON" or "PRN" or "AUX" or "NUL" or "CONIN$" or "CONOUT$" || | |
| 73 | 추가: (stem.Length == 4 && (stem.StartsWith("COM") || stem.StartsWith("LPT")) && | |
| 74 | 추가: "123456789¹²³".Contains(stem[3]))) | |
| 75 | 추가: { | |
| 76 | 추가: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 77 | 추가: } | |
| 78 | 추가: } | |
| 79 | 추가: | |
| 80 | 추가: return Array.AsReadOnly(segments); | |
| 81 | 추가: } | |
| 82 | 추가: } |
| @@ -0,0 +1,8 @@ | ||
| 1 | 추가: <Project Sdk="Microsoft.NET.Sdk"> | |
| 2 | 추가: <PropertyGroup> | |
| 3 | 추가: <TargetFramework>net10.0</TargetFramework> | |
| 4 | 추가: <Nullable>enable</Nullable> | |
| 5 | 추가: <ImplicitUsings>enable</ImplicitUsings> | |
| 6 | 추가: <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | |
| 7 | 추가: </PropertyGroup> | |
| 8 | 추가: </Project> |