Skip to content

RESTHeart 9.12.2

Choose a tag to compare

@github-actions github-actions released this 27 Oct 16:34
· 431 commits to master since this release
4c95e84

This is a security release. It fixes a change stream bug that could deliver one client's events to other clients, and it hardens the
restheart-accounts endpoints that send emails. If you use change streams with notify_when, or restheart-accounts, upgrade. Read "Before you
upgrade" first: some changes alter existing behaviour.

Before you upgrade

  1. Your change streams use notify_when. A client that does not bind the variable named in notify_when is now rejected with 400
    variable not bound. Before, it received every event of the stream.
  2. Your tests or tools send X-Skip-Email: true. The header is now ignored unless you set /accountsEmailPolicy/allow-skip-email-header: true.
    Without it, register, forgot-password, invite and resend-invite send the email.
  3. You call /auth/forgot-password more than once for the same address. It now sends at most one email per address every 300 seconds. The
    response is still 202. Set /accountsEmailPolicy/resend-cooldown-seconds to change the interval, or 0 to turn it off.
  4. Your sign-up form accepts unusual values. /auth/register now answers 400 to anything but a single email address up to 254 characters,
    and to names longer than 100 characters or containing line breaks, control characters, < or >.

Security: change streams delivered events to the wrong clients (#770)

notify_when filters the events of a change stream per client, by comparing a field of the event with a variable the client binds when it
connects. Two bugs combined:

  • The variable was read only from a plain query parameter (?chatId=...). A client that bound it with avars={"chatId": "..."}, as for the
    stream's own stages, was treated as unbound.
  • An unbound variable disabled the filter. The client received the events of every other client of the same stream.

A client that used avars therefore received all the events of the stream, including documents that belonged to other users.

Now:

  • ?tid=... and avars={"tid": "..."} are equivalent. When both are given, avars wins, as for stage variables.
  • A client that does not bind the variable is rejected with 400 variable not bound, and receives nothing.
  • A variable bound in avars to a value that is not a string is rejected with 400, unless the plain query parameter gives a string.

Security: restheart-accounts emails

A new provider, accountsEmailPolicy, decides when restheart-accounts may skip an email and how often it may resend one:

/accountsEmailPolicy:
  # Honour the X-Skip-Email: true header. For integration tests only.
  allow-skip-email-header: false
  # Minimum seconds between two password-reset or verification emails to the same address.
  resend-cooldown-seconds: 300

X-Skip-Email is off by default

Register, forgot-password, invite and resend-invite skipped the email whenever the request carried X-Skip-Email: true. Anyone could create an
account, or a password-reset token, for an address without its owner being told. The header is now honoured only when
allow-skip-email-header is true, and RESTHeart logs a warning at startup when it is.

forgot-password has a cooldown

/auth/forgot-password sent an email every time it was called, so it could be used to flood an address, also one seeded through
/auth/register. It now sends at most one password-reset (or verification, for unverified accounts) email per address per
resend-cooldown-seconds. The response is the same 202 either way, so the cooldown does not reveal whether the account exists.

register validates its input

/auth/register now accepts only one email address, up to 254 characters, and names up to 100 characters without line breaks, control
characters, < or >. Names end up in emails, and these values could add lines or markup to them.

Other changes

  • Compiler deprecation warnings removed.
  • CI: the release workflow runs on ubuntu-22.04, like the branch and pull request workflows. On ubuntu-latest the kernel is 6.19+, on which
    mongod 8.x refuses to start (SERVER-131155).

Full Changelog: 9.12.1...9.12.2