GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(handshake): live-handshake core primitive — sessions, fresh re-auth, TTL, audit, retention by kiodreambau · Pull Request #502 · OpenResilienceInitiative/ORISO-UserService Conversation
|
📝 WalkthroughWalkthroughThe change adds role-aware live handshakes with fresh password and OTP checks, audit persistence, expiry handling, and confirmation limits. Confirmed support handshakes create temporary Matrix support rooms with APIs for listing, termination, and expiry cleanup. ChangesLive support access
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant AuthenticatedUser
participant HandshakeController
participant HandshakeService
participant KeycloakAuthClient
participant SupportAccessCompletionHandler
participant SupportRoomService
participant MatrixService
AuthenticatedUser->>HandshakeController: initiate handshake
HandshakeController->>HandshakeService: submit initiation request
HandshakeService->>KeycloakAuthClient: verify password and OTP
AuthenticatedUser->>HandshakeController: confirm handshake
HandshakeController->>HandshakeService: submit confirmation password
HandshakeService->>SupportAccessCompletionHandler: notify confirmed session
SupportAccessCompletionHandler->>SupportRoomService: create support room
SupportRoomService->>MatrixService: create room and join consultant
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…listing, 2FA gate ADR-018: GSA is an additive support identity with its own table, never mixed into tenant/agency admin listings. Adds the global-support-admin role/authority, AdminType.SUPPORT, a supportadmins/search endpoint in the shared admin-search response shape, and a fail-closed 2FA gate in HandshakeService — a support admin without active OTP enrollment cannot initiate any handshake. Realm-role creation (Keycloak realm.json) is an ops prerequisite tracked with the Helm deployment. Co-Authored-By: Claude Fable 5 <[email protected]>
|
@kiodreambau here are the results of PR review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@kiodreambau
Here are the concerns to fix
🔴 Must-fix before merge (2 items)
TOCTOU race on confirm() — two concurrent requests can both see status == PENDING before either updates it. Add @Version long version to HandshakeSession (optimistic locking). On MySQL READ_COMMITTED, @transactional alone does not prevent this.
Fragile Keycloak OTP-bypass detection — verifyIgnoringOtp returns true if the error body contains "Missing totp". That string is Keycloak-internal, not a stable contract. A Keycloak upgrade could silently break or bypass password verification for counterparts.
🟡 Should-fix (4 items)
No @Valid / size constraints on request DTOs — password, otp, counterpartId accept unlimited input that is passed to Keycloak.
Role-check failure produces no audit entry — CONFIRM_REJECTED is only written for password failures; a role mismatch is silent in the audit trail.
LocalDateTime.now() is timezone-unaware — container JVM ≠ DB timezone breaks TTL comparisons. Use LocalDateTime.now(ZoneOffset.UTC).
sweepExpired() has no upper bound — a large backlog returns all rows into memory at once; paginate.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Deep readiness review: this PR should remain blocked even though its checks are green.\n\nThe core ADR-018 skeleton is present, but the current confirmation path has three concrete security and consistency gaps:\n\n1. Tenant isolation: the session stores the initiator tenant, but confirm only checks counterpart ID and role. It never verifies that the authenticated counterpart belongs to the session tenant. The pending query is also keyed only by counterpart ID. Both confirm and pending lookup need tenant-scoped repository methods or an explicit same-tenant/platform-admin policy, with negative cross-tenant tests.\n2. Brute-force protection: every wrong counterpart password reaches Keycloak and writes an audit event, but there is no per-session/per-actor attempt limit, cooldown, or terminal lock state. A durable attempt counter and threshold should be enforced transactionally, in addition to upstream Keycloak protections.\n3. Double confirmation: findById followed by an ordinary save permits two concurrent requests to observe PENDING and both execute completion handlers. Add optimistic locking with a version column or a conditional PENDING-to-CONFIRMED update and make handler execution depend on exactly one successful transition.\n\nThe earlier review summary also refers to findings 1 through 7, but their descriptions are not present in any inline thread or visible comment. The missing details need to be restored before a complete fix can be verified. Because this path authorizes privileged actions, I do not recommend guessing at the remaining requirements or applying a partial autofix. Please add the seven concrete findings; then the above three should be implemented with concurrency and cross-tenant tests before approval. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…h cutoff, never reused
ADR-018 §2: a confirmed SUPPORT_ACCESS handshake creates a fresh
encrypted 1:1 Matrix room (SupportAccessCompletionHandler inside the
confirm transaction — a failed room creation rolls the confirmation
back). The lease dies hard at four hours via a scheduled sweep, or
earlier when the Berater*in terminates; closing kicks the support
admin and marks the room CLOSED even if the homeserver hiccups. Rooms
are never reused. Adds support_room (Liquibase 0073), participant-
scoped GET /users/support-rooms/active and POST
/users/support-rooms/{id}/terminate, audit entries on create/close.
Co-Authored-By: Claude Fable 5 <[email protected]>
…, tenant policy, strict SPI contract, UTC, bounded sweep Addresses the PR #502 review (shazia-k + deep readiness review): - @Version optimistic lock on handshake_session; exactly one concurrent PENDING→CONFIRMED transition wins, the loser gets 400 and never dispatches completion handlers (TOCTOU/double-confirm). - Durable brute-force guard: failed counterpart passwords increment a persisted attempt counter; at the limit (default 5) the session locks terminally with a CONFIRM_LOCKED audit entry. - Tenant isolation: SUPPORT_ACCESS stays cross-tenant by design (platform support); every other purpose requires the confirming counterpart to be in the session tenant or platform-scoped, with negative cross-tenant tests. - verifyIgnoringOtp no longer substring-matches 'Missing totp': strict JSON error_description contract of the vendored otp-config SPI (ADR-013), with a negative test for phrase-containing bodies. - Role-mismatch confirmations now write CONFIRM_REJECTED audit entries. - All timestamps via CustomLocalDateTime.nowInUtc(). - sweepExpired processes bounded batches (default 200) instead of loading the full backlog. - Bean-validation constraints on both request DTOs (@Valid in the controller). Co-Authored-By: Claude Fable 5 <[email protected]>
Conflict in HandshakeServiceTest setUp: keep both the review-fix field initialisation (maxConfirmAttempts, sweepBatchSize) and the GSA 2FA lenient OTP stub. Co-Authored-By: Claude Fable 5 <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
…stamps, bounded sweep Same review classes as the handshake fixes on PR #502: all timestamps via CustomLocalDateTime.nowInUtc() and the expiry sweep processes bounded batches (default 200) instead of loading the full backlog. Co-Authored-By: Claude Fable 5 <[email protected]>
|
@shazia-k @Storypapst thanks — all findings are addressed in 3375f8b (and propagated up the stack to #504/#506): Must-fix
Tenant isolation → per-purpose policy: Brute force → durable Should-fix → bean-validation Full unit suite green (3716 on this branch, 3730 on top of the stack). 🤖 Generated with Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…om-lifecycle feat(support): support-room lifecycle — dual-confirm creation, hard 4h cutoff, never reused
…port-admin-identity feat(support): Global Support Admin identity — role, admin type, own listing, 2FA gate
…ngesets around 0072_user_do_not_disturb pre-dev introduced 0072_user_do_not_disturb while this branch carried an unmerged 0072_handshake + 0073_support_room. Since neither has ever been merged or deployed, they are renumbered to 0073_handshake and 0074_support_room (directory, file and changeset id) so the master changelog stays strictly ordered and collision-free. Co-Authored-By: Claude Fable 5 <[email protected]>
Adopts the deadlock lesson from pre-dev adadd47 (platform admins were locked behind an unsatisfiable 2FA gate): when the OTP role policy denies OTP for the support-admin role, enrollment is impossible, so the gate can never be satisfied. It still fails closed — privileged access without 2FA is never granted — but reports a deployment configuration error (identity.otp-allowed-*) instead of asking the admin to complete an enrollment they cannot perform. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Rebased onto current Conflict: Adopted from parallel work on
Note that #504 and #506 merged into this branch, so this PR now carries the whole stack: handshake primitive + GSA identity + support-room lifecycle (35 files vs Full unit suite green after the merge: 3838 tests, 0 failures. 🤖 Generated with Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
pre-dev's Rocket.Chat removal claimed 0073-0075, so the unmerged handshake/support changesets move again (directory, file and changeSet id). Neither has ever been merged or deployed, so renumbering is safe; the master changelog stays strictly ordered. Co-Authored-By: Claude Fable 5 <[email protected]>
…gelog conflict The pre-dev merge resolution lost the opening <include> tag before the 0073_remove_rocket_chat_user_ids entry, leaving stray character data in databaseChangeLog. Liquibase refused to parse the master changelog, so every fresh-database boot failed (caught by the mariadb-contract gate). Verified against a clean MariaDB: DatabaseChangelogDriftIT and AdminStatisticsRepositoryMariaDbIT both green. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Rebased onto current Changeset renumbering (second time): Defect found by No functional change to the handshake/support code in these two commits. 🤖 Generated with Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Keep verifyWithOtp and strict Missing-totp JSON contract on KeycloakAuthClient, drop closeSession (moved out in pre-dev refactor). Renumber handshake and support_room Liquibase changesets to 0078/0079 after pre-dev claimed 0076/0077. Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 26
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
src/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakAuthClient.java (1)
196-211: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick winRedact the
otpfield inSensitiveKeycloakFormData.
verifyWithOtpaddsotpto the same form map thatSensitiveKeycloakFormDatawraps (line 87), buttoString()only redactsrefresh_tokenandpassword. If this map is ever logged (debug interceptors, exception messages), the one-time OTP code leaks in plain text. OTP is fresh credential material under ADR-018 and should get the same treatment aspassword.🔒 Proposed fix
private static final class SensitiveKeycloakFormData extends LinkedMultiValueMap<String, String> { private static final String REDACTED = "[REDACTED]"; + private static final String BODY_KEY_OTP = "otp"; `@Override` public String toString() { var sanitized = new LinkedMultiValueMap<>(this); if (sanitized.containsKey(KEYCLOAK_GRANT_TYPE_REFRESH_TOKEN)) { sanitized.put(KEYCLOAK_GRANT_TYPE_REFRESH_TOKEN, Collections.singletonList(REDACTED)); } if (sanitized.containsKey(BODY_KEY_PASSWORD)) { sanitized.put(BODY_KEY_PASSWORD, Collections.singletonList(REDACTED)); } + if (sanitized.containsKey(BODY_KEY_OTP)) { + sanitized.put(BODY_KEY_OTP, Collections.singletonList(REDACTED)); + } return sanitized.toString(); } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakAuthClient.java` around lines 196 - 211, Update SensitiveKeycloakFormData.toString() to redact the OTP field key used by verifyWithOtp, alongside the existing refresh-token and password sanitization, so OTP values are replaced with REDACTED before the form map is rendered.
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakAuthClient.java`:
- Around line 78-104: Update verifyWithOtp to catch the broader
RestClientException, including ResourceAccessException, around the Keycloak
login request; log the caught failure and return false so all transport and
response failures follow the existing fail-closed verification path.
In
`@src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportRoomController.java`:
- Around line 20-38: Update SecurityConfig to protect /users/support-rooms and
/users/support-rooms/** with the professional role gate requiring
CONSULTANT_DEFAULT or SUPPORT_ADMIN instead of only authenticated access.
Preserve the existing SupportRoomController endpoints and apply the restriction
to both the collection and nested room paths.
In
`@src/main/java/de/caritas/cob/userservice/api/admin/service/admin/SupportAdminUserService.java`:
- Around line 32-41: Annotate findSupportAdminsByInfix with a read-only
transaction boundary covering the paged admin query, full-admin lookup, and
consultant identity lookup, ensuring the subsequent mapping uses one consistent
read snapshot.
In `@src/main/java/de/caritas/cob/userservice/api/model/Admin.java`:
- Around line 60-63: Widen the Admin.type persistence column to accommodate the
7-character AdminType.SUPPORT value: update the `@Column` length on the Admin.type
field and add a Liquibase changeset altering admin.type from varchar(6) to the
matching larger width. Keep the existing enum mappings unchanged.
In `@src/main/java/de/caritas/cob/userservice/api/model/HandshakeSession.java`:
- Around line 30-34: Add CONFIRM_LOCKED to HandshakeSession.HandshakeStatus and
update the repeated-confirmation-failure lockout path to persist that status
instead of EXPIRED. Keep EXPIRED for normal handshake expiry so the two terminal
audit states remain distinct.
In `@src/main/java/de/caritas/cob/userservice/api/model/SupportRoom.java`:
- Around line 54-56: Add a `@Version` field to SupportRoom and create the
corresponding Liquibase column changeset; update SupportRoomService.close() to
verify the room is still in the closable status, catch
OptimisticLockingFailureException from save, and return for losing callers
before Matrix cleanup or duplicate audit emission. Apply these changes at
SupportRoom.java:54-56 and SupportRoomService.java:171-188.
In
`@src/main/java/de/caritas/cob/userservice/api/port/out/HandshakeAuditEventRepository.java`:
- Around line 7-9: Update
HandshakeAuditEventRepository.deleteAllByCreateDateBefore to use a modifying
bulk-delete query rather than entity-loading deletion, and ensure
HandshakeService.purgeOldAuditEvents processes large backlogs in bounded batches
or another bounded pattern. Adjust the corresponding HandshakeServiceTest
assertion to verify the updated purge behavior and repository interaction.
In
`@src/main/java/de/caritas/cob/userservice/api/service/handshake/HandshakePurpose.java`:
- Around line 18-31: Replace the duplicated role string literals in the
HandshakePurpose initializers SUPPORT_ACCESS, RECOVERY_SUPPORT_ADMIN,
RECOVERY_CONSULTANT, and IDENTITY_GRANT with the corresponding UserRole
constants’ getValue() results. Keep HandshakePurpose.PLATFORM_ADMIN unchanged as
the platform-admin marker.
- Around line 56-62: Update HandshakePurpose.matches and the recovery handshake
role configuration to enforce the intended four-eyes pairing: the confirmer must
hold the counterpart authority to the initiator’s role rather than merely any
role in the shared allowed set. Preserve the platform-admin handling and
existing distinct-user check, while ensuring RECOVERY_SUPPORT_ADMIN requires a
platform admin counterpart and RECOVERY_CONSULTANT requires the corresponding
support-admin counterpart.
In
`@src/main/java/de/caritas/cob/userservice/api/service/handshake/HandshakeService.java`:
- Around line 294-300: The purposeOf method currently discards the caught enum
parsing exception; pass e as the cause when constructing BadRequestException.
Apply the same cause-preserving change to the corresponding BadRequestException
construction near line 153, while retaining the existing handling of
IllegalArgumentException and NullPointerException.
- Around line 178-195: Guard both scheduled methods,
HandshakeService.sweepExpired and HandshakeService.purgeOldAuditEvents, with a
distributed single-instance execution mechanism such as ShedLock or the
project’s leader-election facility so only one replica runs each job at a time.
Preserve the existing scheduling, transaction boundaries, batch size, and
retention behavior, and add an index-backed metric or structured log reporting
the number of sessions swept and audit events purged.
- Around line 201-215: The tenant-policy rejection audit in enforceTenantPolicy
must survive the ForbiddenException rollback: route audit(session,
EVENT_CONFIRM_REJECTED, ...) through an independent REQUIRES_NEW transaction or
another non-rollback side effect. Also require session.getTenantId() to be
non-null for tenant-scoped handshakes, rejecting and auditing non-platform
counterparts when it is missing instead of allowing the comparison to be
skipped.
- Around line 218-229: Ensure all failed-confirmation state and audit writes
commit independently of confirm’s rollback by moving them into a collaborator
method annotated with REQUIRES_NEW. Update registerFailedConfirmAttempt to
persist the attempt increment, expiration status, and corresponding
CONFIRM_LOCKED or CONFIRM_REJECTED audit; update the expire, role-mismatch, and
tenant-mismatch paths to use the same independent transaction before throwing.
In HandshakeService.java lines 218-229, 122-125, 133-139, and 201-215, apply the
specified changes; add an integration test that verifies the attempt count
remains persisted after a failed confirmation.
- Around line 148-165: Ensure the handshake update is flushed immediately after
saving the confirmed session and before audit or any
completionHandlers.onConfirmed invocation, so the version conflict is detected
at this boundary and translated consistently to BadRequestException. Update the
repository abstraction used by handshakeSessionRepository to expose saveAndFlush
(or perform an equivalent explicit flush), then use it in this confirmation flow
while preserving the existing concurrent-modification handling.
In
`@src/main/java/de/caritas/cob/userservice/api/service/support/SupportRoomService.java`:
- Around line 159-169: Remove the batch-level transaction from sweepExpired()
and execute each room’s close operation in its own transaction, preserving the
existing bounded query and iteration. Ensure the per-room transactional boundary
is applied through a Spring-managed method or bean so close() commits
independently after its Matrix calls, rather than keeping one transaction open
across the entire batch.
- Around line 92-98: Update SupportRoomService.createForConfirmedHandshake so
the room created through matrixSynapseService.createRoom is explicitly
configured with encryption enabled, regardless of the global
matrix.encryptionEnabled default; use the existing Matrix room configuration or
initial-state mechanism rather than changing unrelated room creation paths.
- Around line 64-126: Update createForConfirmedHandshake so any failure after
Matrix room creation, including SupportRoom persistence or audit, performs
best-effort compensation using the created roomId and available credentials,
such as removing the consultant and cleaning up the room. Ensure cleanup
failures do not replace the original exception, while preserving the existing
transaction and error propagation behavior.
In
`@src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakAuthClientTest.java`:
- Around line 209-219: Strengthen
verifyWithOtp_Should_ReturnTrueAndLogout_When_LoginWithOtpSucceeds by verifying
the logout request through the existing sibling-test pattern and capturing the
OTP login request to assert its form body contains the provided "otp" value.
Replace or supplement the unused Void.class stub with interaction and
request-content assertions so the test fails if logout is omitted or the OTP
field is not transmitted.
In
`@src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/HandshakeControllerTest.java`:
- Around line 41-52: Add an MVC-layer validation test for
HandshakeController.confirm using `@WebMvcTest` or standalone MockMvcBuilders;
submit a confirmation request with an empty password and assert HTTP 400,
ensuring the test exercises `@NotBlank` validation and would fail if `@Valid` is
removed.
In
`@src/test/java/de/caritas/cob/userservice/api/adapters/web/mapping/AdminDtoMapperTest.java`:
- Around line 47-61: Restore the true and false hasOtherIdentity test coverage
for AdminDtoMapper.adminDtoOf, keeping the new
adminSearchResultOf_Should_MapSupportAdminRoleInOrg test as well. Ensure each
test supplies the corresponding result-map value and asserts the mapped
hasOtherIdentity output, so both branches can fail independently.
In
`@src/test/java/de/caritas/cob/userservice/api/service/handshake/HandshakeServiceTest.java`:
- Around line 380-391: Strengthen both query tests in
src/test/java/de/caritas/cob/userservice/api/service/handshake/HandshakeServiceTest.java:380-391
and 393-407 by capturing repository invocation arguments instead of stubbing all
parameters with any(). In
pendingForCounterpart_Should_ReturnOnlyUnexpiredPendingSessions, assert the
counterpart id, PENDING status, and a UTC cutoff near the current time passed to
findAllByCounterpartIdAndStatusAndExpiryDateAfter; in the sibling test, assert
findAllByStatusAndExpiryDateBefore receives PENDING and a Pageable with the
configured sweepBatchSize of 200.
- Around line 342-376: Add positive coverage in the handshake confirmation tests
for tenant-scoped purposes: add cases proving confirm succeeds when the
counterpart has the same tenant ID and when the counterpart is platform-scoped
with tenant ID 0. Configure successful authentication and persistence, then
assert the returned status is CONFIRMED so an over-restrictive
enforceTenantPolicy implementation fails.
- Around line 176-191: Add verifyNoInteractions/never verification to the
repository save operation in
initiate_Should_Reject_When_InitiatorTargetsThemselves and
initiate_Should_Reject_When_PurposeIsUnknown, preserving their
BadRequestException assertions. Ensure each test proves
handshakeService.initiate does not persist a session when validation rejects the
request.
- Around line 208-222: Update
confirm_Should_ConfirmAndNotifyHandlers_When_CounterpartPasswordIsValid to
verify handshakeAuditEventRepository.save was called for the successful
CONFIRMED transition, matching the audit assertions in the expiry and
role-mismatch tests. Ensure the verification covers the saved event for this
session and confirmation transition so removing the audit write from
HandshakeService.confirm causes the test to fail.
In
`@src/test/java/de/caritas/cob/userservice/api/service/support/SupportRoomServiceTest.java`:
- Line 131: Update the audit assertions in the affected SupportRoomServiceTest
cases to capture the argument passed to handshakeAuditEventRepository.save
rather than matching any value. Assert the captured event’s event constant,
tenantId, and actorId fields against the expected values for each scenario,
while preserving verification that save is invoked.
- Around line 96-133: Add a test alongside
createForConfirmedHandshake_Should_CreateEncryptedRoomWithBothMembersAndFourHourLease
that stubs matrixSynapseService.userExists("sam.support") to return false,
configures createUser to return a response containing a Matrix user ID, and
executes the confirmed-handshake creation flow. Verify createUser is invoked and
that the returned user ID is used in the subsequent Matrix operations, while
retaining assertions that the room is created successfully.
---
Outside diff comments:
In
`@src/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakAuthClient.java`:
- Around line 196-211: Update SensitiveKeycloakFormData.toString() to redact the
OTP field key used by verifyWithOtp, alongside the existing refresh-token and
password sanitization, so OTP values are replaced with REDACTED before the form
map is rendered.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4390dbe7-a38b-4805-a066-a41898068bac
src/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakAuthClient.javasrc/main/java/de/caritas/cob/userservice/api/adapters/web/controller/HandshakeController.javasrc/main/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportAdminController.javasrc/main/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportRoomController.javasrc/main/java/de/caritas/cob/userservice/api/adapters/web/mapping/AdminDtoMapper.javasrc/main/java/de/caritas/cob/userservice/api/admin/service/admin/SupportAdminUserService.javasrc/main/java/de/caritas/cob/userservice/api/config/auth/Authority.javasrc/main/java/de/caritas/cob/userservice/api/config/auth/SecurityConfig.javasrc/main/java/de/caritas/cob/userservice/api/config/auth/UserRole.javasrc/main/java/de/caritas/cob/userservice/api/model/Admin.javasrc/main/java/de/caritas/cob/userservice/api/model/HandshakeAuditEvent.javasrc/main/java/de/caritas/cob/userservice/api/model/HandshakeSession.javasrc/main/java/de/caritas/cob/userservice/api/model/SupportRoom.javasrc/main/java/de/caritas/cob/userservice/api/port/out/HandshakeAuditEventRepository.javasrc/main/java/de/caritas/cob/userservice/api/port/out/HandshakeSessionRepository.javasrc/main/java/de/caritas/cob/userservice/api/port/out/SupportRoomRepository.javasrc/main/java/de/caritas/cob/userservice/api/service/handshake/HandshakeCompletionHandler.javasrc/main/java/de/caritas/cob/userservice/api/service/handshake/HandshakePurpose.javasrc/main/java/de/caritas/cob/userservice/api/service/handshake/HandshakeService.javasrc/main/java/de/caritas/cob/userservice/api/service/support/SupportAccessCompletionHandler.javasrc/main/java/de/caritas/cob/userservice/api/service/support/SupportRoomService.javasrc/main/resources/db/changelog/changeset/0078_handshake/0078_changeSet.xmlsrc/main/resources/db/changelog/changeset/0078_handshake/migrate.sqlsrc/main/resources/db/changelog/changeset/0079_support_room/0079_changeSet.xmlsrc/main/resources/db/changelog/changeset/0079_support_room/migrate.sqlsrc/main/resources/db/changelog/userservice-master.xmlsrc/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakAuthClientTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/HandshakeControllerTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportAdminControllerTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportRoomControllerTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/mapping/AdminDtoMapperTest.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/admin/SupportAdminUserServiceTest.javasrc/test/java/de/caritas/cob/userservice/api/service/handshake/HandshakeServiceTest.javasrc/test/java/de/caritas/cob/userservice/api/service/support/SupportRoomServiceTest.java⚙️ CodeRabbit configuration file
src/main/resources/db/**: Liquibase changesets are append-only. Flag edits to already-applied
changesets, missing rollback, and changes that are not idempotent.
Files:
src/main/resources/db/changelog/changeset/0078_handshake/0078_changeSet.xmlsrc/main/resources/db/changelog/changeset/0079_support_room/0079_changeSet.xmlsrc/main/resources/db/changelog/changeset/0078_handshake/migrate.sqlsrc/main/resources/db/changelog/changeset/0079_support_room/migrate.sqlsrc/main/resources/db/changelog/userservice-master.xml⚙️ CodeRabbit configuration file
src/test/**/*.java: Tests must be able to fail. Flag over-mocking that hides the defect,
assertions that cannot break, and missing edge cases.
Files:
src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportRoomControllerTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/HandshakeControllerTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportAdminControllerTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/web/mapping/AdminDtoMapperTest.javasrc/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakAuthClientTest.javasrc/test/java/de/caritas/cob/userservice/api/admin/service/admin/SupportAdminUserServiceTest.javasrc/test/java/de/caritas/cob/userservice/api/service/handshake/HandshakeServiceTest.javasrc/test/java/de/caritas/cob/userservice/api/service/support/SupportRoomServiceTest.java⚙️ CodeRabbit configuration file
src/main/**/*.java: Check behavior against the surrounding ORISO flow, not only types. Flag
missing transaction boundaries, swallowed exceptions, N+1 queries, and
privacy regressions around Matrix identifiers, chat content and user data.
Configuration must stay environment-driven — never hardcode hosts, IPs or
credentials (see ADR-005 / finding DB-M04).
Files:
src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportAdminController.javasrc/main/java/de/caritas/cob/userservice/api/port/out/HandshakeAuditEventRepository.javasrc/main/java/de/caritas/cob/userservice/api/config/auth/UserRole.javasrc/main/java/de/caritas/cob/userservice/api/service/support/SupportAccessCompletionHandler.javasrc/main/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportRoomController.javasrc/main/java/de/caritas/cob/userservice/api/config/auth/SecurityConfig.javasrc/main/java/de/caritas/cob/userservice/api/service/handshake/HandshakeCompletionHandler.javasrc/main/java/de/caritas/cob/userservice/api/adapters/web/mapping/AdminDtoMapper.javasrc/main/java/de/caritas/cob/userservice/api/model/HandshakeAuditEvent.javasrc/main/java/de/caritas/cob/userservice/api/model/HandshakeSession.javasrc/main/java/de/caritas/cob/userservice/api/port/out/SupportRoomRepository.javasrc/main/java/de/caritas/cob/userservice/api/adapters/web/controller/HandshakeController.javasrc/main/java/de/caritas/cob/userservice/api/port/out/HandshakeSessionRepository.javasrc/main/java/de/caritas/cob/userservice/api/model/SupportRoom.javasrc/main/java/de/caritas/cob/userservice/api/admin/service/admin/SupportAdminUserService.javasrc/main/java/de/caritas/cob/userservice/api/service/handshake/HandshakePurpose.javasrc/main/java/de/caritas/cob/userservice/api/config/auth/Authority.javasrc/main/java/de/caritas/cob/userservice/api/model/Admin.javasrc/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakAuthClient.javasrc/main/java/de/caritas/cob/userservice/api/service/support/SupportRoomService.javasrc/main/java/de/caritas/cob/userservice/api/service/handshake/HandshakeService.javaLearnt from: Storypapst
Repo: OpenResilienceInitiative/ORISO-UserService PR: 420
File: src/main/java/de/caritas/cob/userservice/api/conversation/service/AnonymousConversationCreatorService.java:34-35
Timestamp: 2026-07-12T05:15:05.095Z
Learning: In ORISO-UserService, treat `rocket-chat.enabled` defaulting to `false` (e.g., `Value("${rocket-chat.enabled:false}")`) as an intentional Matrix-only default. Do not flag code paths/config placeholders that use this default-false behavior as a bug in future reviews. Rocket.Chat must be explicitly enabled only by setting `ROCKET_CHAT_ENABLED=true` (or the equivalent `rocket-chat.enabled=true`), consistent with the repository’s `application*.properties`/configuration validator and the disabled Rocket.Chat service wiring.
Applied to files:
src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportAdminController.javasrc/main/java/de/caritas/cob/userservice/api/port/out/HandshakeAuditEventRepository.javasrc/main/java/de/caritas/cob/userservice/api/config/auth/UserRole.javasrc/main/java/de/caritas/cob/userservice/api/service/support/SupportAccessCompletionHandler.javasrc/main/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportRoomController.javasrc/main/java/de/caritas/cob/userservice/api/config/auth/SecurityConfig.javasrc/main/java/de/caritas/cob/userservice/api/service/handshake/HandshakeCompletionHandler.javasrc/main/java/de/caritas/cob/userservice/api/adapters/web/mapping/AdminDtoMapper.javasrc/main/java/de/caritas/cob/userservice/api/model/HandshakeAuditEvent.javasrc/main/java/de/caritas/cob/userservice/api/model/HandshakeSession.javasrc/main/java/de/caritas/cob/userservice/api/port/out/SupportRoomRepository.javasrc/main/java/de/caritas/cob/userservice/api/adapters/web/controller/HandshakeController.javasrc/main/java/de/caritas/cob/userservice/api/port/out/HandshakeSessionRepository.javasrc/main/java/de/caritas/cob/userservice/api/model/SupportRoom.javasrc/main/java/de/caritas/cob/userservice/api/admin/service/admin/SupportAdminUserService.javasrc/main/java/de/caritas/cob/userservice/api/service/handshake/HandshakePurpose.javasrc/main/java/de/caritas/cob/userservice/api/config/auth/Authority.javasrc/main/java/de/caritas/cob/userservice/api/model/Admin.javasrc/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakAuthClient.javasrc/main/java/de/caritas/cob/userservice/api/service/support/SupportRoomService.javasrc/main/java/de/caritas/cob/userservice/api/service/handshake/HandshakeService.java[Medium] 153-154: PreserveStackTrace (Best Practices): Thrown exception does not preserve the stack trace of exception 'e' on all code paths
(PreserveStackTrace (Best Practices))
[Medium] 298-298: PreserveStackTrace (Best Practices): Thrown exception does not preserve the stack trace of exception 'e' on all code paths
(PreserveStackTrace (Best Practices))
src/main/java/de/caritas/cob/userservice/api/port/out/SupportRoomRepository.java (1)
1-22: LGTM!src/main/java/de/caritas/cob/userservice/api/service/support/SupportAccessCompletionHandler.java (1)
1-31: LGTM!src/main/resources/db/changelog/changeset/0079_support_room/0079_changeSet.xml (1)
1-18: LGTM!src/main/resources/db/changelog/changeset/0079_support_room/migrate.sql (1)
1-22: LGTM!src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportRoomControllerTest.java (1)
1-48: LGTM!src/main/java/de/caritas/cob/userservice/api/service/support/SupportRoomService.java (1)
190-203: 🎯 Functional CorrectnessNo change needed here: the existing localpart fallback is consistent with Synapse’s lowercase localpart usage in this path.
matrixSynapseService.userExists(localpart)andcreateUser(...)both send lowercased localparts to the Synapse register endpoint, and Synapse normalizes Matrix IDs to lowercase.src/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakAuthClient.java (1)
105-123: LGTM!Also applies to: 154-173
src/main/java/de/caritas/cob/userservice/api/config/auth/Authority.java (1)
59-63: LGTM!Also applies to: 102-102
src/main/java/de/caritas/cob/userservice/api/config/auth/UserRole.java (1)
24-25: LGTM!src/main/java/de/caritas/cob/userservice/api/config/auth/SecurityConfig.java (2)
211-216: 🔒 Security & PrivacyConfirm per-purpose role checks fully replace the coarse authorization here.
/users/handshakes/**and/users/support-rooms/**use.authenticated(), so any authenticated principal — including a plainUSER_DEFAULTorANONYMOUS_DEFAULTasker — passes the Spring Security layer. All role enforcement for this privileged, two-person-integrity primitive now lives solely inHandshakePurpose.mayInitiate/mayConfirm, which is not in this file set.Confirm that
HandshakePurposerejects non-privileged roles for every current and future purpose, since there is no framework-level backstop if that logic has a gap.
327-328: LGTM!src/main/java/de/caritas/cob/userservice/api/adapters/web/mapping/AdminDtoMapper.java (1)
192-193: LGTM!src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportAdminController.java (1)
21-43: LGTM!src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportAdminControllerTest.java (1)
19-43: LGTM!src/test/java/de/caritas/cob/userservice/api/admin/service/admin/SupportAdminUserServiceTest.java (1)
76-109: LGTM!src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakAuthClientTest.java (2)
87-110: LGTM!
221-241: LGTM!src/main/java/de/caritas/cob/userservice/api/service/handshake/HandshakePurpose.java (1)
44-54: LGTM!src/main/java/de/caritas/cob/userservice/api/model/HandshakeAuditEvent.java (1)
20-54: LGTM!src/main/java/de/caritas/cob/userservice/api/model/HandshakeSession.java (2)
36-64: LGTM!
66-74: 🗄️ Data Integrity & IntegrationNo migration change needed.
userservice.handshake_sessionalready defines bothconfirm_attempts INT NOT NULL DEFAULT 0andversion BIGINT NOT NULL DEFAULT 0, and the master changelog includes the handshake changeset exactly once.src/main/java/de/caritas/cob/userservice/api/port/out/HandshakeSessionRepository.java (2)
9-16: LGTM!
11-15: 🚀 Performance & ScalabilityIndex coverage is already in place.
src/test/java/de/caritas/cob/userservice/api/service/handshake/HandshakeServiceTest.java (3)
47-113: LGTM!
224-307: LGTM!Also applies to: 326-340
409-420: LGTM!src/main/java/de/caritas/cob/userservice/api/service/handshake/HandshakeCompletionHandler.java (1)
11-16: LGTM!src/main/resources/db/changelog/changeset/0078_handshake/0078_changeSet.xml (1)
7-18: LGTM!src/main/resources/db/changelog/userservice-master.xml (1)
133-136: LGTM!src/test/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakServiceTest.java (1)
1347-1348: 🎯 Functional CorrectnessNo change needed.
The production path requires the JSON
error_descriptionfield to equal exactly"Missing totp"; bodies that are not JSON or contain the phrase without that field are handled as false.src/main/resources/db/changelog/changeset/0078_handshake/migrate.sql (1)
3-34: 🗄️ Data Integrity & IntegrationNo changeset numbering or schema prefix issue.
src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/HandshakeController.java (1)
35-53: 🔒 Security & PrivacyNo change needed.
/users/handshakes/**is covered by an explicitauthenticated()matcher before the finaldenyAll().
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| /** | ||
| * Verifies password AND active second factor by performing a full direct-grant login including | ||
| * the {@code otp} form field (the vendored otp-config SPI validates it, ADR-013). Any obtained | ||
| * session is logged out immediately — this is a verification, not a login. | ||
| * | ||
| * @return true only if Keycloak accepted password and OTP together | ||
| */ | ||
| public boolean verifyWithOtp(String username, String password, String otp) { | ||
| var entity = loginRequest(usernameTranscoder.decodeUsername(username), password); | ||
| entity.getBody().add("otp", otp); | ||
| var url = identityClientConfig.getOpenIdConnectUrl(ENDPOINT_OPENID_CONNECT_LOGIN); | ||
|
|
||
| ResponseEntity<KeycloakLoginResponseDTO> loginResponse; | ||
| try { | ||
| loginResponse = restTemplate.postForEntity(url, entity, KeycloakLoginResponseDTO.class); | ||
| } catch (RestClientResponseException exception) { | ||
| return false; | ||
| } | ||
|
|
||
| var responsePayload = loginResponse.getBody(); | ||
| if (nonNull(responsePayload) && nonNull(responsePayload.getRefreshToken())) { | ||
| logoutUser(responsePayload.getRefreshToken()); | ||
| } | ||
|
|
||
| return loginResponse.getStatusCode().is2xxSuccessful(); | ||
| } | ||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Widen the caught exception type in verifyWithOtp.
verifyWithOtp catches only RestClientResponseException. A Keycloak timeout or connection failure throws ResourceAccessException, which extends RestClientException but not RestClientResponseException. That exception propagates uncaught through HandshakeService.initiate() (also @Transactional) and surfaces as an unhandled 500, instead of the intended fail-closed ForbiddenException path used for every other verification failure.
Catch the broader RestClientException and log the failure so an unreachable Keycloak instance does not produce an unhandled exception on this security-critical path.
ResponseEntity<KeycloakLoginResponseDTO> loginResponse;
try {
loginResponse = restTemplate.postForEntity(url, entity, KeycloakLoginResponseDTO.class);
- } catch (RestClientResponseException exception) {
+ } catch (RestClientException exception) {
+ log.warn("Keycloak OTP verification request failed for user {}", username, exception);
return false;
}Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/main/java/de/caritas/cob/userservice/api/adapters/keycloak/KeycloakAuthClient.java`
around lines 78 - 104, Update verifyWithOtp to catch the broader
RestClientException, including ResourceAccessException, around the Keycloak
login request; log the caught failure and return false so all transport and
response failures follow the existing fail-closed verification path.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @RestController | ||
| @RequestMapping("/users/support-rooms") | ||
| @RequiredArgsConstructor | ||
| public class SupportRoomController { | ||
|
|
||
| private final @NonNull SupportRoomService supportRoomService; | ||
| private final @NonNull AuthenticatedUser authenticatedUser; | ||
|
|
||
| @GetMapping("/active") | ||
| public ResponseEntity<List<SupportRoomItem>> active() { | ||
| return ResponseEntity.ok(supportRoomService.activeFor(authenticatedUser)); | ||
| } | ||
|
|
||
| @PostMapping("/{roomId}/terminate") | ||
| public ResponseEntity<Void> terminate(@PathVariable String roomId) { | ||
| supportRoomService.terminate(authenticatedUser, roomId); | ||
| return ResponseEntity.noContent().build(); | ||
| } | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🏁 Script executed:
#!/bin/bash # Description: Check whether SecurityConfig restricts the new support-rooms endpoints by role. rg -n -C5 'support-rooms' src/main/java/de/caritas/cob/userservice/api/config/auth/SecurityConfig.java
Repository: OpenResilienceInitiative/ORISO-UserService
Length of output: 917
Restrict /users/support-rooms} behind the professional role gate.
SecurityConfig only calls .authenticated() for /users/support-rooms and /users/support-rooms/**. Any authenticated Matrix user can call these new endpoints, while sensitive Room identifiers and participant IDs are only scoped by caller.getUserId() after access is granted. Require CONSULTANT_DEFAULT/SUPPORT_ADMIN here, or confirm this is intentional.
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/SupportRoomController.java`
around lines 20 - 38, Update SecurityConfig to protect /users/support-rooms and
/users/support-rooms/** with the professional role gate requiring
CONSULTANT_DEFAULT or SUPPORT_ADMIN instead of only authenticated access.
Preserve the existing SupportRoomController endpoints and apply the restriction
to both the collection and nested room paths.
Source: Path instructions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| public Map<String, Object> findSupportAdminsByInfix(String infix, PageRequest pageRequest) { | ||
| Page<AdminBase> adminsPage = | ||
| retrieveAdminService.findAllByInfix(infix, Admin.AdminType.SUPPORT, pageRequest); | ||
| var adminIds = adminsPage.stream().map(AdminBase::getId).collect(Collectors.toSet()); | ||
| var fullAdmins = retrieveAdminService.findAllById(adminIds); | ||
|
|
||
| Set<String> idsWithConsultantIdentity = | ||
| adminIds.isEmpty() | ||
| ? Collections.emptySet() | ||
| : consultantRepository.findActiveIdsByIdIn(adminIds); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🏁 Script executed:
#!/bin/bash # Inspect transaction boundaries on sibling admin search services. fd -e java . src/main/java/de/caritas/cob/userservice/api/admin/service/admin \ --exec rg -n -B4 'findAll(ByInfix|ById)\s*\(' {} # Inspect how mapOfAdmin pairs page entries with full admin records. ast-grep run --pattern 'mapOfAdmin($$$) { $$$ }' --lang java src/main/java/de/caritas/cob/userservice/api/UserServiceMapper.java \ || rg -n -A40 '\bmapOfAdmin\s*\(' src/main/java/de/caritas/cob/userservice/api/UserServiceMapper.java
Repository: OpenResilienceInitiative/ORISO-UserService
Length of output: 6811
🏁 Script executed:
#!/bin/bash set -euo pipefail printf 'Relevant service files:\n' fd -e java . src/main/java/de/caritas/cob/userservice/api/admin/service/admin \ --exec sh -c 'echo "--- {}"; sed -n "1,180p" "{}"' \; printf '\nUserServiceMapper mapOfAdmin implementation:\n' sed -n '140,200p' src/main/java/de/caritas/cob/userservice/api/UserServiceMapper.java sed -n '320,360p' src/main/java/de/caritas/cob/userservice/api/UserServiceMapper.java printf '\nTransaction annotations in admin service package:\n' rg -n -B2 -A2 '`@Transactional`|findSupportAdminsByInfix|findAgencyAdminsByInfix|findTenantAdminsByInfix' \ src/main/java/de/caritas/cob/userservice/api/admin/service/admin || true printf '\nInfix admin controller params / services:\n' rg -n -B5 -A15 'findSupportAdminsByInfix|findAgencyAdminsByInfix|findTenantAdminsByInfix' \ src/main/java/de/caritas/cob/userservice/api
Repository: OpenResilienceInitiative/ORISO-UserService
Length of output: 50398
Add a read-only transaction boundary around the admin snapshot.
findSupportAdminsByInfix reads the paged support admin list, full admin records, and consultant identity IDs. Wrap these reads in a read-only transaction so the mapper cannot receive page entries whose full admin records are already gone or inconsistent.
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/main/java/de/caritas/cob/userservice/api/admin/service/admin/SupportAdminUserService.java`
around lines 32 - 41, Annotate findSupportAdminsByInfix with a read-only
transaction boundary covering the paged admin query, full-admin lookup, and
consultant identity lookup, ensuring the subsequent mapping uses one consistent
read snapshot.
Source: Path instructions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| SUPER, | ||
| /** Global Support Admin (ADR-018) — additive support identity, separate from Platform Admin. */ | ||
| SUPPORT | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🔴 Critical | ⚡ Quick win
🏁 Script executed:
#!/bin/bash # Description: Find the admin table's `type` column definition across Liquibase changesets. fd -e xml -e sql . src/main/resources/db/changelog | xargs rg -l -i 'admin' | while IFS= read -r f; do echo "== $f ==" rg -n -i -B3 -A3 'name="type"|`type`|type varchar|type VARCHAR' "$f" done
Repository: OpenResilienceInitiative/ORISO-UserService
Length of output: 2304
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "== Admin.java relevant lines ==" sed -n '45,115p' src/main/java/de/caritas/cob/userservice/api/model/Admin.java | cat -n echo echo "== AdminType usages ==" rg -n "AdminType\.|enum AdminType|`@Enumerated`\(EnumType\.STRING\)|`@Column`\(length = 6" src/main/java src/main/resources/db/changelog echo echo "== Admin table init ==" sed -n '1,80p' src/main/resources/db/changelog/changeset/0035_admin/admin.sql | cat -n
Repository: OpenResilienceInitiative/ORISO-UserService
Length of output: 11488
🏁 Script executed:
#!/bin/bash set -euo pipefail # Check support-admin service flow and persist/create/update paths around AdminType.SUPPORT. for f in \ src/main/java/de/caritas/cob/userservice/api/admin/service/admin/SupportAdminUserService.java \ src/main/java/de/caritas/cob/userservice/api/admin/service/admin/retrieve/RetrieveAdminService.java \ src/main/java/de/caritas/cob/userservice/api/admin/service/admin/create/CreateAdminService.java \ src/main/java/de/caritas/cob/userservice/api/admin/service/admin/update/UpdateAdminService.java \ src/main/java/de/caritas/cob/userservice/api/admin/service/admin/repository/AdminRepository.java do if [ -f "$f" ]; then echo "== $f ==" wc -l "$f" sed -n '1,220p' "$f" | cat -n fi done echo echo "== Search for SUPPORT enum persistence and repository method types ==" rg -n "AdminType\.SUPPORT|SUPPORT|AdminRepository|Type\(|findBy.*Type|save|update|findById|exists|type" \ src/main/java/de/caritas/cob/userservice/api/admin \ src/main/java/de/caritas/cob/userservice/api/model/Admin.java
Repository: OpenResilienceInitiative/ORISO-UserService
Length of output: 50398
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "== Support admin repo/service/controller outline and exact files ==" fd -i 'supportadmin|SupportAdmin' src/main/java | sort for f in $(fd -i 'supportadmin|SupportAdmin' src/main/java | sort); do echo "== $f ==" wc -l "$f" sed -n '1,220p' "$f" | cat -n done echo echo "== Repository methods for Admin ==" fd -i 'adminrepository|AdminRepository' src/main/java | sort | while read -r f; do echo "== $f ==" sed -n '1,200p' "$f" | cat -n done echo echo "== Support admin references, limited ==" rg -n "SupportAdminUserService|findSupportAdminsByInfix|SUPPORT|adminRepository|AdminRepository" \ src/main/java/de/caritas/cob/userservice/api/admin src/main/java/de/caritas/cob/userservice/api/model/Admin.java
Repository: OpenResilienceInitiative/ORISO-UserService
Length of output: 14840
Widen Admin.type to store AdminType.SUPPORT.
AdminType.SUPPORT is 7 chars, while Admin.type is mapped as varchar(6) and Liquibase declares admin.type varchar(6). Existing types fit in 6 chars, so SUPPORT either saves as truncated discriminator data or fails on insert. Add a Liquibase changeset that widens admin.type and update @Column(length = ...) to the same width.
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/main/java/de/caritas/cob/userservice/api/model/Admin.java` around lines
60 - 63, Widen the Admin.type persistence column to accommodate the 7-character
AdminType.SUPPORT value: update the `@Column` length on the Admin.type field and
add a Liquibase changeset altering admin.type from varchar(6) to the matching
larger width. Keep the existing enum mappings unchanged.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| public enum HandshakeStatus { | ||
| PENDING, | ||
| CONFIRMED, | ||
| EXPIRED | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🏁 Script executed:
#!/bin/bash # Check the persisted status column width and any status-value constraints. fd -e sql -e xml . src/main/resources/db/changelog --exec rg -n -i -C3 'handshake_session|status' {} # Find every consumer that branches on HandshakeStatus. rg -n -C3 'HandshakeStatus\.' src/main src/test
Repository: OpenResilienceInitiative/ORISO-UserService
Length of output: 25794
Persist a distinct CONFIRM_LOCKED handshake status.
HandshakeSession.HandshakeStatus only defines PENDING, CONFIRMED, and EXPIRED, while the lockout path records repeated confirmation failures as EXPIRED. The handshake_session.status column is VARCHAR(16), so CONFIRM_LOCKED fits existing schema width. Add the enum value and persist it in the failed-attempt lockout path so expiry and brute-force lockout do not produce the same terminal audit state.
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/main/java/de/caritas/cob/userservice/api/model/HandshakeSession.java`
around lines 30 - 34, Add CONFIRM_LOCKED to HandshakeSession.HandshakeStatus and
update the repeated-confirmation-failure lockout path to persist that status
instead of EXPIRED. Keep EXPIRED for normal handshake expiry so the two terminal
audit states remain distinct.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| void confirm_Should_ConfirmAndNotifyHandlers_When_CounterpartPasswordIsValid() { | ||
| var session = pendingSession(); | ||
| when(handshakeSessionRepository.findById("hs-1")).thenReturn(Optional.of(session)); | ||
| when(keycloakAuthClient.verifyIgnoringOtp("consultant.user", "pw")).thenReturn(true); | ||
| when(handshakeSessionRepository.save(any(HandshakeSession.class))) | ||
| .thenAnswer(invocation -> invocation.getArgument(0)); | ||
| when(completionHandler.supports(HandshakePurpose.SUPPORT_ACCESS)).thenReturn(true); | ||
|
|
||
| var item = handshakeService.confirm(consultant(), "hs-1", "pw"); | ||
|
|
||
| assertThat(item.getStatus()).isEqualTo("CONFIRMED"); | ||
| assertThat(session.getStatus()).isEqualTo(HandshakeSession.HandshakeStatus.CONFIRMED); | ||
| assertThat(session.getConfirmedDate()).isNotNull(); | ||
| verify(completionHandler).onConfirmed(session); | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Assert the confirmation audit entry.
Issue #495 requires an audit entry for every transition. The expiry test at line 259 and the role-mismatch test at line 305 both verify handshakeAuditEventRepository.save. The happy path does not. If the CONFIRMED audit write were removed from HandshakeService.confirm, this test would still pass, and the successful two-person transition would leave no audit record.
assertThat(session.getConfirmedDate()).isNotNull();
verify(completionHandler).onConfirmed(session);
+ verify(handshakeAuditEventRepository).save(any());
}As per path instructions: "Tests must be able to fail. Flag over-mocking that hides the defect, assertions that cannot break, and missing edge cases."
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| void confirm_Should_ConfirmAndNotifyHandlers_When_CounterpartPasswordIsValid() { | |
| var session = pendingSession(); | |
| when(handshakeSessionRepository.findById("hs-1")).thenReturn(Optional.of(session)); | |
| when(keycloakAuthClient.verifyIgnoringOtp("consultant.user", "pw")).thenReturn(true); | |
| when(handshakeSessionRepository.save(any(HandshakeSession.class))) | |
| .thenAnswer(invocation -> invocation.getArgument(0)); | |
| when(completionHandler.supports(HandshakePurpose.SUPPORT_ACCESS)).thenReturn(true); | |
| var item = handshakeService.confirm(consultant(), "hs-1", "pw"); | |
| assertThat(item.getStatus()).isEqualTo("CONFIRMED"); | |
| assertThat(session.getStatus()).isEqualTo(HandshakeSession.HandshakeStatus.CONFIRMED); | |
| assertThat(session.getConfirmedDate()).isNotNull(); | |
| verify(completionHandler).onConfirmed(session); | |
| } | |
| void confirm_Should_ConfirmAndNotifyHandlers_When_CounterpartPasswordIsValid() { | |
| var session = pendingSession(); | |
| when(handshakeSessionRepository.findById("hs-1")).thenReturn(Optional.of(session)); | |
| when(keycloakAuthClient.verifyIgnoringOtp("consultant.user", "pw")).thenReturn(true); | |
| when(handshakeSessionRepository.save(any(HandshakeSession.class))) | |
| .thenAnswer(invocation -> invocation.getArgument(0)); | |
| when(completionHandler.supports(HandshakePurpose.SUPPORT_ACCESS)).thenReturn(true); | |
| var item = handshakeService.confirm(consultant(), "hs-1", "pw"); | |
| assertThat(item.getStatus()).isEqualTo("CONFIRMED"); | |
| assertThat(session.getStatus()).isEqualTo(HandshakeSession.HandshakeStatus.CONFIRMED); | |
| assertThat(session.getConfirmedDate()).isNotNull(); | |
| verify(completionHandler).onConfirmed(session); | |
| verify(handshakeAuditEventRepository).save(any()); | |
| } |
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/test/java/de/caritas/cob/userservice/api/service/handshake/HandshakeServiceTest.java`
around lines 208 - 222, Update
confirm_Should_ConfirmAndNotifyHandlers_When_CounterpartPasswordIsValid to
verify handshakeAuditEventRepository.save was called for the successful
CONFIRMED transition, matching the audit assertions in the expiry and
role-mismatch tests. Ensure the verification covers the saved event for this
session and confirmation transition so removing the audit write from
HandshakeService.confirm causes the test to fail.
Source: Path instructions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @Test | ||
| void confirm_Should_ForbidCrossTenant_When_PurposeIsTenantScoped() { | ||
| // RECOVERY/IDENTITY purposes are tenant-scoped; only SUPPORT_ACCESS crosses | ||
| // tenants by design (platform support). | ||
| var session = pendingSession(); | ||
| session.setPurpose(HandshakePurpose.RECOVERY_CONSULTANT); | ||
| session.setTenantId(1L); | ||
| when(handshakeSessionRepository.findById("hs-1")).thenReturn(Optional.of(session)); | ||
| var crossTenantAdmin = new AuthenticatedUser(); | ||
| crossTenantAdmin.setUserId(CONSULTANT_ID); | ||
| crossTenantAdmin.setUsername("agency.admin"); | ||
| crossTenantAdmin.setRoles(Set.of("agency-admin")); | ||
| crossTenantAdmin.setTenantId(2L); | ||
|
|
||
| assertThatThrownBy(() -> handshakeService.confirm(crossTenantAdmin, "hs-1", "pw")) | ||
| .isInstanceOf(ForbiddenException.class); | ||
|
|
||
| verify(completionHandler, never()).onConfirmed(any()); | ||
| } | ||
|
|
||
| @Test | ||
| void confirm_Should_AllowCrossTenant_When_PurposeIsSupportAccess() { | ||
| var session = pendingSession(); | ||
| session.setTenantId(0L); // platform-side support admin | ||
| when(handshakeSessionRepository.findById("hs-1")).thenReturn(Optional.of(session)); | ||
| when(keycloakAuthClient.verifyIgnoringOtp("consultant.user", "pw")).thenReturn(true); | ||
| when(handshakeSessionRepository.save(any(HandshakeSession.class))) | ||
| .thenAnswer(invocation -> invocation.getArgument(0)); | ||
| var tenantConsultant = consultant(); | ||
| tenantConsultant.setTenantId(5L); | ||
|
|
||
| var item = handshakeService.confirm(tenantConsultant, "hs-1", "pw"); | ||
|
|
||
| assertThat(item.getStatus()).isEqualTo("CONFIRMED"); | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Add the positive tenant-scoped cases.
Both tenant tests are one-sided. Line 343 proves a tenant mismatch is rejected, and line 363 proves SUPPORT_ACCESS crosses tenants. No test proves a tenant-scoped purpose succeeds when the tenants match. If enforceTenantPolicy rejected every tenant-scoped confirmation, both tests would still pass and the RECOVERY_* and IDENTITY_GRANT flows would be fully broken in production.
HandshakePurpose lines 41-42 also promise a second allowance: the counterpart may be platform-scoped (tenant 0) on a tenant-scoped purpose. That branch has no test either.
Add two cases: matching tenant confirms, and a tenant-0 counterpart confirms a tenant-scoped purpose.
`@Test` void confirm_Should_AllowSameTenant_When_PurposeIsTenantScoped() { var session = pendingSession(); session.setPurpose(HandshakePurpose.RECOVERY_CONSULTANT); session.setTenantId(1L); when(handshakeSessionRepository.findById("hs-1")).thenReturn(Optional.of(session)); when(keycloakAuthClient.verifyIgnoringOtp("agency.admin", "pw")).thenReturn(true); when(handshakeSessionRepository.save(any(HandshakeSession.class))) .thenAnswer(invocation -> invocation.getArgument(0)); var sameTenantAdmin = new AuthenticatedUser(); sameTenantAdmin.setUserId(CONSULTANT_ID); sameTenantAdmin.setUsername("agency.admin"); sameTenantAdmin.setRoles(Set.of("agency-admin")); sameTenantAdmin.setTenantId(1L); assertThat(handshakeService.confirm(sameTenantAdmin, "hs-1", "pw").getStatus()) .isEqualTo("CONFIRMED"); } `@Test` void confirm_Should_AllowPlatformScopedCounterpart_When_PurposeIsTenantScoped() { // HandshakePurpose: a tenant-scoped purpose also accepts a platform-scoped (tenant 0) counterpart. var session = pendingSession(); session.setPurpose(HandshakePurpose.RECOVERY_CONSULTANT); session.setTenantId(1L); when(handshakeSessionRepository.findById("hs-1")).thenReturn(Optional.of(session)); when(keycloakAuthClient.verifyIgnoringOtp("agency.admin", "pw")).thenReturn(true); when(handshakeSessionRepository.save(any(HandshakeSession.class))) .thenAnswer(invocation -> invocation.getArgument(0)); var platformAdmin = new AuthenticatedUser(); platformAdmin.setUserId(CONSULTANT_ID); platformAdmin.setUsername("agency.admin"); platformAdmin.setRoles(Set.of("agency-admin")); platformAdmin.setTenantId(0L); assertThat(handshakeService.confirm(platformAdmin, "hs-1", "pw").getStatus()) .isEqualTo("CONFIRMED"); }
As per path instructions: "Tests must be able to fail. Flag over-mocking that hides the defect, assertions that cannot break, and missing edge cases."
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/test/java/de/caritas/cob/userservice/api/service/handshake/HandshakeServiceTest.java`
around lines 342 - 376, Add positive coverage in the handshake confirmation
tests for tenant-scoped purposes: add cases proving confirm succeeds when the
counterpart has the same tenant ID and when the counterpart is platform-scoped
with tenant ID 0. Configure successful authentication and persistence, then
assert the returned status is CONFIRMED so an over-restrictive
enforceTenantPolicy implementation fails.
Source: Path instructions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @Test | ||
| void pendingForCounterpart_Should_ReturnOnlyUnexpiredPendingSessions() { | ||
| var session = pendingSession(); | ||
| when(handshakeSessionRepository.findAllByCounterpartIdAndStatusAndExpiryDateAfter( | ||
| any(), any(), any(LocalDateTime.class))) | ||
| .thenReturn(List.of(session)); | ||
|
|
||
| var items = handshakeService.pendingForCounterpart(consultant()); | ||
|
|
||
| assertThat(items).hasSize(1); | ||
| assertThat(items.get(0).getPurpose()).isEqualTo("SUPPORT_ACCESS"); | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Both query tests stub the repository with any() and assert nothing about the arguments. Each test names a guarantee that lives entirely in the mocked derived query, so neither test can fail on the behavior it claims to cover. Capture the arguments the service passes and assert them.
src/test/java/de/caritas/cob/userservice/api/service/handshake/HandshakeServiceTest.java#L380-L391: verify findAllByCounterpartIdAndStatusAndExpiryDateAfter receives the counterpart id, status PENDING, and a cutoff near the current UTC time.src/test/java/de/caritas/cob/userservice/api/service/handshake/HandshakeServiceTest.java#L393-L407: verify findAllByStatusAndExpiryDateBefore receives status PENDING and a Pageable whose page size equals the configured sweepBatchSize of 200.As per path instructions: "Tests must be able to fail. Flag over-mocking that hides the defect, assertions that cannot break, and missing edge cases."
src/test/java/de/caritas/cob/userservice/api/service/handshake/HandshakeServiceTest.java#L380-L391 (this comment)src/test/java/de/caritas/cob/userservice/api/service/handshake/HandshakeServiceTest.java#L393-L407Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/test/java/de/caritas/cob/userservice/api/service/handshake/HandshakeServiceTest.java`
around lines 380 - 391, Strengthen both query tests in
src/test/java/de/caritas/cob/userservice/api/service/handshake/HandshakeServiceTest.java:380-391
and 393-407 by capturing repository invocation arguments instead of stubbing all
parameters with any(). In
pendingForCounterpart_Should_ReturnOnlyUnexpiredPendingSessions, assert the
counterpart id, PENDING status, and a UTC cutoff near the current time passed to
findAllByCounterpartIdAndStatusAndExpiryDateAfter; in the sibling test, assert
findAllByStatusAndExpiryDateBefore receives PENDING and a Pageable with the
configured sweepBatchSize of 200.
Source: Path instructions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| private void stubHappyMatrix() throws Exception { | ||
| when(matrixSynapseService.userExists("sam.support")).thenReturn(true); | ||
| when(matrixSynapseService.loginAsUserAccessToken(GSA_MXID)).thenReturn("gsa-token"); | ||
| when(matrixSynapseService.loginAsUserAccessToken(CONSULTANT_MXID)) | ||
| .thenReturn("consultant-token"); | ||
| var roomResponse = new MatrixCreateRoomResponseDTO(); | ||
| roomResponse.setRoomId(ROOM_ID); | ||
| when(matrixSynapseService.createRoom(anyString(), any(), eq("gsa-token"))) | ||
| .thenReturn(ResponseEntity.ok(roomResponse)); | ||
| when(matrixSynapseService.joinRoom(ROOM_ID, "consultant-token")).thenReturn(true); | ||
| } | ||
|
|
||
| // --- creation on confirmed handshake --- | ||
|
|
||
| @Test | ||
| void createForConfirmedHandshake_Should_CreateEncryptedRoomWithBothMembersAndFourHourLease() | ||
| throws Exception { | ||
| when(adminRepository.findById(GSA_ID)).thenReturn(Optional.of(gsa())); | ||
| when(consultantRepository.findByIdAndDeleteDateIsNull(CONSULTANT_ID)) | ||
| .thenReturn(Optional.of(consultantWithMatrix())); | ||
| stubHappyMatrix(); | ||
| when(supportRoomRepository.save(any(SupportRoom.class))) | ||
| .thenAnswer(invocation -> invocation.getArgument(0)); | ||
|
|
||
| var room = supportRoomService.createForConfirmedHandshake(confirmedSession()); | ||
|
|
||
| verify(matrixSynapseService).inviteUserToRoom(ROOM_ID, CONSULTANT_MXID, "gsa-token"); | ||
| verify(matrixSynapseService).joinRoom(ROOM_ID, "consultant-token"); | ||
| assertThat(room.getMatrixRoomId()).isEqualTo(ROOM_ID); | ||
| assertThat(room.getStatus()).isEqualTo(SupportRoom.SupportRoomStatus.ACTIVE); | ||
| assertThat(room.getSupportAdminId()).isEqualTo(GSA_ID); | ||
| assertThat(room.getConsultantId()).isEqualTo(CONSULTANT_ID); | ||
| assertThat(room.getExpiryDate()) | ||
| .isAfter(LocalDateTime.now(ZoneOffset.UTC).plusHours(3)) | ||
| .isBefore(LocalDateTime.now(ZoneOffset.UTC).plusHours(5)); | ||
| verify(handshakeAuditEventRepository).save(any()); | ||
| } | ||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Missing test for the Matrix account auto-provisioning branch.
Every happy-path test stubs userExists(...) to return true (Line 97), so resolveSupportAdminMatrixId's createUser(...) branch — which registers a brand-new Matrix account with a discarded random password — is never exercised. Add a test where userExists returns false and assert createUser is called and its returned userId is used.
As per path instructions for src/test/**/*.java: "Flag over-mocking that hides the defect, assertions that cannot break, and missing edge cases."
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/test/java/de/caritas/cob/userservice/api/service/support/SupportRoomServiceTest.java`
around lines 96 - 133, Add a test alongside
createForConfirmedHandshake_Should_CreateEncryptedRoomWithBothMembersAndFourHourLease
that stubs matrixSynapseService.userExists("sam.support") to return false,
configures createUser to return a response containing a Matrix user ID, and
executes the confirmed-handshake creation flow. Verify createUser is invoked and
that the returned user ID is used in the subsequent Matrix operations, while
retaining assertions that the room is created successfully.
Source: Path instructions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| assertThat(room.getExpiryDate()) | ||
| .isAfter(LocalDateTime.now(ZoneOffset.UTC).plusHours(3)) | ||
| .isBefore(LocalDateTime.now(ZoneOffset.UTC).plusHours(5)); | ||
| verify(handshakeAuditEventRepository).save(any()); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Audit assertions cannot detect wrong event data.
verify(handshakeAuditEventRepository).save(any()); at Lines 131, 180, and 215 only checks that some call happened. It cannot fail if the code saves the wrong event constant, drops tenantId, or records the wrong actorId. Capture the argument and assert on its fields.
+import org.mockito.ArgumentCaptor; +import de.caritas.cob.userservice.api.model.HandshakeAuditEvent; ... - verify(handshakeAuditEventRepository).save(any()); + var captor = ArgumentCaptor.forClass(HandshakeAuditEvent.class); + verify(handshakeAuditEventRepository).save(captor.capture()); + assertThat(captor.getValue().getEvent()).isEqualTo("SUPPORT_ROOM_CREATED"); + assertThat(captor.getValue().getTenantId()).isEqualTo(1L);
Also applies to: 180-180, 215-215
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/test/java/de/caritas/cob/userservice/api/service/support/SupportRoomServiceTest.java`
at line 131, Update the audit assertions in the affected SupportRoomServiceTest
cases to capture the argument passed to handshakeAuditEventRepository.save
rather than matching any value. Assert the captured event’s event constant,
tenantId, and actorId fields against the expected values for each scenario,
while preserving verification that save is invoked.
Source: Path instructions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
PR #502 added @scheduled methods on HandshakeService and SupportRoomService without updating the replica-safety catalog, which broke the PreDev CI contract inherited by docs/add-agents-md.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.