Skip to content

RESTHeart 9.13.0

Choose a tag to compare

@github-actions github-actions released this 31 Oct 14:30
· 385 commits to master since this release
3e225be

Two things in this release: MongoDB 9.0 is supported and tested, and a security fix in the accounts module closes an account takeover through a pre-registered email address. Every deployment that uses the accounts module with self-registration should upgrade.

MongoDB 9.0 (#780)

Every build now runs the test suite against MongoDB 7.0, 8.0, 8.3 and 9.0, and against mongodb-atlas-local. The README has a new "Supported MongoDB versions" section; older servers down to 4.2 should work but are not tested.

MongoDB Java driver 5.14.0. The first driver release with the 9.0 wire version. It also carries the security fixes of 5.9.2 and 5.11.1. The transactions code was adapted to the driver internals that changed since 5.7.1.

Error codes of 9.0 mapped to HTTP statuses. Verified on MongoDB 9.0.4:

  • 400 for the geo key extraction errors (510, 511, and 16755/16756 that they replace; before 9.0 these were a 500), for a $group accumulator with an empty field name (12116300), and for the memory limits (146, 292). MongoDB 9.0 adds a per-operation memory limit and /_aggrs default to allowDiskUse: false: the message now suggests allowDiskUse.
  • 503 for TooManyOpenTransactions (509) and for the SystemOverloadedError category. A 503 is logged as a warning without the stack trace, and the client gets a clean message instead of the raw driver one.

Change streams survive an election. After an election MongoDB 9.0 returns InterruptedDueToReplStateChange (11602) from a change stream's getMore, and the driver resumes by itself. When the driver cannot resume, RESTHeart used to reopen the stream after a second from the token it was created with: the events written in between were lost, or sent again. The change stream worker and the MCP collection watchers now reopen from the last event dispatched, so an SSE or MCP client gets every event exactly once. If the oplog no longer holds that point (286 ChangeStreamHistoryLost, 280 on older servers), a warning is logged, the stream reopens from now and the sessions stay open.

Transactions. The parsing of the transaction errors (225, 251, 256) is verified against the messages MongoDB 9.0.4 returns.

Native image. The reachability metadata is aligned with driver 5.14.0, and the docs explain how to regenerate it with the tracing agent.

Tooling. docker-compose.yml and docker-compose-native.yml start mongo:9.0, with a health check on db.hello(); run-mongo-container.sh uses mongosh; CONTRIBUTING explains how to test on a version without an atlas-local image.

Security: account takeover through a pre-registered email (GHSA-m7m7-gjxg-cjmm)

Anyone could call POST /auth/register with someone else's email address and a password of their choice. The account stayed unverified, but the password was stored. When the real owner later signed in with Google, or asked for a password reset, the account was activated and the attacker's password survived: the attacker could then log in with Basic authentication and the password they had chosen.

The fix, in the accounts module:

  • OAuth activation drops the registration password. When an unverified account is activated through an OAuth provider, the stored password is cleared and the provider is recorded in socialAuths. The account signs in through the provider; a password can be set later with the reset flow.
  • Forgot password always sends the reset link. Before, an unverified account got the verification link again, which activated it with the password the registrant had chosen. Now the owner gets a reset link; the reset sets the password and verifies the address in one step.
  • An empty stored password never authenticates. MongoRealmAuthenticator refuses an account whose stored password is empty, in both the bcrypt and the plaintext mode.
  • The token issued right after an OAuth activation carries the activated roles. It used to carry $unauthenticated, from the document read before the activation.

Affected: 9.4.0, the first release with the accounts module, up to 9.12.3. Thanks to Santoshkumarpuppala for the report. The advisory has the details and the CVSS score.

One behaviour to know: a user who registers with a password and then activates the account with Google ends up without a password, by design. They sign in with Google, or use "Forgot password" to set one.

Note: no native image for 9.13.0

The native build of 9.13.0 failed: the polyglot libraries moved to GraalVM 25.4.4.1.1 while the native build and the Docker base image stayed on 25.1.3. 9.13.0 has no native binaries and no -native Docker image, and its JVM image runs on GraalVM CE 25.1.3 (JDK 25.0.3). 9.13.1 fixes the build with no code change: same Java, GraalVM 25.4.4.1.1 everywhere, native binaries and -native image back.

Other changes

  • The karate tests of the accounts module cover the two recovery paths above.
  • SonarQube local analysis data is ignored by git; update-dependencies.sh comments clarified.

Full Changelog: 9.12.3...9.13.0