fix(security): enforce tenant-scoped admin deletion - #341
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
Changes테넌트 범위 작업 삭제
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant AdminController
participant TenantAccessService
participant DocumentConversionService
Client->>AdminController: DELETE 요청 및 테넌트 헤더
AdminController->>TenantAccessService: 테넌트와 JOB_DELETE 권한 검증
TenantAccessService-->>AdminController: TenantContext
AdminController->>DocumentConversionService: TenantContext와 jobId로 삭제
DocumentConversionService-->>AdminController: 삭제 결과
AdminController-->>Client: 204 또는 404 응답
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/test/java/com/clearfolio/viewer/controller/AdminControllerDeleteTenantBoundaryTest.java`:
- Line 44: 인증 거부 경로에서 특정 메서드뿐 아니라 conversionService의 모든 상호작용이 없음을 검증하세요.
AdminControllerDeleteTenantBoundaryTest.java의 44-44 및 57-57 위치에서 기존
verify(conversionService, never()).deleteJob(jobId) 검증을
verifyNoInteractions(conversionService)로 교체하세요.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b07a0b1a-75ec-497c-81de-af7d7fa6bd62
📒 Files selected for processing (3)
src/main/java/com/clearfolio/viewer/controller/AdminController.javasrc/test/java/com/clearfolio/viewer/controller/AdminControllerDeleteTenantBoundaryTest.javasrc/test/java/com/clearfolio/viewer/controller/AdminControllerTest.java
|
Superseded by current-main replacement #436. The replacement preserves this PR's three-file tenant-scoped administrative deletion semantic delta on protected |
Pull request was closed
Objective
Reconcile one high-risk semantic slice from stale descendant #268 directly on current protected main: administrative delete must authenticate tenant authority, require delete permission, use the existing tenant-scoped service mutation, and conceal missing/foreign jobs as the same 404 outcome.
Fresh exact state — 2026-08-10
5da7462b0b98cabc429ea922888ebb8b5a0ccf1c;main:55d7ae8647208e301f282350f076eeddaba61d11;31399587866: success;31399587848: success;31399587735: success;31399587671: success;Test-first evidence
RED
Test-only head
110bf80220b2783e73b496b4edfd54d119c17e06added the focused WebFlux regression before changing production. Exact-head CI31399317127failed in Maven test compilation atAdminControllerDeleteTenantBoundaryTest: production exposed onlyAdminController(DocumentConversionService)and therefore had no tenant-authorization dependency. The exact checkout identity in the failed job was the RED SHA. Security Scan and SAST were already successful on that test-only head.GREEN
Current
AdminControllerinjectsTenantAccessService, requiresjob:deletefrom request tenant claims before any deletion, delegates only to the existingdeleteJob(jobId, TenantContext)service boundary, and maps a missing or cross-tenant result to the same controlled 404. The legacy globaldeleteJob(jobId)path is no longer reachable from this administrative delete endpoint.Focused tests prove:
The authoritative exact-head
mvn -B --no-transfer-progress verifyCI lifecycle, synthetic-merge verification, security scan, Semgrep and fuzz are all GREEN.Scope boundary
This deliberately does not copy #268's stale ancestry or claim the whole descendant is reconciled. Tenant-scoped admin list/retry, durable deletion receipts/recovery, immutable identity/generation fencing and privacy-safe audit remain separate semantics to preserve or reimplement deliberately. Issue #263's end-to-end accessible deletion/download/recovery journey also remains open.
Merge gate
Move to Ready for ordinary independent review. Keep this exact head unchanged. Merge or auto-merge may complete only after live repository protection still sees all required gates passing, zero valid unresolved findings, and any required qualifying independent non-author approval. Automated evidence is not approval.
Summary by CodeRabbit
401, 권한이 없으면403을 반환합니다.404로 처리합니다.204를 반환합니다.