fix: #92 clean 삭제 안전성 및 오탐 방지 강화 - #97
Conversation
|
Review pending — current head Scope: complete PR #97 diff for issue #92, including clean/apply filesystem safety, schema-v3 Validation: local Blocking findings: review not yet concluded; current-head review and terminal CI remain required. Human action boundary: no merge, release, version bump, tag, or publish performed. Manual merge remains the owner gate after a blocker-free current-head verdict. |
67f960d to
1f23b5e
Compare
|
PENDING — current head
|
08babf7 to
49c9da0
Compare
SHA-256 분석 스냅샷·파일/부모 identity를 결속하고 quarantine 재검증과 fail-closed apply를 적용합니다. schema v3 계약·CLI/native smoke·framework false-positive 회귀를 함께 갱신합니다. Co-authored-by: Hermes
49c9da0 to
6df3d87
Compare
Windows에서는 persistent file identity evidence가 null이고 clean apply가 비활성화되는 계약을 패키지 smoke에서 검증합니다.\n\nCo-authored-by: Hermes
8ce14c1 to
a6d2465
Compare
Independent security/spec review verdict — current HEADVerdict: PASS for the reviewed issue #92 scope. Reviewed current PR head Blocking findings remediated
Evidence
Boundaries / nonblocking note
|
renameat/linkat/unlinkat와 openat 기반 검증으로 parent 및 quarantine pathname 교체가 외부 파일 삭제로 이어지지 않게 합니다. schema v3 README와 legacy fail-closed 정책도 동기화합니다. Co-authored-by: Hermes
패키징된 Windows CLI로 실제 clean --apply를 실행하고 모든 deletion candidate의 내용이 보존되는지 확인합니다. Co-authored-by: Hermes
Windows future-schema CLI smoke가 null identity를 허용하고 apply 보존을 검증하도록 하며 active roadmap을 schema v3로 맞춥니다. Co-authored-by: Hermes
Portable POSIX의 final verify-to-unlink race를 제거하기 위해 검증된 파일을 .kratos/clean-quarantine 아래에 유지하고 원래 코드 경로에서만 제거합니다. CLI, localized README, 계약 문서와 package smoke가 retained quarantine semantics를 검증합니다. Co-authored-by: Hermes
deleted_files 필드는 코드 경로에서 보존 격리된 수를 뜻하는 compatibility count로 유지하고 실제 보존 경로는 quarantined_files에 노출합니다. Co-authored-by: Hermes
복원·건너뜀·실패 중 남은 quarantine object도 CleanOutcome과 CLI에서 last-known path로 노출하고, 코드 경로에서 이동된 수와 보존 파일 수를 분리합니다. Co-authored-by: Hermes
Candidate file뿐 아니라 invocation directory도 자동 unlink하지 않아 same-credential namespace 교체가 unrelated entry 삭제로 이어질 마지막 pathname race를 제거합니다. Co-authored-by: Hermes
Post-move 검증 실패 시 가변 entry를 코드 경로로 link하지 않고 residue와 실제 코드 경로 제거를 정확히 집계합니다. 기존 CleanOutcome 공개 shape는 유지하고 상세 결과는 별도 API로 제공합니다. Co-authored-by: Hermes
Dry-run 안내와 CLI 계약 테스트를 자동 삭제가 아닌 원래 코드 경로의 보존 격리 의미로 맞춥니다. Co-authored-by: Hermes
What
cleanSafety에 분석 당시 SHA-256, stable file identity, stable parent identity를 기록합니다.clean --apply는 검증된 candidate parent 및<root>/.kratos/clean-quarantine/descriptor 사이에서renameat으로 이동합니다.openat(..., O_NOFOLLOW)로 재검증하며 자동으로 물리unlink하지 않고 owner-only quarantine에 보존합니다.linkatno-clobber이며 quarantine link도 보존합니다.Why
clean은 기본 preview여야 하며, 명시적--apply에서도 분석 후 파일이나 pathname 해석이 달라지면 unrelated/out-of-root pathname을 삭제하면 안 됩니다. Portable POSIX는 opened-file 검증과 exact directory-entry unlink를 원자적으로 결합하지 못하므로, 검증된 bytes를 retained quarantine에 남겨 final verify→unlink race를 제거했습니다.Scope / Risk
.kratos/clean-quarantine/에 보존하므로 수동 정리 전까지 디스크를 사용합니다.unlink하지 않으며, 실패한 pre-move 시 빈 invocation directory가 남을 수 있습니다.CleanOutcome { deleted_files, skipped_files }와 기존 함수 반환형은 source-compatible하게 유지하고, 새CleanApplyOutcome/*_detailedAPI가 확인된 quarantine 경로와 per-file failure를 제공합니다.null로 기록해clean --apply를 fail-closed하며, scan/preview/package는 유지합니다.Validation
현재 head
7a642aafb8eb65ba6059cb082bd559c148bba24e기준:cargo test --workspace— PASSnpm run verify— PASS (9 pass, native 환경-gated 1 skip)cargo clippy --workspace --all-targets— exit 0, 기존 warning만 존재cargo metadata --locked --no-deps --format-version 1— PASScargo check -p kratos-core -p kratos-node --target x86_64-pc-windows-msvc --locked— PASSgit diff --check— PASSclean --apply후 모든 candidate bytes 보존 검증Wiki Context Manifest
kratos clean delete safety quarantine TOCTOUReview boundary
Draft PR입니다. Exact-head security/product ddalggak review와 current-head GitHub checks가 blocker 0일 때만 manual merge를 권고합니다.