๐ก๏ธ Sentinel: [CRITICAL] ๊ด๋ฆฌ์ ์๋ํฌ์ธํธ์ ์ธ์ฆ ๋ฐ ๊ถํ ๋ถ์ฌ ์ถ๊ฐ - #196
๐ก๏ธ Sentinel: [CRITICAL] ๊ด๋ฆฌ์ ์๋ํฌ์ธํธ์ ์ธ์ฆ ๋ฐ ๊ถํ ๋ถ์ฌ ์ถ๊ฐ#196seonghobae wants to merge 1 commit into
Conversation
AdminController์ ๋ชจ๋ ์๋ํฌ์ธํธ๊ฐ ์ธ์ฆ ์์ด ๋ ธ์ถ๋์ด ๋ชจ๋ ์ฌ์ฉ์๊ฐ ์์คํ ๋ด์ ์ ํ ์์ ์ ์ฝ๊ณ , ์ญ์ ํ๊ณ , ์ฌ์๋ํ ์ ์๋ ๋ณด์ ์ทจ์ฝ์ ์ ๋ฐ๊ฒฌํ์ฌ ์์ ํ์ต๋๋ค. - `TenantPermissions`์ `admin:read` ๋ฐ `admin:write` ์์ ์ถ๊ฐ - `AdminController`์ ์์ฑ์์ `TenantAccessService` ์ฃผ์ ๋ฐ ํ๋ ์ด๋ฆ ์ถฉ๋ ๋ฐฉ์ง (Checkstyle ๊ท์น ์ค์) - ๊ฐ API ์๋ํฌ์ธํธ ์คํ ์ `tenantAccessSvc.require()` ํธ์ถ์ ํตํด ๊ถํ ๊ฒ์ฆ ์ ์ฉ - `AdminControllerTest`๋ฅผ ์ ๋ฐ์ดํธํ์ฌ ์๋ก ์ถ๊ฐ๋ `TenantAccessService` ์์กด์ฑ์ ๋ชจ์(mock) ๊ฐ์ฒด๋ก ์ฃผ์
|
๐ 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
Adds tenant-claim authentication and explicit permission checks to AdminController admin endpoints to prevent unauthorized users from listing, retrying, or deleting conversion jobs.
Changes:
- Guard
/api/v1/admin/convert/jobs(read) and admin mutation endpoints (write) viaTenantAccessService.require(...). - Introduce
admin:read/admin:writepermission constants inTenantPermissions. - Update controller construction in
AdminControllerTestand record the incident in.jules/sentinel.md.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/main/java/com/clearfolio/viewer/controller/AdminController.java | Adds header-based auth and permission checks to admin job endpoints. |
| src/test/java/com/clearfolio/viewer/controller/AdminControllerTest.java | Updates test wiring for the new AdminController constructor signature. |
| src/main/java/com/clearfolio/viewer/auth/TenantPermissions.java | Adds admin permission constants (admin:read, admin:write). |
| .jules/sentinel.md | Documents the admin-endpoint authorization miss and prevention guidance. |
๐ก Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| tenantAccessService.require(headers, TenantPermissions.ADMIN_WRITE); | ||
| RetryDeadLetterResult result = conversionService.retryDeadLettered( | ||
| jobId, "admin"); |
| @BeforeEach | ||
| void setUp() { | ||
| conversionService = mock(DocumentConversionService.class); | ||
| controller = new AdminController(conversionService); | ||
| tenantAccessService = mock(TenantAccessService.class); | ||
| controller = new AdminController(conversionService, tenantAccessService); | ||
| webTestClient = WebTestClient.bindToController(controller) | ||
| .controllerAdvice(new ApiExceptionHandler()) | ||
| .build(); |
| **Prevention:** Always enforce a strict, configurable size limit (e.g., `ConversionProperties.maxUploadSizeBytes`) within the `while` loop that reads from untrusted input streams. Track `totalRead` and throw an exception immediately if the limit is exceeded. | ||
| ## 2026-07-23 - ๊ด๋ฆฌ์ ์๋ํฌ์ธํธ ์ธ์ฆ ๋ฐ ๊ถํ ๋ถ์ฌ ๋๋ฝ ์์ |
Superseded by #172, the verified canonical implementation of per-endpoint
admin:readandadmin:writeauthorization. This duplicate is closed to keep one review and merge path.