feat(documents): gate /incomplete behind WRITE_ALL permission

Only users who can enrich documents should see the queue.
Mirrors the frontend guard in enrich/+page.server.ts and closes the
CWE-285 gap Nora flagged on issue #296.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-20 21:05:35 +02:00
parent bc3a268f66
commit 2c5cfcedbc
2 changed files with 8 additions and 0 deletions

View File

@@ -199,6 +199,7 @@ public class DocumentController {
}
@GetMapping("/incomplete")
@RequirePermission(Permission.WRITE_ALL)
public List<IncompleteDocumentDTO> getIncomplete(
@Parameter(description = "Maximum number of results (server caps at 200)")
@RequestParam(defaultValue = "50") int size) {

View File

@@ -414,6 +414,13 @@ class DocumentControllerTest {
.andExpect(jsonPath("$[0].uploadedAt").exists());
}
@Test
@WithMockUser(authorities = "READ_ALL")
void getIncomplete_returns403_forReaderOnly() throws Exception {
mockMvc.perform(get("/api/documents/incomplete"))
.andExpect(status().isForbidden());
}
// ─── GET /api/documents/incomplete/next ──────────────────────────────────
@Test