GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(auth): self-service password reset (mirrors Magic Link) by Storypapst · Pull Request #439 · OpenResilienceInitiative/ORISO-UserService

Conversation

@Storypapst

@Storypapst Storypapst commented Jul 15, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Affected repos: ORISO-UserService, ORISO-Frontend (OpenResilienceInitiative/ORISO-Frontend#470 for the frontend half)

Why

Closes the need for ORISO-Helm#72 (localizing Keycloak's hosted password-reset email) by moving password reset fully in-app, mirroring the existing self-service Magic Link login pattern instead of depending on Keycloak's theme.

What changed

  • New PasswordResetService (service/auth/), architecturally identical to MagicLinkLoginService:
    • requestPasswordReset(username, locale) — resolves the account (asker or consultant, same username-transcoder fallback logic as Magic Link), generates a one-time token (120 min TTL, in-memory store), and sends a branded HTML email directly via the existing global SMTP settings (from ConsultingTypeService), localized into all 6 platform languages. Always completes silently regardless of whether the account exists or has a real (non-dummy) email, to avoid account enumeration — this is stricter than Magic Link, which does leak an enabled/not-enabled distinction.
    • confirmPasswordReset(token, newPassword) — validates the one-time token, then calls the existing KeycloakService.updatePassword to actually set the new password. Token is single-use.
  • New endpoints: POST /users/password-reset/request, POST /users/password-reset/confirm, wired through UserController → UserRegistrationControllerDelegate, same pattern as the magic-link endpoints.
  • SecurityConfig + StatelessCsrfFilter: whitelisted the new endpoints as public/CSRF-exempt bootstrap endpoints (the requester has no session yet), same treatment as magic-link.
  • New config: password.reset.frontend.base-url (defaults to https://app.oriso.org), used to build the link sent in the email.

Tests

  • 15 new unit tests for PasswordResetService (blank/unknown/dummy-email inputs, SMTP not-configured, SMTP happy-path, locale fallback, consultant-vs-asker resolution, token expiry/single-use/cleanup, confirm success/failure).
  • Updated UserRegistrationControllerDelegateTest with the new mock + 3 delegate-level tests.
  • Full suite: 3558 tests pass, no regressions.

Verified on Pre-Dev

  • Hot-deployed (docker build → k3s ctr images import → kubectl set image, image tag oriso-userservice:password-reset-e2e) — not a persistent deploy, will be overwritten by the next real :dev rollout, so this PR still needs to merge to persist.
  • POST /service/users/password-reset/request responds 204 for both known and unknown accounts (no enumeration).
  • Confirmed Pre-Dev's global SMTP is enabled and configured (globalSmtpEnabled=true, real host), so the email-send path is live and will fire for any account with a real email.

Not yet done

  • Full click-through of a received reset email end-to-end — need a Pre-Dev consultant account with a real inbox to finish this (askers don't have real emails by design). Will follow up with a screenshot once available.

Summary by CodeRabbit

  • New Features
    • Added self-service password reset request and confirmation endpoints (no-auth + CSRF exempt), backed by validated request payloads.
    • Implemented one-time, time-limited reset tokens and localized HTML reset emails with environment-driven link generation via password.reset.frontend.base-url.
  • Security
    • Exempted password-reset routes from authentication and CSRF checks (exact request/confirm paths, including optional /service prefix).
  • Bug Fixes
    • Reset confirmation fails safely on invalid/expired inputs; tokens are consumed only after a successful password update.
  • Tests
    • Added unit tests for controller delegation and password reset service success/failure and token lifecycle scenarios.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Hassan9215 and others added 2 commits July 13, 2026 17:23
@Hassan9215
Merge pull request #429 from OpenResilienceInitiative/pre-dev
4d3c370
Sync pre-dev into dev
@Storypapst
feat(auth): self-service password reset (mirrors Magic Link)
6e9f895
@cursor

cursor Bot commented Jul 15, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds self-service password-reset request and confirmation endpoints with validated DTOs, public security rules, localized email delivery, expiring one-time tokens, Keycloak password updates, runtime SMTP configuration, and unit coverage.

Changes

Password reset flow

Layer / File(s) Summary
Reset service and token lifecycle
src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java
Adds account resolution, dummy-account filtering, localized reset emails, runtime SMTP configuration, expiring in-memory tokens, frontend reset URLs, and token-consuming Keycloak password updates.
Validated public endpoints and access rules
src/main/java/de/caritas/cob/userservice/api/adapters/web/dto/*, src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/*, src/main/java/de/caritas/cob/userservice/api/config/auth/SecurityConfig.java, src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/interceptor/StatelessCsrfFilter.java, src/main/resources/application.properties
Adds validated request DTOs and controller delegation, returns 204 No Content or 400 Bad Request, permits password-reset requests through authorization and CSRF rules, and adds frontend URL configuration.
Password reset behavior coverage
src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java, src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserRegistrationControllerDelegateTest.java
Covers account resolution, silent request handling, SMTP failures, locale fallback, token expiry, retry behavior, single-use tokens, and delegate response codes.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant UserController
  participant UserRegistrationControllerDelegate
  participant PasswordResetService
  participant KeycloakService

  Client->>UserController: POST password-reset/request
  UserController->>UserRegistrationControllerDelegate: pass validated request
  UserRegistrationControllerDelegate->>PasswordResetService: requestPasswordReset(username, locale)
  PasswordResetService-->>UserRegistrationControllerDelegate: complete silently
  UserRegistrationControllerDelegate-->>Client: 204 No Content

  Client->>UserController: POST password-reset/confirm
  UserController->>UserRegistrationControllerDelegate: pass validated token and password
  UserRegistrationControllerDelegate->>PasswordResetService: confirmPasswordReset(token, newPassword)
  PasswordResetService->>KeycloakService: updatePassword(...)
  KeycloakService-->>PasswordResetService: update result
  PasswordResetService-->>UserRegistrationControllerDelegate: boolean status
  UserRegistrationControllerDelegate-->>Client: 204 or 400 response
Loading
🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.93% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Validation Evidence ✅ Passed PASS: The PR adds dedicated unit tests for PasswordResetService and delegate coverage, and the description reports the full suite passing (3,558 tests).
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding self-service password reset support mirroring the Magic Link flow.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/password-reset-self-service

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.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Storypapst Storypapst mentioned this pull request Jul 15, 2026
feat(login): in-app branded password reset flow (replaces Keycloak redirect) OpenResilienceInitiative/ORISO-Frontend#470
Merged
@Storypapst Storypapst added the coderabbit label Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/password-reset-self-service

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.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Storypapst

Storypapst commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Storypapst
fix(auth): don't burn the reset token on a failed password update
f7000a6
Self-review found that confirmPasswordReset removed the one-time token
before calling KeycloakService.updatePassword, with no restore on
failure — unlike MagicLinkLoginService, which explicitly restores its
token when the exchange fails. If Keycloak rejected the new password
(e.g. a policy violation), the user's emailed link was burned on the
first attempt, forcing them to request an entirely new email instead
of just retrying with a different password.

Token is now only removed after a successful update.
coderabbitai[bot]
coderabbitai Bot requested changes Jul 17, 2026
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

🤖 Prompt for all review comments with 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.

Inline comments:
In
`@src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/interceptor/StatelessCsrfFilter.java`:
- Around line 103-108: The password-reset CSRF exemption is too broad. In
StatelessCsrfFilter, replace the URI substring check with exact matching for the
four intended POST routes: direct and /service request and confirm paths. In
SecurityConfig, remove the redundant broad password-reset regex while retaining
the existing exact POST matchers.

In
`@src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java`:
- Line 52: Replace the in-memory resetTokens ConcurrentHashMap used by
PasswordResetService with a shared persistent store, such as Redis or the
database, configured with a 120-minute TTL. Update token creation, lookup, and
invalidation to use that store so tokens survive restarts and can be confirmed
across replicas.
- Around line 67-84: Update requestPasswordReset to enqueue the complete account
lookup, eligibility checks, locale resolution, and sendPasswordResetEmailSafely
operation, returning immediately before any account-dependent work executes.
Preserve the existing blank-input guard and ensure the queued task handles
unknown, dummy, or missing-email accounts without changing the external
response.
- Around line 146-178: Update the token storage flow around
generateAndStoreToken so expired entries are removed before inserting each new
token. In the password-reset email dispatch flow, remove the generated
oneTimeToken from storage when message creation or Transport.send fails, while
preserving the existing failure propagation behavior.
- Around line 57-58: Update the passwordResetFrontendBaseUrl configuration in
PasswordResetService to remove the hardcoded production URL default, making the
property required so missing configuration fails validation rather than falling
back to app.oriso.org.
- Around line 179-183: Update the catch block in PasswordResetService to remove
target.getKeycloakUserId() and ex.getMessage() from the warning log. Log only a
generic, non-identifying password-reset email dispatch failure category, without
recipient, SMTP, account, or other exception details.
- Around line 101-109: Update the token confirmation flow around resetTokens and
keycloakService.updatePassword to atomically remove the token only if it still
maps to the validated entry before updating Keycloak. If the Keycloak update
rejects or fails, restore that exact token entry; otherwise keep it removed so
concurrent confirmations cannot reuse it.

In
`@src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserRegistrationControllerDelegateTest.java`:
- Around line 369-390: Update both confirmPasswordReset tests around
UserRegistrationControllerDelegateTest to verify
passwordResetService.confirmPasswordReset is invoked with the exact token and
new password used by each test, while retaining the existing status assertions
so the tests fail if delegation is hardcoded or incorrect.

In
`@src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java`:
- Around line 33-34: Remove the class-level `@MockitoSettings`(strictness =
Strictness.LENIENT) from PasswordResetServiceTest and restore Mockito’s default
strict stubbing; if a specific test requires leniency, apply it only to that
individual stub rather than weakening the entire suite.
- Around line 67-167: Strengthen the requestPasswordReset tests around
PasswordResetService by injecting or mocking a mail-delivery abstraction instead
of allowing Transport.send to contact smtp.invalid. Verify account resolution,
generated reset URL/token, selected locale content, recipient, and invocation
count for valid-send scenarios; retain explicit zero-interaction assertions for
unknown accounts, blank or dummy emails, and unavailable SMTP. Replace
no-exception-only assertions where they cannot detect missing flow behavior, and
flag or remove assertions that provide no meaningful coverage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a6586411-ca31-4b23-a3f0-297ae8462f67

📥 Commits

Reviewing files that changed from the base of the PR and between cd18f7e and f7000a6.

📒 Files selected for processing (9)
  • src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/UserController.java
  • src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/UserRegistrationControllerDelegate.java
  • src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/interceptor/StatelessCsrfFilter.java
  • src/main/java/de/caritas/cob/userservice/api/adapters/web/dto/PasswordResetConfirmDTO.java
  • src/main/java/de/caritas/cob/userservice/api/adapters/web/dto/PasswordResetRequestDTO.java
  • src/main/java/de/caritas/cob/userservice/api/config/auth/SecurityConfig.java
  • src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java
  • src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserRegistrationControllerDelegateTest.java
  • src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: test, build and Docker validation
  • GitHub Check: integration-tests (non-blocking, burn-in)
  • GitHub Check: integration-tests (non-blocking, burn-in)
  • GitHub Check: test and build UserService
🧰 Additional context used
📓 Path-based instructions (2)
src/main/**/*.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/dto/PasswordResetConfirmDTO.java
  • src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/interceptor/StatelessCsrfFilter.java
  • src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/UserController.java
  • src/main/java/de/caritas/cob/userservice/api/adapters/web/dto/PasswordResetRequestDTO.java
  • src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/UserRegistrationControllerDelegate.java
  • src/main/java/de/caritas/cob/userservice/api/config/auth/SecurityConfig.java
  • src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java
src/test/**/*.java

⚙️ 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/UserRegistrationControllerDelegateTest.java
  • src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java
🧠 Learnings (1)
📚 Learning: 2026-07-12T05:15:05.095Z
Learnt 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/dto/PasswordResetConfirmDTO.java
  • src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/interceptor/StatelessCsrfFilter.java
  • src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/UserController.java
  • src/main/java/de/caritas/cob/userservice/api/adapters/web/dto/PasswordResetRequestDTO.java
  • src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/UserRegistrationControllerDelegate.java
  • src/main/java/de/caritas/cob/userservice/api/config/auth/SecurityConfig.java
  • src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java
🪛 ast-grep (0.44.1)
src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java

[warning] 360-396: Do not use DES
Context: Map.of(
"de",
new EmailContent(
"Passwort zurücksetzen",
"Es wurde eine Änderung der Anmeldeinformationen für Ihren Account Caritas Onlineberatung angefordert. Wenn Sie diese Änderung beantragt haben, klicken Sie auf den unten stehenden Link.",
"Link zum Zurücksetzen von Anmeldeinformationen",
"Die Gültigkeit des Links wird in 120 Minuten verfallen. Sollten Sie keine Änderung vollziehen wollen, können Sie diese Nachricht ignorieren."),
"en",
new EmailContent(
"Reset password",
"A change of login credentials for your Caritas Online Counselling account has been requested. If you requested this change, click the link below.",
"Link to reset login credentials",
"This link will expire in 120 minutes. If you do not want to make this change, you can ignore this message."),
"fr",
new EmailContent(
"Réinitialiser le mot de passe",
"Une modification des informations de connexion de votre compte Caritas Online-Beratung a été demandée. Si vous êtes à l'origine de cette demande, cliquez sur le lien ci-dessous.",
"Lien pour réinitialiser les informations de connexion",
"Ce lien expirera dans 120 minutes. Si vous ne souhaitez pas effectuer cette modification, vous pouvez ignorer ce message."),
"ru",
new EmailContent(
"Сброс пароля",
"Был запрошен сброс учётных данных для входа в ваш аккаунт Caritas Online-Beratung. Если вы запросили это изменение, перейдите по ссылке ниже.",
"Ссылка для сброса учётных данных",
"Срок действия ссылки истекает через 120 минут. Если вы не хотите вносить это изменение, просто проигнорируйте это письмо."),
"ti",
new EmailContent(
"ፓስዎርድ ዳግማይ ምቕማጥ",
"ንኣካውንትካ Caritas Online-Beratung ናይ መእተዊ ሓበሬታ ንምቕያር ተሓቲቱ ኣሎ። እዚ ለውጢ እዚ ንስኻ እንተኾንካ ሓቲትካዮ፣ ነቲ ኣብ ታሕቲ ዘሎ ሊንክ ጠውቕ።",
"ናይ መእተዊ ሓበሬታ ዳግማይ ንምቕማጥ ዝኸውን ሊንክ",
"ጽንዓት እዚ ሊንክ እዚ ኣብ 120 ደቓይቕ ክውዳእ እዩ። እዚ ለውጢ እዚ ክትገብር ዘይትደሊ እንተኾንካ፣ ነዚ መልእኽቲ እዚ ክትንዕቆ ትኽእል ኢኻ።"),
"tr",
new EmailContent(
"Şifreyi sıfırla",
"Caritas Online-Beratung hesabınız için oturum açma bilgilerinizde bir değişiklik talep edildi. Bu değişikliği siz talep ettiyseniz aşağıdaki bağlantıya tıklayın.",
"Oturum açma bilgilerini sıfırlama bağlantısı",
"Bu bağlantının geçerlilik süresi 120 dakika içinde dolacaktır. Bu değişikliği yapmak istemiyorsanız bu mesajı yok sayabilirsiniz."))
Note: [CWE-326] Inadequate Encryption Strength.

(no-des-cipher)


[warning] 366-366: Do not use DES
Context: "Die Gültigkeit des Links wird in 120 Minuten verfallen. Sollten Sie keine Änderung vollziehen wollen, können Sie diese Nachricht ignorieren."
Note: [CWE-326] Inadequate Encryption Strength.

(no-des-cipher)


[warning] 376-376: Do not use DES
Context: "Une modification des informations de connexion de votre compte Caritas Online-Beratung a été demandée. Si vous êtes à l'origine de cette demande, cliquez sur le lien ci-dessous."
Note: [CWE-326] Inadequate Encryption Strength.

(no-des-cipher)

🔇 Additional comments (6)
src/main/java/de/caritas/cob/userservice/api/adapters/web/dto/PasswordResetConfirmDTO.java (1)

1-11: LGTM!

src/main/java/de/caritas/cob/userservice/api/adapters/web/dto/PasswordResetRequestDTO.java (1)

1-11: LGTM!

src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/UserController.java (1)

32-33: LGTM!

Also applies to: 114-124

src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/UserRegistrationControllerDelegate.java (1)

14-15: LGTM!

Also applies to: 29-29, 59-59, 96-106

src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java (1)

171-267: LGTM!

src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserRegistrationControllerDelegateTest.java (1)

23-24: LGTM!

Also applies to: 42-42, 76-76, 357-367

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread .../de/caritas/cob/userservice/api/adapters/web/controller/interceptor/StatelessCsrfFilter.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java
private final @NonNull KeycloakService keycloakService;
private final @NonNull RestTemplate restTemplate;

private final Map<String, ResetTokenEntry> resetTokens = new ConcurrentHashMap<>();

@coderabbitai coderabbitai Bot Jul 17, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Do not keep reset tokens only in process memory.

A restart immediately invalidates every outstanding link, and multiple replicas cannot confirm tokens created by another replica. This breaks the advertised 120-minute validity. Use a shared TTL-backed store such as Redis or the database.

🤖 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/service/auth/PasswordResetService.java`
at line 52, Replace the in-memory resetTokens ConcurrentHashMap used by
PasswordResetService with a shared persistent store, such as Redis or the
database, configured with a 120-minute TTL. Update token creation, lookup, and
invalidation to use that store so tokens survive restarts and can be confirmed
across replicas.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Storypapst Storypapst Jul 18, 2026

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledged as a deliberate deferral (leaving this thread open). Moving reset tokens to a Redis/DB-backed store is intentionally out of scope for this change. In b51ce31 we documented the constraint prominently at class level: the in-memory store means a restart/crash invalidates every outstanding reset link, and the feature is not safe to run with more than one replica (a confirm routed to a different replica will not find the token). A shared store is tracked as follow-up work.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@coderabbitai coderabbitai Bot Jul 18, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Storypapst Acknowledged. The limitation is correctly characterized: deployment must remain single-replica, and restarts/crashes invalidate outstanding reset links. Keeping this thread open is appropriate until the shared TTL-backed store follow-up is implemented.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...itas/cob/userservice/api/adapters/web/controller/UserRegistrationControllerDelegateTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Storypapst

Storypapst commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Storypapst
Storypapst marked this pull request as draft July 17, 2026 23:20
Storypapst and others added 3 commits July 18, 2026 04:56
@Storypapst @claude
fix(auth): harden self-service password reset service
b51ce31
Address CodeRabbit security/stability findings on PasswordResetService:

- Never log the Keycloak account id or raw exception message on mail
  failure; log a generic warning with the exception class only and keep
  details at DEBUG (no PII).
- Remove the hardcoded https://app.oriso.org default for
  password.reset.frontend.base-url. The property is now required; when
  unset the feature is disabled (fail closed) with a startup warning and
  no reset mail is sent. Add the (default-empty) property to
  application.properties.
- Consume the token atomically on confirm: Map.remove() first to kill the
  concurrent double-confirm race, and re-insert the entry only if the
  Keycloak update fails so a policy-rejected password can still be
  retried with the same link (small re-insert window documented).
- Bound the in-memory token map: purge expired entries before insert, cap
  to one outstanding token per account, and remove the token when the
  mail send fails so nothing leaks for a mail that never went out.
- Dispatch the account lookup + mail send on an executor so the HTTP
  response returns in near-constant time regardless of account existence
  (mitigates timing-based account enumeration).
- Document the single-replica in-memory token-store limitation at class
  level (deliberate deferral; no Redis/DB store in this change).

Co-Authored-By: Claude Fable 5 <[email protected]>
@Storypapst @claude
fix(auth): scope password-reset CSRF exemption to exact routes
c280847
The StatelessCsrfFilter exempted any URI containing the substring
"/users/password-reset/", and SecurityConfig carried a redundant broad
regex on top of the exact request matchers. Restrict the CSRF exemption
to the two exact routes (.../users/password-reset/request and
.../confirm, optionally under a /service prefix) and drop the redundant
regex, since those endpoints are already permitted by the exact
requestMatchers.

Co-Authored-By: Claude Fable 5 <[email protected]>
@Storypapst @claude
test(auth): strengthen password-reset test coverage
0975a4f
- Drop the class-wide @MockitoSettings(LENIENT) on PasswordResetServiceTest
  and rely on strict stubbing.
- Add a mail-sending seam (PasswordResetMailSender) so request-flow tests
  capture the recipient, locale and reset URL (base URL + 64-hex-char
  token format) without opening an SMTP socket, plus a fail-closed test
  for the unset base URL.
- Verify passwordResetService delegation in both the confirm success and
  failure branches of UserRegistrationControllerDelegateTest.

Co-Authored-By: Claude Fable 5 <[email protected]>
@Storypapst

Storypapst commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Storypapst Storypapst mentioned this pull request Jul 18, 2026
fix(userservice): wire frontend base URL for Magic Link + password reset OpenResilienceInitiative/ORISO-Helm#100
Merged
coderabbitai[bot]
coderabbitai Bot requested changes Jul 18, 2026
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java (2)

177-183: 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Remove the repeated user lookups.

UserService.findUserByUsername already queries encoded and decoded username variants. Retrying it with both variants performs the equivalent repository lookup up to three times per unauthenticated request.

As per path instructions, check the surrounding ORISO flow and flag N+1 or excessive queries.

🤖 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/service/auth/PasswordResetService.java`
around lines 177 - 183, In the password-reset user resolution flow, remove the
fallback lookups for decoded and encoded usernames after the initial
userService.findUserByUsername(username) call. Keep a single lookup and preserve
the existing empty-result handling, relying on UserService.findUserByUsername to
resolve username variants internally.

Source: Path instructions


315-322: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Make per-account token replacement atomic.

Concurrent reset requests can both complete removeIf before either inserts, leaving multiple valid tokens for one account. Use an account-keyed atomic operation or per-account synchronization, and add a concurrent regression test.

🤖 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/service/auth/PasswordResetService.java`
around lines 315 - 322, Update generateAndStoreToken so removing the existing
token and storing the replacement are atomic per Keycloak user account, using an
account-keyed atomic operation or synchronization to prevent concurrent requests
from leaving multiple valid tokens. Preserve the one-outstanding-token behavior,
and add a concurrent regression test covering simultaneous reset requests for
the same account.
♻️ Duplicate comments (2)
src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/interceptor/StatelessCsrfFilter.java (1)

106-110: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Match the four permitted paths explicitly.

endsWith still exempts arbitrary prefixes such as /admin/users/password-reset/request; it is not limited to the direct and /service routes stated by the comment. Compare against the four complete paths and add a negative-prefix test.

🤖 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/web/controller/interceptor/StatelessCsrfFilter.java`
around lines 106 - 110, Update the path matching in StatelessCsrfFilter to
compare the complete request URI against exactly the four permitted direct and
/service password-reset request/confirm paths, replacing the endsWith checks.
Preserve case-insensitive matching and add a negative-prefix test confirming
paths such as /admin/users/password-reset/request remain protected.

Source: Path instructions

src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java (1)

82-123: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Assert the no-send behavior directly.

These tests still pass if an email is incorrectly dispatched. Assert sentMails is empty in every no-send case; the consultant test should also verify the exact consultant lookup instead of treating “no NPE” as proof.

As per path instructions, tests must be able to fail and assertions that cannot expose defects must be flagged.

Also applies to: 169-181

🤖 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/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java`
around lines 82 - 123, The no-send password-reset tests only assert absence of
exceptions, so they must directly verify that no email was dispatched. Update
requestPasswordReset_Should_CompleteSilently_When_AccountNotFound, the
blank-email and dummy-suffix tests, and the SMTP-not-configured test to assert
sentMails is empty; in the account-not-found case, also verify the exact
consultant lookup arguments rather than relying on no-throw behavior.

Source: Path instructions

🤖 Prompt for all review comments with 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.

Inline comments:
In
`@src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java`:
- Around line 68-75: Replace the locally created passwordResetExecutor in
PasswordResetService with an injected, Spring-managed bounded executor.
Configure an explicit queue capacity, rejection policy, and lifecycle shutdown
behavior, and use that executor for password-reset dispatch so overload is
rejected or handled promptly instead of accumulating unbounded work.
- Around line 158-167: The catch in PasswordResetService should restore
resetTokens only for the explicit Keycloak password-policy validation exception;
allow unknown or ambiguous RuntimeExceptions to propagate without reinserting
the consumed token. In PasswordResetServiceTest, use the policy exception for
retry coverage and add an assertion that an unknown failure leaves the token
consumed. Update the affected sites in
src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java
lines 158-167 and
src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java
lines 218-230.

---

Outside diff comments:
In
`@src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java`:
- Around line 177-183: In the password-reset user resolution flow, remove the
fallback lookups for decoded and encoded usernames after the initial
userService.findUserByUsername(username) call. Keep a single lookup and preserve
the existing empty-result handling, relying on UserService.findUserByUsername to
resolve username variants internally.
- Around line 315-322: Update generateAndStoreToken so removing the existing
token and storing the replacement are atomic per Keycloak user account, using an
account-keyed atomic operation or synchronization to prevent concurrent requests
from leaving multiple valid tokens. Preserve the one-outstanding-token behavior,
and add a concurrent regression test covering simultaneous reset requests for
the same account.

---

Duplicate comments:
In
`@src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/interceptor/StatelessCsrfFilter.java`:
- Around line 106-110: Update the path matching in StatelessCsrfFilter to
compare the complete request URI against exactly the four permitted direct and
/service password-reset request/confirm paths, replacing the endsWith checks.
Preserve case-insensitive matching and add a negative-prefix test confirming
paths such as /admin/users/password-reset/request remain protected.

In
`@src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java`:
- Around line 82-123: The no-send password-reset tests only assert absence of
exceptions, so they must directly verify that no email was dispatched. Update
requestPasswordReset_Should_CompleteSilently_When_AccountNotFound, the
blank-email and dummy-suffix tests, and the SMTP-not-configured test to assert
sentMails is empty; in the account-not-found case, also verify the exact
consultant lookup arguments rather than relying on no-throw behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 08db3936-6c77-4d60-b50b-84023a309ba9

📥 Commits

Reviewing files that changed from the base of the PR and between f7000a6 and 0975a4f.

📒 Files selected for processing (6)
  • src/main/java/de/caritas/cob/userservice/api/adapters/web/controller/interceptor/StatelessCsrfFilter.java
  • src/main/java/de/caritas/cob/userservice/api/config/auth/SecurityConfig.java
  • src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java
  • src/main/resources/application.properties
  • src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserRegistrationControllerDelegateTest.java
  • src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: integration-tests (non-blocking, burn-in)
  • GitHub Check: test, build and Docker validation
  • GitHub Check: integration-tests (non-blocking, burn-in)
  • GitHub Check: test and build UserService
🧰 Additional context used
📓 Path-based instructions (2)
src/main/**/*.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/interceptor/StatelessCsrfFilter.java
  • src/main/java/de/caritas/cob/userservice/api/config/auth/SecurityConfig.java
  • src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java
src/test/**/*.java

⚙️ 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/UserRegistrationControllerDelegateTest.java
  • src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java
🧠 Learnings (1)
📚 Learning: 2026-07-12T05:15:05.095Z
Learnt 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/interceptor/StatelessCsrfFilter.java
  • src/main/java/de/caritas/cob/userservice/api/config/auth/SecurityConfig.java
  • src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java
🔇 Additional comments (5)
src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java (1)

13-13: LGTM!

Also applies to: 63-67, 77-132, 151-157, 172-176, 184-313, 326-496

src/main/java/de/caritas/cob/userservice/api/config/auth/SecurityConfig.java (1)

112-134: LGTM!

src/main/resources/application.properties (1)

40-42: LGTM!

src/test/java/de/caritas/cob/userservice/api/adapters/web/controller/UserRegistrationControllerDelegateTest.java (1)

76-76: LGTM!

Also applies to: 357-393

src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java (1)

17-64: LGTM!

Also applies to: 68-79, 125-167, 184-217, 233-294

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Storypapst @claude
fix(auth): bound the reset dispatch executor and restore tokens only …
5680518
…on policy rejection

- Replace the fixed thread pool (unbounded queue) with a bounded
  ThreadPoolExecutor (2..4 threads, 200-slot queue, AbortPolicy) plus
  @PreDestroy shutdown; overflow is dropped silently so the public
  endpoint's response stays identical under flood.
- Re-insert the one-time token only on a definitive password-policy
  rejection (CustomValidationHttpStatusException from Keycloak). Any
  indeterminate failure keeps the token consumed, since the password may
  already have been applied.
- Tests: policy rejection keeps the token, indeterminate failure
  consumes it.

Co-Authored-By: Claude Fable 5 <[email protected]>
@Storypapst

Storypapst commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Storypapst

Storypapst commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

coderabbitai[bot]
coderabbitai Bot reviewed Jul 18, 2026
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java (1)

1-1: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Assert that no emails were sent to ensure the tests can fail on regression.

As noted in the previous review, these request-flow tests currently only assert that no exception is thrown. If the service erroneously sent an email or made an external HTTP call, these tests would still pass. As per path instructions, tests must be able to fail. Add explicit negative assertions to preserve the intended no-send behavior as a regression check.

  • src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java#L84-92: Add assertThat(sentMails).isEmpty(); and verify(restTemplate, never()).getForObject(anyString(), any());.
  • src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java#L71-76: Add assertThat(sentMails).isEmpty();.
  • src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java#L78-82: Add assertThat(sentMails).isEmpty();.
  • src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java#L94-104: Add assertThat(sentMails).isEmpty();.
  • src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java#L106-116: Add assertThat(sentMails).isEmpty();.
  • src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java#L118-126: Add assertThat(sentMails).isEmpty();.
  • src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java#L172-185: Add assertThat(sentMails).isEmpty(); to verify the no-send behavior when SMTP is not configured via consultant fallback.
🤖 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/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java`
at line 1, Update the request-flow tests in PasswordResetServiceTest to assert
sentMails is empty after each listed no-send scenario, including the
SMTP-unconfigured consultant-fallback case. In the test covering the external
lookup, also verify restTemplate.getForObject(anyString(), any()) is never
called, while preserving the existing test behavior.

Source: Path instructions

🤖 Prompt for all review comments with 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.

Outside diff comments:
In
`@src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java`:
- Line 1: Update the request-flow tests in PasswordResetServiceTest to assert
sentMails is empty after each listed no-send scenario, including the
SMTP-unconfigured consultant-fallback case. In the test covering the external
lookup, also verify restTemplate.getForObject(anyString(), any()) is never
called, while preserving the existing test behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a4d0421e-4bcb-4935-b873-01004d9f024e

📥 Commits

Reviewing files that changed from the base of the PR and between 0975a4f and 5680518.

📒 Files selected for processing (2)
  • src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java
  • src/test/java/de/caritas/cob/userservice/api/service/auth/PasswordResetServiceTest.java
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
src/test/**/*.java

⚙️ 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/service/auth/PasswordResetServiceTest.java
src/main/**/*.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/service/auth/PasswordResetService.java
🧠 Learnings (1)
📚 Learning: 2026-07-12T05:15:05.095Z
Learnt 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/service/auth/PasswordResetService.java
🔇 Additional comments (1)
src/main/java/de/caritas/cob/userservice/api/service/auth/PasswordResetService.java (1)

1-525: LGTM!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Storypapst

Storypapst commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 34 minutes.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Storypapst
Storypapst changed the base branch from dev to pre-dev July 18, 2026 05:02
This was referenced Jul 23, 2026
Email 2FA completion fails for encoded Admin usernames #727
Closed
Persist one-time authentication tokens for cross-replica failover #739
Closed
Prevent notification failures from rolling back anonymous deletions #745
Closed
[Stability] Measure OTP provider admin-session retries #766
Closed
[Stability] Remove the remaining disabled email-supplier tests #768
Closed
Decouple magic-link sessions from Keycloak transport #770
Closed
Prove authenticated writes across two UserService replicas #773
Closed
Route username availability through the identity input port #775
Closed
Route user web identity policy through an input port #777
Closed
Split email-owner lookup from the broad identity client #787
Closed
Type and isolate identity second-factor verification #793
Closed
Complete the focused identity email-address mutation boundary #797
Closed
Complete the focused identity account-settings boundary #801
Closed
Move identity profile updates behind a focused port #809
Closed
Move identity password writes behind a focused port #814
Closed
Refactor dummy-email updates behind a focused identity port #820
Closed
Admin user search returns 403 for tenant-admin and agency-admin lists on Pre-Dev #858
Open
Password reset and magic link never send mail: SMTP credentials read from the public settings endpoint #863
Closed
Split authentication from the broad identity client #789
Closed
[P6] Login, two-factor authentication and password reset #896
Open
Recovery code for anonymous accounts without e-mail #928
Open
This was referenced Aug 2, 2026
MagicLinkLoginService: replace the hand-written HTML with the e-mail design system #944
Closed
SupervisorAddedEmailNotificationService: replace the hand-written HTML with the e-mail design system #945
Closed
DpaForwardEmailService and GlobalSmtpTestEmailService onto the e-mail design system #946
Closed
P0: Expose transient Matrix UIA credential to the authenticated browser session #950
Closed
[P0] Registration double-decodes passwords and creates unusable accounts #959
Closed
feat: provision counsellors from accepted account invites #967
Merged
Login cannot tell a self-deleted account from one a counsellor closed #982
Open
This was referenced Aug 12, 2026
[AGY-PUB-01] 400 on askers/session/new: Jackson 3 fails on absent primitive newUserAccount #992
Closed
DPA_SIGNED_NOTICE and the onboarding-wizard DPA forward path #1031
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] requested changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Storypapst @Hassan9215
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.