Skip to content

🛡️ Sentinel: [CRITICAL] 관리자 엔드포인트에 인증 추가 - #193

Closed
seonghobae wants to merge 1 commit into
mainfrom
fix-admin-endpoint-auth-18304710320699021932
Closed

🛡️ Sentinel: [CRITICAL] 관리자 엔드포인트에 인증 추가#193
seonghobae wants to merge 1 commit into
mainfrom
fix-admin-endpoint-auth-18304710320699021932

Conversation

@seonghobae

@seonghobae seonghobae commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Superseded by #172, which already implements and verifies the same ADMIN_READ/ADMIN_WRITE authorization controls. Closing this duplicate prevents parallel security patches from diverging.

관리자 엔드포인트(`AdminController`)에 적절한 인증 및 권한 확인이 부족하여, 인증되지 않은 사용자가 모든 변환 작업을 읽거나 삭제하고 재시도할 수 있는 보안 취약점이 있었습니다.

TenantAccessService를 주입하고 모든 엔드포인트(getAllJobs, deleteJob, retryDeadLettered)에서 `tenantAccessService.require(...)`를 호출하여 적절한 권한(`ADMIN_READ`, `ADMIN_WRITE`)이 있는지 확인하도록 수정했습니다. `TenantPermissions` 클래스에 관련 상수도 추가했습니다. 관련된 테스트도 모의 컨텍스트를 제공하도록 업데이트했습니다.
Copilot AI review requested due to automatic review settings July 22, 2026 21:29
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens Clearfolio’s admin conversion endpoints by enforcing tenant-based authentication and explicit admin permissions, aligning /api/v1/admin/** operations with the existing TenantAccessService security model used elsewhere in the viewer backend.

Changes:

  • Inject TenantAccessService into AdminController and require ADMIN_READ / ADMIN_WRITE permissions on admin endpoints.
  • Introduce TenantPermissions.ADMIN_READ and TenantPermissions.ADMIN_WRITE.
  • Update AdminControllerTest to accommodate the new controller dependency and request header expectations; add a Sentinel log entry for the incident.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
src/main/java/com/clearfolio/viewer/controller/AdminController.java Adds tenant/permission enforcement to admin endpoints via TenantAccessService.require(...).
src/test/java/com/clearfolio/viewer/controller/AdminControllerTest.java Updates tests for new controller constructor + request headers; currently mocks auth.
src/main/java/com/clearfolio/viewer/auth/TenantPermissions.java Adds ADMIN_READ / ADMIN_WRITE permission constants.
.jules/sentinel.md Records the security learning/prevention note for the fixed admin-auth issue (currently duplicated).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .jules/sentinel.md
Comment on lines +5 to +8
## 2026-07-22 - Missing Authentication on Admin Endpoints
**Vulnerability:** The `AdminController` endpoints (`/api/v1/admin/convert/jobs`, `/api/v1/admin/convert/jobs/{jobId}`, `/api/v1/admin/convert/jobs/{jobId}/retry`) lacked authentication and authorization checks, allowing unauthenticated users to read, delete, and retry all conversion jobs.
**Learning:** Spring controllers must explicitly enforce security policies, even if they are placed under an `/admin` path. The existence of an admin path does not automatically protect it.
**Prevention:** Always inject `TenantAccessService` and invoke `tenantAccessService.require(...)` for every controller method to ensure permissions are checked before processing the request. Add corresponding unit tests that explicitly check for these authorization controls.
webTestClient = WebTestClient.bindToController(controller)
.controllerAdvice(new ApiExceptionHandler())
.build();
when(tenantAccessService.require(any(), any())).thenReturn(new TenantContext("t1", "s1", Set.of("admin:read", "admin:write")));
Comment on lines +33 to +37
controller = new AdminController(conversionService, tenantAccessService);
webTestClient = WebTestClient.bindToController(controller)
.controllerAdvice(new ApiExceptionHandler())
.build();
when(tenantAccessService.require(any(), any())).thenReturn(new TenantContext("t1", "s1", Set.of("admin:read", "admin:write")));
Comment on lines 46 to 50
@@ -43,7 +50,8 @@ public AdminController(DocumentConversionService conversionService) {
* @return list of conversion jobs
Comment thread src/main/java/com/clearfolio/viewer/controller/AdminController.java
Comment thread src/main/java/com/clearfolio/viewer/controller/AdminController.java
@seonghobae seonghobae closed this Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants