๐ก๏ธ Sentinel: [HIGH] ๊ด๋ฆฌ์ ์๋ํฌ์ธํธ ๊ถํ ์ฐํ ์ทจ์ฝ์ ์์ - #205
๐ก๏ธ Sentinel: [HIGH] ๊ด๋ฆฌ์ ์๋ํฌ์ธํธ ๊ถํ ์ฐํ ์ทจ์ฝ์ ์์ #205seonghobae wants to merge 1 commit into
Conversation
์ด ์ปค๋ฐ์ `AdminController`์ ๋ฏผ๊ฐํ ์์ (`getAllJobs`, `deleteJob`, `retryDeadLettered`)์ ๋๋ฝ๋ ์ ๊ทผ ์ ์ด๋ฅผ ์ถ๊ฐํ์ฌ ๋ณด์ ์ทจ์ฝ์ ์ ํด๊ฒฐํฉ๋๋ค. ๋ณ๊ฒฝ ์ฌํญ: - `TenantPermissions`์ `ADMIN_READ` ๋ฐ `ADMIN_WRITE` ๊ถํ ์์๋ฅผ ์ถ๊ฐํ์ต๋๋ค. - `AdminController`์ `TenantAccessService`๋ฅผ ์ฃผ์ ํ๊ณ , ๋ชจ๋ ์๋ํฌ์ธํธ ๋ฉ์๋์์ ์ ์ ํ ๊ถํ์ ํ์ธํ๋๋ก ๋ณ๊ฒฝํ์ต๋๋ค. - `AdminControllerTest`๋ฅผ ์ ๋ฐ์ดํธํ์ฌ `TenantAccessService` ๋ชฉ(Mock) ๊ฐ์ฒด๋ฅผ ์ฌ์ฉํ๋๋ก ์์ ํ์ต๋๋ค. - ๋ณด์ ์๋ํฌ์ธํธ์ ๋ํ ์ธ์ฆ/์ธ๊ฐ ๋๋ฝ ์ทจ์ฝ์ ์ ์ค๋ช ํ๋ ํ์ต ๋ด์ฉ์ Sentinel ์ ๋์ ์ถ๊ฐํ์ต๋๋ค.
|
๐ 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
This PR fixes a high-severity authorization bypass by enforcing tenant-authn/authz checks on AdminController endpoints, ensuring only callers with explicit admin permissions can list, delete, or retry conversion jobs.
Changes:
- Added
admin:read/admin:writepermissions toTenantPermissions. - Injected
TenantAccessServiceintoAdminControllerand required the appropriate permission per admin endpoint. - Updated tests and documented the security learning 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 | Enforces tenant permission checks on admin endpoints via TenantAccessService.require(...). |
| src/main/java/com/clearfolio/viewer/auth/TenantPermissions.java | Adds new admin permission constants (ADMIN_READ, ADMIN_WRITE). |
| src/test/java/com/clearfolio/viewer/controller/AdminControllerTest.java | Adjusts test wiring for the new TenantAccessService dependency (and should better enforce permission expectations). |
| .jules/sentinel.md | Records the vulnerability/learning/prevention note for the admin authz fix. |
Comments suppressed due to low confidence (1)
src/main/java/com/clearfolio/viewer/controller/AdminController.java:39
- The field JavaDoc block indentation is inconsistent (extra leading spaces) and may trip checkstyle/formatting rules. Align it with the rest of the codebaseโs indentation (e.g., ConversionControllerโs JavaDoc at src/main/java/com/clearfolio/viewer/controller/ConversionController.java:53-60).
/**
* Tenant access service.
*/
private final TenantAccessService tenantAccessService;
๐ก Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // By default, allow everything | ||
| when(tenantAccessService.require(any(HttpHeaders.class), any(String.class))).thenReturn(tenantContext); |
| /** | ||
| * Document conversion service. | ||
| */ | ||
| private final DocumentConversionService conversionService; |
| **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-25 - ๊ด๋ฆฌ์ ์๋ํฌ์ธํธ ์ธ์ฆ/์ธ๊ฐ ๋๋ฝ ํด๊ฒฐ |
Superseded by #172. The same admin authorization gap is addressed there with distinct
admin:readandadmin:writepermissions and successful exact-head checks.