test(geschichte): GeschichteServiceTest — list_withDraftRequest_returnsPublished_whenCallerLacksBlogWrite #808
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Identified during review of #794 (annotate GET /api/geschichten OpenAPI params). This is the most security-sensitive unguarded behaviour in the Geschichte domain.
GeschichteService.java:81silently overrides anystatus=DRAFTrequest from a caller lackingBLOG_WRITEtoPUBLISHED. There is currently no automated regression test for this behaviour — if the guard is removed in a future refactor, no test will catch it.What needs to be done
Add a
@ExtendWith(MockitoExtension.class)unit test toGeschichteServiceTest:Acceptance Criteria
GeschichteServiceTestcontainslist_withDraftRequest_returnsPublished_whenCallerLacksBlogWrite@ExtendWith(MockitoExtension.class)unit test — no Spring contextWhy this matters
This is the only regression guard for the
READ_ALL-caller status-override security behaviour documented inGeschichteService.java:81. Without it, the permission-gated logic can be silently removed in a refactor and no CI signal will catch it.