Compare commits

..
Author SHA1 Message Date
Chris Eager 9379af28fd Add resilience configuration to CommandDependencies 2026-09-21 15:42:44 -04:00
Jonathan Klabunde Tomer de5ae9f7e7 Retire message delivery-loop monitor 2026-09-21 15:24:45 -04:00
Chris Eager c171a89f03 Update BulkheadConfiguration.maxWaitDuration validation 2026-09-21 12:46:40 -04:00
Chris Eager 4bc550320b Update to the latest version of the spam filter 2026-09-21 12:23:13 -04:00
Jon Chambers 361b982357 Use FoundationDB as the source of presence when reading "live" messages from FoundationDB 2026-09-21 12:06:45 -04:00
Ravi Khadiwala 534825fb68 Use stripe-style currency minor-units in donations/configuration 2026-09-21 12:05:20 -04:00
Jon Chambers 9e3d10a6e8 Add bulkheads to FaultTolerantDatabase 2026-09-21 12:04:39 -04:00
Ravi Khadiwala ddb4b5d5dd Adjust default MFA rate-limit 2026-09-21 12:04:17 -04:00
Jon Chambers ca34692cbb Retire the verificationCodePushNotification experiment (now permanently on) 2026-09-21 12:02:16 -04:00
Katherine 2bffd909a5 Allow up to MAX_SHARDS FoundationDB shards 2026-09-21 11:55:47 -04:00
Chris Eager d400e700ac Add comment regarding when a one-time donation record might not be found 2026-09-18 17:38:13 -04:00
Ravi Khadiwala 755a87c74d Clear receipt state before integration tests 2026-09-17 12:50:28 -05:00
Ravi Khadiwala b30fc7aa8b Add a metric for duplicate receipt redemption 2026-09-16 12:43:22 -05:00
Jonathan Klabunde Tomer 4f4bd431f5 gRPC endpoints to verify existing MFA tokens 2026-09-16 10:37:50 -07:00
Jon Chambers 79757458d6 Introduce an experiment to use FoundationDB as the primary source for "live" messages 2026-09-16 10:46:35 -04:00
Jon Chambers c09aab080f Rename the "answer challenge" method and normalize "not permitted" responses 2026-09-16 10:27:38 -04:00
Jon Chambers 580960d958 Add a gRPC endpoint for requesting push challenges 2026-09-16 10:27:38 -04:00
Ravi Khadiwala c21475e3e7 Add an 'impossible' marker to mismatched number logs 2026-09-16 10:17:52 -04:00
Jon Chambers 09b5289d83 Add a gRPC endpoint for reporting spam 2026-09-16 10:16:40 -04:00
Jon Chambers f66bd0858d Introduce ReportMessageHelper 2026-09-16 10:16:40 -04:00
Jon Chambers ce8cc80f66 Retire unused "report spam via e164" pathway 2026-09-16 10:16:40 -04:00
Chris Eager 66b5412103 Update netty to 4.2.18 2026-09-16 10:06:13 -04:00
Chris Eager 11b6894dae Add backend tag to H2FrameProxyHandler writability changed metric 2026-09-16 10:05:55 -04:00
moiseev-signal 02b86d67ad Override domain in KT gRPC errors with chat domain 2026-09-16 09:56:41 -04:00
Jon Chambers f55c3c22fe Clarify naming and reduce duplication in CredentialsGrpcService 2026-09-16 09:20:48 -04:00
Jonathan Klabunde Tomer eb601cd51e Add WebAuthn MFA key support 2026-09-14 10:48:37 -04:00
Jon Chambers 2ee739dbe1 Add a dynamic configuration flag to fail open in the event of upstream captcha errors 2026-09-14 10:35:04 -04:00
Jon Chambers a15b70476d Add a gauge for concurrent FoundationDB transactions 2026-09-14 10:34:58 -04:00
Ameya Lokare 5f124cc812 Port /v1/archives/backupid/limits to gRPC 2026-09-14 10:34:51 -04:00
Chris Eager ce3378354d Address various deprecations 2026-09-14 10:30:24 -04:00
Ravi Khadiwala cb02200a24 Delete updated user at end of testRecoverWithTotp 2026-09-11 16:55:41 -04:00
Ameya Lokare fd36a8909c Improve handling of FoundationDB errors in reactive streams 2026-09-10 10:49:45 -07:00
Ravi Khadiwala 78c15d2a9a Only enable setting MFA from numberless accounts 2026-09-10 10:48:19 -07:00
Ameya Lokare 5815bb8e3f Measure missing mirrored messages' age 2026-09-10 10:47:45 -07:00
Katherine d366cdbcb0 Instrument more FoundationDB calls 2026-09-10 13:46:00 -04:00
Jon Chambers 52b32ce2d4 Add a slightly more descriptive error message if something goes wrong starting FoundationDB 2026-09-10 10:42:13 -07:00
Ameya Lokare e976c4fbb5 Add method to check for account existence by ACI 2026-09-10 10:41:21 -07:00
Ameya Lokare 81f38c1db7 Configure multiple FoundationDB client threads 2026-09-10 10:29:37 -07:00
Ravi Khadiwala 5221b3fb84 Add an integration test for recovering with a TOTP 2026-09-09 16:31:03 -05:00
Jon Chambers 53bd7a5587 Update to Java 26 2026-09-09 11:21:20 -04:00
Katherine 100ab61c82 Add circuit breakers to FoundationDB operations 2026-09-08 14:36:52 -04:00
Ameya Lokare 4d48c40ce1 Add timer to measure warmup time 2026-09-08 10:35:20 -04:00
Ameya Lokare 93ade07c57 Read status key at startup to warm up FoundationDB connections 2026-09-08 10:35:20 -04:00
Jon Chambers c1d8ca3c14 Update to the latest version of the spam filter 2026-09-08 10:34:02 -04:00
Jon Chambers 38707313d7 Retire UpdateGambiaPniMappingsCommand 2026-09-03 12:29:56 -04:00
ameya-signal 8eb2f5cec6 Use content hash to compare message envelopes 2026-09-03 09:28:06 -07:00
ameya-signal a7d66cb8e6 Add ephemeral tag to missing messages counter 2026-09-03 09:28:02 -07:00
ameya-signal 9db804f7c0 Add metrics to measure stream agreement between Redis/Dynamo and FoundationDB 2026-09-03 09:27:57 -07:00
Jon Chambers e93395e334 Retire PopulateAccountRecoveryPasswordsCommand 2026-09-03 12:12:05 -04:00
ameya-signal c9b8645469 Instrument FoundationDB transaction errors in a central place 2026-09-03 12:09:46 -04:00
Katherine f92681dbae Don't fall back to v4 UUIDs if FoundationDB insert fails 2026-09-03 12:09:28 -04:00
Ravi Khadiwala 7489c62fb7 Avoid attribute modification errors on numberless accounts 2026-09-02 16:17:26 -05:00
Ravi Khadiwala 23932b1087 Update constructors in UpdateGambiaPniMappingsCommandTest 2026-09-02 16:15:37 -05:00
Ravi Khadiwala 6b3f66ddc1 Forbid idempotent numberless registration retries if MFA keys are present 2026-09-02 16:56:11 -04:00
Jon Chambers 77e3675fc9 Add a command to map alternate forms of existing Gambian phone numbers to the same PNI 2026-09-02 16:55:49 -04:00
Jon Chambers 2f712b3f93 Add an alternate number form generator for Gambia 2026-09-02 16:55:49 -04:00
Jon Chambers 9b5ad238cf Introduce the AlternatePhoneNumberFormGenerator interface 2026-09-02 16:55:49 -04:00
Ravi Khadiwala 8c62a7f819 Add delay to TOTP confirmation validation 2026-09-02 16:55:35 -04:00
Jonathan Klabunde Tomer 3a75f705c2 Simplify list-MFA-keys RPC
Turns out clients only actually want the metadata, repeating the crypto
parameters is useless
2026-09-02 16:55:26 -04:00
Ameya Lokare d79e37230e Return 401 if receipt credential fails verification, is expired or is
already redeemed
2026-09-02 16:54:12 -04:00
Ameya Lokare 7bc8b93c18 Remove use of account lock executor in
ClearOrphanedFoundationDbQueuesCommand
2026-09-02 16:53:51 -04:00
Ravi Khadiwala b6bed9d772 Remove confusing subscriber_id_mismatch response 2026-09-02 16:34:48 -04:00
Ravi Khadiwala 18e58dd21f Improve error response documentation in subscription.proto 2026-09-02 16:34:48 -04:00
Ravi Khadiwala 6ab0acadfd Document RPCs that require an Accept-Language header 2026-09-02 16:34:48 -04:00
Ravi Khadiwala 6209466d1d Fix accidental renumbering in login_purchase.proto 2026-09-02 16:34:17 -04:00
Ameya Lokare 9483f358cd Remove executor for acquiring locks in AccountLockManager 2026-09-02 16:33:49 -04:00
Ameya Lokare 1c28620b65 Re-use ACI / clear account queues under a pessimistic ACI lock 2026-09-02 16:33:29 -04:00
dependabot[bot] cc50ff7074 Bump the minor-java-dependencies group across 4 directories with 6 updates
Bumps the minor-java-dependencies group with 5 updates in the /api-doc directory:

| Package | From | To |
| --- | --- | --- |
| [com.google.cloud:libraries-bom](https://github.com/googleapis/google-cloud-java) | `26.86.0` | `26.87.0` |
| software.amazon.awssdk:bom | `2.54.5` | `2.54.7` |
| [com.googlecode.libphonenumber:libphonenumber](https://github.com/google/libphonenumber) | `9.0.37` | `9.0.38` |
| [com.stripe:stripe-java](https://github.com/stripe/stripe-java) | `33.3.0` | `33.4.0` |
| [org.signal:libsignal-server](https://github.com/signalapp/libsignal) | `0.101.0` | `0.101.2` |

Bumps the minor-java-dependencies group with 5 updates in the /integration-tests directory:

| Package | From | To |
| --- | --- | --- |
| [com.google.cloud:libraries-bom](https://github.com/googleapis/google-cloud-java) | `26.86.0` | `26.87.0` |
| software.amazon.awssdk:bom | `2.54.5` | `2.54.7` |
| [com.googlecode.libphonenumber:libphonenumber](https://github.com/google/libphonenumber) | `9.0.37` | `9.0.38` |
| [com.stripe:stripe-java](https://github.com/stripe/stripe-java) | `33.3.0` | `33.4.0` |
| [org.signal:libsignal-server](https://github.com/signalapp/libsignal) | `0.101.0` | `0.101.2` |

Bumps the minor-java-dependencies group with 6 updates in the /service directory:

| Package | From | To |
| --- | --- | --- |
| [com.google.cloud:libraries-bom](https://github.com/googleapis/google-cloud-java) | `26.86.0` | `26.87.0` |
| software.amazon.awssdk:bom | `2.54.5` | `2.54.7` |
| [com.googlecode.libphonenumber:libphonenumber](https://github.com/google/libphonenumber) | `9.0.37` | `9.0.38` |
| [com.stripe:stripe-java](https://github.com/stripe/stripe-java) | `33.3.0` | `33.4.0` |
| [org.signal:libsignal-server](https://github.com/signalapp/libsignal) | `0.101.0` | `0.101.2` |
| [com.googlecode.libphonenumber:geocoder](https://github.com/google/libphonenumber) | `3.37` | `3.38` |

Bumps the minor-java-dependencies group with 5 updates in the /websocket-resources directory:

| Package | From | To |
| --- | --- | --- |
| [com.google.cloud:libraries-bom](https://github.com/googleapis/google-cloud-java) | `26.86.0` | `26.87.0` |
| software.amazon.awssdk:bom | `2.54.5` | `2.54.7` |
| [com.googlecode.libphonenumber:libphonenumber](https://github.com/google/libphonenumber) | `9.0.37` | `9.0.38` |
| [com.stripe:stripe-java](https://github.com/stripe/stripe-java) | `33.3.0` | `33.4.0` |
| [org.signal:libsignal-server](https://github.com/signalapp/libsignal) | `0.101.0` | `0.101.2` |



Updates `com.google.cloud:libraries-bom` from 26.86.0 to 26.87.0
- [Release notes](https://github.com/googleapis/google-cloud-java/releases)
- [Changelog](https://github.com/googleapis/google-cloud-java/blob/main/CHANGELOG.md)
- [Commits](https://github.com/googleapis/google-cloud-java/compare/libraries-bom/v26.86.0...libraries-bom/v26.87.0)

Updates `software.amazon.awssdk:bom` from 2.54.5 to 2.54.7

Updates `com.googlecode.libphonenumber:libphonenumber` from 9.0.37 to 9.0.38
- [Release notes](https://github.com/google/libphonenumber/releases)
- [Changelog](https://github.com/google/libphonenumber/blob/master/release_notes.txt)
- [Commits](https://github.com/google/libphonenumber/compare/v9.0.37...v9.0.38)

Updates `com.stripe:stripe-java` from 33.3.0 to 33.4.0
- [Release notes](https://github.com/stripe/stripe-java/releases)
- [Changelog](https://github.com/stripe/stripe-java/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stripe/stripe-java/compare/v33.3.0...v33.4.0)

Updates `org.signal:libsignal-server` from 0.101.0 to 0.101.2
- [Release notes](https://github.com/signalapp/libsignal/releases)
- [Changelog](https://github.com/signalapp/libsignal/blob/main/RELEASE_NOTES.md)
- [Commits](https://github.com/signalapp/libsignal/compare/v0.101.0...v0.101.2)

Updates `com.google.cloud:libraries-bom` from 26.86.0 to 26.87.0
- [Release notes](https://github.com/googleapis/google-cloud-java/releases)
- [Changelog](https://github.com/googleapis/google-cloud-java/blob/main/CHANGELOG.md)
- [Commits](https://github.com/googleapis/google-cloud-java/compare/libraries-bom/v26.86.0...libraries-bom/v26.87.0)

Updates `software.amazon.awssdk:bom` from 2.54.5 to 2.54.7

Updates `com.googlecode.libphonenumber:libphonenumber` from 9.0.37 to 9.0.38
- [Release notes](https://github.com/google/libphonenumber/releases)
- [Changelog](https://github.com/google/libphonenumber/blob/master/release_notes.txt)
- [Commits](https://github.com/google/libphonenumber/compare/v9.0.37...v9.0.38)

Updates `com.stripe:stripe-java` from 33.3.0 to 33.4.0
- [Release notes](https://github.com/stripe/stripe-java/releases)
- [Changelog](https://github.com/stripe/stripe-java/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stripe/stripe-java/compare/v33.3.0...v33.4.0)

Updates `org.signal:libsignal-server` from 0.101.0 to 0.101.2
- [Release notes](https://github.com/signalapp/libsignal/releases)
- [Changelog](https://github.com/signalapp/libsignal/blob/main/RELEASE_NOTES.md)
- [Commits](https://github.com/signalapp/libsignal/compare/v0.101.0...v0.101.2)

Updates `com.google.cloud:libraries-bom` from 26.86.0 to 26.87.0
- [Release notes](https://github.com/googleapis/google-cloud-java/releases)
- [Changelog](https://github.com/googleapis/google-cloud-java/blob/main/CHANGELOG.md)
- [Commits](https://github.com/googleapis/google-cloud-java/compare/libraries-bom/v26.86.0...libraries-bom/v26.87.0)

Updates `software.amazon.awssdk:bom` from 2.54.5 to 2.54.7

Updates `com.googlecode.libphonenumber:libphonenumber` from 9.0.37 to 9.0.38
- [Release notes](https://github.com/google/libphonenumber/releases)
- [Changelog](https://github.com/google/libphonenumber/blob/master/release_notes.txt)
- [Commits](https://github.com/google/libphonenumber/compare/v9.0.37...v9.0.38)

Updates `com.stripe:stripe-java` from 33.3.0 to 33.4.0
- [Release notes](https://github.com/stripe/stripe-java/releases)
- [Changelog](https://github.com/stripe/stripe-java/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stripe/stripe-java/compare/v33.3.0...v33.4.0)

Updates `org.signal:libsignal-server` from 0.101.0 to 0.101.2
- [Release notes](https://github.com/signalapp/libsignal/releases)
- [Changelog](https://github.com/signalapp/libsignal/blob/main/RELEASE_NOTES.md)
- [Commits](https://github.com/signalapp/libsignal/compare/v0.101.0...v0.101.2)

Updates `com.googlecode.libphonenumber:geocoder` from 3.37 to 3.38
- [Release notes](https://github.com/google/libphonenumber/releases)
- [Changelog](https://github.com/google/libphonenumber/blob/master/release_notes.txt)
- [Commits](https://github.com/google/libphonenumber/commits)

Updates `com.google.cloud:libraries-bom` from 26.86.0 to 26.87.0
- [Release notes](https://github.com/googleapis/google-cloud-java/releases)
- [Changelog](https://github.com/googleapis/google-cloud-java/blob/main/CHANGELOG.md)
- [Commits](https://github.com/googleapis/google-cloud-java/compare/libraries-bom/v26.86.0...libraries-bom/v26.87.0)

Updates `software.amazon.awssdk:bom` from 2.54.5 to 2.54.7

Updates `com.googlecode.libphonenumber:libphonenumber` from 9.0.37 to 9.0.38
- [Release notes](https://github.com/google/libphonenumber/releases)
- [Changelog](https://github.com/google/libphonenumber/blob/master/release_notes.txt)
- [Commits](https://github.com/google/libphonenumber/compare/v9.0.37...v9.0.38)

Updates `com.stripe:stripe-java` from 33.3.0 to 33.4.0
- [Release notes](https://github.com/stripe/stripe-java/releases)
- [Changelog](https://github.com/stripe/stripe-java/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stripe/stripe-java/compare/v33.3.0...v33.4.0)

Updates `org.signal:libsignal-server` from 0.101.0 to 0.101.2
- [Release notes](https://github.com/signalapp/libsignal/releases)
- [Changelog](https://github.com/signalapp/libsignal/blob/main/RELEASE_NOTES.md)
- [Commits](https://github.com/signalapp/libsignal/compare/v0.101.0...v0.101.2)

---
updated-dependencies:
- dependency-name: com.google.cloud:libraries-bom
  dependency-version: 26.87.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.googlecode.libphonenumber:libphonenumber
  dependency-version: 9.0.38
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.stripe:stripe-java
  dependency-version: 33.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.signal:libsignal-server
  dependency-version: 0.101.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.cloud:libraries-bom
  dependency-version: 26.87.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.googlecode.libphonenumber:libphonenumber
  dependency-version: 9.0.38
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.stripe:stripe-java
  dependency-version: 33.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.signal:libsignal-server
  dependency-version: 0.101.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.cloud:libraries-bom
  dependency-version: 26.87.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.googlecode.libphonenumber:libphonenumber
  dependency-version: 9.0.38
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.stripe:stripe-java
  dependency-version: 33.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.signal:libsignal-server
  dependency-version: 0.101.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.googlecode.libphonenumber:geocoder
  dependency-version: '3.38'
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.cloud:libraries-bom
  dependency-version: 26.87.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.googlecode.libphonenumber:libphonenumber
  dependency-version: 9.0.38
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.stripe:stripe-java
  dependency-version: 33.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.signal:libsignal-server
  dependency-version: 0.101.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-09-02 16:29:21 -04:00
Katherine Yen c60ba6677a Lower queue sizes to 3 MB total 2026-09-02 16:26:37 -04:00
Jon Chambers 32fc76fd47 Install gpg with sudo for integration tests 2026-09-01 17:02:56 -04:00
dependabot[bot] 370c3a9992 Bump actions/setup-java from 5.7.0 to 6.0.0
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 5.7.0 to 6.0.0.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/b6effb05e454b25005698d916606bdc6ffcbf961...dd06d9cba3e5552c54d9f8ea23572deb30010f7c)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-31 16:58:10 -04:00
Jon Chambers b3506b186d Install gpg before running setup-java 2026-08-31 16:58:10 -04:00
Ameya Lokare a91585d3c0 Unwrap exception on FoundationDB insert 2026-08-31 13:28:59 -05:00
Jonathan Klabunde Tomer 5469341fd6 make some TOTP-specific RPCs generic to any MFA factor 2026-08-31 11:27:11 -07:00
Ravi Khadiwala 9ee081ef28 Add playOptionId to login configuration 2026-08-31 12:59:56 -05:00
Chris Eager 33bf9ccae5 Update sample configuration 2026-08-27 18:45:43 -04:00
Ameya Lokare 2321f42e20 Verify that FoundationDbMessageStore#clearAll clears the entire account
subspace
2026-08-27 17:39:41 -04:00
Chris Eager 355d95c6c6 Add support for issuing libsignal v0.101.0+ call link credentials 2026-08-27 17:39:03 -04:00
Chris Eager 3dde05de8a Revert to Lettuce 7.6.0 2026-08-27 17:36:45 -04:00
dependabot[bot] 1ed282a790 Bump the minor-java-dependencies group across 4 directories with 10 updates
Bumps the minor-java-dependencies group with 8 updates in the /api-doc directory:

| Package | From | To |
| --- | --- | --- |
| io.swagger.core.v3:swagger-maven-plugin-jakarta | `2.2.53` | `2.2.54` |
| [com.google.protobuf:protobuf-bom](https://github.com/protocolbuffers/protobuf) | `4.35.1` | `4.36.0` |
| software.amazon.awssdk:bom | `2.51.4` | `2.54.5` |
| [io.micrometer:micrometer-bom](https://github.com/micrometer-metrics/micrometer-commercial) | `1.17.0` | `1.17.1` |
| [io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom](https://github.com/open-telemetry/opentelemetry-java-instrumentation) | `2.30.0` | `2.31.1` |
| [io.projectreactor:reactor-bom](https://github.com/reactor/reactor) | `2025.0.6` | `2025.0.7` |
| [io.lettuce:lettuce-core](https://github.com/redis/lettuce) | `7.6.0.RELEASE` | `7.7.0.RELEASE` |
| [com.google.guava:guava](https://github.com/google/guava) | `33.7.0-jre` | `33.7.1-jre` |

Bumps the minor-java-dependencies group with 7 updates in the /integration-tests directory:

| Package | From | To |
| --- | --- | --- |
| [com.google.protobuf:protobuf-bom](https://github.com/protocolbuffers/protobuf) | `4.35.1` | `4.36.0` |
| software.amazon.awssdk:bom | `2.51.4` | `2.54.5` |
| [io.micrometer:micrometer-bom](https://github.com/micrometer-metrics/micrometer-commercial) | `1.17.0` | `1.17.1` |
| [io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom](https://github.com/open-telemetry/opentelemetry-java-instrumentation) | `2.30.0` | `2.31.1` |
| [io.projectreactor:reactor-bom](https://github.com/reactor/reactor) | `2025.0.6` | `2025.0.7` |
| [io.lettuce:lettuce-core](https://github.com/redis/lettuce) | `7.6.0.RELEASE` | `7.7.0.RELEASE` |
| [com.google.guava:guava](https://github.com/google/guava) | `33.7.0-jre` | `33.7.1-jre` |

Bumps the minor-java-dependencies group with 9 updates in the /service directory:

| Package | From | To |
| --- | --- | --- |
| [com.google.protobuf:protobuf-bom](https://github.com/protocolbuffers/protobuf) | `4.35.1` | `4.36.0` |
| software.amazon.awssdk:bom | `2.51.4` | `2.54.5` |
| [io.micrometer:micrometer-bom](https://github.com/micrometer-metrics/micrometer-commercial) | `1.17.0` | `1.17.1` |
| [io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom](https://github.com/open-telemetry/opentelemetry-java-instrumentation) | `2.30.0` | `2.31.1` |
| [io.projectreactor:reactor-bom](https://github.com/reactor/reactor) | `2025.0.6` | `2025.0.7` |
| [io.lettuce:lettuce-core](https://github.com/redis/lettuce) | `7.6.0.RELEASE` | `7.7.0.RELEASE` |
| [com.google.guava:guava](https://github.com/google/guava) | `33.7.0-jre` | `33.7.1-jre` |
| io.swagger.core.v3:swagger-jaxrs2-jakarta | `2.2.53` | `2.2.54` |
| [io.opentelemetry.instrumentation:opentelemetry-logback-appender-1.0](https://github.com/open-telemetry/opentelemetry-java-instrumentation) | `2.30.0-alpha` | `2.31.1-alpha` |

Bumps the minor-java-dependencies group with 7 updates in the /websocket-resources directory:

| Package | From | To |
| --- | --- | --- |
| [com.google.protobuf:protobuf-bom](https://github.com/protocolbuffers/protobuf) | `4.35.1` | `4.36.0` |
| software.amazon.awssdk:bom | `2.51.4` | `2.54.5` |
| [io.micrometer:micrometer-bom](https://github.com/micrometer-metrics/micrometer-commercial) | `1.17.0` | `1.17.1` |
| [io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom](https://github.com/open-telemetry/opentelemetry-java-instrumentation) | `2.30.0` | `2.31.1` |
| [io.projectreactor:reactor-bom](https://github.com/reactor/reactor) | `2025.0.6` | `2025.0.7` |
| [io.lettuce:lettuce-core](https://github.com/redis/lettuce) | `7.6.0.RELEASE` | `7.7.0.RELEASE` |
| [com.google.guava:guava](https://github.com/google/guava) | `33.7.0-jre` | `33.7.1-jre` |

Updates `io.swagger.core.v3:swagger-maven-plugin-jakarta` from 2.2.53 to 2.2.54

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `io.swagger.core.v3:swagger-jaxrs2-jakarta` from 2.2.53 to 2.2.54

Updates `io.opentelemetry.instrumentation:opentelemetry-logback-appender-1.0` from 2.30.0-alpha to 2.31.1-alpha
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/commits)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `com.google.guava:guava` from 33.7.0-jre to 33.7.1-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `com.google.protobuf:protobuf-bom` from 4.35.1 to 4.36.0
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.54.5

Updates `io.micrometer:micrometer-bom` from 1.17.0 to 1.17.1
- [Commits](https://github.com/micrometer-metrics/micrometer-commercial/commits)

Updates `io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom` from 2.30.0 to 2.31.1
- [Release notes](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-java-instrumentation/compare/v2.30.0...v2.31.1)

Updates `io.projectreactor:reactor-bom` from 2025.0.6 to 2025.0.7
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2025.0.6...2025.0.7)

Updates `io.lettuce:lettuce-core` from 7.6.0.RELEASE to 7.7.0.RELEASE
- [Release notes](https://github.com/redis/lettuce/releases)
- [Changelog](https://github.com/redis/lettuce/blob/main/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/lettuce/compare/7.6.0.RELEASE...7.7.0.RELEASE)

---
updated-dependencies:
- dependency-name: io.swagger.core.v3:swagger-maven-plugin-jakarta
  dependency-version: 2.2.54
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.swagger.core.v3:swagger-jaxrs2-jakarta
  dependency-version: 2.2.54
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-logback-appender-1.0
  dependency-version: 2.31.1-alpha
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.1-jre
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-version: 4.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.54.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.micrometer:micrometer-bom
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom
  dependency-version: 2.31.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.projectreactor:reactor-bom
  dependency-version: 2025.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: io.lettuce:lettuce-core
  dependency-version: 7.7.0.RELEASE
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-27 17:36:45 -04:00
Jon Chambers d1ec5d7d9c More explicitly link TOTP key length with the TOTP HMAC algorithm 2026-08-27 17:35:05 -04:00
Ravi Khadiwala c09e167f3f Don't forward exception messages in unavailable statuses 2026-08-26 15:03:45 -05:00
Ravi Khadiwala eaa3c5f20f Remove GrpcExceptionMapper 2026-08-26 15:03:45 -05:00
Jon Chambers eb0ffb0c4d Preserve TOTP keys when reclaiming accounts 2026-08-26 16:01:00 -04:00
Jon Chambers 31b34ed06f Add a missing @Test annotation 2026-08-26 15:58:13 -04:00
Jon Chambers b247fc24c1 Use a TOTP algorithm supported by a wider range of authenticator apps 2026-08-26 15:57:41 -04:00
Ravi Khadiwala 56a91f104e Use exact path matchers in the omnibus 2026-08-26 14:56:59 -05:00
Ravi Khadiwala 461fce800a Remove test-only Subscriptions method 2026-08-26 14:56:36 -05:00
Ameya Lokare 7f08e8bf4e Fix overflow when calculating chunk size in ClearOrphanedFoundationDbQueuesCommand 2026-08-26 09:37:57 -07:00
Ameya Lokare 08ca97ba00 Register clear orphaned FoundationDB queues command 2026-08-25 16:01:28 -07:00
Chris Eager 4577a4aa9b Also ignore org.eclipse.jetty.ee10:* <=12.1.12 2026-08-25 13:29:52 -07:00
Chris Eager 8fac5de9af Update fdb-java to 7.3.76 2026-08-25 13:29:52 -07:00
Ravi Khadiwala 1dd7383af0 Avoid DNS lookups when parsing PPv2 headers
PPv2 headers should only come from trusted sources, but use a less
error-prone IP parsing mechanism anyways
2026-08-25 13:28:34 -07:00
Ravi Khadiwala 5f66f1c51d Only support X-Forwarded-For header for setting remote address 2026-08-25 13:27:16 -07:00
Ameya Lokare 867ec4a3df Increase queue empty timeout in MessagingTest 2026-08-25 13:26:14 -07:00
Ravi Khadiwala a5f2f7f3e5 Move number rate-limiting after verification 2026-08-25 13:25:28 -07:00
Ameya Lokare 4c2cd0c999 Add command to clear orphaned queues in FoundationDB 2026-08-25 13:13:18 -07:00
Chris Eager 14fb2fb29d Update base image to 25.0.4_7 2026-08-25 11:27:50 -04:00
Jon Chambers c612bd4b73 Use single bytes to represent TOTP key IDs and limit key IDs to [0, 127] 2026-08-25 11:27:38 -04:00
Jon Chambers 4157cadf44 Correct type for TOTP key IDs 2026-08-25 11:27:38 -04:00
Chris Eager 0cabb53aed Reorganize ignore in dependabot.yml 2026-08-25 11:27:31 -04:00
Chris Eager f04e716347 Clean up WhisperServerServiceTest 2026-08-25 11:27:31 -04:00
Chris Eager 558649ba65 Fix jetty-bom in dependency management 2026-08-25 11:27:31 -04:00
Chris Eager 43dc9d11fd Revert fdb-java to 7.3.68
7.3.79 is a pre-release
2026-08-25 11:27:31 -04:00
Chris Eager 9547655a9c Pin jackson-databind to 3.2.1 2026-08-25 11:27:31 -04:00
Chris Eager 547bde4869 Pin okio-jvm to 3.17.0 2026-08-25 11:27:31 -04:00
Chris Eager fe1082d8ba Ignore AWS SDK 2.52.0+
https://github.com/aws/aws-sdk-java-v2/issues/7313
2026-08-25 11:27:31 -04:00
Chris Eager 7c77dd20bc Re-pin logback to 1.5.38 2026-08-25 11:27:31 -04:00
dependabot[bot] f0370b75af Bump the minor-java-dependencies group across 4 directories with 9 updates
Bumps the minor-java-dependencies group with 6 updates in the /api-doc directory:

| Package | From | To |
| --- | --- | --- |
| io.swagger.core.v3:swagger-maven-plugin-jakarta | `2.2.46` | `2.2.53` |
| software.amazon.awssdk:bom | `2.51.4` | `2.53.1` |
| [org.foundationdb:fdb-java](https://github.com/apple/foundationdb) | `7.3.68` | `7.3.79` |
| [com.google.guava:guava](https://github.com/google/guava) | `33.6.0-jre` | `33.7.0-jre` |
| [ch.qos.logback:logback-core](https://github.com/qos-ch/logback) | `1.5.38` | `1.6.3` |
| [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) | `1.5.38` | `1.6.3` |

Bumps the minor-java-dependencies group with 5 updates in the /integration-tests directory:

| Package | From | To |
| --- | --- | --- |
| software.amazon.awssdk:bom | `2.51.4` | `2.53.1` |
| [org.foundationdb:fdb-java](https://github.com/apple/foundationdb) | `7.3.68` | `7.3.79` |
| [com.google.guava:guava](https://github.com/google/guava) | `33.6.0-jre` | `33.7.0-jre` |
| [ch.qos.logback:logback-core](https://github.com/qos-ch/logback) | `1.5.38` | `1.6.3` |
| [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) | `1.5.38` | `1.6.3` |

Bumps the minor-java-dependencies group with 8 updates in the /service directory:

| Package | From | To |
| --- | --- | --- |
| software.amazon.awssdk:bom | `2.51.4` | `2.53.1` |
| [org.foundationdb:fdb-java](https://github.com/apple/foundationdb) | `7.3.68` | `7.3.79` |
| [com.google.guava:guava](https://github.com/google/guava) | `33.6.0-jre` | `33.7.0-jre` |
| [ch.qos.logback:logback-core](https://github.com/qos-ch/logback) | `1.5.38` | `1.6.3` |
| [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) | `1.5.38` | `1.6.3` |
| io.swagger.core.v3:swagger-jaxrs2-jakarta | `2.2.46` | `2.2.53` |
| [tools.jackson.core:jackson-databind](https://github.com/FasterXML/jackson) | `3.2.1` | `3.2.2` |
| [com.squareup.okio:okio-jvm](https://github.com/lysine-dev/okio) | `3.17.0` | `3.18.1` |

Bumps the minor-java-dependencies group with 5 updates in the /websocket-resources directory:

| Package | From | To |
| --- | --- | --- |
| software.amazon.awssdk:bom | `2.51.4` | `2.53.1` |
| [org.foundationdb:fdb-java](https://github.com/apple/foundationdb) | `7.3.68` | `7.3.79` |
| [com.google.guava:guava](https://github.com/google/guava) | `33.6.0-jre` | `33.7.0-jre` |
| [ch.qos.logback:logback-core](https://github.com/qos-ch/logback) | `1.5.38` | `1.6.3` |
| [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) | `1.5.38` | `1.6.3` |



Updates `io.swagger.core.v3:swagger-maven-plugin-jakarta` from 2.2.46 to 2.2.53

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `io.swagger.core.v3:swagger-jaxrs2-jakarta` from 2.2.46 to 2.2.53

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `tools.jackson.core:jackson-databind` from 3.2.1 to 3.2.2
- [Commits](https://github.com/FasterXML/jackson/commits)

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `com.squareup.okio:okio-jvm` from 3.17.0 to 3.18.1
- [Changelog](https://github.com/lysine-dev/okio/blob/main/CHANGELOG.md)
- [Commits](https://github.com/lysine-dev/okio/compare/parent-3.17.0...parent-3.18.1)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `ch.qos.logback:logback-core` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `ch.qos.logback:logback-classic` from 1.5.38 to 1.6.3
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.38...v_1.6.3)

Updates `com.google.guava:guava` from 33.6.0-jre to 33.7.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

Updates `software.amazon.awssdk:bom` from 2.51.4 to 2.53.1

Updates `org.foundationdb:fdb-java` from 7.3.68 to 7.3.79
- [Release notes](https://github.com/apple/foundationdb/releases)
- [Commits](https://github.com/apple/foundationdb/compare/7.3.68...7.3.79)

---
updated-dependencies:
- dependency-name: io.swagger.core.v3:swagger-maven-plugin-jakarta
  dependency-version: 2.2.53
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: io.swagger.core.v3:swagger-jaxrs2-jakarta
  dependency-version: 2.2.53
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: tools.jackson.core:jackson-databind
  dependency-version: 3.2.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.squareup.okio:okio-jvm
  dependency-version: 3.18.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-core
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: ch.qos.logback:logback-classic
  dependency-version: 1.6.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: com.google.guava:guava
  dependency-version: 33.7.0-jre
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: software.amazon.awssdk:bom
  dependency-version: 2.53.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-java-dependencies
- dependency-name: org.foundationdb:fdb-java
  dependency-version: 7.3.79
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-java-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-25 11:27:31 -04:00
Ravi Khadiwala ed08d1dc23 Handle empty RRPs gracefully 2026-08-25 11:27:26 -04:00
Chris Eager 369ca0b514 Add OpenTelemetryConfiguration.publishMaxGaugeForHistograms 2026-08-21 17:44:47 -04:00
199 changed files with 7766 additions and 2422 deletions

No files matched your search

+21
View File
@@ -19,6 +19,27 @@ updates:
update-types:
- version-update:semver-major
- version-update:semver-minor
# Ignore the latest pre-release version
versions: ["<=7.3.79"]
# Temporary exclusions, pending upstream fixes
# https://github.com/dropwizard/dropwizard/pull/11273
- dependency-name: "ch.qos.logback:*"
versions: [">=1.6.0"]
# https://github.com/jetty/jetty.project/issues/15657
- dependency-name: "org.eclipse.jetty:*"
versions: ["<=12.1.12"]
- dependency-name: "org.eclipse.jetty.ee10:*"
versions: ["<=12.1.12"]
# Temporary exclusions, pending adaptation to upstream changes
- dependency-name: "io.lettuce:lettuce-core"
versions: [">=7.7.0.RELEASE"]
# Dependency convergence sentinels, pinned to specific versions
- dependency-name: "tools.jackson.core:jackson-databind"
- dependency-name: "com.squareup.okio:okio-jvm"
groups:
minor-java-dependencies:
# Java: Only group minor and patch updates (we want to carefully review major updates)
+7 -6
View File
@@ -12,16 +12,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
- name: Install APT packages
run: |
sudo apt-get update
# setup-java requires gpg
sudo apt-get install -y protobuf-compiler gpg
pip install sabledocs
- uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: 'temurin'
java-version-file: .java-version
cache: 'maven'
- name: Install gRPC documentation tooling
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
pip install sabledocs
- name: Generate OpenAPI documentation
run: ./mvnw compile
- name: Generate gRPC documentation
+6 -1
View File
@@ -20,7 +20,12 @@ jobs:
issues: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
- name: Install APT packages
run: |
# setup-java requires gpg
sudo apt update
sudo apt install -y gpg
- uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: 'temurin'
java-version-file: .java-version
+4 -4
View File
@@ -32,11 +32,11 @@ jobs:
- name: Install APT packages
# ca-certificates: required for AWS CRT client
run: |
# Add Docker's official GPG key:
apt update
apt install -y ca-certificates curl
# Maven Wrapper requires `unzip`; see https://github.com/apache/maven-wrapper/issues/425
apt install -y unzip
# setup-java requires gpg
apt install -y ca-certificates curl gpg unzip
# Add Docker's official GPG key:
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
@@ -50,7 +50,7 @@ jobs:
# ca-certificates: required for AWS CRT client
apt update && apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin ca-certificates
- name: Set up JDK
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0
with:
distribution: 'temurin'
java-version-file: .java-version
+1 -1
View File
@@ -1 +1 @@
temurin-25
temurin-26
+6 -5
View File
@@ -10,10 +10,6 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-tests</artifactId>
<properties>
<jetty.http2-client.version>12.1.12</jetty.http2-client.version>
</properties>
<dependencies>
<dependency>
<groupId>org.whispersystems.textsecure</groupId>
@@ -39,7 +35,12 @@
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
<artifactId>jetty-http2-client-transport</artifactId>
<version>${jetty.http2-client.version}</version>
</dependency>
<dependency>
<groupId>com.webauthn4j</groupId>
<artifactId>webauthn4j-test</artifactId>
<version>${webauthn4j.version}</version>
</dependency>
</dependencies>
@@ -1,101 +0,0 @@
/*
* Copyright 2023 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.signal.integration;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import java.util.Base64;
import org.signal.libsignal.protocol.IdentityKey;
import org.signal.libsignal.protocol.ecc.ECPublicKey;
public final class Codecs {
private Codecs() {
// utility class
}
@FunctionalInterface
public interface CheckedFunction<T, R> {
R apply(T t) throws Exception;
}
public static class Base64BasedSerializer<T> extends JsonSerializer<T> {
private final CheckedFunction<T, byte[]> mapper;
public Base64BasedSerializer(final CheckedFunction<T, byte[]> mapper) {
this.mapper = mapper;
}
@Override
public void serialize(final T value, final JsonGenerator gen, final SerializerProvider serializers) throws IOException {
try {
gen.writeString(Base64.getEncoder().withoutPadding().encodeToString(mapper.apply(value)));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
public static class Base64BasedDeserializer<T> extends JsonDeserializer<T> {
private final CheckedFunction<byte[], T> mapper;
public Base64BasedDeserializer(final CheckedFunction<byte[], T> mapper) {
this.mapper = mapper;
}
@Override
public T deserialize(final JsonParser p, final DeserializationContext ctxt) throws IOException {
try {
return mapper.apply(Base64.getDecoder().decode(p.getValueAsString()));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
public static class ByteArraySerializer extends Base64BasedSerializer<byte[]> {
public ByteArraySerializer() {
super(bytes -> bytes);
}
}
public static class ByteArrayDeserializer extends Base64BasedDeserializer<byte[]> {
public ByteArrayDeserializer() {
super(bytes -> bytes);
}
}
public static class ECPublicKeySerializer extends Base64BasedSerializer<ECPublicKey> {
public ECPublicKeySerializer() {
super(ECPublicKey::serialize);
}
}
public static class ECPublicKeyDeserializer extends Base64BasedDeserializer<ECPublicKey> {
public ECPublicKeyDeserializer() {
super(ECPublicKey::new);
}
}
public static class IdentityKeySerializer extends Base64BasedSerializer<IdentityKey> {
public IdentityKeySerializer() {
super(IdentityKey::serialize);
}
}
public static class IdentityKeyDeserializer extends Base64BasedDeserializer<IdentityKey> {
public IdentityKeyDeserializer() {
super(bytes -> new IdentityKey(bytes, 0));
}
}
}
@@ -10,10 +10,27 @@ import static java.util.Objects.requireNonNull;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.common.io.Resources;
import com.google.common.net.HttpHeaders;
import com.webauthn4j.data.AuthenticatorAssertionResponse;
import com.webauthn4j.data.PublicKeyCredential;
import com.webauthn4j.data.PublicKeyCredentialDescriptor;
import com.webauthn4j.data.PublicKeyCredentialRequestOptions;
import com.webauthn4j.data.PublicKeyCredentialType;
import com.webauthn4j.data.UserVerificationRequirement;
import com.webauthn4j.data.client.challenge.DefaultChallenge;
import com.webauthn4j.test.client.ClientPlatform;
import io.dropwizard.configuration.ConfigurationValidationException;
import io.dropwizard.jersey.validation.Validators;
import io.grpc.ChannelCredentials;
import io.grpc.ClientInterceptor;
import io.grpc.Grpc;
import io.grpc.ManagedChannel;
import io.grpc.Metadata;
import io.grpc.TlsChannelCredentials;
import io.grpc.stub.MetadataUtils;
import jakarta.validation.ConstraintViolation;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.lang.invoke.MethodHandles;
import java.net.URI;
import java.net.URL;
@@ -24,6 +41,7 @@ import java.security.KeyStore;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
import java.util.List;
@@ -32,6 +50,7 @@ import java.util.Optional;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.tuple.Pair;
@@ -43,6 +62,7 @@ import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.signal.integration.config.Config;
import org.signal.integration.config.WebAuthnConfiguration;
import org.signal.libsignal.protocol.IdentityKey;
import org.signal.libsignal.protocol.ecc.ECKeyPair;
import org.signal.libsignal.protocol.ecc.ECPublicKey;
@@ -58,6 +78,7 @@ import org.signal.libsignal.zkgroup.receipts.ReceiptCredentialPresentation;
import org.signal.libsignal.zkgroup.receipts.ReceiptSerial;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.auth.grpc.RequireAuthenticationInterceptor;
import org.whispersystems.textsecuregcm.entities.AccountAttributes;
import org.whispersystems.textsecuregcm.entities.AccountIdentityResponse;
import org.whispersystems.textsecuregcm.entities.DeviceActivationRequest;
@@ -65,6 +86,7 @@ import org.whispersystems.textsecuregcm.entities.ECSignedPreKey;
import org.whispersystems.textsecuregcm.entities.KEMSignedPreKey;
import org.whispersystems.textsecuregcm.entities.RegistrationRequest;
import org.whispersystems.textsecuregcm.http.FaultTolerantHttpClient;
import org.whispersystems.textsecuregcm.mappers.MfaFailureExceptionMapper;
import org.whispersystems.textsecuregcm.storage.Device;
import org.whispersystems.textsecuregcm.util.CertificateUtil;
import org.whispersystems.textsecuregcm.util.HeaderUtils;
@@ -77,6 +99,8 @@ public final class Operations {
private static final Config CONFIG = loadConfigFromClasspath("config.yml");
private static final String GRPC_DOMAIN = "grpc." + CONFIG.domain();
private static final IntegrationTools INTEGRATION_TOOLS = IntegrationTools.create(CONFIG);
private static final String USER_AGENT = "integration-test";
@@ -85,6 +109,7 @@ public final class Operations {
private static final WebSocketClient WEB_SOCKET_CLIENT = buildWebSocketClient();
private static final ManagedChannel GRPC_CHANNEL = buildGrpcChannel();
private Operations() {
// utility class
@@ -99,6 +124,10 @@ public final class Operations {
);
}
public static WebAuthnConfiguration getWebAuthnConfiguration() {
return CONFIG.webAuthn();
}
public static TestUser registerNumberlessUser(final ReceiptCredential receiptCredential)
throws InvalidInputException, VerificationFailedException {
final String accountPassword = Base64.getEncoder().encodeToString(randomBytes(32));
@@ -113,6 +142,7 @@ public final class Operations {
null,
receiptCredentialPresentation.serialize(),
null,
null,
user.accountAttributes(),
true,
new IdentityKey(aciIdentityKeyPair.getPublicKey()),
@@ -133,6 +163,107 @@ public final class Operations {
return user;
}
public static TestUser recoverNumberlessUserWithTotp(final TestUser testUser, @Nullable final Integer totp) {
final TestUser recoveredUser = TestUser.createNumberlessForRecovery(testUser.accountPassword(), testUser.registrationPassword());
final ECKeyPair aciIdentityKeyPair = ECKeyPair.generate();
final ECKeyPair pniIdentityKeyPair = ECKeyPair.generate();
final RegistrationRequest registrationRequest = new RegistrationRequest(null,
testUser.registrationPassword(),
null,
totp,
null,
recoveredUser.accountAttributes(),
true,
new IdentityKey(aciIdentityKeyPair.getPublicKey()),
new IdentityKey(pniIdentityKeyPair.getPublicKey()),
new DeviceActivationRequest(generateSignedECPreKey(1, aciIdentityKeyPair),
Optional.of(generateSignedECPreKey(2, pniIdentityKeyPair)),
generateSignedKEMPreKey(3, aciIdentityKeyPair),
Optional.of(generateSignedKEMPreKey(4, pniIdentityKeyPair)),
Optional.empty(),
Optional.empty()));
final AccountIdentityResponse registrationResponse = apiPost("/v1/registration", registrationRequest)
// For a numberless account recovery, the username is the ACI
.authorized(testUser.aciUuid().toString(), testUser.accountPassword())
.executeExpectSuccess(AccountIdentityResponse.class);
recoveredUser.setAciUuid(registrationResponse.uuid());
return recoveredUser;
}
public static TestUser recoverNumberlessUserWithWebAuthn(final TestUser testUser,
final ClientPlatform clientPlatform,
final byte[] credentialId,
final String relyingPartyId) {
final TestUser recoveredUser = TestUser.createNumberlessForRecovery(testUser.accountPassword(), testUser.registrationPassword());
final ECKeyPair aciIdentityKeyPair = ECKeyPair.generate();
final ECKeyPair pniIdentityKeyPair = ECKeyPair.generate();
final RegistrationRequest initialRequest = new RegistrationRequest(null,
testUser.registrationPassword(),
null,
null,
null,
recoveredUser.accountAttributes(),
true,
new IdentityKey(aciIdentityKeyPair.getPublicKey()),
new IdentityKey(pniIdentityKeyPair.getPublicKey()),
new DeviceActivationRequest(generateSignedECPreKey(1, aciIdentityKeyPair),
Optional.of(generateSignedECPreKey(2, pniIdentityKeyPair)),
generateSignedKEMPreKey(3, aciIdentityKeyPair),
Optional.of(generateSignedKEMPreKey(4, pniIdentityKeyPair)),
Optional.empty(),
Optional.empty()));
final Pair<Integer, MfaFailureExceptionMapper.MfaFailureResponse> initialResponse = apiPost("/v1/registration", initialRequest)
// For a numberless account recovery, the username is the ACI
.authorized(testUser.aciUuid().toString(), testUser.accountPassword())
.execute(MfaFailureExceptionMapper.MfaFailureResponse.class);
// we expect (and need) failure with status 441, which will contain the WebAuthn challenge
assert initialResponse.getLeft() == 441;
final MfaFailureExceptionMapper.MfaFailureResponse mfaFailureResponse = initialResponse.getRight();
assert mfaFailureResponse.webAuthnParameters().allowedCredentialIds()
.stream()
.anyMatch(allowedId -> Arrays.equals(allowedId, credentialId));
final PublicKeyCredential<AuthenticatorAssertionResponse, ?> credential =
clientPlatform.get(new PublicKeyCredentialRequestOptions(
new DefaultChallenge(mfaFailureResponse.webAuthnParameters().challenge()),
null,
relyingPartyId,
List.of(new PublicKeyCredentialDescriptor(PublicKeyCredentialType.PUBLIC_KEY, credentialId, null)),
UserVerificationRequirement.DISCOURAGED,
null));
final RegistrationRequest registrationRequest = new RegistrationRequest(null,
testUser.registrationPassword(),
null,
null,
webAuthnVerificationResponseJson(credential),
recoveredUser.accountAttributes(),
true,
new IdentityKey(aciIdentityKeyPair.getPublicKey()),
new IdentityKey(pniIdentityKeyPair.getPublicKey()),
new DeviceActivationRequest(generateSignedECPreKey(1, aciIdentityKeyPair),
Optional.of(generateSignedECPreKey(2, pniIdentityKeyPair)),
generateSignedKEMPreKey(3, aciIdentityKeyPair),
Optional.of(generateSignedKEMPreKey(4, pniIdentityKeyPair)),
Optional.empty(),
Optional.empty()));
final AccountIdentityResponse registrationResponse = apiPost("/v1/registration", registrationRequest)
// For a numberless account recovery, the username is the ACI
.authorized(testUser.aciUuid().toString(), testUser.accountPassword())
.executeExpectSuccess(AccountIdentityResponse.class);
recoveredUser.setAciUuid(registrationResponse.uuid());
return recoveredUser;
}
public static TestUser newRegisteredUser(final String number) {
final byte[] registrationPassword = populateRandomRecoveryPassword(number);
final String accountPassword = Base64.getEncoder().encodeToString(randomBytes(32));
@@ -148,6 +279,7 @@ public final class Operations {
registrationPassword,
null,
null,
null,
accountAttributes,
true,
new IdentityKey(aciIdentityKeyPair.getPublicKey()),
@@ -239,7 +371,7 @@ public final class Operations {
}
}
private static byte[] randomBytes(int numBytes) {
public static byte[] randomBytes(final int numBytes) {
final byte[] bytes = new byte[numBytes];
new SecureRandom().nextBytes(bytes);
return bytes;
@@ -272,6 +404,33 @@ public final class Operations {
return URI.create("https://" + CONFIG.domain() + endpoint + query);
}
public static ManagedChannel grpcChannel() {
return GRPC_CHANNEL;
}
public static ClientInterceptor authorizationInterceptor(final TestUser user, final byte deviceId) {
final String username = "%s.%d".formatted(user.aciUuid().toString(), deviceId);
final Metadata metadata = new Metadata();
metadata.put(RequireAuthenticationInterceptor.AUTHORIZATION_METADATA_KEY,
HeaderUtils.basicAuthHeader(username, user.accountPassword()));
return MetadataUtils.newAttachHeadersInterceptor(metadata);
}
private static ManagedChannel buildGrpcChannel() {
try {
final ByteArrayInputStream rootCert =
new ByteArrayInputStream(CONFIG.rootCert().getBytes(StandardCharsets.UTF_8));
final ChannelCredentials credentials = TlsChannelCredentials.newBuilder().trustManager(rootCert).build();
return Grpc.newChannelBuilderForAddress(GRPC_DOMAIN, 443, credentials)
.userAgent(USER_AGENT)
.build();
} catch (final IOException e) {
throw new UncheckedIOException(e);
}
}
public static class RequestBuilder {
private final HttpRequest.Builder builder;
@@ -322,33 +481,39 @@ public final class Operations {
}
public Pair<Integer, Void> executeExpectSuccess() {
final Pair<Integer, Void> execute = execute();
final RawResponse response = executeRaw();
Validate.isTrue(
HttpUtils.isSuccessfulResponse(execute.getLeft()),
"Unexpected response code: %d",
execute.getLeft());
return execute;
HttpUtils.isSuccessfulResponse(response.statusCode()),
"Unexpected response code: %d, body: %s",
response.statusCode(), response.body());
return Pair.of(response.statusCode(), null);
}
public <T> T executeExpectSuccess(final Class<T> expectedType) {
final Pair<Integer, T> execute = execute(expectedType);
final RawResponse response = executeRaw();
Validate.isTrue(
HttpUtils.isSuccessfulResponse(execute.getLeft()),
"Unexpected response code: %d : %s",
execute.getLeft(), execute.getRight());
return requireNonNull(execute.getRight());
HttpUtils.isSuccessfulResponse(response.statusCode()),
"Unexpected response code: %d, body: %s",
response.statusCode(), response.body());
return requireNonNull(parseBody(response.body(), expectedType));
}
public void executeExpectStatusCode(final int expectedStatusCode) {
final Pair<Integer, Void> execute = execute(Void.class);
final RawResponse response = executeRaw();
Validate.isTrue(
execute.getLeft() == expectedStatusCode,
"Unexpected response code: %d",
execute.getLeft()
);
response.statusCode() == expectedStatusCode,
"Unexpected response code: %d (expected %d), body: %s",
response.statusCode(), expectedStatusCode, response.body());
}
public <T> Pair<Integer, T> execute(final Class<T> expectedType) {
final RawResponse response = executeRaw();
return Pair.of(response.statusCode(), parseBody(response.body(), expectedType));
}
private record RawResponse(int statusCode, String body) {}
private RawResponse executeRaw() {
builder.uri(serverUri(endpoint, queryParams))
.header(HttpHeaders.USER_AGENT, USER_AGENT);
return CLIENT.sendAsync(builder.build(), HttpResponse.BodyHandlers.ofString(StandardCharsets.UTF_8))
@@ -358,19 +523,24 @@ public final class Operations {
error.printStackTrace();
}
})
.thenApply(response -> {
try {
final T result = expectedType.equals(Void.class)
? null
: SystemMapper.jsonMapper().readValue(response.body(), expectedType);
return Pair.of(response.statusCode(), result);
} catch (final IOException e) {
throw new RuntimeException(e);
}
})
.thenApply(response -> new RawResponse(response.statusCode(), response.body()))
.join();
}
@Nullable
private static <T> T parseBody(final String body, final Class<T> expectedType) {
if (expectedType.equals(Void.class)) {
return null;
}
try {
return SystemMapper.jsonMapper().readValue(body, expectedType);
} catch (final IOException e) {
throw new RuntimeException(
"Could not parse response body as %s, body: %s".formatted(expectedType.getSimpleName(), body), e);
}
}
}
private static FaultTolerantHttpClient buildClient() {
@@ -416,7 +586,7 @@ public final class Operations {
final String path,
final Map<String, String> headers) throws IOException {
final URI uri = URI.create("wss://grpc." + CONFIG.domain() + path);
final URI uri = URI.create("wss://" + GRPC_DOMAIN + path);
final ClientUpgradeRequest request = new ClientUpgradeRequest(uri);
headers.forEach(request::setHeader);
@@ -466,4 +636,34 @@ public final class Operations {
throw new RuntimeException(e);
}
}
/// Serializes an assertion into the [specification](https://www.w3.org/TR/webauthn/#dictdef-authenticationresponsejson) format.
static String webAuthnVerificationResponseJson(final PublicKeyCredential<AuthenticatorAssertionResponse, ?> credential) {
final AuthenticatorAssertionResponse response = credential.getResponse();
return """
{
"id": "%s",
"rawId": "%s",
"type": "public-key",
"clientExtensionResults": {},
"response": {
"clientDataJSON": "%s",
"authenticatorData": "%s",
"signature": "%s",
"userHandle": %s
}
}
""".formatted(
base64Url(credential.getRawId()),
base64Url(credential.getRawId()),
base64Url(response.getClientDataJSON()),
base64Url(response.getAuthenticatorData()),
base64Url(response.getSignature()),
response.getUserHandle() == null ? "null" : "\"" + base64Url(response.getUserHandle()) + "\"");
}
private static String base64Url(@Nullable final byte[] bytes) {
return Base64.getUrlEncoder().withoutPadding().encodeToString(bytes);
}
}
@@ -1,61 +0,0 @@
/*
* Copyright 2023 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.signal.integration;
import jakarta.annotation.Nullable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.lang3.tuple.Pair;
import org.signal.libsignal.protocol.IdentityKeyPair;
import org.signal.libsignal.protocol.ecc.ECKeyPair;
import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
public class TestDevice {
private final byte deviceId;
private final Map<Integer, Pair<IdentityKeyPair, SignedPreKeyRecord>> signedPreKeys = new ConcurrentHashMap<>();
public static TestDevice create(
final byte deviceId,
final IdentityKeyPair aciIdentityKeyPair,
@Nullable final IdentityKeyPair pniIdentityKeyPair) {
final TestDevice device = new TestDevice(deviceId);
device.addSignedPreKey(aciIdentityKeyPair);
if (pniIdentityKeyPair != null) {
device.addSignedPreKey(pniIdentityKeyPair);
}
return device;
}
public TestDevice(final byte deviceId) {
this.deviceId = deviceId;
}
public byte deviceId() {
return deviceId;
}
public SignedPreKeyRecord latestSignedPreKey(final IdentityKeyPair identity) {
final int id = signedPreKeys.entrySet()
.stream()
.filter(p -> p.getValue().getLeft().equals(identity))
.mapToInt(Map.Entry::getKey)
.max()
.orElseThrow();
return signedPreKeys.get(id).getRight();
}
public SignedPreKeyRecord addSignedPreKey(final IdentityKeyPair identity) {
final int nextId = signedPreKeys.keySet().stream().mapToInt(k -> k + 1).max().orElse(0);
final ECKeyPair keyPair = ECKeyPair.generate();
final byte[] signature = keyPair.getPrivateKey().calculateSignature(keyPair.getPublicKey().serialize());
final SignedPreKeyRecord signedPreKeyRecord = new SignedPreKeyRecord(nextId, System.currentTimeMillis(), keyPair, signature);
signedPreKeys.put(nextId, Pair.of(identity, signedPreKeyRecord));
return signedPreKeyRecord;
}
}
@@ -5,29 +5,15 @@
package org.signal.integration;
import static java.util.Objects.requireNonNull;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.security.SecureRandom;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.security.SecureRandom;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import org.signal.libsignal.protocol.IdentityKey;
import org.signal.libsignal.protocol.IdentityKeyPair;
import org.signal.libsignal.protocol.InvalidKeyException;
import org.signal.libsignal.protocol.ecc.ECPublicKey;
import org.signal.libsignal.protocol.state.SignedPreKeyRecord;
import javax.annotation.Nullable;
import org.signal.libsignal.protocol.util.KeyHelper;
import org.whispersystems.textsecuregcm.auth.UnidentifiedAccessUtil;
import org.whispersystems.textsecuregcm.entities.AccountAttributes;
import org.whispersystems.textsecuregcm.storage.Device;
import org.whispersystems.textsecuregcm.storage.DeviceCapability;
import javax.annotation.Nullable;
public class TestUser {
@@ -36,21 +22,14 @@ public class TestUser {
@Nullable
private final Integer pniRegistrationId;
private final IdentityKeyPair aciIdentityKey;
private final Map<Byte, TestDevice> devices = new ConcurrentHashMap<>();
private final byte[] unidentifiedAccessKey;
@Nullable
private String phoneNumber;
private final String phoneNumber;
@Nullable
private IdentityKeyPair pniIdentityKey;
private final String accountPassword;
private String accountPassword;
private byte[] registrationPassword;
private final byte[] registrationPassword;
private UUID aciUuid;
@@ -58,40 +37,44 @@ public class TestUser {
private UUID pniUuid;
public static TestUser createNumberless(final String accountPassword, final byte[] accountRecoveryPassword) {
final IdentityKeyPair aciIdentityKey = IdentityKeyPair.generate();
final int registrationId = KeyHelper.generateRegistrationId(false);
final byte[] unidentifiedAccessKey = new byte[UnidentifiedAccessUtil.UNIDENTIFIED_ACCESS_KEY_LENGTH];
new SecureRandom().nextBytes(unidentifiedAccessKey);
final byte[] unidentifiedAccessKey = Operations.randomBytes(UnidentifiedAccessUtil.UNIDENTIFIED_ACCESS_KEY_LENGTH);
return new TestUser(
registrationId,
null,
aciIdentityKey,
null,
null,
unidentifiedAccessKey,
accountPassword,
accountRecoveryPassword);
}
public static TestUser createNumberlessForRecovery(final String accountPassword, final byte[] accountRecoveryPassword) {
// Recovering a numberless account requires PNI keys (though they are discarded by the server)
final int registrationId = KeyHelper.generateRegistrationId(false);
final int pniRegistrationId = KeyHelper.generateRegistrationId(false);
final byte[] unidentifiedAccessKey = new byte[UnidentifiedAccessUtil.UNIDENTIFIED_ACCESS_KEY_LENGTH];
new SecureRandom().nextBytes(unidentifiedAccessKey);
return new TestUser(
registrationId,
pniRegistrationId,
null,
unidentifiedAccessKey,
accountPassword,
accountRecoveryPassword);
}
public static TestUser create(final String phoneNumber, final String accountPassword, final byte[] registrationPassword) {
// ACI identity key pair
final IdentityKeyPair aciIdentityKey = IdentityKeyPair.generate();
// PNI identity key pair
final IdentityKeyPair pniIdentityKey = IdentityKeyPair.generate();
// registration id
final int registrationId = KeyHelper.generateRegistrationId(false);
final int pniRegistrationId = KeyHelper.generateRegistrationId(false);
// uak
final byte[] unidentifiedAccessKey = new byte[UnidentifiedAccessUtil.UNIDENTIFIED_ACCESS_KEY_LENGTH];
new SecureRandom().nextBytes(unidentifiedAccessKey);
return new TestUser(
registrationId,
pniRegistrationId,
aciIdentityKey,
phoneNumber,
pniIdentityKey,
unidentifiedAccessKey,
accountPassword,
registrationPassword);
@@ -100,39 +83,26 @@ public class TestUser {
public TestUser(
final int registrationId,
@Nullable final Integer pniRegistrationId,
final IdentityKeyPair aciIdentityKey,
@Nullable final String phoneNumber,
@Nullable final IdentityKeyPair pniIdentityKey,
final byte[] unidentifiedAccessKey,
final String accountPassword,
final byte[] registrationPassword) {
this.registrationId = registrationId;
this.pniRegistrationId = pniRegistrationId;
this.aciIdentityKey = aciIdentityKey;
this.phoneNumber = phoneNumber;
this.pniIdentityKey = pniIdentityKey;
this.unidentifiedAccessKey = unidentifiedAccessKey;
this.accountPassword = accountPassword;
this.registrationPassword = registrationPassword;
devices.put(Device.PRIMARY_ID, TestDevice.create(Device.PRIMARY_ID, aciIdentityKey, pniIdentityKey));
}
public int registrationId() {
return registrationId;
}
public IdentityKeyPair aciIdentityKey() {
return aciIdentityKey;
}
public Optional<String> phoneNumber() {
return Optional.ofNullable(phoneNumber);
}
public Optional<IdentityKeyPair> pniIdentityKey() {
return Optional.ofNullable(pniIdentityKey);
}
public String accountPassword() {
return accountPassword;
}
@@ -151,9 +121,8 @@ public class TestUser {
public AccountAttributes accountAttributes() {
return new AccountAttributes(true, registrationId, pniRegistrationId, "".getBytes(StandardCharsets.UTF_8), "", true,
DeviceCapability.CAPABILITIES_REQUIRED_FOR_NEW_DEVICES, null)
.setUnidentifiedAccessKey(unidentifiedAccessKey)
.setRecoveryPassword(registrationPassword);
DeviceCapability.CAPABILITIES_REQUIRED_FOR_NEW_DEVICES, registrationPassword)
.setUnidentifiedAccessKey(unidentifiedAccessKey);
}
public void setAciUuid(final UUID aciUuid) {
@@ -163,59 +132,4 @@ public class TestUser {
public void setPniUuid(@Nullable final UUID pniUuid) {
this.pniUuid = pniUuid;
}
public void setPhoneNumber(@Nullable final String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public void setPniIdentityKey(@Nullable final IdentityKeyPair pniIdentityKey) {
this.pniIdentityKey = pniIdentityKey;
}
public void setAccountPassword(final String accountPassword) {
this.accountPassword = accountPassword;
}
public void setRegistrationPassword(final byte[] registrationPassword) {
this.registrationPassword = registrationPassword;
}
public PreKeySetPublicView preKeys(final byte deviceId, final boolean pni) {
final IdentityKeyPair identity = pni
? pniIdentityKey
: aciIdentityKey;
final TestDevice device = requireNonNull(devices.get(deviceId));
final SignedPreKeyRecord signedPreKeyRecord = device.latestSignedPreKey(identity);
try {
return new PreKeySetPublicView(
Collections.emptyList(),
identity.getPublicKey(),
new SignedPreKeyPublicView(
signedPreKeyRecord.getId(),
signedPreKeyRecord.getKeyPair().getPublicKey(),
signedPreKeyRecord.getSignature()
)
);
} catch (InvalidKeyException e) {
throw new RuntimeException(e);
}
}
public record SignedPreKeyPublicView(
int keyId,
@JsonSerialize(using = Codecs.ECPublicKeySerializer.class)
@JsonDeserialize(using = Codecs.ECPublicKeyDeserializer.class)
ECPublicKey publicKey,
@JsonSerialize(using = Codecs.ByteArraySerializer.class)
@JsonDeserialize(using = Codecs.ByteArrayDeserializer.class)
byte[] signature) {
}
public record PreKeySetPublicView(
List<String> preKeys,
@JsonSerialize(using = Codecs.IdentityKeySerializer.class)
@JsonDeserialize(using = Codecs.IdentityKeyDeserializer.class)
IdentityKey identityKey,
SignedPreKeyPublicView signedPreKey) {
}
}
@@ -18,5 +18,6 @@ public record Config(@NotBlank String domain,
@NotBlank String prescribedRegistrationCode,
@NotBlank String prescribedReceiptSerial,
@NotBlank String prescribedReceiptCredential,
@NotBlank String serverZkPublicParams) {
@NotBlank String serverZkPublicParams,
@NotNull @Valid WebAuthnConfiguration webAuthn) {
}
@@ -0,0 +1,13 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.signal.integration.config;
import jakarta.validation.constraints.NotBlank;
public record WebAuthnConfiguration(
@NotBlank String relyingPartyId,
@NotBlank String origin) {
}
@@ -5,18 +5,61 @@
package org.signal.integration;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import com.eatthepath.otp.TimeBasedOneTimePasswordGenerator;
import com.google.protobuf.ByteString;
import com.webauthn4j.data.AttestationConveyancePreference;
import com.webauthn4j.data.AuthenticatorAttestationResponse;
import com.webauthn4j.data.AuthenticatorSelectionCriteria;
import com.webauthn4j.data.PublicKeyCredential;
import com.webauthn4j.data.PublicKeyCredentialCreationOptions;
import com.webauthn4j.data.PublicKeyCredentialParameters;
import com.webauthn4j.data.PublicKeyCredentialRpEntity;
import com.webauthn4j.data.PublicKeyCredentialType;
import com.webauthn4j.data.PublicKeyCredentialUserEntity;
import com.webauthn4j.data.ResidentKeyRequirement;
import com.webauthn4j.data.UserVerificationRequirement;
import com.webauthn4j.data.attestation.statement.COSEAlgorithmIdentifier;
import com.webauthn4j.data.client.Origin;
import com.webauthn4j.data.client.challenge.DefaultChallenge;
import com.webauthn4j.test.EmulatorUtil;
import com.webauthn4j.test.authenticator.webauthn.WebAuthnAuthenticatorAdaptor;
import com.webauthn4j.test.client.ClientPlatform;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.time.Duration;
import java.time.Instant;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.http.HttpStatus;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.signal.chat.account.AccountsGrpc;
import org.signal.chat.account.ConfirmTotpKeyRequest;
import org.signal.chat.account.ConfirmTotpKeyResponse;
import org.signal.chat.account.FinishWebAuthnRegistrationRequest;
import org.signal.chat.account.FinishWebAuthnRegistrationResponse;
import org.signal.chat.account.GenerateTotpKeyRequest;
import org.signal.chat.account.GenerateTotpKeyResponse;
import org.signal.chat.account.ListMfaKeysRequest;
import org.signal.chat.account.ListMfaKeysResponse;
import org.signal.chat.account.StartWebAuthnRegistrationRequest;
import org.signal.chat.account.StartWebAuthnRegistrationResponse;
import org.signal.chat.account.TotpParameters;
import org.signal.integration.config.WebAuthnConfiguration;
import org.signal.libsignal.protocol.IdentityKey;
import org.signal.libsignal.protocol.ecc.ECKeyPair;
import org.signal.libsignal.usernames.BaseUsernameException;
@@ -39,18 +82,149 @@ public class AccountTest {
public void testCreateNumberlessAccount()
throws VerificationFailedException, InvalidInputException {
final Operations.Receipt receipt = Operations.getPrescribedReceipt();
final TestUser user = Operations.registerNumberlessUser(receipt.credential());
Operations.deleteReceipt(receipt.serial());
TestUser user = null;
try {
user = Operations.registerNumberlessUser(receipt.credential());
final Pair<Integer, AccountIdentityResponse> execute = Operations.apiGet("/v1/accounts/whoami")
.authorized(user)
.execute(AccountIdentityResponse.class);
assertEquals(HttpStatus.SC_OK, execute.getLeft());
} finally {
Operations.deleteReceipt(receipt.serial());
Operations.deleteUser(user);
if (user != null) {
Operations.deleteUser(user);
}
}
}
@Nested
class RecoverWithMfa {
private TestUser user;
@BeforeEach
void setup() throws InvalidInputException, VerificationFailedException {
final Operations.Receipt receipt = Operations.getPrescribedReceipt();
// Clear receipt state in case a previous run had an unclean failure
Operations.deleteReceipt(receipt.serial());
user = Operations.registerNumberlessUser(receipt.credential());
}
@AfterEach
void teardown() throws InvalidInputException {
final Operations.Receipt receipt = Operations.getPrescribedReceipt();
Operations.deleteReceipt(receipt.serial());
if (user != null) {
Operations.deleteUser(user);
}
}
@Test
public void testRecoverWithTotp() throws NoSuchAlgorithmException, InvalidKeyException {
final GenerateTotpKeyResponse generateTotpKeyResponse =
getAccountsStubForUser(user).generateTotpKey(GenerateTotpKeyRequest.getDefaultInstance());
assertEquals(GenerateTotpKeyResponse.ResponseCase.KEY_GENERATED, generateTotpKeyResponse.getResponseCase());
final TotpParameters totpParameters = generateTotpKeyResponse.getKeyGenerated().getTotpParameters();
final TimeBasedOneTimePasswordGenerator totpGenerator = new TimeBasedOneTimePasswordGenerator(
Duration.ofSeconds(totpParameters.getTimeStepSeconds()),
totpParameters.getPasswordLength(),
totpParameters.getAlgorithm());
final SecretKey totpKey = new SecretKeySpec(
generateTotpKeyResponse.getKeyGenerated().getKey().toByteArray(),
totpParameters.getAlgorithm());
final byte[] totpMetadata = Operations.randomBytes(160);
final ConfirmTotpKeyResponse confirmTotpKeyResponse = getAccountsStubForUser(user)
.confirmTotpKey(ConfirmTotpKeyRequest.newBuilder()
.setOneTimePassword(totpGenerator.generateOneTimePassword(totpKey, Instant.now()))
.setMetadataCiphertext(ByteString.copyFrom(totpMetadata))
.build());
assertEquals(ConfirmTotpKeyResponse.ResponseCase.KEY_CONFIRMED, confirmTotpKeyResponse.getResponseCase());
final int keyId = confirmTotpKeyResponse.getKeyConfirmed().getKeyId();
final TestUser recoveredUser =
Operations.recoverNumberlessUserWithTotp(user, totpGenerator.generateOneTimePassword(totpKey, Instant.now()));
assertEquals(user.aciUuid(), recoveredUser.aciUuid());
// MFA key should remain set after re-registration
final Map<Integer, ListMfaKeysResponse.MfaKeyMetadata> mfaKeys =
getAccountsStubForUser(recoveredUser).listMfaKeys(ListMfaKeysRequest.getDefaultInstance()).getKeysMap();
assertEquals(1, mfaKeys.size());
assertTrue(mfaKeys.containsKey(keyId));
assertEquals(ListMfaKeysResponse.MfaKeyMetadata.MfaKeyType.MFA_KEY_TYPE_TOTP, mfaKeys.get(keyId).getType());
assertArrayEquals(totpMetadata, mfaKeys.get(keyId).getMetadataCiphertext().toByteArray());
}
@Test
public void testRecoverWithWebAuthn() {
final WebAuthnConfiguration webAuthnConfiguration = Operations.getWebAuthnConfiguration();
final ClientPlatform clientPlatform = new ClientPlatform(new Origin(webAuthnConfiguration.origin()), new WebAuthnAuthenticatorAdaptor(EmulatorUtil.NONE_ATTESTATION_AUTHENTICATOR));
final COSEAlgorithmIdentifier algorithm = COSEAlgorithmIdentifier.ES256;
final StartWebAuthnRegistrationResponse startWebAuthnRegistrationResponse =
getAccountsStubForUser(user).startWebAuthnRegistration(StartWebAuthnRegistrationRequest.getDefaultInstance());
assertEquals(StartWebAuthnRegistrationResponse.ResponseCase.PARAMS,
startWebAuthnRegistrationResponse.getResponseCase());
final StartWebAuthnRegistrationResponse.WebAuthnCreateParameters webAuthnCreateParameters = startWebAuthnRegistrationResponse.getParams();
assertTrue(
webAuthnCreateParameters.getAllowedAlgorithmsList().contains(algorithm.getValue()));
final PublicKeyCredential<AuthenticatorAttestationResponse, ?> credential =
clientPlatform.create(new PublicKeyCredentialCreationOptions(
new PublicKeyCredentialRpEntity(webAuthnConfiguration.relyingPartyId(), "test"),
new PublicKeyCredentialUserEntity(webAuthnCreateParameters.getUserHandle().toByteArray(), "test", "test"),
new DefaultChallenge(),
List.of(new PublicKeyCredentialParameters(PublicKeyCredentialType.PUBLIC_KEY, algorithm)),
null,
List.of(),
new AuthenticatorSelectionCriteria(
null, false, ResidentKeyRequirement.DISCOURAGED, UserVerificationRequirement.DISCOURAGED),
AttestationConveyancePreference.NONE,
null));
final byte[] metadataCiphertext = Operations.randomBytes(160);
final FinishWebAuthnRegistrationResponse finishWebAuthnRegistrationResponse = getAccountsStubForUser(user)
.finishWebAuthnRegistration(FinishWebAuthnRegistrationRequest.newBuilder()
.setAttestationObject(ByteString.copyFrom(credential.getResponse().getAttestationObject()))
.setCollectedClientDataJsonBytes(ByteString.copyFrom(credential.getResponse().getClientDataJSON()))
.setMetadataCiphertext(ByteString.copyFrom(metadataCiphertext))
.build());
assertEquals(FinishWebAuthnRegistrationResponse.ResponseCase.KEY_CONFIRMED,
finishWebAuthnRegistrationResponse.getResponseCase());
final int keyId = finishWebAuthnRegistrationResponse.getKeyConfirmed().getKeyId();
final TestUser recoveredUser = Operations.recoverNumberlessUserWithWebAuthn(user, clientPlatform, credential.getRawId(),
webAuthnConfiguration.relyingPartyId());
assertEquals(user.aciUuid(), recoveredUser.aciUuid());
// MFA key should remain set after re-registration
final Map<Integer, ListMfaKeysResponse.MfaKeyMetadata> mfaKeys =
getAccountsStubForUser(recoveredUser).listMfaKeys(ListMfaKeysRequest.getDefaultInstance()).getKeysMap();
assertEquals(1, mfaKeys.size());
assertTrue(mfaKeys.containsKey(keyId));
assertEquals(ListMfaKeysResponse.MfaKeyMetadata.MfaKeyType.MFA_KEY_TYPE_WEBAUTHN, mfaKeys.get(keyId).getType());
assertArrayEquals(metadataCiphertext, mfaKeys.get(keyId).getMetadataCiphertext().toByteArray());
}
}
private static AccountsGrpc.AccountsBlockingStub getAccountsStubForUser(final TestUser user) {
return AccountsGrpc
.newBlockingStub(Operations.grpcChannel())
.withInterceptors(Operations.authorizationInterceptor(user, Device.PRIMARY_ID));
}
@Test
public void testCreateAccount() {
final TestUser user = Operations.newRegisteredUser("+19995550101");
@@ -61,7 +61,7 @@ public class MessagingTest {
assertDoesNotThrow(() -> WebsocketClientSession.decode(SendMessageResponse.class, responseMessage));
final WebsocketClientSession websocketB = Operations.authenticatedWebsocket(userB, Device.PRIMARY_ID);
assertTimeoutPreemptively(Duration.ofSeconds(5), websocketB::waitForQueueEmpty);
assertTimeoutPreemptively(Duration.ofSeconds(15), websocketB::waitForQueueEmpty);
assertEquals(1, websocketB.getReceivedEnvelopes().size());
final MessageProtos.Envelope envelope = websocketB.getReceivedEnvelopes().getFirst();
+37 -19
View File
@@ -45,51 +45,52 @@
</modules>
<properties>
<aws.sdk2.version>2.51.4</aws.sdk2.version>
<aws.sdk2.version>2.54.7</aws.sdk2.version>
<braintree.version>3.53.0</braintree.version>
<commons-csv.version>1.14.1</commons-csv.version>
<commons-io.version>2.22.0</commons-io.version>
<dropwizard.version>5.0.2</dropwizard.version>
<!-- Note: We use x86_64 builds without AVX instructions enabled (i.e. FoundationDB versions with even-numbered
patch versions). Also when updating FoundationDB, make sure to update the version of FoundationDBused by GitHub
Actions. -->
<foundationdb.version>7.3.68</foundationdb.version>
patch versions). -->
<foundationdb.version>7.3.76</foundationdb.version>
<foundationdb.api-version>730</foundationdb.api-version>
<foundationdb.client-library-sha256>8c96a1f7ab561cd38e16e4c269c5e50ae0fd8063854e0d72c89339a7ac1b6873</foundationdb.client-library-sha256>
<google-cloud-libraries.version>26.86.0</google-cloud-libraries.version>
<foundationdb.client-library-sha256>af099848721d08904ff9e5d38fade0de24d92e86451ea491d9ab5ce84adcf62a</foundationdb.client-library-sha256>
<google-cloud-libraries.version>26.87.0</google-cloud-libraries.version>
<grpc.version>1.76.3</grpc.version> <!-- should be kept in sync with the value from Google libraries-bom -->
<gson.version>2.14.0</gson.version>
<guava.version>33.6.0-jre</guava.version>
<guava.version>33.7.1-jre</guava.version>
<!-- several libraries (AWS, Google Cloud) use Apache http components transitively, and we need to align them -->
<httpcore.version>4.4.16</httpcore.version>
<httpclient.version>4.5.14</httpclient.version>
<jackson.version>2.22.2</jackson.version>
<java-otp.version>1.0.0</java-otp.version>
<jetty.version>12.1.9</jetty.version>
<junit-pioneer.version>2.3.0</junit-pioneer.version>
<jsr305.version>3.0.2</jsr305.version>
<kotlin.version>2.4.10</kotlin.version>
<!-- dropwizard references a constant removed in 1.6 -->
<!-- dropwizard references a constant removed in 1.6. See also: dependabot.yml -->
<logback.version>1.5.38</logback.version>
<logback-access-common.version>2.0.15</logback-access-common.version>
<lettuce.version>7.6.0.RELEASE</lettuce.version>
<libphonenumber.version>9.0.37</libphonenumber.version>
<libphonenumber.version>9.0.38</libphonenumber.version>
<logstash.logback.version>9.0</logstash.logback.version>
<log4j-bom.version>2.26.1</log4j-bom.version>
<luajava.version>4.1.0</luajava.version>
<micrometer.version>1.17.0</micrometer.version>
<netty.version>4.2.17.Final</netty.version>
<micrometer.version>1.17.1</micrometer.version>
<netty.version>4.2.18.Final</netty.version>
<!-- must be greater than or equal to the value from Google libraries-bom, see https://protobuf.dev/support/cross-version-runtime-guarantee/ -->
<!-- the latest 4.x should be fine https://central.sonatype.com/artifact/com.google.protobuf/protobuf-java/versions -->
<protobuf.version>4.35.1</protobuf.version>
<protobuf.version>4.36.0</protobuf.version>
<pushy.version>0.15.6</pushy.version>
<reactor-bom.version>2025.0.6</reactor-bom.version> <!-- 3.8.4, see https://github.com/reactor/reactor#bom-versioning-scheme -->
<reactor-bom.version>2025.0.7</reactor-bom.version> <!-- 3.8.4, see https://github.com/reactor/reactor#bom-versioning-scheme -->
<resilience4j.version>2.4.0</resilience4j.version>
<semver4j.version>3.1.0</semver4j.version>
<simple-grpc.version>0.2.1</simple-grpc.version>
<slf4j.version>2.0.18</slf4j.version>
<stripe.version>33.3.0</stripe.version>
<swagger.version>2.2.46</swagger.version>
<stripe.version>33.4.0</stripe.version>
<swagger.version>2.2.54</swagger.version>
<testcontainers.version>2.0.5</testcontainers.version>
<webauthn4j.version>0.31.9.RELEASE</webauthn4j.version>
<!-- images to use in tests via testcontainers -->
<dynamodb.image>amazon/dynamodb-local:3.3.1@sha256:ff89bd48ff32cd8d9be5fee8873b65b8854dc408f1afe881be6eb00247bc0dab</dynamodb.image>
@@ -97,7 +98,7 @@
<redis.image>redis:7.4-alpine@sha256:6ab0b6e7381779332f97b8ca76193e45b0756f38d4c0dcda72dbb3c32061ab99</redis.image>
<redis-cluster.image>docker.io/bitnamilegacy/redis-cluster:7.4.3@sha256:a53d023fdfaf8a8d7ddc58da040d3494e4cb45772644618ffa44c42dcd32b9af</redis-cluster.image>
<docker.image>eclipse-temurin:25-jre-resolute@sha256:17ddcc32b1f296155738c4b2f689208e46bf0cf4eb0b215c717717deb8b74b90</docker.image>
<docker.image>eclipse-temurin:26-jre-resolute@sha256:c3b6e31e48772c98e8868654e5f21fb2c3670e67c055ddd76d8cf37e62113eb5</docker.image>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -109,6 +110,7 @@
<dependencyManagement>
<!-- note: order matters, and earlier declarations take precedence -->
<dependencies>
<!-- use a pinned version of jackson, rather than Dropwizard's BOM -->
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
@@ -116,6 +118,22 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- use a pinned version of jetty, rather than Dropwizard's BOM -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-bom</artifactId>
<version>${jetty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- use a pinned version of jetty, rather than Dropwizard's BOM -->
<dependency>
<groupId>org.eclipse.jetty.ee10</groupId>
<artifactId>jetty-ee10-bom</artifactId>
<version>${jetty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
@@ -182,7 +200,7 @@
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-bom</artifactId>
<version>2.30.0</version>
<version>2.31.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@@ -300,7 +318,7 @@
<dependency>
<groupId>org.signal</groupId>
<artifactId>libsignal-server</artifactId>
<version>0.101.0</version>
<version>0.101.2</version>
</dependency>
<dependency>
<groupId>org.signal</groupId>
@@ -515,7 +533,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.15.0</version>
<configuration>
<release>25</release>
<release>26</release>
</configuration>
</plugin>
+4 -1
View File
@@ -79,7 +79,8 @@ storageService.userAuthenticationTokenSharedSecret: AAAAAAAAAAAAAAAAAAAAAAAAAAAA
zkConfig-libsignal-0.42.serverSecret: ABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdef
callingZkConfig.serverSecret: ABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzAA==
callingZkConfigPreV101.serverSecret: ABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzAA==
callingZkConfigV101.serverSecret: ABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzAA==
chatZkConfig.serverSecret: ABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/0123456789+abcdefghijklmnopqrstuvwxyzAA==
paymentsService.userAuthenticationTokenSharedSecret: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= # base64-encoded 32-byte secret shared with MobileCoin services used to generate auth tokens for Signal users
@@ -101,3 +102,5 @@ hlrLookup.apiKey: AAAAAAAAAAA
hlrLookup.apiSecret: AAAAAAAAAAA
foundationDbMessages.versionstampCipherKey.0: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
registrationWebAuthn.userHandleBlindingSecret: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+11 -1
View File
@@ -315,8 +315,11 @@ storageService:
AAAAAAAAAAAAAAAAAAAA
-----END CERTIFICATE-----
callingZkConfigPreV101:
serverSecret: secret://callingZkConfigPreV101.serverSecret
callingZkConfig:
serverSecret: secret://callingZkConfig.serverSecret
serverSecret: secret://callingZkConfigV101.serverSecret
chatZkConfig:
serverSecret: secret://chatZkConfig.serverSecret
@@ -384,6 +387,7 @@ subscription: # configuration for Stripe subscriptions
loginPurchase:
playProductId: login_example
playOptionId: login_option_example
appStoreProductId: login_example
oneTimeDonations:
@@ -568,3 +572,9 @@ foundationDbMessages:
- messages-1
- messages-2
- messages-3
registrationWebAuthn:
relyingPartyId: example.org
origin: https://example.org
challengeTtl: PT2M
userHandleBlindingSecret: secret://registrationWebAuthn.userHandleBlindingSecret
+20 -5
View File
@@ -15,15 +15,13 @@
<commons-compress.version>1.28.0</commons-compress.version>
<dynamodb-lock-client.version>1.5.0</dynamodb-lock-client.version>
<firebase-admin.version>9.10.0</firebase-admin.version>
<libphonenumber-geocoder.version>3.37</libphonenumber-geocoder.version>
<libphonenumber-geocoder.version>3.38</libphonenumber-geocoder.version>
<google-androidpublisher.version>v3-rev20250904-2.0.0</google-androidpublisher.version>
<java-jwt.version>4.6.0</java-jwt.version>
<java-uuid-generator.version>5.2.0</java-uuid-generator.version>
<!-- *all* opentelemetry-logback-appender versions are "alpha" despite the advanced version number -->
<opentelemetry-logback-appender-1.0.version>2.30.0-alpha</opentelemetry-logback-appender-1.0.version>
<opentelemetry-logback-appender-1.0.version>2.31.1-alpha</opentelemetry-logback-appender-1.0.version>
<storekit.version>5.2.0</storekit.version>
<webauthn4j.version>0.31.9.RELEASE</webauthn4j.version>
<jetty.http2-client.version>12.1.12</jetty.http2-client.version>
</properties>
<dependencies>
@@ -59,6 +57,11 @@
<artifactId>webauthn4j-appattest</artifactId>
<version>${webauthn4j.version}</version>
</dependency>
<dependency>
<groupId>com.webauthn4j</groupId>
<artifactId>webauthn4j-core</artifactId>
<version>${webauthn4j.version}</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2-jakarta</artifactId>
@@ -147,7 +150,6 @@
<groupId>org.eclipse.jetty.http2</groupId>
<artifactId>jetty-http2-client-transport</artifactId>
<scope>test</scope>
<version>${jetty.http2-client.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
@@ -190,6 +192,7 @@
<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<!-- update dependabot.yml when this dependency is removed -->
<version>3.2.1</version>
</dependency>
@@ -323,6 +326,10 @@
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-bulkhead</artifactId>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-circuitbreaker</artifactId>
@@ -573,6 +580,13 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.webauthn4j</groupId>
<artifactId>webauthn4j-test</artifactId>
<version>${webauthn4j.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
@@ -641,6 +655,7 @@
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio-jvm</artifactId>
<!-- update dependabot.yml when this dependency is removed -->
<version>3.17.0</version>
</dependency>
@@ -20,6 +20,7 @@ import org.whispersystems.textsecuregcm.configuration.AwsCredentialsProviderFact
import org.whispersystems.textsecuregcm.configuration.BackupConfiguration;
import org.whispersystems.textsecuregcm.configuration.BadgesConfiguration;
import org.whispersystems.textsecuregcm.configuration.BraintreeConfiguration;
import org.whispersystems.textsecuregcm.configuration.BulkheadConfiguration;
import org.whispersystems.textsecuregcm.configuration.CallQualitySurveyConfiguration;
import org.whispersystems.textsecuregcm.configuration.Cdn3StorageManagerConfiguration;
import org.whispersystems.textsecuregcm.configuration.CdnConfiguration;
@@ -67,6 +68,7 @@ import org.whispersystems.textsecuregcm.configuration.TotpConfiguration;
import org.whispersystems.textsecuregcm.configuration.TurnConfiguration;
import org.whispersystems.textsecuregcm.configuration.UnidentifiedDeliveryConfiguration;
import org.whispersystems.textsecuregcm.configuration.VirtualThreadConfiguration;
import org.whispersystems.textsecuregcm.configuration.WebAuthnConfiguration;
import org.whispersystems.textsecuregcm.configuration.ZkConfig;
import org.whispersystems.websocket.configuration.WebSocketConfiguration;
@@ -228,6 +230,11 @@ public class WhisperServerConfiguration extends Configuration {
@JsonProperty
private PaymentsServiceConfiguration paymentsService;
@Valid
@NotNull
@JsonProperty
private GenericZkConfig callingZkConfigPreV101;
@Valid
@NotNull
@JsonProperty
@@ -332,9 +339,6 @@ public class WhisperServerConfiguration extends Configuration {
@JsonProperty
private KeyTransparencyServiceConfiguration keyTransparencyService;
@JsonProperty
private boolean logMessageDeliveryLoops;
@JsonProperty
private IdlePrimaryDeviceReminderConfiguration idlePrimaryDeviceReminder =
new IdlePrimaryDeviceReminderConfiguration(Duration.ofDays(30));
@@ -345,6 +349,9 @@ public class WhisperServerConfiguration extends Configuration {
@JsonProperty
private Map<String, @Valid RetryConfiguration> retries = Collections.emptyMap();
@JsonProperty
private Map<String, @Valid BulkheadConfiguration> bulkheads = Collections.emptyMap();
@Valid
@NotNull
@JsonProperty
@@ -385,6 +392,11 @@ public class WhisperServerConfiguration extends Configuration {
@JsonProperty
private TotpConfiguration registrationTotp = TotpConfiguration.DEFAULT;
@Valid
@NotNull
@JsonProperty
private WebAuthnConfiguration registrationWebAuthn;
public TlsKeyStoreConfiguration getTlsKeyStoreConfiguration() {
return tlsKeyStore;
}
@@ -514,6 +526,11 @@ public class WhisperServerConfiguration extends Configuration {
return chatZkConfig;
}
/// ZK secret shared with Calling Service
public GenericZkConfig getCallingZkConfigPreV101() {
return callingZkConfigPreV101;
}
/// ZK secret shared with Calling Service
public GenericZkConfig getCallingZkConfig() {
return callingZkConfig;
@@ -596,10 +613,6 @@ public class WhisperServerConfiguration extends Configuration {
return keyTransparencyService;
}
public boolean logMessageDeliveryLoops() {
return logMessageDeliveryLoops;
}
public IdlePrimaryDeviceReminderConfiguration idlePrimaryDeviceReminderConfiguration() {
return idlePrimaryDeviceReminder;
}
@@ -612,6 +625,10 @@ public class WhisperServerConfiguration extends Configuration {
return retries;
}
public Map<String, BulkheadConfiguration> getBulkheadConfigurations() {
return bulkheads;
}
public RetryConfiguration getGeneralRedisRetryConfiguration() {
return generalRedisRetry;
}
@@ -643,4 +660,8 @@ public class WhisperServerConfiguration extends Configuration {
public TotpConfiguration getRegistrationTotpConfiguration() {
return registrationTotp;
}
public WebAuthnConfiguration getRegistrationWebAuthnConfiguration() {
return registrationWebAuthn;
}
}
@@ -97,6 +97,7 @@ import org.whispersystems.textsecuregcm.auth.ExternalServiceCredentialsGenerator
import org.whispersystems.textsecuregcm.auth.IdlePrimaryDeviceAuthenticatedWebSocketUpgradeFilter;
import org.whispersystems.textsecuregcm.auth.PhoneVerificationTokenManager;
import org.whispersystems.textsecuregcm.auth.RegistrationLockVerificationManager;
import org.whispersystems.textsecuregcm.auth.webauthn.WebAuthnCeremonyManager;
import org.whispersystems.textsecuregcm.auth.grpc.ProhibitAuthenticationInterceptor;
import org.whispersystems.textsecuregcm.auth.grpc.RequireAuthenticationInterceptor;
import org.whispersystems.textsecuregcm.backup.BackupAuthManager;
@@ -111,6 +112,7 @@ import org.whispersystems.textsecuregcm.captcha.CaptchaClient;
import org.whispersystems.textsecuregcm.captcha.RegistrationCaptchaManager;
import org.whispersystems.textsecuregcm.captcha.ShortCodeExpander;
import org.whispersystems.textsecuregcm.configuration.BadgeConfiguration;
import org.whispersystems.textsecuregcm.configuration.FoundationDbExternalClientConfiguration;
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration;
import org.whispersystems.textsecuregcm.configuration.secrets.SecretStore;
import org.whispersystems.textsecuregcm.configuration.secrets.SecretsModule;
@@ -197,22 +199,19 @@ import org.whispersystems.textsecuregcm.grpc.net.SniMapper;
import org.whispersystems.textsecuregcm.jetty.JettyHttpConfigurationCustomizer;
import org.whispersystems.textsecuregcm.keytransparency.KeyTransparencyServiceClient;
import org.whispersystems.textsecuregcm.limits.CardinalityEstimator;
import org.whispersystems.textsecuregcm.limits.MessageDeliveryLoopMonitor;
import org.whispersystems.textsecuregcm.limits.NoopMessageDeliveryLoopMonitor;
import org.whispersystems.textsecuregcm.limits.PushChallengeManager;
import org.whispersystems.textsecuregcm.limits.RateLimitByIpFilter;
import org.whispersystems.textsecuregcm.limits.RateLimitChallengeManager;
import org.whispersystems.textsecuregcm.limits.RateLimiters;
import org.whispersystems.textsecuregcm.limits.RedisMessageDeliveryLoopMonitor;
import org.whispersystems.textsecuregcm.mappers.BackupExceptionMapper;
import org.whispersystems.textsecuregcm.mappers.CompletionExceptionMapper;
import org.whispersystems.textsecuregcm.mappers.DeviceLimitExceededExceptionMapper;
import org.whispersystems.textsecuregcm.mappers.GrpcStatusRuntimeExceptionMapper;
import org.whispersystems.textsecuregcm.mappers.IOExceptionMapper;
import org.whispersystems.textsecuregcm.mappers.IllegalStateExceptionMapper;
import org.whispersystems.textsecuregcm.mappers.ImpossiblePhoneNumberExceptionMapper;
import org.whispersystems.textsecuregcm.mappers.InvalidWebsocketAddressExceptionMapper;
import org.whispersystems.textsecuregcm.mappers.JsonMappingExceptionMapper;
import org.whispersystems.textsecuregcm.mappers.MfaFailureExceptionMapper;
import org.whispersystems.textsecuregcm.mappers.NonNormalizedPhoneNumberExceptionMapper;
import org.whispersystems.textsecuregcm.mappers.ObsoletePhoneNumberFormatExceptionMapper;
import org.whispersystems.textsecuregcm.mappers.RateLimitExceededExceptionMapper;
@@ -273,14 +272,14 @@ import org.whispersystems.textsecuregcm.storage.OneTimeDonationsManager;
import org.whispersystems.textsecuregcm.storage.PagedSingleUseKEMPreKeyStore;
import org.whispersystems.textsecuregcm.storage.PersistentTimer;
import org.whispersystems.textsecuregcm.storage.PhoneNumberIdentifiers;
import org.whispersystems.textsecuregcm.storage.PhoneNumberRecoveryPasswords;
import org.whispersystems.textsecuregcm.storage.PhoneNumberRecoveryPasswordsManager;
import org.whispersystems.textsecuregcm.storage.ProfileAvatars;
import org.whispersystems.textsecuregcm.storage.Profiles;
import org.whispersystems.textsecuregcm.storage.ProfilesManager;
import org.whispersystems.textsecuregcm.storage.ProfilesV2;
import org.whispersystems.textsecuregcm.storage.PushChallengeDynamoDb;
import org.whispersystems.textsecuregcm.storage.RedeemedReceiptsManager;
import org.whispersystems.textsecuregcm.storage.PhoneNumberRecoveryPasswords;
import org.whispersystems.textsecuregcm.storage.PhoneNumberRecoveryPasswordsManager;
import org.whispersystems.textsecuregcm.storage.RemoteConfigs;
import org.whispersystems.textsecuregcm.storage.RemoteConfigsManager;
import org.whispersystems.textsecuregcm.storage.RepeatedUseECSignedPreKeyStore;
@@ -295,7 +294,9 @@ import org.whispersystems.textsecuregcm.storage.VerificationSessions;
import org.whispersystems.textsecuregcm.storage.devicecheck.AppleDeviceCheckManager;
import org.whispersystems.textsecuregcm.storage.devicecheck.AppleDeviceCheckTrustAnchor;
import org.whispersystems.textsecuregcm.storage.devicecheck.AppleDeviceChecks;
import org.whispersystems.textsecuregcm.storage.foundationdb.FaultTolerantDatabase;
import org.whispersystems.textsecuregcm.storage.foundationdb.FoundationDbMessageStore;
import org.whispersystems.textsecuregcm.storage.foundationdb.FoundationDBWarmup;
import org.whispersystems.textsecuregcm.storage.foundationdb.VersionstampUUIDCipher;
import org.whispersystems.textsecuregcm.subscriptions.AppleAppStoreClient;
import org.whispersystems.textsecuregcm.subscriptions.AppleAppStoreManager;
@@ -328,12 +329,12 @@ import org.whispersystems.textsecuregcm.workers.CertificateCommand;
import org.whispersystems.textsecuregcm.workers.CheckDynamicConfigurationCommand;
import org.whispersystems.textsecuregcm.workers.ClearExpiredFoundationDbMessagesCommand;
import org.whispersystems.textsecuregcm.workers.ClearIssuedReceiptRedemptionsCommand;
import org.whispersystems.textsecuregcm.workers.ClearOrphanedFoundationDbQueuesCommand;
import org.whispersystems.textsecuregcm.workers.CopyToS3Command;
import org.whispersystems.textsecuregcm.workers.DeleteUserCommand;
import org.whispersystems.textsecuregcm.workers.IdleDeviceNotificationSchedulerFactory;
import org.whispersystems.textsecuregcm.workers.MessagePersisterServiceCommand;
import org.whispersystems.textsecuregcm.workers.NotifyIdleDevicesCommand;
import org.whispersystems.textsecuregcm.workers.PopulateAccountRecoveryPasswordsCommand;
import org.whispersystems.textsecuregcm.workers.ProcessScheduledJobsServiceCommand;
import org.whispersystems.textsecuregcm.workers.RegenerateSecondaryDynamoDbTableDataCommand;
import org.whispersystems.textsecuregcm.workers.RemoveExpiredAccountsCommand;
@@ -406,6 +407,7 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
bootstrap.addCommand(new CopyToS3Command());
bootstrap.addCommand(new ClearExpiredFoundationDbMessagesCommand(Clock.systemUTC()));
bootstrap.addCommand(new TrimOversizedFoundationDbMessageQueuesCommand());
bootstrap.addCommand(new ClearOrphanedFoundationDbQueuesCommand());
bootstrap.addCommand(new ProcessScheduledJobsServiceCommand("process-idle-device-notification-jobs",
"Processes scheduled jobs to send notifications to idle devices",
@@ -413,8 +415,6 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
bootstrap.addCommand(new RegenerateSecondaryDynamoDbTableDataCommand());
bootstrap.addCommand(new PopulateAccountRecoveryPasswordsCommand());
ServiceLoader.load(SpamFilter.class)
.stream()
.map(ServiceLoader.Provider::get)
@@ -441,6 +441,9 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
config.getRetryConfigurations().forEach((name, configuration) ->
ResilienceUtil.getRetryRegistry().addConfiguration(name, configuration.toRetryConfigBuilder().build()));
config.getBulkheadConfigurations().forEach((name, configuration) ->
ResilienceUtil.getBulkheadRegistry().addConfiguration(name, configuration.toBulkheadConfig().build()));
ResilienceUtil.setGeneralRedisRetryConfiguration(config.getGeneralRedisRetryConfiguration());
ScheduledExecutorService dynamicConfigurationExecutor = ScheduledExecutorServiceBuilder.of(environment, "dynamicConfiguration")
@@ -500,9 +503,20 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
// we'd like, but is the least bad option given current constraints.
fdb.disableShutdownHook();
final Map<Integer, List<Database>> messageDatabasesByEpoch;
final FoundationDbExternalClientConfiguration externalClientConfiguration = config.getFoundationDbMessagesConfiguration()
.externalClientConfiguration();
if (externalClientConfiguration != null) {
// If threadsPerClient is not specified, we default to the cluster size so that there is 1:1 correspondence between
// Database objects and threads.
final int clientThreadsPerVersion = externalClientConfiguration.threadsPerClient()
.orElseGet(() -> config.getFoundationDbMessagesConfiguration().clusters().size());
externalClientConfiguration.clientLibraryPaths().forEach(path -> fdb.options().setExternalClientLibrary(path));
fdb.options().setClientThreadsPerVersion(clientThreadsPerVersion);
}
final Map<Integer, List<FaultTolerantDatabase>> messageDatabasesByEpoch;
{
final Map<String, Database> databasesByName =
final Map<String, FaultTolerantDatabase> faultTolerantDatabasesByName =
config.getFoundationDbMessagesConfiguration().clusters().entrySet().stream()
.collect(Collectors.toUnmodifiableMap(Map.Entry::getKey,
entry -> {
@@ -514,7 +528,9 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
database.options().setTransactionRetryLimit(
config.getFoundationDbMessagesConfiguration().transactionRetryLimit());
return database;
return new FaultTolerantDatabase(database, entry.getKey(),
config.getFoundationDbMessagesConfiguration().circuitBreakerConfigurationName(),
config.getFoundationDbMessagesConfiguration().bulkheadConfigurationName());
} catch (final IOException e) {
throw new UncheckedIOException(e);
}
@@ -523,8 +539,10 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
messageDatabasesByEpoch = config.getFoundationDbMessagesConfiguration().epochs().entrySet().stream()
.collect(Collectors.toUnmodifiableMap(Map.Entry::getKey,
entry -> entry.getValue().stream()
.map(databasesByName::get)
.map(faultTolerantDatabasesByName::get)
.toList()));
environment.lifecycle().manage(new FoundationDBWarmup(faultTolerantDatabasesByName));
}
final AwsCredentialsProvider cdnCredentialsProvider = config.getCdnConfiguration().credentials().build();
@@ -667,10 +685,6 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
.workQueue(receiptSenderQueue)
.rejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy())
.build();
ExecutorService accountLockExecutor = ExecutorServiceBuilder.of(environment, "accountLock")
.minThreads(8)
.maxThreads(8)
.build();
// unbounded executor (same as cachedThreadPool)
ExecutorService remoteStorageHttpExecutor = ExecutorServiceBuilder.of(environment, "remoteStorage")
.minThreads(0)
@@ -800,12 +814,19 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
changeNumberWaitingPeriods, config.getChangeNumber().postRegistrationWaitingPeriod(), clock);
AccountLockManager accountLockManager = new AccountLockManager(dynamoDbClient,
config.getDynamoDbTables().getDeletedAccountsLock().getTableName());
AccountsManager accountsManager = new AccountsManager(accounts, phoneNumberIdentifiers, cacheCluster,
final WebAuthnCeremonyManager webAuthnCeremonyManager = new WebAuthnCeremonyManager(
config.getRegistrationWebAuthnConfiguration().relyingPartyId(),
config.getRegistrationWebAuthnConfiguration().origin(),
config.getRegistrationWebAuthnConfiguration().challengeTtl(),
config.getRegistrationWebAuthnConfiguration().userHandleBlindingSecret().value(),
rateLimitersCluster);
final AccountsManager accountsManager = new AccountsManager(accounts, phoneNumberIdentifiers, cacheCluster,
pubsubClient, accountLockManager, keysManager, messagesManager, profilesManager,
changeNumberWaitingPeriodManager, secureStorageClient, secureValueRecovery2Client, disconnectionRequestManager,
phoneNumberRecoveryPasswordsManager, accountLockExecutor, messagePollExecutor,
phoneNumberRecoveryPasswordsManager, messagePollExecutor,
retryExecutor, clock, config.getLinkDeviceSecretConfiguration().secret().value(),
config.getRegistrationTotpConfiguration().maxValidationDelay());
config.getRegistrationTotpConfiguration().maxValidationDelay(),
webAuthnCeremonyManager);
RemoteConfigsManager remoteConfigsManager = new RemoteConfigsManager(remoteConfigs, config.getRemoteConfigConfiguration().globalConfig());
APNSender apnSender = new APNSender(apnSenderExecutor, Clock.systemUTC(), config.getApnConfiguration());
FcmSender fcmSender = new FcmSender(fcmSenderExecutor, config.getFcmConfiguration().credentials().value());
@@ -826,8 +847,6 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
config.getDynamoDbTables().getDonationPermits().getTableName(), config.getDynamoDbTables().getDonationPermits().getExpiration(), dynamoDbClient);
Subscriptions subscriptions = new Subscriptions(
config.getDynamoDbTables().getSubscriptions().getTableName(), dynamoDbClient);
MessageDeliveryLoopMonitor messageDeliveryLoopMonitor =
config.logMessageDeliveryLoops() ? new RedisMessageDeliveryLoopMonitor(rateLimitersCluster) : new NoopMessageDeliveryLoopMonitor();
CallQualitySurveyManager callQualitySurveyManager = new CallQualitySurveyManager(asnInfoProviderSupplier,
config.getCallQualitySurveyConfiguration().pubSubPublisher().build(),
Clock.systemUTC(),
@@ -939,6 +958,7 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
config.getCdnConfiguration().credentials().secretAccessKey().value());
ServerSecretParams groupZkSecretParams = new ServerSecretParams(config.getGroupsZkConfig().serverSecret().value());
GenericServerSecretParams callingPreV101GenericZkSecretParams = new GenericServerSecretParams(config.getCallingZkConfigPreV101().serverSecret().value());
GenericServerSecretParams callingGenericZkSecretParams = new GenericServerSecretParams(config.getCallingZkConfig().serverSecret().value());
GenericServerSecretParams chatGenericZkSecretParams = new GenericServerSecretParams(config.getChatZkConfig().serverSecret().value());
ServerZkProfileOperations zkProfileOperations = new ServerZkProfileOperations(groupZkSecretParams);
@@ -1056,7 +1076,7 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
final HttpClient shortCodeRetrieverHttpClient = HttpClient.newBuilder().version(HttpClient.Version.HTTP_2)
.connectTimeout(Duration.ofSeconds(10)).build();
final ShortCodeExpander shortCodeRetriever = new ShortCodeExpander(shortCodeRetrieverHttpClient, config.getShortCodeRetrieverConfiguration().baseUrl());
final CaptchaChecker captchaChecker = new CaptchaChecker(shortCodeRetriever, captchaClientSupplier);
final CaptchaChecker captchaChecker = new CaptchaChecker(shortCodeRetriever, captchaClientSupplier, dynamicConfigurationManager);
final RegistrationCaptchaManager registrationCaptchaManager = new RegistrationCaptchaManager(captchaChecker);
@@ -1088,8 +1108,7 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
final GroupSendTokenUtil groupSendTokenUtil = new GroupSendTokenUtil(groupZkSecretParams, Clock.systemUTC());
final MessageMetrics messageMetrics = new MessageMetrics();
final MessageDispatcher messageDispatcher = new MessageDispatcher(receiptSender, messagesManager, messageMetrics,
pushNotificationManager, pushNotificationScheduler, messageDeliveryLoopMonitor, disconnectionRequestManager,
clientReleaseManager);
pushNotificationManager, pushNotificationScheduler, disconnectionRequestManager, clientReleaseManager);
final CertificateGenerator certificateGenerator =
new CertificateGenerator(config.getDeliveryCertificate().certificate(),
@@ -1111,7 +1130,7 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
new CredentialsGrpcService(accountsManager, certificateGenerator, zkAuthOperations, callingGenericZkSecretParams, rateLimiters, Clock.systemUTC(), ExternalServiceDefinitions.createExternalServiceList(config, Clock.systemUTC())),
new KeysGrpcService(accountsManager, keysManager, rateLimiters),
new ProfileGrpcService(clock, accountsManager, profilesManager, asnInfoProviderSupplier, dynamicConfigurationManager, config.getBadges(), profileCdnPolicyGenerator, chatGenericZkSecretParams, profileBadgeConverter, rateLimiters),
new MessagesGrpcService(accountsManager, rateLimiters, messageSender, messageByteLimitCardinalityEstimator, spamChecker, messageDispatcher, Clock.systemUTC()),
new MessagesGrpcService(accountsManager, reportMessageManager, phoneNumberIdentifiers, rateLimiters, messageSender, messageByteLimitCardinalityEstimator, spamChecker, messageDispatcher, Clock.systemUTC()),
new BackupsGrpcService(accountsManager, backupAuthManager, backupMetrics),
new DevicesGrpcService(accountsManager),
new AttachmentsGrpcService(experimentEnrollmentManager, rateLimiters, gcsAttachmentGenerator,
@@ -1180,11 +1199,14 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
unauthenticatedServices.forEach(serverBuilder::addService);
final ManagedGrpcServer localGrpcServer = new ManagedGrpcServer(serverBuilder.build());
final String websocketServletPath = "/v1/websocket/";
final String provisioningWebsocketServletPath = "/v1/websocket/provisioning/";
final SocketAddress websocketAddress =
new InetSocketAddress(config.getGrpc().websocketAddress(), config.getGrpc().websocketPort());
final OmnibusRouter omnibusRouter = new OmnibusRouter(List.of(
new OmnibusRouter.OmnibusRoute("/v1/websocket", websocketAddress),
new OmnibusRouter.OmnibusRoute("/v1/provisioning", websocketAddress)),
final OmnibusRouter omnibusRouter = new OmnibusRouter(Map.of(
websocketServletPath, websocketAddress,
provisioningWebsocketServletPath, websocketAddress),
grpcLocalAddress);
@Nullable final Mapping<String, SslContext> sniMapping = config.getGrpc().h2c()
? null
@@ -1215,9 +1237,6 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
.setAuthenticator(accountAuthenticator)
.buildAuthFilter();
final String websocketServletPath = "/v1/websocket/";
final String provisioningWebsocketServletPath = "/v1/websocket/provisioning/";
MetricsHttpEventHandler.configure(environment, Metrics.globalRegistry, clientReleaseManager, Set.of(websocketServletPath, provisioningWebsocketServletPath, "/health-check"));
// BufferingInterceptor is needed on the base environment but not the WebSocketEnvironment,
@@ -1248,7 +1267,7 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
webSocketEnvironment.setConnectListener(
new AuthenticatedConnectListener(accountsManager, receiptSender, messagesManager, messageMetrics, pushNotificationManager,
pushNotificationScheduler, disconnectionRequestManager,
messageDeliveryScheduler, asnInfoProviderSupplier, clientReleaseManager, messageDeliveryLoopMonitor, experimentEnrollmentManager
messageDeliveryScheduler, asnInfoProviderSupplier, clientReleaseManager, experimentEnrollmentManager
));
webSocketEnvironment.jersey().register(new RateLimitByIpFilter(rateLimiters));
webSocketEnvironment.jersey().register(new RequestStatisticsFilter(TrafficSource.WEBSOCKET));
@@ -1267,9 +1286,9 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
experimentEnrollmentManager, config.getAttachments().maxAttachmentUploadSizeInBytes()),
new ArchiveController(accountsManager, backupAuthManager, backupManager, backupMetrics, config.getAttachments().maxAttachmentUploadSizeInBytes(), config.getAttachments().maxMessageBackupUploadSizeInBytes()),
new CallRoutingControllerV2(rateLimiters, cloudflareTurnCredentialsManager),
new CallLinkController(rateLimiters, callingGenericZkSecretParams),
new CallLinkController(rateLimiters, callingGenericZkSecretParams, callingPreV101GenericZkSecretParams),
new CallQualitySurveyController(callQualitySurveyManager),
new CertificateController(accountsManager, certificateGenerator, zkAuthOperations, callingGenericZkSecretParams, clock),
new CertificateController(accountsManager, certificateGenerator, zkAuthOperations, callingGenericZkSecretParams, callingPreV101GenericZkSecretParams, clock),
new ChallengeController(accountsManager, rateLimitChallengeManager, challengeConstraintChecker),
new DeviceController(accountsManager, rateLimiters, persistentTimer),
new DeviceCheckController(clock, accountsManager, backupAuthManager, appleDeviceCheckManager, rateLimiters,
@@ -1295,7 +1314,7 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
new VerificationController(registrationServiceClient, new VerificationSessionManager(verificationSessions),
pushNotificationManager, registrationCaptchaManager, phoneNumberRecoveryPasswordsManager,
phoneNumberIdentifiers, rateLimiters, accountsManager, carrierDataProvider, registrationFraudChecker,
dynamicConfigurationManager, experimentEnrollmentManager, clock),
dynamicConfigurationManager, clock),
new SubscriptionController(clock, config.getSubscription(), config.getOneTimeDonations(),
config.getLoginPurchase(), subscriptionManager, stripeManager, braintreeManager, googlePlayBillingManager,
appleAppStoreManager,
@@ -1364,7 +1383,6 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
List.of(
new LoggingUnhandledExceptionMapper(),
new CompletionExceptionMapper(),
new GrpcStatusRuntimeExceptionMapper(),
new IOExceptionMapper(),
new RateLimitExceededExceptionMapper(),
new InvalidWebsocketAddressExceptionMapper(),
@@ -1378,7 +1396,8 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
new SubscriptionExceptionMapper(),
new BackupExceptionMapper(),
new JsonMappingExceptionMapper(),
new RegistrationLockFailureExceptionMapper()
new RegistrationLockFailureExceptionMapper(),
new MfaFailureExceptionMapper()
).forEach(exceptionMapper -> {
environment.jersey().register(exceptionMapper);
webSocketEnvironment.jersey().register(exceptionMapper);
@@ -0,0 +1,29 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.auth;
import javax.annotation.Nullable;
import org.whispersystems.textsecuregcm.auth.webauthn.AuthenticationCeremonyParameters;
import org.whispersystems.textsecuregcm.util.NoStackTraceException;
public class MfaFailureException extends NoStackTraceException {
private final @Nullable AuthenticationCeremonyParameters webAuthnParameters;
private final boolean hasTotp;
public MfaFailureException(@Nullable AuthenticationCeremonyParameters webAuthnParameters, boolean hasTotpKey) {
this.webAuthnParameters = webAuthnParameters;
this.hasTotp = hasTotpKey;
}
public @Nullable AuthenticationCeremonyParameters getWebAuthnParameters() {
return webAuthnParameters;
}
public boolean hasTotpKey() {
return hasTotp;
}
}
@@ -0,0 +1,16 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.auth.webauthn;
import java.time.Duration;
import java.util.List;
/// Server-generated parameters for a freshly-initiated authentication ceremony.
public record AuthenticationCeremonyParameters(
byte[] challenge,
Duration timeout,
List<byte[]> allowedCredentialIds) {
}
@@ -0,0 +1,15 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.auth.webauthn;
import java.util.List;
/// Server-generated parameters for a freshly-initiated registration ceremony.
public record RegistrationCeremonyParameters(
byte[] userHandle,
List<Long> allowedAlgorithms,
List<byte[]> excludedCredentialIds) {
}
@@ -0,0 +1,17 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.auth.webauthn;
import com.webauthn4j.data.attestation.authenticator.AttestedCredentialData;
import com.webauthn4j.data.client.CollectedClientData;
/// Results of a registration ceremony for persisting.
public record RegistrationCeremonyResult(
AttestedCredentialData attestedCredentialData,
CollectedClientData collectedClientData,
long signCount
) {
}
@@ -0,0 +1,27 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.auth.webauthn;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.v3.oas.annotations.media.Schema;
import org.whispersystems.textsecuregcm.util.ByteArrayAdapter;
import java.util.List;
public record WebAuthnAuthenticationParameters(
@Schema(description = "The authentication ceremony challenge.")
@JsonDeserialize(using = ByteArrayAdapter.Deserializing.class)
@JsonSerialize(using = ByteArrayAdapter.Serializing.class)
byte[] challenge,
@Schema(description = "The number of seconds the challenge will be valid.")
long timeoutSeconds,
@Schema(description = "A list of authenticators previously registered to the account.")
@JsonDeserialize(contentUsing = ByteArrayAdapter.Deserializing.class)
@JsonSerialize(contentUsing = ByteArrayAdapter.Serializing.class)
List<byte[]> allowedCredentialIds) {}
@@ -0,0 +1,231 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.auth.webauthn;
import com.google.common.annotations.VisibleForTesting;
import com.webauthn4j.WebAuthnManager;
import com.webauthn4j.credential.CredentialRecord;
import com.webauthn4j.data.AuthenticationData;
import com.webauthn4j.data.AuthenticationParameters;
import com.webauthn4j.data.PublicKeyCredentialParameters;
import com.webauthn4j.data.PublicKeyCredentialType;
import com.webauthn4j.data.RegistrationData;
import com.webauthn4j.data.RegistrationParameters;
import com.webauthn4j.data.RegistrationRequest;
import com.webauthn4j.data.attestation.statement.COSEAlgorithmIdentifier;
import com.webauthn4j.data.client.Origin;
import com.webauthn4j.server.ServerProperty;
import com.webauthn4j.util.exception.WebAuthnException;
import com.webauthn4j.verifier.exception.BadChallengeException;
import com.webauthn4j.verifier.exception.VerificationException;
import io.lettuce.core.SetArgs;
import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import javax.annotation.Nullable;
import org.whispersystems.textsecuregcm.redis.FaultTolerantRedisClusterClient;
import org.whispersystems.textsecuregcm.util.HmacUtils;
import org.whispersystems.textsecuregcm.util.ResilienceUtil;
import org.whispersystems.textsecuregcm.util.UUIDUtil;
import tools.jackson.core.JacksonException;
/// Handles WebAuthn registration and authentication operations.
public class WebAuthnCeremonyManager {
/// [relying party ID - WebAuthn TR](https://www.w3.org/TR/webauthn/#relying-party-identifier)
private final String rpId;
/// [origin - WebAuthn TR](https://www.w3.org/TR/webauthn/#dom-collectedclientdata-origin)
private final Origin origin;
private final byte[] blindingSecret;
private final Duration challengeTtl;
private final FaultTolerantRedisClusterClient challengeStorageCluster;
private final WebAuthnManager webAuthnManager;
private static final String RETRY_NAME = ResilienceUtil.name(WebAuthnCeremonyManager.class);
/// Ed25519 support is fairly limited, while ES256 is broadly supported
private static final List<PublicKeyCredentialParameters> ALLOWED_WEBAUTHN_CREDENTIAL_ALGORITHMS = List.of(
new PublicKeyCredentialParameters(PublicKeyCredentialType.PUBLIC_KEY, COSEAlgorithmIdentifier.Ed25519),
new PublicKeyCredentialParameters(PublicKeyCredentialType.PUBLIC_KEY, COSEAlgorithmIdentifier.ES256)
);
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
public WebAuthnCeremonyManager(final String rpId, final String origin, final Duration challengeTtl, final byte[] blindingSecret,
final FaultTolerantRedisClusterClient challengeStorageCluster) {
this.rpId = rpId;
this.origin = new Origin(origin);
this.challengeTtl = challengeTtl;
this.blindingSecret = blindingSecret;
this.challengeStorageCluster = challengeStorageCluster;
this.webAuthnManager = WebAuthnManager.createNonStrictWebAuthnManager();
}
/// Initiates a WebAuthn registration ceremony
///
/// @param identifier The account identifier
///
/// @param existingCredentials a list of already-stored credential records for the user; their IDs
/// will be provided to the client to help prevent registering a duplicate ID on the same
/// authenticator
///
/// @return parameters the client must use for its step in the registration ceremony. `identifier` will be blinded, so
/// that it is a [non-identifiable user handle](https://www.w3.org/TR/webauthn/#sctn-user-handle-privacy)
public RegistrationCeremonyParameters startRegistration(final UUID identifier, final List<? extends CredentialRecord> existingCredentials) {
return new RegistrationCeremonyParameters(
blindIdentifier(identifier),
ALLOWED_WEBAUTHN_CREDENTIAL_ALGORITHMS.stream().map(pkcp -> pkcp.getAlg().getValue()).toList(),
existingCredentials.stream().map(credentialRecord -> credentialRecord.getAttestedCredentialData().getCredentialId()).toList()
);
}
/// Verifies that the supplied authenticator response components form a
/// valid WebAuthn registration ceremony with acceptable parameters.
///
/// @param serializedAttestationObject the "attestation object" from the authenticator response,
/// serialized in the format specified by the WebAuthn TR. Its attestation format must be `none`
/// and any attestation statement must have been cleared to mitigate privacy risks.
///
/// @param collectedClientDataJson the "collected client data" from the authenticator response,
/// serialized in the [format specified by the WebAuthn TR](https://www.w3.org/TR/webauthn/#sctn-generating-an-attestation-object)
///
/// @return a record that can be stored for future authentication.
///
/// @throws WebAuthnException if the supplied authenticator response is
/// invalid for any reason (structurally or due to selecting unacceptable
/// parameters, for example an unsupported signature algorithm)
public RegistrationCeremonyResult verifyRegistration(
final byte[] serializedAttestationObject, final String collectedClientDataJson) throws WebAuthnException {
final RegistrationData registrationData;
try {
registrationData = webAuthnManager.parse(
new RegistrationRequest(serializedAttestationObject, collectedClientDataJson.getBytes(StandardCharsets.UTF_8)));
} catch (final JacksonException e) {
throw new WebAuthnException(e);
}
// These shouldn't ever be null, because the upstream RPC inputs are not nullable. However, the fields are annotated as
// nullable.
if (registrationData.getAttestationObject() == null) {
throw new WebAuthnException("Attestation object must not be null");
}
if (registrationData.getCollectedClientData() == null) {
throw new WebAuthnException("Collected client data must not be null");
}
if (!"none".equals(registrationData.getAttestationObject().getAttestationStatement().getFormat())) {
// Refuse any attestations; clients must clear them to prevent sharing information we don't want to store
throw new WebAuthnException("attestation format must be 'none'");
}
final ServerProperty serverProperties = ServerProperty.builder()
// we aren't verifying any signatures for registration, so we don't need to bother saving a
// challenge; accept whatever is supplied
.challenge(registrationData.getCollectedClientData().getChallenge())
.origin(origin)
.rpId(rpId)
.build();
webAuthnManager.verify(registrationData,
new RegistrationParameters(serverProperties, ALLOWED_WEBAUTHN_CREDENTIAL_ALGORITHMS, false, true));
return new RegistrationCeremonyResult(
registrationData.getAttestationObject().getAuthenticatorData().getAttestedCredentialData(),
registrationData.getCollectedClientData(),
registrationData.getAttestationObject().getAuthenticatorData().getSignCount());
}
/// Initiates a WebAuthn authentication ceremony.
///
/// Each call generates, and replaces any existing, [challenge](https://www.w3.org/TR/webauthn/#sctn-cryptographic-challenges).
///
/// @param identifier the identifier of the account to be authenticated
/// @param existingCredentials a list of stored credential records for the user being authenticated
///
/// @return a [AuthenticationCeremonyParameters] record with the details
/// needed by a client in possession of a matching authenticator to complete
/// the ceremony
public AuthenticationCeremonyParameters startAuthentication(final UUID identifier, List<? extends CredentialRecord> existingCredentials) {
final byte[] challengeKey = challengeKey(identifier);
final byte[] challenge = new byte[16];
SECURE_RANDOM.nextBytes(challenge);
ResilienceUtil.getGeneralRedisRetry(RETRY_NAME)
.executeRunnable(
() -> challengeStorageCluster.withBinaryCluster(cluster -> cluster.sync().set(challengeKey, challenge, SetArgs.Builder.ex(challengeTtl.toSeconds()))));
return new AuthenticationCeremonyParameters(
challenge,
challengeTtl,
existingCredentials.stream().map(cr -> cr.getAttestedCredentialData().getCredentialId()).toList());
}
/// Parses an authenticator response JSON blob, whose format is specified in the WebAuthn Technical Report
public AuthenticationData parseAuthenticationResponse(final String authenticationResponseJson) throws WebAuthnException {
try {
return webAuthnManager.parseAuthenticationResponseJSON(authenticationResponseJson);
} catch (final NullPointerException | JacksonException e) {
throw new WebAuthnException(e);
}
}
/// Verifies an authenticator response to a WebAuthn authentication ceremony, consuming any existing stored challenge.
///
/// If verification succeeds, the `CredentialRecord` is [updated in-place](https://www.w3.org/TR/webauthn-3/#authn-ceremony-update-credential-record).
///
/// @param identifier the identifier of the account to be authenticated
/// @param matchingCredential the stored credential record for the account to be authenticated with an ID matching the one from the authenticator response
/// @param authenticationData the parsed authenticator response
///
///
/// @throws VerificationException if the response could not be verified for any reason (incorrect signature, incorrect or expired challenge)
public void verifyAuthentication(
final UUID identifier,
final CredentialRecord matchingCredential,
final AuthenticationData authenticationData) throws VerificationException {
final byte[] challengeKey = challengeKey(identifier);
@Nullable final byte[] challenge = ResilienceUtil.getGeneralRedisRetry(RETRY_NAME)
.executeSupplier(() -> challengeStorageCluster.withBinaryCluster(cluster -> cluster.sync().getdel(challengeKey)));
//noinspection ConstantValue
if (challenge == null) {
throw new BadChallengeException("no challenge stored");
}
final byte[] credentialId = matchingCredential.getAttestedCredentialData().getCredentialId();
final AuthenticationParameters authenticationParameters = new AuthenticationParameters(
ServerProperty.builder()
.origin(origin)
.rpId(rpId)
.challenge(() -> challenge)
.build(),
matchingCredential,
List.of(credentialId),
false,
true);
webAuthnManager.verify(authenticationData, authenticationParameters);
}
/// @return `true` if [CredentialRecord]s represent the same actual credential ID. Note that this is more specific than
/// whether they came from the same authenticator device, which cannot be determined in general.
public static boolean isSameCredential(final CredentialRecord a, final CredentialRecord b) {
return Arrays.equals(a.getAttestedCredentialData().getCredentialId(), b.getAttestedCredentialData().getCredentialId());
}
@VisibleForTesting
static byte[] challengeKey(final UUID identifier) {
return String.format("webauthn_challenge::{%s}", identifier).getBytes(StandardCharsets.UTF_8);
}
private byte[] blindIdentifier(final UUID identifier) {
return HmacUtils.hmac256Truncated(blindingSecret, UUIDUtil.toBytes(identifier), 32);
}
}
@@ -9,7 +9,6 @@ import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name;
import com.google.common.annotations.VisibleForTesting;
import io.micrometer.core.instrument.Metrics;
import jakarta.ws.rs.BadRequestException;
import java.io.IOException;
import java.util.Locale;
import java.util.Optional;
@@ -19,6 +18,8 @@ import java.util.function.Function;
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration;
import org.whispersystems.textsecuregcm.storage.DynamicConfigurationManager;
public class CaptchaChecker {
private static final Logger logger = LoggerFactory.getLogger(CaptchaChecker.class);
@@ -33,12 +34,15 @@ public class CaptchaChecker {
private final ShortCodeExpander shortCodeExpander;
private final Function<String, CaptchaClient> captchaClientSupplier;
private final DynamicConfigurationManager<DynamicConfiguration> dynamicConfigurationManager;
public CaptchaChecker(
final ShortCodeExpander shortCodeRetriever,
final Function<String, CaptchaClient> captchaClientSupplier) {
final Function<String, CaptchaClient> captchaClientSupplier,
final DynamicConfigurationManager<DynamicConfiguration> dynamicConfigurationManager) {
this.shortCodeExpander = shortCodeRetriever;
this.captchaClientSupplier = captchaClientSupplier;
this.dynamicConfigurationManager = dynamicConfigurationManager;
}
@@ -105,12 +109,21 @@ public class CaptchaChecker {
throw new InvalidCaptchaArgumentException("invalid captcha site-key");
}
final AssessmentResult result = client.verify(maybeAci, siteKey, parsedAction, token, ip, userAgent);
Metrics.counter(ASSESSMENTS_COUNTER_NAME,
"action", action,
"score", result.getScoreString(),
"provider", provider)
.increment();
return result;
try {
final AssessmentResult result = client.verify(maybeAci, siteKey, parsedAction, token, ip, userAgent);
Metrics.counter(ASSESSMENTS_COUNTER_NAME,
"action", action,
"score", result.getScoreString(),
"provider", provider)
.increment();
return result;
} catch (final IOException | RuntimeException e) {
if (dynamicConfigurationManager.getConfiguration().getCaptchaConfiguration().isFailOpen()) {
logger.warn("Failed to verify captcha; failing open", e);
return AssessmentResult.alwaysValid();
}
throw e;
}
}
}
@@ -0,0 +1,45 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.configuration;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.github.resilience4j.bulkhead.BulkheadConfig;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import java.time.Duration;
public class BulkheadConfiguration {
@JsonProperty
@Min(1)
private int maxConcurrentCalls = BulkheadConfig.DEFAULT_MAX_CONCURRENT_CALLS;
@JsonProperty
@NotNull
private Duration maxWaitDuration = BulkheadConfig.DEFAULT_MAX_WAIT_DURATION;
public int getMaxConcurrentCalls() {
return maxConcurrentCalls;
}
public void setMaxConcurrentCalls(final int maxConcurrentCalls) {
this.maxConcurrentCalls = maxConcurrentCalls;
}
public Duration getMaxWaitDuration() {
return maxWaitDuration;
}
public void setMaxWaitDuration(final Duration maxWaitDuration) {
this.maxWaitDuration = maxWaitDuration;
}
public BulkheadConfig.Builder toBulkheadConfig() {
return BulkheadConfig.custom()
.maxConcurrentCalls(maxConcurrentCalls)
.maxWaitDuration(maxWaitDuration);
}
}
@@ -0,0 +1,22 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.configuration;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.PositiveOrZero;
import java.util.List;
import java.util.Optional;
/// Configuration for FoundationDB external clients. Primarily exists because an external client must be specified to
/// make use of the multi-threaded client feature.
///
/// @param clientLibraryPaths a list of paths to external client libraries (generally .so files on Linux). This allows
/// us to run multiple FDB client versions concurrently if needed; however, during normal operation, we expect the list
/// to be a single path pointing to the current FDB client library
/// @param threadsPerClient the number of networking threads spawned per client
public record FoundationDbExternalClientConfiguration(@NotEmpty List<@NotBlank String> clientLibraryPaths,
Optional<@PositiveOrZero Integer> threadsPerClient) {}
@@ -5,6 +5,7 @@
package org.whispersystems.textsecuregcm.configuration;
import jakarta.annotation.Nullable;
import jakarta.validation.Valid;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.Max;
@@ -25,7 +26,7 @@ import org.whispersystems.textsecuregcm.storage.foundationdb.FoundationDbMessage
/// @param batchPriorityTransactionTimeout the maximum time for a batch priority transaction. Should be greater than or equal to {@link transactionTimeout}
/// @param batchPriorityTransactionRetryLimit the maximum number of retries permitted _within_ a batch priority transaction
public record FoundationDbMessagesConfiguration(@NotEmpty Map<String, @Valid FoundationDbDatabaseFactory> clusters,
@NotEmpty Map<@PositiveOrZero @Max(FoundationDbMessageStore.MAX_EPOCHS - 1) Integer, @Size(min = 1, max = FoundationDbMessageStore.MAX_SHARDS - 1) List<String>> epochs,
@NotEmpty Map<@PositiveOrZero @Max(FoundationDbMessageStore.MAX_EPOCHS - 1) Integer, @Size(min = 1, max = FoundationDbMessageStore.MAX_SHARDS) List<String>> epochs,
@PositiveOrZero @Max(FoundationDbMessageStore.MAX_EPOCHS - 1) int activeEpoch,
@NotEmpty Map<@PositiveOrZero @Max(63) Integer, SecretBytes> versionstampCipherKeys,
@PositiveOrZero @Max(63) int currentVersionstampCipherKey,
@@ -33,7 +34,10 @@ public record FoundationDbMessagesConfiguration(@NotEmpty Map<String, @Valid Fou
@NotNull Duration transactionTimeout,
@PositiveOrZero long transactionRetryLimit,
@NotNull Duration batchPriorityTransactionTimeout,
@PositiveOrZero long batchPriorityTransactionRetryLimit) {
@PositiveOrZero long batchPriorityTransactionRetryLimit,
@Nullable String circuitBreakerConfigurationName,
@Nullable String bulkheadConfigurationName,
@Nullable @Valid FoundationDbExternalClientConfiguration externalClientConfiguration) {
public static final long DEFAULT_MAX_WATCHES_PER_CLIENT = 10_000;
public static final Duration DEFAULT_TRANSACTION_TIMEOUT = Duration.ofSeconds(1);
@@ -12,7 +12,9 @@ import java.time.Duration;
/// Configuration for one-time Signal Login purchases
///
/// @param playProductId the Google Play Billing productId clients should purchase to obtain a Signal Login
/// @param playOptionId the Google Play Billing optionId clients should purchase to obtain a Signal Login
/// @param appStoreProductId the App Store productId clients should purchase to obtain a Signal Login
public record LoginPurchaseConfiguration(
@NotEmpty String playProductId,
@NotEmpty String playOptionId,
@NotEmpty String appStoreProductId) {}
@@ -18,6 +18,7 @@ public record OpenTelemetryConfiguration(
@JsonProperty Duration shutdownWaitDuration,
@JsonProperty int maxBucketCount,
@JsonProperty Map<String, Integer> maxBucketsPerMeter,
@JsonProperty boolean publishMaxGaugeForHistograms,
@JsonAnyGetter @JsonAnySetter Map<String, String> otlpConfig
) implements OtlpConfig {
@@ -0,0 +1,19 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.configuration;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.time.Duration;
import org.whispersystems.textsecuregcm.configuration.secrets.SecretBytes;
import org.whispersystems.textsecuregcm.util.ExactlySize;
public record WebAuthnConfiguration(
@NotBlank String relyingPartyId,
@NotBlank String origin,
@NotNull Duration challengeTtl,
@NotNull @ExactlySize(32) SecretBytes userHandleBlindingSecret) {
}
@@ -35,6 +35,9 @@ public class DynamicCaptchaConfiguration {
@NotNull
private Map<Action, BigDecimal> scoreFloorByAction = Collections.emptyMap();
@JsonProperty
private boolean failOpen = false;
public BigDecimal getScoreFloor() {
return scoreFloor;
}
@@ -66,4 +69,11 @@ public class DynamicCaptchaConfiguration {
this.hCaptchaSiteKeys = hCaptchaSiteKeys;
}
public boolean isFailOpen() {
return failOpen;
}
public void setFailOpen(final boolean failOpen) {
this.failOpen = failOpen;
}
}
@@ -239,6 +239,10 @@ public class AccountController {
}
});
if (StringUtils.isNotEmpty(attributes.getRegistrationLock()) && a.getNumber().isEmpty()) {
throw new BadRequestException("account does not have a phone number");
}
a.setRegistrationLockFromAttributes(attributes);
a.setUnidentifiedAccessKey(attributes.getUnidentifiedAccessKey());
a.setUnrestrictedUnidentifiedAccess(attributes.isUnrestrictedUnidentifiedAccess());
@@ -2,6 +2,7 @@ package org.whispersystems.textsecuregcm.controllers;
import io.dropwizard.auth.Auth;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
@@ -9,6 +10,7 @@ import jakarta.ws.rs.BadRequestException;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
@@ -26,13 +28,16 @@ import org.whispersystems.textsecuregcm.limits.RateLimiters;
public class CallLinkController {
private final RateLimiters rateLimiters;
private final GenericServerSecretParams genericServerSecretParams;
private final GenericServerSecretParams genericServerSecretParamsPreV101;
public CallLinkController(
final RateLimiters rateLimiters,
final GenericServerSecretParams genericServerSecretParams
final GenericServerSecretParams genericServerSecretParams,
final GenericServerSecretParams genericServerSecretParamsPreV101
) {
this.rateLimiters = rateLimiters;
this.genericServerSecretParams = genericServerSecretParams;
this.genericServerSecretParamsPreV101 = genericServerSecretParamsPreV101;
}
@POST
@@ -52,7 +57,9 @@ public class CallLinkController {
@ApiResponse(responseCode = "429", description = "Ratelimited.")
public CreateCallLinkCredential getCreateAuth(
final @Auth AuthenticatedDevice auth,
final @NotNull @Valid GetCreateCallLinkCredentialsRequest request
final @NotNull @Valid GetCreateCallLinkCredentialsRequest request,
@Parameter(description = "Whether to use libsignal v0.101.0+ secret params")
final @QueryParam("v101") boolean v101
) throws RateLimitExceededException {
rateLimiters.getCreateCallLinkLimiter().validate(auth.accountIdentifier());
@@ -67,7 +74,7 @@ public class CallLinkController {
}
return new CreateCallLinkCredential(
createCallLinkCredentialRequest.issueCredential(new ServiceId.Aci(auth.accountIdentifier()), truncatedDayTimestamp, genericServerSecretParams).serialize(),
createCallLinkCredentialRequest.issueCredential(new ServiceId.Aci(auth.accountIdentifier()), truncatedDayTimestamp, v101 ? genericServerSecretParams : genericServerSecretParamsPreV101).serialize(),
truncatedDayTimestamp.getEpochSecond()
);
}
@@ -10,6 +10,7 @@ import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name;
import com.google.common.annotations.VisibleForTesting;
import io.dropwizard.auth.Auth;
import io.micrometer.core.instrument.Metrics;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.ws.rs.BadRequestException;
import jakarta.ws.rs.DefaultValue;
@@ -49,6 +50,7 @@ public class CertificateController {
private final CertificateGenerator certificateGenerator;
private final ServerZkAuthOperations serverZkAuthOperations;
private final GenericServerSecretParams genericServerSecretParams;
private final GenericServerSecretParams genericServerSecretParamsPreV101;
private final Clock clock;
@VisibleForTesting
@@ -61,12 +63,14 @@ public class CertificateController {
@Nonnull CertificateGenerator certificateGenerator,
@Nonnull ServerZkAuthOperations serverZkAuthOperations,
@Nonnull GenericServerSecretParams genericServerSecretParams,
@Nonnull GenericServerSecretParams genericServerSecretParamsPreV101,
@Nonnull Clock clock) {
this.accountsManager = accountsManager;
this.certificateGenerator = Objects.requireNonNull(certificateGenerator);
this.serverZkAuthOperations = Objects.requireNonNull(serverZkAuthOperations);
this.genericServerSecretParams = genericServerSecretParams;
this.genericServerSecretParamsPreV101 = genericServerSecretParamsPreV101;
this.clock = Objects.requireNonNull(clock);
}
@@ -95,7 +99,9 @@ public class CertificateController {
public GroupCredentials getGroupAuthenticationCredentials(
@Auth AuthenticatedDevice auth,
@QueryParam("redemptionStartSeconds") long startSeconds,
@QueryParam("redemptionEndSeconds") long endSeconds) {
@QueryParam("redemptionEndSeconds") long endSeconds,
@Parameter(description = "Whether to use libsignal v0.101.0+ secret params")
@QueryParam("v101") boolean v101) {
final RedemptionRange redemptionRange;
try {
@@ -127,7 +133,7 @@ public class CertificateController {
(int) redemption.getEpochSecond()));
callLinkAuthCredentials.add(new GroupCredentials.CallLinkAuthCredential(
CallLinkAuthCredentialResponse.issueCredential(aci, redemption, genericServerSecretParams).serialize(),
CallLinkAuthCredentialResponse.issueCredential(aci, redemption, v101 ? genericServerSecretParams : genericServerSecretParamsPreV101).serialize(),
redemption.getEpochSecond()));
}
@@ -91,9 +91,9 @@ import org.whispersystems.textsecuregcm.spam.SpamChecker;
import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.AccountsManager;
import org.whispersystems.textsecuregcm.storage.PhoneNumberIdentifiers;
import org.whispersystems.textsecuregcm.storage.ReportMessageHelper;
import org.whispersystems.textsecuregcm.storage.ReportMessageManager;
import org.whispersystems.textsecuregcm.util.HeaderUtils;
import org.whispersystems.textsecuregcm.util.Util;
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
@Path("/v1/messages")
@@ -605,7 +605,7 @@ public class MessageController {
CompletableFuture.allOf(resolvedRecipients.values()
.stream()
.map(account -> account.getAccountIdentifier())
.map(Account::getAccountIdentifier)
.map(accountIdentifier ->
rateLimiters.getStoriesLimiter().validateAsync(accountIdentifier).toCompletableFuture())
.toList()
@@ -731,45 +731,10 @@ public class MessageController {
@Path("/report/{source}/{messageGuid}")
public Response reportSpamMessage(
@Auth AuthenticatedDevice auth,
@PathParam("source") String source,
@PathParam("source") UUID source,
@PathParam("messageGuid") UUID messageGuid,
@Nullable SpamReport spamReport,
@HeaderParam(HttpHeaders.USER_AGENT) String userAgent
) {
final Optional<String> sourceNumber;
final Optional<UUID> sourceAci;
final Optional<UUID> sourcePni;
boolean sourceAccountDeleted = false;
if (source.startsWith("+")) {
sourceNumber = Optional.of(source);
final Optional<Account> maybeAccount = accountsManager.getByE164(source);
if (maybeAccount.isPresent()) {
sourceAci = maybeAccount.map(Account::getAccountIdentifier);
sourcePni = maybeAccount.flatMap(Account::getPhoneNumberIdentifier);
} else {
sourcePni = Optional.ofNullable(phoneNumberIdentifiers.getPhoneNumberIdentifier(source).join());
sourceAci = sourcePni.flatMap(accountsManager::findRecentlyDeletedAccountIdentifier);
sourceAccountDeleted = true;
}
} else {
sourceAci = Optional.of(UUID.fromString(source));
final Optional<Account> sourceAccount = accountsManager.getByAccountIdentifier(sourceAci.get());
if (sourceAccount.isEmpty()) {
logger.warn("Could not find source: {}", sourceAci.get());
sourcePni = accountsManager.findRecentlyDeletedPhoneNumberIdentifier(sourceAci.get());
sourceNumber = sourcePni.flatMap(pni ->
Util.getCanonicalNumber(phoneNumberIdentifiers.getPhoneNumber(pni).join()));
sourceAccountDeleted = true;
} else {
sourceNumber = sourceAccount.flatMap(Account::getNumber);
sourcePni = sourceAccount.flatMap(Account::getPhoneNumberIdentifier);
}
}
final UUID spamReporterUuid = auth.accountIdentifier();
@HeaderParam(HttpHeaders.USER_AGENT) String userAgent) {
// spam report token is optional, but if provided ensure it is non-empty.
final Optional<byte[]> maybeSpamReportToken =
@@ -777,7 +742,14 @@ public class MessageController {
.flatMap(r -> Optional.ofNullable(r.token()))
.filter(t -> t.length > 0);
reportMessageManager.report(sourceNumber, sourceAci, sourcePni, messageGuid, spamReporterUuid, maybeSpamReportToken, userAgent, sourceAccountDeleted);
ReportMessageHelper.reportMessage(new AciServiceIdentifier(source),
new AciServiceIdentifier(auth.accountIdentifier()),
messageGuid,
maybeSpamReportToken.orElse(null),
userAgent,
accountsManager,
phoneNumberIdentifiers,
reportMessageManager);
return Response.status(Status.ACCEPTED)
.build();
@@ -199,7 +199,7 @@ public class OneTimeDonationController {
throw new WebApplicationException(Response.Status.UNAUTHORIZED);
}
validateRequestCurrencyAmount(request, BigDecimal.valueOf(request.amount), stripeManager);
validateRequestCurrencyAmount(request, request.amount, stripeManager);
final PaymentIntent paymentIntent = stripeManager.createPaymentIntent(request.currency, request.amount,
request.level,
getClientPlatform(userAgent));
@@ -212,7 +212,7 @@ public class OneTimeDonationController {
*
* @throws BadRequestException indicates validation failed. Inspect {@code response.error} for details
*/
private void validateRequestCurrencyAmount(final CreateBoostRequest request, final BigDecimal amount,
private void validateRequestCurrencyAmount(final CreateBoostRequest request, final long amount,
final CustomerAwareSubscriptionPaymentProcessor manager) {
final Map<String, String> errorBody = switch (OneTimeDonationUtil.validateOneTimeDonationRequest(request.currency,
@@ -222,11 +222,9 @@ public class OneTimeDonationController {
case OneTimeDonationUtil.OneTimeDonationRequestValidationResult.UnsupportedCurrency _ ->
Map.of("error", "unsupported_currency");
case OneTimeDonationUtil.OneTimeDonationRequestValidationResult.AmountBelowMinimum(final BigDecimal min) ->
Map.of("error", "amount_below_currency_minimum",
"minimum", min.toString());
Map.of("error", "amount_below_currency_minimum", "minimum", min.toString());
case OneTimeDonationUtil.OneTimeDonationRequestValidationResult.AmountAboveSepaLimit(final BigDecimal max) ->
Map.of("error", "amount_above_sepa_limit",
"maximum", max.toString());
Map.of("error", "amount_above_sepa_limit", "maximum", max.toString());
case OneTimeDonationUtil.OneTimeDonationRequestValidationResult.Success _ -> Collections.emptyMap();
};
@@ -265,7 +263,7 @@ public class OneTimeDonationController {
throw new ForbiddenException("must not use authenticated connection for one-time donation operations");
}
validateRequestCurrencyAmount(request, BigDecimal.valueOf(request.amount), braintreeManager);
validateRequestCurrencyAmount(request, request.amount, braintreeManager);
final List<Locale> acceptableLanguages =
HeaderUtils.getAcceptableLanguagesForRequest(containerRequestContext);
final OneTimeDonationUtil.LocalizedPayPalDonationLineItem localizedLineItem = OneTimeDonationUtil.localizePayPalDonationLineItem(
@@ -307,7 +305,7 @@ public class OneTimeDonationController {
throw new ForbiddenException("must not use authenticated connection for one-time donation operations");
}
validateRequestCurrencyAmount(request, BigDecimal.valueOf(request.amount), braintreeManager);
validateRequestCurrencyAmount(request, request.amount, braintreeManager);
final BraintreeManager.PayPalChargeSuccessDetails chargeSuccessDetails = braintreeManager.captureOneTimePayment(
request.payerId, request.paymentId,
request.paymentToken, request.currency, request.amount, request.level, getClientPlatform(userAgent));
@@ -53,6 +53,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.auth.BasicAuthorizationHeader;
import org.whispersystems.textsecuregcm.auth.InvalidRegistrationSessionException;
import org.whispersystems.textsecuregcm.auth.MfaFailureException;
import org.whispersystems.textsecuregcm.auth.PhoneVerificationTokenManager;
import org.whispersystems.textsecuregcm.auth.RecoveryPasswordVerificationFailedException;
import org.whispersystems.textsecuregcm.auth.RegistrationLockFailureException;
@@ -66,10 +67,13 @@ import org.whispersystems.textsecuregcm.entities.RegistrationLockFailure;
import org.whispersystems.textsecuregcm.entities.RegistrationRequest;
import org.whispersystems.textsecuregcm.filters.RemoteAddressFilter;
import org.whispersystems.textsecuregcm.limits.RateLimiters;
import org.whispersystems.textsecuregcm.mappers.MfaFailureExceptionMapper;
import org.whispersystems.textsecuregcm.metrics.UserAgentTagUtil;
import org.whispersystems.textsecuregcm.spam.RegistrationFraudChecker;
import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.AccountsManager;
import org.whispersystems.textsecuregcm.storage.AnnotatedTotpKey;
import org.whispersystems.textsecuregcm.storage.AnnotatedWebAuthnCredential;
import org.whispersystems.textsecuregcm.storage.DeviceCapability;
import org.whispersystems.textsecuregcm.storage.DeviceIdentityInfo;
import org.whispersystems.textsecuregcm.storage.DeviceSpec;
@@ -141,7 +145,7 @@ public class RegistrationController {
""")
@ApiResponse(responseCode = "200", description = "Account creation succeeded", useReturnTypeSchema = true)
@ApiResponse(responseCode = "400", description = "Invalid session ID or receipt credential presentation")
@ApiResponse(responseCode = "401", description = "The session identified in the request is not verified")
@ApiResponse(responseCode = "401", description = "The session identified in the request is not verified, or the receipt credential presented fails verification, is expired, or is already redeemed")
@ApiResponse(responseCode = "403", description = "Verification failed for the provided Registration Recovery Password")
@ApiResponse(responseCode = "409", description = "The caller has not explicitly elected to skip transferring data from another device, but a device transfer is technically possible")
@ApiResponse(responseCode = "422", description = "The request did not pass validation")
@@ -149,7 +153,12 @@ public class RegistrationController {
@ApiResponse(responseCode = "429", description = "Too many attempts", headers = @Header(
name = "Retry-After",
description = "If present, an positive integer indicating the number of seconds before a subsequent attempt could succeed"))
@ApiResponse(responseCode = "441", description = "A valid one-time password (TOTP) is required, but either no password was provided or it was incorrect")
@ApiResponse(responseCode = "441",
description = """
Second factor authentication failed. Either the account has one or more factors configured, and the request’s
factor was incorrect or absent, or the account has no factors, but the request included a factor.
""",
content = @Content(schema = @Schema(implementation = MfaFailureExceptionMapper.MfaFailureResponse.class)))
@ApiResponse(responseCode = "499", description = "Client must support post-quantum ratchet")
public AccountCreationResponse register(
@Parameter(
@@ -171,7 +180,7 @@ public class RegistrationController {
@HeaderParam(HttpHeaders.USER_AGENT) final String userAgent,
@NotNull @Valid final RegistrationRequest registrationRequest,
@Context final ContainerRequestContext requestContext)
throws RateLimitExceededException, InterruptedException, RegistrationLockFailureException {
throws RateLimitExceededException, InterruptedException, RegistrationLockFailureException, MfaFailureException {
if (!registrationRequest.isEverySignedKeyValid(userAgent)) {
throw new WebApplicationException("Invalid signature", 422);
@@ -219,15 +228,13 @@ public class RegistrationController {
final ContainerRequestContext requestContext,
final String userAgent,
final String signalAgent)
throws RateLimitExceededException, InterruptedException, RegistrationLockFailureException {
throws RateLimitExceededException, InterruptedException, RegistrationLockFailureException, MfaFailureException {
if (registrationRequest.pniIdentityKey() == null) {
// RegistrationRequest checks that either all phone number-associated information is present or all is absent
throw new WebApplicationException("PNI keys and registration ID must be provided", 422);
}
rateLimiters.getRegistrationLimiter().validate(number);
final PhoneVerificationRequest.VerificationType verificationType;
try {
verificationType = phoneVerificationTokenManager.verify(
@@ -247,9 +254,11 @@ public class RegistrationController {
throw new ForbiddenException("recovery password could not be verified");
}
rateLimiters.getRegistrationLimiter().validate(number);
// There can be at most one existing account for a set of numbers in the same equivalence class, so it's sufficient
// to find the first one.
final Optional<Account> existingAccount = Util.getAlternateForms(number)
Optional<Account> existingAccount = Util.getAlternateForms(number)
.stream()
.map(accounts::getByE164)
.filter(Optional::isPresent)
@@ -274,7 +283,7 @@ public class RegistrationController {
registrationRequest.accountAttributes().getRegistrationLock(),
userAgent, RegistrationLockVerificationManager.Flow.REGISTRATION, verificationType);
checkTotp(existingAccount.get(), registrationRequest.totp());
existingAccount = Optional.of(checkMfa(existingAccount.get(), registrationRequest.webAuthnResponse(), registrationRequest.totp()));
}
final Account account = accounts.create(number,
@@ -348,12 +357,12 @@ public class RegistrationController {
try {
serverZkReceiptOperations.verifyReceiptCredentialPresentation(receiptCredentialPresentation);
} catch (VerificationFailedException _) {
throw new BadRequestException("Receipt credential presentation verification failed");
throw new NotAuthorizedException("Receipt credential presentation verification failed");
}
final Instant receiptExpiration = Instant.ofEpochSecond(receiptCredentialPresentation.getReceiptExpirationTime());
if (clock.instant().isAfter(receiptExpiration)) {
throw new BadRequestException("Receipt is already expired");
throw new NotAuthorizedException("Receipt is already expired");
}
final long receiptLevel = receiptCredentialPresentation.getReceiptLevel();
@@ -386,7 +395,7 @@ public class RegistrationController {
final AccountIdentityResponse accountIdentityResponse = new AccountIdentityResponseBuilder(account).build();
return new AccountCreationResponse(accountIdentityResponse, false);
} catch (ReceiptAlreadyRedeemedException _) {
throw new BadRequestException("Receipt already redeemed");
throw new NotAuthorizedException("Receipt already redeemed");
}
}
@@ -394,7 +403,7 @@ public class RegistrationController {
final String password,
final RegistrationRequest registrationRequest,
final String userAgent,
final String signalAgent) throws RegistrationLockFailureException, RateLimitExceededException {
final String signalAgent) throws RegistrationLockFailureException, RateLimitExceededException, MfaFailureException {
if (!dynamicConfigurationManager.getConfiguration().getLoginPurchaseConfiguration().enabled()) {
throw new BadRequestException("login purchases are not enabled");
@@ -412,7 +421,7 @@ public class RegistrationController {
throw new BadRequestException("Must specify a PNI-associated identity key when recovering an account by identifier");
}
final Account existingAccount = accounts.getByAccountIdentifier(accountIdentifier)
Account existingAccount = accounts.getByAccountIdentifier(accountIdentifier)
.orElseThrow(ForbiddenException::new);
final boolean passwordVerified = existingAccount.getAccountRecoveryPassword()
@@ -423,7 +432,7 @@ public class RegistrationController {
throw new ForbiddenException();
}
checkTotp(existingAccount, registrationRequest.totp());
existingAccount = checkMfa(existingAccount, registrationRequest.webAuthnResponse(), registrationRequest.totp());
if (!registrationRequest.skipDeviceTransfer() && existingAccount.hasCapability(DeviceCapability.TRANSFER)) {
// If a device transfer is possible, clients must explicitly opt out of a transfer (i.e. after prompting the user)
@@ -508,11 +517,39 @@ public class RegistrationController {
userAgent);
}
private void checkTotp(final Account account, @Nullable final Integer totp) throws RateLimitExceededException {
rateLimiters.getCheckTotpLimiter().validate(account.getAccountIdentifier());
/// @return the maybe-updated [Account] reference. Callers must use it to avoid stale reads and updates.
private Account checkMfa(final Account account, @Nullable final String webAuthn, @Nullable final Integer totp) throws RateLimitExceededException, MfaFailureException {
if (!accounts.verifyTotp(account, clock.instant(), totp)) {
throw new WebApplicationException(441);
final boolean hasTotp = account.getMfaKeys().values().stream().anyMatch(k -> k instanceof AnnotatedTotpKey);
final boolean hasWebAuthn = account.getMfaKeys().values().stream().anyMatch(k -> k instanceof AnnotatedWebAuthnCredential);
if (!hasTotp && !hasWebAuthn) {
if (totp != null || webAuthn != null) {
throw new MfaFailureException(null, false);
}
return account;
}
if (totp != null || webAuthn != null) {
rateLimiters.getCheckMfaLimiter().validate(account.getAccountIdentifier());
}
final Optional<Account> updatedAccount;
if (hasWebAuthn && webAuthn != null) {
updatedAccount = accounts.verifyWebAuthnAuthentication(account, webAuthn);
} else {
updatedAccount = Optional.empty();
}
final boolean webAuthnVerified = updatedAccount.isPresent();
final boolean totpVerified = hasTotp && totp != null
&& accounts.verifyTotp(account, clock.instant(), totp);
if (webAuthnVerified || totpVerified) {
return updatedAccount.orElse(account);
}
throw new MfaFailureException(accounts.startWebAuthnAuthentication(account).orElse(null), hasTotp);
}
}
@@ -171,7 +171,9 @@ public class SubscriptionController {
buildDonationLevelsConfiguration(subscriptionConfiguration, oneTimeDonationConfiguration, badgeTranslator,
acceptableLanguages),
new BackupConfiguration(backupLevels, subscriptionConfiguration.getbackupFreeTierMediaDuration().toDays()),
new LoginConfiguration(ReceiptLevel.LOGIN.getValue(), loginPurchaseConfiguration.playProductId(),
new LoginConfiguration(ReceiptLevel.LOGIN.getValue(),
loginPurchaseConfiguration.playProductId(),
loginPurchaseConfiguration.playOptionId(),
loginPurchaseConfiguration.appStoreProductId()),
oneTimeDonationConfiguration.sepaMaximumEuros());
}
@@ -549,6 +551,8 @@ public class SubscriptionController {
long level,
@Schema(description = "The play billing productID associated with a Signal Login purchase")
String playProductId,
@Schema(description = "The play billing optionID to use to purchase a Signal Login")
String playOptionId,
@Schema(description = "The App Store productID associated with a Signal Login purchase")
String appStoreProductId) {}
@@ -622,7 +626,7 @@ public class SubscriptionController {
String currency,
@Schema(
description = "The amount paid for the subscription in the currency's smallest unit",
description = "The amount paid for the subscription in the currency's minor unit",
externalDocs = @ExternalDocumentation(description = "Stripe Currencies", url = "https://docs.stripe.com/currencies"))
BigDecimal amount,
@@ -674,7 +678,7 @@ public class SubscriptionController {
subscriptionInformation.active(),
subscriptionInformation.cancelAtPeriodEnd(),
subscriptionInformation.price().currency(),
subscriptionInformation.price().amount(),
BigDecimal.valueOf(subscriptionInformation.price().amount()),
subscriptionInformation.status().getApiValue(),
subscriptionInformation.paymentProvider(),
subscriptionInformation.paymentMethod(),
@@ -752,7 +756,8 @@ public class SubscriptionController {
try {
final SubscriptionManager.ReceiptResult receiptCredential = subscriptionManager.createReceiptCredentials(
subscriberCredentials, request.receiptCredentialRequest(),
r -> SubscriptionsUtil.receiptExpirationWithGracePeriod(subscriptionConfiguration, r));
r -> SubscriptionsUtil.receiptExpirationWithGracePeriod(subscriptionConfiguration, r),
userAgent);
final ReceiptCredentialResponse receiptCredentialResponse = receiptCredential.receiptCredentialResponse();
final CustomerAwareSubscriptionPaymentProcessor.ReceiptItem receipt = receiptCredential.receiptItem();
@@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.controllers;
import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name;
import com.google.common.annotations.VisibleForTesting;
import com.google.i18n.phonenumbers.NumberParseException;
import com.google.i18n.phonenumbers.PhoneNumberUtil;
import com.google.i18n.phonenumbers.Phonenumber;
@@ -73,9 +72,7 @@ import org.whispersystems.textsecuregcm.entities.SubmitVerificationCodeRequest;
import org.whispersystems.textsecuregcm.entities.UpdateVerificationSessionRequest;
import org.whispersystems.textsecuregcm.entities.VerificationCodeRequest;
import org.whispersystems.textsecuregcm.entities.VerificationSessionResponse;
import org.whispersystems.textsecuregcm.experiment.ExperimentEnrollmentManager;
import org.whispersystems.textsecuregcm.filters.RemoteAddressFilter;
import org.whispersystems.textsecuregcm.identity.IdentityType;
import org.whispersystems.textsecuregcm.limits.RateLimiters;
import org.whispersystems.textsecuregcm.mappers.RegistrationServiceSenderExceptionMapper;
import org.whispersystems.textsecuregcm.metrics.CaptchaMetrics;
@@ -132,9 +129,6 @@ public class VerificationController {
private static final String EXISTING_ACCOUNT_PLATFORM = "existingAccountPlatform";
private static final String EXISTING_ACCOUNT_RECENTLY_SEEN_TAG_NAME = "existingAccountRecentlySeen";
@VisibleForTesting
static final String VERIFICATION_CODE_PUSH_NOTIFICATION_EXPERIMENT_NAME = "verificationCodePushNotification";
private final RegistrationServiceClient registrationServiceClient;
private final VerificationSessionManager verificationSessionManager;
private final PushNotificationManager pushNotificationManager;
@@ -146,7 +140,6 @@ public class VerificationController {
private final CarrierDataProvider carrierDataProvider;
private final RegistrationFraudChecker registrationFraudChecker;
private final DynamicConfigurationManager<DynamicConfiguration> dynamicConfigurationManager;
private final ExperimentEnrollmentManager experimentEnrollmentManager;
private final Clock clock;
public VerificationController(final RegistrationServiceClient registrationServiceClient,
@@ -160,7 +153,6 @@ public class VerificationController {
final CarrierDataProvider carrierDataProvider,
final RegistrationFraudChecker registrationFraudChecker,
final DynamicConfigurationManager<DynamicConfiguration> dynamicConfigurationManager,
final ExperimentEnrollmentManager experimentEnrollmentManager,
final Clock clock) {
this.registrationServiceClient = registrationServiceClient;
this.verificationSessionManager = verificationSessionManager;
@@ -173,7 +165,6 @@ public class VerificationController {
this.carrierDataProvider = carrierDataProvider;
this.registrationFraudChecker = registrationFraudChecker;
this.dynamicConfigurationManager = dynamicConfigurationManager;
this.experimentEnrollmentManager = experimentEnrollmentManager;
this.clock = clock;
}
@@ -665,8 +656,6 @@ public class VerificationController {
}
accountsManager.getByE164(registrationServiceSession.number())
.filter(existingAccount ->
experimentEnrollmentManager.isEnrolled(existingAccount.getAccountIdentifier(), VERIFICATION_CODE_PUSH_NOTIFICATION_EXPERIMENT_NAME))
.ifPresent(existingAccount -> {
try {
pushNotificationManager.sendVerificationCodeRequestedNotifications(existingAccount, clock.instant());
@@ -14,6 +14,7 @@ import jakarta.validation.constraints.AssertTrue;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Nullable;
import org.apache.commons.lang3.ArrayUtils;
import org.whispersystems.textsecuregcm.auth.UnidentifiedAccessUtil;
import org.whispersystems.textsecuregcm.storage.DeviceCapability;
import org.whispersystems.textsecuregcm.util.ByteArrayAdapter;
@@ -103,7 +104,7 @@ public class AccountAttributes {
}
public Optional<byte[]> recoveryPassword() {
return Optional.ofNullable(recoveryPassword);
return Optional.ofNullable(recoveryPassword).filter(ArrayUtils::isNotEmpty);
}
@VisibleForTesting
@@ -14,10 +14,12 @@ import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.PositiveOrZero;
import java.util.List;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import jakarta.validation.constraints.PositiveOrZero;
import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.ArrayUtils;
import org.signal.libsignal.protocol.IdentityKey;
import org.whispersystems.textsecuregcm.util.ByteArrayAdapter;
import org.whispersystems.textsecuregcm.util.IdentityKeyAdapter;
@@ -45,18 +47,29 @@ public record RegistrationRequest(@Schema(requiredMode = Schema.RequiredMode.NOT
@Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = """
A base64-encoded receipt credential presentation that allows for redeeming a Signal Login.
Must be provided if `sessionId` and `recoveryPassword` are not provided;
must not be provided if `sessionId` or `recoveryPassword` is provided.
must not be provided if `sessionId` or `recoveryPassword` is provided. Must not be
provided if recovering a previously used account.
""")
@Nullable
byte[] receiptCredentialPresentation,
@Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = """
A TOTP one-time password; required if recovering an account that has TOTP keys.
A TOTP one-time password; required if recovering an account that has TOTP keys. Must
not be provided if `receiptCredentialPresentation` is provided.
""")
@PositiveOrZero
@Nullable
Integer totp,
@Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = """
A JSON-serialized assertion response from a completed authentication ceremony.
See https://www.w3.org/TR/webauthn/#authenticatorassertionresponse.
""")
@Nullable
// There is no documented max size, but 8kiB should be enough
@Size(min = 1, max = 8192)
String webAuthnResponse,
@NotNull
@Valid
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
@@ -142,4 +155,18 @@ public record RegistrationRequest(@Schema(requiredMode = Schema.RequiredMode.NOT
deviceActivationRequest().pniPqLastResortPreKey().isPresent())
.allMatch(present -> present == expectPresence);
}
@VisibleForTesting
@AssertTrue
@Schema(hidden = true)
boolean isMfaAbsentWhenUsingReceipt() {
return ArrayUtils.isEmpty(receiptCredentialPresentation) || (totp == null && webAuthnResponse == null);
}
@VisibleForTesting
@AssertTrue
@Schema(hidden = true)
boolean isAtMostOneMfaPresent() {
return totp == null || webAuthnResponse == null;
}
}
@@ -23,6 +23,7 @@ import java.util.Optional;
import java.util.UUID;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.signal.chat.account.Capabilities;
import org.signal.chat.account.ChangeNumberRequest;
import org.signal.chat.account.ChangeNumberResponse;
@@ -41,6 +42,10 @@ import org.signal.chat.account.DeleteUsernameHashResponse;
import org.signal.chat.account.DeleteUsernameLinkRequest;
import org.signal.chat.account.DeleteUsernameLinkResponse;
import org.signal.chat.account.ExternalServiceCredentials;
import org.signal.chat.account.FinishMfaVerificationRequest;
import org.signal.chat.account.FinishMfaVerificationResponse;
import org.signal.chat.account.FinishWebAuthnRegistrationRequest;
import org.signal.chat.account.FinishWebAuthnRegistrationResponse;
import org.signal.chat.account.GenerateTotpKeyRequest;
import org.signal.chat.account.GenerateTotpKeyResponse;
import org.signal.chat.account.GetAccountDataReportRequest;
@@ -51,27 +56,34 @@ import org.signal.chat.account.GetCapabilitiesRequest;
import org.signal.chat.account.GetCapabilitiesResponse;
import org.signal.chat.account.GetEntitlementsRequest;
import org.signal.chat.account.GetEntitlementsResponse;
import org.signal.chat.account.ListTotpKeysRequest;
import org.signal.chat.account.ListTotpKeysResponse;
import org.signal.chat.account.ListMfaKeysRequest;
import org.signal.chat.account.ListMfaKeysResponse;
import org.signal.chat.account.ListMfaKeysResponse.MfaKeyMetadata.MfaKeyType;
import org.signal.chat.account.StartMfaVerificationResponse.WebAuthnAuthenticationParameters;
import org.signal.chat.account.RegistrationLockFailure;
import org.signal.chat.account.RemoveTotpKeyRequest;
import org.signal.chat.account.RemoveTotpKeyResponse;
import org.signal.chat.account.RemoveMfaKeyRequest;
import org.signal.chat.account.RemoveMfaKeyResponse;
import org.signal.chat.account.ReserveUsernameHashRequest;
import org.signal.chat.account.ReserveUsernameHashResponse;
import org.signal.chat.account.SetDiscoverableByPhoneNumberRequest;
import org.signal.chat.account.SetDiscoverableByPhoneNumberResponse;
import org.signal.chat.account.SetMfaKeyMetadataRequest;
import org.signal.chat.account.SetMfaKeyMetadataResponse;
import org.signal.chat.account.SetRegistrationLockRequest;
import org.signal.chat.account.SetRegistrationLockResponse;
import org.signal.chat.account.SetRegistrationRecoveryPasswordRequest;
import org.signal.chat.account.SetRegistrationRecoveryPasswordResponse;
import org.signal.chat.account.SetTotpKeyMetadataRequest;
import org.signal.chat.account.SetTotpKeyMetadataResponse;
import org.signal.chat.account.SetUsernameLinkRequest;
import org.signal.chat.account.SetUsernameLinkResponse;
import org.signal.chat.account.SetZkCredentialKeyRequest;
import org.signal.chat.account.SetZkCredentialKeyResponse;
import org.signal.chat.account.SimpleAccountsGrpc;
import org.signal.chat.account.StaleDevices;
import org.signal.chat.account.StartMfaVerificationRequest;
import org.signal.chat.account.StartMfaVerificationResponse;
import org.signal.chat.account.StartWebAuthnRegistrationRequest;
import org.signal.chat.account.StartWebAuthnRegistrationResponse;
import org.signal.chat.account.StartWebAuthnRegistrationResponse.WebAuthnCreateParameters;
import org.signal.chat.account.TotpParameters;
import org.signal.chat.account.UsernameNotAvailable;
import org.signal.chat.common.AccountIdentifiers;
@@ -90,6 +102,8 @@ import org.whispersystems.textsecuregcm.auth.SaltedTokenHash;
import org.whispersystems.textsecuregcm.auth.UnverifiedRegistrationSessionException;
import org.whispersystems.textsecuregcm.auth.grpc.AuthenticatedDevice;
import org.whispersystems.textsecuregcm.auth.grpc.AuthenticationUtil;
import org.whispersystems.textsecuregcm.auth.webauthn.AuthenticationCeremonyParameters;
import org.whispersystems.textsecuregcm.auth.webauthn.RegistrationCeremonyParameters;
import org.whispersystems.textsecuregcm.controllers.MessageDeliveryNotAllowedException;
import org.whispersystems.textsecuregcm.controllers.MismatchedDevicesException;
import org.whispersystems.textsecuregcm.controllers.RateLimitExceededException;
@@ -104,10 +118,13 @@ import org.whispersystems.textsecuregcm.limits.RateLimiters;
import org.whispersystems.textsecuregcm.push.MessageTooLargeException;
import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.AccountsManager;
import org.whispersystems.textsecuregcm.storage.AnnotatedMfaKey;
import org.whispersystems.textsecuregcm.storage.AnnotatedTotpKey;
import org.whispersystems.textsecuregcm.storage.AnnotatedWebAuthnCredential;
import org.whispersystems.textsecuregcm.storage.ChangeNumberManager;
import org.whispersystems.textsecuregcm.storage.DeviceCapability;
import org.whispersystems.textsecuregcm.storage.PhoneNumberRecoveryPasswordsManager;
import org.whispersystems.textsecuregcm.storage.TooManyMfaKeysException;
import org.whispersystems.textsecuregcm.storage.TooManyTotpKeysException;
import org.whispersystems.textsecuregcm.storage.TotpKey;
import org.whispersystems.textsecuregcm.storage.UsernameHashNotAvailableException;
@@ -118,7 +135,6 @@ import org.whispersystems.textsecuregcm.util.SystemMapper;
import org.whispersystems.textsecuregcm.util.UUIDUtil;
import org.whispersystems.textsecuregcm.util.UsernameHashZkProofVerifier;
import software.amazon.awssdk.services.dynamodb.model.TransactWriteItem;
import javax.annotation.Nullable;
public class AccountsGrpcService extends SimpleAccountsGrpc.AccountsImplBase {
@@ -131,7 +147,7 @@ public class AccountsGrpcService extends SimpleAccountsGrpc.AccountsImplBase {
private final Clock clock;
private final ChangeNumberManager changeNumberManager;
private static class TotpKeyNotFoundException extends NoStackTraceRuntimeException {
private static class MfaKeyNotFoundException extends NoStackTraceRuntimeException {
}
public AccountsGrpcService(final AccountsManager accountsManager,
@@ -559,6 +575,11 @@ public class AccountsGrpcService extends SimpleAccountsGrpc.AccountsImplBase {
@Override
public GenerateTotpKeyResponse generateTotpKey(final GenerateTotpKeyRequest request) {
try {
final Account account = getAuthenticatedAccount();
if (account.getNumber().isPresent()) {
throw GrpcExceptions.invalidArguments("TOTP keys may not be generated for an account with a number");
}
final TotpKey pendingTotpKey =
accountsManager.generatePendingTotpKey(AuthenticationUtil.requireAuthenticatedDevice().accountIdentifier());
@@ -568,83 +589,196 @@ public class AccountsGrpcService extends SimpleAccountsGrpc.AccountsImplBase {
.setTotpParameters(toGrpcTotpParameters(pendingTotpKey.totpParameters()))
.build())
.build();
} catch (final TooManyTotpKeysException e) {
} catch (final TooManyTotpKeysException _) {
return GenerateTotpKeyResponse.newBuilder()
.setTooManyTotpKeys(FailedPrecondition.getDefaultInstance())
.build();
} catch (final TooManyMfaKeysException _) {
return GenerateTotpKeyResponse.newBuilder()
.setTooManyMfaKeys(FailedPrecondition.getDefaultInstance())
.build();
}
}
@Override
public ConfirmTotpKeyResponse confirmTotpKey(final ConfirmTotpKeyRequest request) {
final Optional<Integer> maybeConfirmedTotpKeyId =
accountsManager.confirmPendingTotpKey(AuthenticationUtil.requireAuthenticatedDevice().accountIdentifier(),
request.getOneTimePassword(),
clock.instant(),
request.getMetadataCiphertext().toByteArray());
try {
final Account account = getAuthenticatedAccount();
if (account.getNumber().isPresent()) {
throw GrpcExceptions.invalidArguments("TOTP keys may not be added to an account with a number");
}
return maybeConfirmedTotpKeyId.map(keyId -> ConfirmTotpKeyResponse.newBuilder()
.setKeyConfirmed(ConfirmTotpKeyResponse.KeyConfirmed.newBuilder()
.setKeyId(keyId)
.build())
.build()).orElseGet(() -> ConfirmTotpKeyResponse.newBuilder()
.setOneTimePasswordNotVerified(FailedPrecondition.getDefaultInstance())
.build());
final Optional<Byte> maybeConfirmedTotpKeyId =
accountsManager.confirmPendingTotpKey(
AuthenticationUtil.requireAuthenticatedDevice().accountIdentifier(),
request.getOneTimePassword(),
clock.instant(),
request.getMetadataCiphertext().toByteArray());
return maybeConfirmedTotpKeyId.map(keyId -> ConfirmTotpKeyResponse.newBuilder()
.setKeyConfirmed(ConfirmTotpKeyResponse.KeyConfirmed.newBuilder()
.setKeyId(keyId)
.build())
.build()).orElseGet(() -> ConfirmTotpKeyResponse.newBuilder()
.setOneTimePasswordNotVerified(FailedPrecondition.getDefaultInstance())
.build());
} catch (TooManyMfaKeysException _) {
return ConfirmTotpKeyResponse.newBuilder()
.setTooManyMfaKeys(FailedPrecondition.getDefaultInstance())
.build();
}
}
@Override
public ListTotpKeysResponse listTotpKeys(final ListTotpKeysRequest request) {
final ListTotpKeysResponse.Builder responseBuilder = ListTotpKeysResponse.newBuilder();
public StartWebAuthnRegistrationResponse startWebAuthnRegistration(final StartWebAuthnRegistrationRequest request) {
getAuthenticatedAccount().getTotpKeys().forEach((keyId, totpKey) -> {
assert totpKey.metadataCiphertext() != null;
final Account account = getAuthenticatedAccount();
if (account.getNumber().isPresent()) {
throw GrpcExceptions.invalidArguments("WebAuthn keys may not be set for an account with a number");
}
responseBuilder.putKeys(keyId, ListTotpKeysResponse.TotpKeyMetadata.newBuilder()
.setMetadataCiphertext(ByteString.copyFrom(totpKey.metadataCiphertext()))
.setTotpParameters(toGrpcTotpParameters(totpKey.totpKey().totpParameters()))
.build());
try {
final RegistrationCeremonyParameters registrationParameters =
accountsManager.startWebAuthnRegistration(AuthenticationUtil.requireAuthenticatedDevice().accountIdentifier());
return StartWebAuthnRegistrationResponse.newBuilder()
.setParams(WebAuthnCreateParameters.newBuilder()
.setUserHandle(ByteString.copyFrom(registrationParameters.userHandle()))
.addAllAllowedAlgorithms(registrationParameters.allowedAlgorithms())
.addAllExcludeCredentialIds(
registrationParameters.excludedCredentialIds().stream().map(ByteString::copyFrom).toList()))
.build();
} catch (TooManyMfaKeysException _) {
return StartWebAuthnRegistrationResponse.newBuilder()
.setTooManyMfaKeys(FailedPrecondition.getDefaultInstance())
.build();
}
}
@Override
public FinishWebAuthnRegistrationResponse finishWebAuthnRegistration(final FinishWebAuthnRegistrationRequest request) {
final Account account = getAuthenticatedAccount();
if (account.getNumber().isPresent()) {
throw GrpcExceptions.invalidArguments("WebAuthn keys may not be set for an account with a number");
}
try {
final Optional<Byte> maybeKeyId = accountsManager.finishWebAuthnRegistration(
AuthenticationUtil.requireAuthenticatedDevice().accountIdentifier(),
request.getAttestationObject().toByteArray(),
request.getCollectedClientDataJson(),
request.getMetadataCiphertext().toByteArray());
return maybeKeyId.map(
keyId -> FinishWebAuthnRegistrationResponse.newBuilder()
.setKeyConfirmed(FinishWebAuthnRegistrationResponse.KeyConfirmed.newBuilder().setKeyId(keyId)))
.orElseGet(() -> FinishWebAuthnRegistrationResponse.newBuilder().setKeyNotConfirmed(FailedPrecondition.getDefaultInstance()))
.build();
} catch (TooManyMfaKeysException _) {
return FinishWebAuthnRegistrationResponse.newBuilder()
.setTooManyMfaKeys(FailedPrecondition.getDefaultInstance())
.build();
}
}
@Override
public ListMfaKeysResponse listMfaKeys(final ListMfaKeysRequest request) {
final ListMfaKeysResponse.Builder responseBuilder = ListMfaKeysResponse.newBuilder();
getAuthenticatedAccount().getMfaKeys().forEach((keyId, mfaKey) -> {
assert mfaKey.metadataCiphertext() != null;
responseBuilder.putKeys(
keyId,
ListMfaKeysResponse.MfaKeyMetadata.newBuilder()
.setMetadataCiphertext(ByteString.copyFrom(mfaKey.metadataCiphertext()))
.setType(switch (mfaKey) {
case AnnotatedTotpKey _ -> MfaKeyType.MFA_KEY_TYPE_TOTP;
case AnnotatedWebAuthnCredential _ -> MfaKeyType.MFA_KEY_TYPE_WEBAUTHN;
}).build());
});
return responseBuilder.build();
}
@Override
public SetTotpKeyMetadataResponse setTotpKeyMetadata(final SetTotpKeyMetadataRequest request) {
public SetMfaKeyMetadataResponse setMfaKeyMetadata(final SetMfaKeyMetadataRequest request) {
final byte keyId = validateMfaKeyId(request.getKeyId());
try {
accountsManager.update(AuthenticationUtil.requireAuthenticatedDevice().accountIdentifier(), account -> {
final Map<Integer, AnnotatedTotpKey> totpKeys = new HashMap<>(account.getTotpKeys());
@Nullable final AnnotatedTotpKey existingKey = totpKeys.get(request.getKeyId());
final Map<Byte, AnnotatedMfaKey> mfaKeys = new HashMap<>(account.getMfaKeys());
@Nullable final AnnotatedMfaKey existingKey = mfaKeys.get(keyId);
if (existingKey == null) {
throw new TotpKeyNotFoundException();
throw new MfaKeyNotFoundException();
}
totpKeys.put(request.getKeyId(),
new AnnotatedTotpKey(existingKey.totpKey(), request.getMetadataCiphertext().toByteArray()));
mfaKeys.put(keyId, existingKey.withMetadataCiphertext(request.getMetadataCiphertext().toByteArray()));
account.setTotpKeys(totpKeys);
account.setMfaKeys(mfaKeys);
});
return SetTotpKeyMetadataResponse.newBuilder()
.setMetadataUpdated(SetTotpKeyMetadataResponse.MetadataUpdated.getDefaultInstance())
return SetMfaKeyMetadataResponse.newBuilder()
.setSuccess(SetMfaKeyMetadataResponse.MetadataUpdated.getDefaultInstance())
.build();
} catch (final TotpKeyNotFoundException _) {
return SetTotpKeyMetadataResponse.newBuilder()
} catch (final MfaKeyNotFoundException _) {
return SetMfaKeyMetadataResponse.newBuilder()
.setKeyNotFound(NotFound.getDefaultInstance())
.build();
}
}
@Override
public RemoveTotpKeyResponse removeTotpKey(final RemoveTotpKeyRequest request) {
accountsManager.update(AuthenticationUtil.requireAuthenticatedDevice().accountIdentifier(), account -> {
final Map<Integer, AnnotatedTotpKey> totpKeys = new HashMap<>(account.getTotpKeys());
totpKeys.remove(request.getKeyId());
public RemoveMfaKeyResponse removeMfaKey(final RemoveMfaKeyRequest request) {
final byte keyId = validateMfaKeyId(request.getKeyId());
account.setTotpKeys(totpKeys);
accountsManager.update(AuthenticationUtil.requireAuthenticatedDevice().accountIdentifier(), account -> {
final Map<Byte, AnnotatedMfaKey> mfaKeys = new HashMap<>(account.getMfaKeys());
mfaKeys.remove(keyId);
account.setMfaKeys(mfaKeys);
});
return RemoveTotpKeyResponse.getDefaultInstance();
return RemoveMfaKeyResponse.getDefaultInstance();
}
@Override
public StartMfaVerificationResponse startMfaVerification(final StartMfaVerificationRequest request) {
final Account account = getAuthenticatedAccount();
final StartMfaVerificationResponse.Builder builder = StartMfaVerificationResponse.newBuilder()
.setHasTotp(account.getMfaKeys().values().stream().anyMatch(AnnotatedTotpKey.class::isInstance));
accountsManager.startWebAuthnAuthentication(account)
.map(AccountsGrpcService::toGrpcWebAuthnAuthenticationParameters)
.ifPresent(builder::setWebauthnAuthenticationParameters);
return builder.build();
}
@Override
public FinishMfaVerificationResponse finishMfaVerification(final FinishMfaVerificationRequest request) throws RateLimitExceededException {
rateLimiters.getCheckMfaLimiter().validate(AuthenticationUtil.requireAuthenticatedDevice().accountIdentifier());
final Account account = getAuthenticatedAccount();
final boolean success = switch (request.getCredentialCase()) {
case TOTP_PASSWORD -> accountsManager.verifyTotp(account, clock.instant(), request.getTotpPassword());
case WEBAUTHN_AUTHENTICATION_RESPONSE_JSON ->
accountsManager.verifyWebAuthnAuthentication(account, request.getWebauthnAuthenticationResponseJson()).isPresent();
case CREDENTIAL_NOT_SET -> false;
};
return FinishMfaVerificationResponse.newBuilder().setSuccess(success).build();
}
private byte validateMfaKeyId(final int keyId) {
if (keyId < 0 || keyId > Account.MAX_MFA_KEY_ID) {
throw GrpcExceptions.invalidArguments("MFA key ID out of range");
}
return (byte) keyId;
}
private static TotpParameters toGrpcTotpParameters(final org.whispersystems.textsecuregcm.storage.TotpParameters totpParameters) {
@@ -655,6 +789,14 @@ public class AccountsGrpcService extends SimpleAccountsGrpc.AccountsImplBase {
.build();
}
private static WebAuthnAuthenticationParameters toGrpcWebAuthnAuthenticationParameters(final AuthenticationCeremonyParameters parameters) {
return WebAuthnAuthenticationParameters.newBuilder()
.setChallenge(ByteString.copyFrom(parameters.challenge()))
.setTimeoutSeconds((int) parameters.timeout().toSeconds())
.addAllAllowedCredentialIds(parameters.allowedCredentialIds().stream().map(ByteString::copyFrom).toList())
.build();
}
private static AccountIdentifiers buildAccountIdentifiers(final Account account) {
final AccountIdentifiers.Builder accountIdentifiersBuilder = AccountIdentifiers.newBuilder()
.addServiceIdentifiers(GrpcServiceIdentifierUtil.toGrpcServiceIdentifier(new AciServiceIdentifier(account.getAccountIdentifier())));
@@ -16,6 +16,7 @@ import java.util.Optional;
import java.util.stream.Collectors;
import org.signal.chat.backup.GetBackupAuthCredentialsRequest;
import org.signal.chat.backup.GetBackupAuthCredentialsResponse;
import org.signal.chat.backup.GetBackupIdLimitsResponse;
import org.signal.chat.backup.RedeemReceiptRequest;
import org.signal.chat.backup.RedeemReceiptResponse;
import org.signal.chat.backup.SetBackupIdRequest;
@@ -138,6 +139,16 @@ public class BackupsGrpcService extends SimpleBackupsGrpc.BackupsImplBase {
}
}
@Override
public GetBackupIdLimitsResponse getBackupIdLimits(final Empty request) {
final Account account = authenticatedAccount();
final BackupAuthManager.BackupIdRotationLimit limit = backupAuthManager.checkBackupIdRotationLimit(account);
return GetBackupIdLimitsResponse.newBuilder()
.setHasPermitsRemaining(limit.hasPermitsRemaining())
.setRetryAfterSeconds(limit.nextPermitAvailable().getSeconds())
.build();
}
@Override
public Throwable mapException(final Throwable throwable) {
return switch (throwable) {
@@ -1,14 +1,18 @@
package org.whispersystems.textsecuregcm.grpc;
import java.io.IOException;
import com.google.protobuf.Empty;
import org.signal.chat.challenge.AnswerChallengeRequest;
import org.signal.chat.challenge.AnswerChallengeResponse;
import org.signal.chat.challenge.RequestPushChallengeRequest;
import org.signal.chat.challenge.RequestPushChallengeResponse;
import org.signal.chat.challenge.SimpleChallengeGrpc;
import org.whispersystems.textsecuregcm.auth.grpc.AuthenticatedDevice;
import org.signal.chat.errors.FailedPrecondition;
import org.whispersystems.textsecuregcm.auth.grpc.AuthenticationUtil;
import org.whispersystems.textsecuregcm.captcha.InvalidCaptchaArgumentException;
import org.whispersystems.textsecuregcm.controllers.RateLimitExceededException;
import org.whispersystems.textsecuregcm.limits.RateLimitChallengeManager;
import org.whispersystems.textsecuregcm.push.NotPushRegisteredException;
import org.whispersystems.textsecuregcm.spam.ChallengeConstraintChecker;
import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.AccountsManager;
@@ -28,19 +32,21 @@ public class ChallengeGrpcService extends SimpleChallengeGrpc.ChallengeImplBase
}
@Override
public AnswerChallengeResponse handleChallengeResponse(final AnswerChallengeRequest request)
public AnswerChallengeResponse answerChallenge(final AnswerChallengeRequest request)
throws RateLimitExceededException, IOException {
final AuthenticatedDevice authenticatedDevice = AuthenticationUtil.requireAuthenticatedDevice();
final Account account = accountsManager.getByAccountIdentifier(authenticatedDevice.accountIdentifier())
.orElseThrow(() -> GrpcExceptions.invalidCredentials("invalid credentials"));
final ChallengeConstraintChecker.ChallengeConstraints constraints = challengeConstraintChecker.challengeConstraintsGrpc(
account);
final Account account = requireAuthenticatedAccount();
final ChallengeConstraintChecker.ChallengeConstraints constraints =
challengeConstraintChecker.challengeConstraintsGrpc(account);
final boolean success = switch (request.getRequestCase()) {
case PUSH -> constraints.pushPermitted() && rateLimitChallengeManager.answerPushChallenge(account,
request.getPush().getChallenge());
case PUSH -> {
if (!constraints.pushPermitted()) {
throw GrpcExceptions.rateLimitExceeded(null);
}
yield rateLimitChallengeManager.answerPushChallenge(account, request.getPush().getChallenge());
}
case CAPTCHA -> {
try {
yield rateLimitChallengeManager.answerCaptchaChallenge(
@@ -49,7 +55,7 @@ public class ChallengeGrpcService extends SimpleChallengeGrpc.ChallengeImplBase
RequestAttributesUtil.getRemoteAddress().getHostAddress(),
RequestAttributesUtil.getUserAgent().orElse(null),
constraints.captchaScoreThreshold());
} catch (InvalidCaptchaArgumentException e) {
} catch (final InvalidCaptchaArgumentException e) {
throw GrpcExceptions.invalidArguments(e.getMessage());
}
}
@@ -60,4 +66,32 @@ public class ChallengeGrpcService extends SimpleChallengeGrpc.ChallengeImplBase
.setSuccess(success)
.build();
}
@Override
public RequestPushChallengeResponse requestPushChallenge(final RequestPushChallengeRequest request) {
final Account account = requireAuthenticatedAccount();
final ChallengeConstraintChecker.ChallengeConstraints constraints =
challengeConstraintChecker.challengeConstraintsGrpc(account);
if (!constraints.pushPermitted()) {
throw GrpcExceptions.rateLimitExceeded(null);
}
try {
rateLimitChallengeManager.sendPushChallenge(account);
} catch (NotPushRegisteredException _) {
return RequestPushChallengeResponse.newBuilder()
.setNoPushToken(FailedPrecondition.getDefaultInstance())
.build();
}
return RequestPushChallengeResponse.newBuilder()
.setSentPushChallenge(Empty.getDefaultInstance())
.build();
}
private Account requireAuthenticatedAccount() {
return accountsManager.getByAccountIdentifier(AuthenticationUtil.requireAuthenticatedDevice().accountIdentifier())
.orElseThrow(() -> GrpcExceptions.invalidCredentials("invalid credentials"));
}
}
@@ -12,9 +12,10 @@ import java.time.temporal.ChronoUnit;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import org.signal.chat.common.ZkCredential;
import org.signal.chat.credentials.ExternalServiceType;
import org.signal.chat.credentials.GetCreateCallLinkCredentialsRequest;
import org.signal.chat.credentials.GetCreateCallLinkCredentialsResponse;
import org.signal.chat.credentials.GetCreateCallLinkCredentialRequest;
import org.signal.chat.credentials.GetCreateCallLinkCredentialResponse;
import org.signal.chat.credentials.GetDeliveryCertificateRequest;
import org.signal.chat.credentials.GetDeliveryCertificateResponse;
import org.signal.chat.credentials.GetExternalServiceCredentialsRequest;
@@ -138,14 +139,14 @@ public class CredentialsGrpcService extends SimpleCredentialsGrpc.CredentialsImp
.orElseThrow(
() -> new IllegalStateException("account without PNI must have auth credential salt")),
redemption));
responseBuilder.addGroupCredentials(GetGroupCredentialsResponse.CredentialAndRedemptionTime.newBuilder()
.setRedemptionTimeSeconds(redemption.getEpochSecond())
responseBuilder.addGroupCredentials(ZkCredential.newBuilder()
.setRedemptionTime(redemption.getEpochSecond())
.setCredential(ByteString.copyFrom(
authCredentialWithPniResponse.serialize()))
.build());
responseBuilder.addCallLinkAuthCredentials(GetGroupCredentialsResponse.CredentialAndRedemptionTime.newBuilder()
.setRedemptionTimeSeconds(redemption.getEpochSecond())
responseBuilder.addCallLinkAuthCredentials(ZkCredential.newBuilder()
.setRedemptionTime(redemption.getEpochSecond())
.setCredential(ByteString.copyFrom(
CallLinkAuthCredentialResponse.issueCredential(aci, redemption, serverSecretParams).serialize()))
.build());
@@ -155,7 +156,7 @@ public class CredentialsGrpcService extends SimpleCredentialsGrpc.CredentialsImp
}
@Override
public GetCreateCallLinkCredentialsResponse getCreateCallLinkCredentials(final GetCreateCallLinkCredentialsRequest request)
public GetCreateCallLinkCredentialResponse getCreateCallLinkCredential(final GetCreateCallLinkCredentialRequest request)
throws RateLimitExceededException {
final UUID accountIdentifier = AuthenticationUtil.requireAuthenticatedDevice().accountIdentifier();
@@ -167,8 +168,7 @@ public class CredentialsGrpcService extends SimpleCredentialsGrpc.CredentialsImp
final CreateCallLinkCredentialRequest createCallLinkCredentialRequest =
new CreateCallLinkCredentialRequest(request.getCredentialRequest().toByteArray());
return GetCreateCallLinkCredentialsResponse.newBuilder()
.setRedemptionTimeSeconds(truncatedDayTimestamp.getEpochSecond())
return GetCreateCallLinkCredentialResponse.newBuilder()
.setCredential(ByteString.copyFrom(createCallLinkCredentialRequest.issueCredential(
new ServiceId.Aci(accountIdentifier),
truncatedDayTimestamp,
@@ -12,12 +12,13 @@ import io.grpc.ServerCallHandler;
import io.grpc.ServerInterceptor;
import io.grpc.Status;
import io.grpc.StatusRuntimeException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.util.ExceptionUtils;
import org.whispersystems.textsecuregcm.util.logging.ImpossibleEvents;
import java.io.IOException;
import java.io.UncheckedIOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.storage.AccountNotFoundException;
import org.whispersystems.textsecuregcm.util.ExceptionUtils;
import org.whispersystems.textsecuregcm.util.logging.ImpossibleEvents;
/**
* This interceptor observes responses from the service and if the response status is {@link Status#UNKNOWN}
@@ -52,6 +53,7 @@ public class ErrorMappingInterceptor implements ServerInterceptor {
final StatusRuntimeException statusException = switch (cause) {
case ConvertibleToGrpcStatus e -> e.toStatusRuntimeException();
case AccountNotFoundException _ -> GrpcExceptions.invalidCredentials("invalid credentials");
case UncheckedIOException e -> {
log.warn("RPC {} encountered UncheckedIOException", call.getMethodDescriptor().getFullMethodName(), e.getCause());
yield GrpcExceptions.unavailable();
@@ -62,7 +64,7 @@ public class ErrorMappingInterceptor implements ServerInterceptor {
}
case IllegalStateException e -> {
ImpossibleEvents.logImpossible(log, e.getMessage(), e);
yield GrpcExceptions.unavailable(e.getMessage());
yield GrpcExceptions.unavailable();
}
case null -> {
log.error("RPC {} finished with status UNKNOWN: {}",
@@ -72,7 +74,7 @@ public class ErrorMappingInterceptor implements ServerInterceptor {
default -> {
log.error("RPC {} finished with status UNKNOWN",
call.getMethodDescriptor().getFullMethodName(), status.getCause());
yield GrpcExceptions.unavailable(status.getCause().getMessage());
yield GrpcExceptions.unavailable();
}
};
super.close(statusException.getStatus(), statusException.getTrailers());
@@ -0,0 +1,26 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.grpc;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.rpc.ErrorInfo;
import java.io.UncheckedIOException;
import java.util.Optional;
public class ErrorUtil {
public static Optional<ErrorInfo> errorInfo(final com.google.rpc.Status statusProto) {
return statusProto.getDetailsList().stream()
.filter(any -> any.is(ErrorInfo.class))
.map(errorInfo -> {
try {
return errorInfo.unpack(ErrorInfo.class);
} catch (final InvalidProtocolBufferException e) {
throw new UncheckedIOException(e);
}
})
.findFirst();
}
}
@@ -6,22 +6,19 @@
package org.whispersystems.textsecuregcm.grpc;
import com.google.common.annotations.VisibleForTesting;
import io.grpc.Status;
import org.signal.keytransparency.client.AciMonitorRequest;
import org.signal.keytransparency.client.ConsistencyParameters;
import com.google.protobuf.Any;
import com.google.rpc.ErrorInfo;
import com.google.rpc.Status;
import io.grpc.StatusRuntimeException;
import io.grpc.protobuf.StatusProto;
import org.signal.keytransparency.client.DistinguishedRequest;
import org.signal.keytransparency.client.DistinguishedResponse;
import org.signal.keytransparency.client.E164MonitorRequest;
import org.signal.keytransparency.client.E164SearchRequest;
import org.signal.keytransparency.client.MonitorRequest;
import org.signal.keytransparency.client.MonitorResponse;
import org.signal.keytransparency.client.MonitorResponseV2;
import org.signal.keytransparency.client.SearchRequest;
import org.signal.keytransparency.client.SearchResponse;
import org.signal.keytransparency.client.SearchResponseV2;
import org.signal.keytransparency.client.SimpleKeyTransparencyQueryServiceGrpc;
import org.signal.keytransparency.client.UsernameHashMonitorRequest;
import org.whispersystems.textsecuregcm.controllers.AccountController;
import org.whispersystems.textsecuregcm.controllers.RateLimitExceededException;
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
import org.whispersystems.textsecuregcm.keytransparency.KeyTransparencyServiceClient;
@@ -88,4 +85,28 @@ public class KeyTransparencyGrpcService extends
return request;
}
@Override
public Throwable mapException(final Throwable throwable) {
// Reconstruct the exception so that we can override the backing service domain with chat's own domain.
if (throwable instanceof StatusRuntimeException s) {
final ErrorInfo.Builder errInfoBuilder = ErrorInfo.newBuilder()
.setDomain(GrpcExceptions.DOMAIN);
final Status statusProto = StatusProto.fromStatusAndTrailers(s.getStatus(), s.getTrailers());
ErrorUtil.errorInfo(statusProto)
.map(ErrorInfo::getReason)
.ifPresent(errInfoBuilder::setReason);
return StatusProto.toStatusRuntimeException(Status.newBuilder()
// See https://github.com/signalapp/key-transparency-server/blob/30b7a2a40604fbe04545d47f26e4c5a35f5d3161/cmd/kt-server/errors.go#L32
// for a list of error codes that the key transparency service can generate.
.setCode(statusProto.getCode())
.setMessage(statusProto.getMessage())
.addDetails(Any.pack(errInfoBuilder.build()))
.build());
}
return throwable;
}
}
@@ -19,7 +19,6 @@ import org.whispersystems.textsecuregcm.auth.DisconnectionRequestListener;
import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager;
import org.whispersystems.textsecuregcm.entities.MessageProtos;
import org.whispersystems.textsecuregcm.identity.IdentityType;
import org.whispersystems.textsecuregcm.limits.MessageDeliveryLoopMonitor;
import org.whispersystems.textsecuregcm.metrics.MessageMetrics;
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
import org.whispersystems.textsecuregcm.push.PushNotificationManager;
@@ -69,7 +68,6 @@ public class MessageDispatcher {
private final PushNotificationManager pushNotificationManager;
private final PushNotificationScheduler pushNotificationScheduler;
private final ClientReleaseManager clientReleaseManager;
private final MessageDeliveryLoopMonitor messageDeliveryLoopMonitor;
private final DisconnectionRequestManager disconnectionRequestManager;
public MessageDispatcher(final ReceiptSender receiptSender,
@@ -77,7 +75,6 @@ public class MessageDispatcher {
final MessageMetrics messageMetrics,
final PushNotificationManager pushNotificationManager,
final PushNotificationScheduler pushNotificationScheduler,
final MessageDeliveryLoopMonitor messageDeliveryLoopMonitor,
final DisconnectionRequestManager disconnectionRequestManager,
final ClientReleaseManager clientReleaseManager) {
this.receiptSender = receiptSender;
@@ -85,7 +82,6 @@ public class MessageDispatcher {
this.messageMetrics = messageMetrics;
this.pushNotificationManager = pushNotificationManager;
this.pushNotificationScheduler = pushNotificationScheduler;
this.messageDeliveryLoopMonitor = messageDeliveryLoopMonitor;
this.disconnectionRequestManager = disconnectionRequestManager;
this.clientReleaseManager = clientReleaseManager;
}
@@ -140,12 +136,6 @@ public class MessageDispatcher {
.name(SEND_MESSAGES_FLUX_NAME)
.tap(Micrometer.metrics(Metrics.globalRegistry))
.limitRate(MESSAGE_PUBLISHER_LIMIT_RATE)
// Check the first message we send for message-delivery loops
.switchOnFirst((firstEntry, flux) -> {
recordDeliveryAttempt(account, device, userAgentString, firstEntry);
return flux;
})
.flatMapSequential(entry -> switch (entry) {
case MessageStreamEntry.Envelope(final MessageProtos.Envelope envelope) -> {
final UUID serverGuid = UUIDUtil.fromByteString(envelope.getServerGuid());
@@ -237,17 +227,6 @@ public class MessageDispatcher {
});
}
private void recordDeliveryAttempt(final Account account, final Device device, final String userAgent,
final Signal<? extends MessageStreamEntry> firstEntry) {
if (firstEntry.get() instanceof MessageStreamEntry.Envelope(final MessageProtos.Envelope message)) {
messageDeliveryLoopMonitor.recordDeliveryAttempt(account.getAccountIdentifier(),
device.getId(),
UUIDUtil.fromByteString(message.getServerGuid()),
userAgent,
MessageMetrics.GRPC_CHANNEL);
}
}
private void maybeSendDeliveryReceipt(
final Device device,
final PendingAcknowledgementTracker.UnacknowledgedEnvelope unacknowledgedEnvelope) {
@@ -20,6 +20,8 @@ import org.signal.chat.errors.NotFound;
import org.signal.chat.messages.GetMessagesRequest;
import org.signal.chat.messages.GetMessagesResponse;
import org.signal.chat.messages.IndividualRecipientMessageBundle;
import org.signal.chat.messages.ReportMessageRequest;
import org.signal.chat.messages.ReportMessageResponse;
import org.signal.chat.messages.SendAuthenticatedSenderMessageRequest;
import org.signal.chat.messages.SendMessageAuthenticatedSenderResponse;
import org.signal.chat.messages.SendMessageType;
@@ -44,6 +46,9 @@ import org.whispersystems.textsecuregcm.spam.SpamChecker;
import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.AccountsManager;
import org.whispersystems.textsecuregcm.storage.Device;
import org.whispersystems.textsecuregcm.storage.PhoneNumberIdentifiers;
import org.whispersystems.textsecuregcm.storage.ReportMessageHelper;
import org.whispersystems.textsecuregcm.storage.ReportMessageManager;
import org.whispersystems.textsecuregcm.util.UUIDUtil;
import reactor.adapter.JdkFlowAdapter;
import reactor.core.publisher.Flux;
@@ -52,6 +57,8 @@ import javax.annotation.Nullable;
public class MessagesGrpcService extends SimpleMessagesGrpc.MessagesImplBase {
private final AccountsManager accountsManager;
private final ReportMessageManager reportMessageManager;
private final PhoneNumberIdentifiers phoneNumberIdentifiers;
private final RateLimiters rateLimiters;
private final MessageSender messageSender;
private final CardinalityEstimator messageByteLimitEstimator;
@@ -63,6 +70,8 @@ public class MessagesGrpcService extends SimpleMessagesGrpc.MessagesImplBase {
SendMessageAuthenticatedSenderResponse.newBuilder().setSuccess(Empty.getDefaultInstance()).build();
public MessagesGrpcService(final AccountsManager accountsManager,
final ReportMessageManager reportMessageManager,
final PhoneNumberIdentifiers phoneNumberIdentifiers,
final RateLimiters rateLimiters,
final MessageSender messageSender,
final CardinalityEstimator messageByteLimitEstimator,
@@ -71,6 +80,8 @@ public class MessagesGrpcService extends SimpleMessagesGrpc.MessagesImplBase {
final Clock clock) {
this.accountsManager = accountsManager;
this.reportMessageManager = reportMessageManager;
this.phoneNumberIdentifiers = phoneNumberIdentifiers;
this.rateLimiters = rateLimiters;
this.messageSender = messageSender;
this.messageByteLimitEstimator = messageByteLimitEstimator;
@@ -261,4 +272,22 @@ public class MessagesGrpcService extends SimpleMessagesGrpc.MessagesImplBase {
throw GrpcExceptions.invalidArguments("unrecognized envelope type");
};
}
@Override
public ReportMessageResponse reportMessage(final ReportMessageRequest request) {
final ServiceIdentifier sourceServiceIdentifier =
GrpcServiceIdentifierUtil.fromGrpcServiceIdentifier(request.getSourceServiceIdentifier());
ReportMessageHelper.reportMessage(
sourceServiceIdentifier,
new AciServiceIdentifier(AuthenticationUtil.requireAuthenticatedDevice().accountIdentifier()),
UUIDUtil.fromByteString(request.getMessageGuid()),
request.getReportSpamToken().isEmpty() ? null : request.getReportSpamToken().toByteArray(),
RequestAttributesUtil.getUserAgent().orElse(null),
accountsManager,
phoneNumberIdentifiers,
reportMessageManager);
return ReportMessageResponse.getDefaultInstance();
}
}
@@ -127,7 +127,7 @@ public class MetricServerInterceptor implements ServerInterceptor {
@Override
public void close(final Status status, final Metadata responseHeaders) {
if (!status.isOk()) {
reason = errorInfo(StatusProto.fromStatusAndTrailers(status, responseHeaders))
reason = ErrorUtil.errorInfo(StatusProto.fromStatusAndTrailers(status, responseHeaders))
.map(ErrorInfo::getReason)
.orElse(DEFAULT_ERROR_REASON);
}
@@ -232,16 +232,4 @@ public class MetricServerInterceptor implements ServerInterceptor {
}
}
private static Optional<ErrorInfo> errorInfo(final com.google.rpc.Status statusProto) {
return statusProto.getDetailsList().stream()
.filter(any -> any.is(ErrorInfo.class))
.map(errorInfo -> {
try {
return errorInfo.unpack(ErrorInfo.class);
} catch (final InvalidProtocolBufferException e) {
throw new UncheckedIOException(e);
}
})
.findFirst();
}
}
@@ -16,7 +16,7 @@ import org.whispersystems.textsecuregcm.subscriptions.SubscriptionCurrencyUtil;
public class OneTimeDonationUtil {
private static final String EURO_CURRENCY_CODE = "EUR";
public static final String EURO_CURRENCY_CODE = "EUR";
private static final Logger LOGGER = LoggerFactory.getLogger(OneTimeDonationUtil.class);
@@ -51,7 +51,7 @@ public class OneTimeDonationUtil {
public static OneTimeDonationRequestValidationResult validateOneTimeDonationRequest(
final String currency,
final BigDecimal amount,
final long amount,
final long level,
final PaymentMethod paymentMethod,
final OneTimeDonationConfiguration oneTimeDonationConfiguration,
@@ -69,21 +69,17 @@ public class OneTimeDonationUtil {
return new OneTimeDonationRequestValidationResult.UnsupportedCurrency();
}
final BigDecimal minCurrencyAmountMajorUnits = oneTimeDonationConfiguration.currencies()
.get(currency.toLowerCase(Locale.ROOT)).minimum();
final BigDecimal minCurrencyAmountMinorUnits = SubscriptionCurrencyUtil.convertConfiguredAmountToApiAmount(
currency,
minCurrencyAmountMajorUnits);
if (minCurrencyAmountMinorUnits.compareTo(amount) > 0) {
return new OneTimeDonationRequestValidationResult.AmountBelowMinimum(minCurrencyAmountMajorUnits);
final BigDecimal minCurrencyAmount =
oneTimeDonationConfiguration.currencies().get(currency.toLowerCase(Locale.ROOT)).minimum();
if (SubscriptionCurrencyUtil.convertPrimaryToMinorUnits(currency, minCurrencyAmount) > amount) {
return new OneTimeDonationRequestValidationResult.AmountBelowMinimum(minCurrencyAmount);
}
if (paymentMethod == PaymentMethod.SEPA_DEBIT &&
amount.compareTo(SubscriptionCurrencyUtil.convertConfiguredAmountToApiAmount(
EURO_CURRENCY_CODE,
oneTimeDonationConfiguration.sepaMaximumEuros())) > 0) {
return new OneTimeDonationRequestValidationResult.AmountAboveSepaLimit(
oneTimeDonationConfiguration.sepaMaximumEuros());
if (paymentMethod == PaymentMethod.SEPA_DEBIT) {
final BigDecimal sepaMaximumEuros = oneTimeDonationConfiguration.sepaMaximumEuros();
if (amount > SubscriptionCurrencyUtil.convertPrimaryToMinorUnits(EURO_CURRENCY_CODE, sepaMaximumEuros)) {
return new OneTimeDonationRequestValidationResult.AmountAboveSepaLimit(sepaMaximumEuros);
}
}
return new OneTimeDonationRequestValidationResult.Success();
}
@@ -8,17 +8,16 @@ import static org.whispersystems.textsecuregcm.grpc.SubscriptionsUtil.getClientP
import static org.whispersystems.textsecuregcm.grpc.SubscriptionsUtil.toChargeFailure;
import com.google.protobuf.ByteString;
import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Tag;
import io.micrometer.core.instrument.Tags;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.Clock;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Tag;
import io.micrometer.core.instrument.Tags;
import org.signal.chat.errors.FailedPrecondition;
import org.signal.chat.errors.FailedZkAuthentication;
import org.signal.chat.errors.NotFound;
@@ -32,8 +31,8 @@ import org.signal.chat.purchase.CreateBoostRequest;
import org.signal.chat.purchase.CreateBoostResponse;
import org.signal.chat.purchase.CreatePayPalBoostRequest;
import org.signal.chat.purchase.CreatePayPalBoostResponse;
import org.signal.chat.purchase.SimpleOneTimeDonationsGrpc;
import org.signal.chat.purchase.PaymentRequired;
import org.signal.chat.purchase.SimpleOneTimeDonationsGrpc;
import org.signal.libsignal.zkgroup.InvalidInputException;
import org.signal.libsignal.zkgroup.VerificationFailedException;
import org.signal.libsignal.zkgroup.donation.DonationPermit;
@@ -54,6 +53,7 @@ import org.whispersystems.textsecuregcm.subscriptions.PaymentDetails;
import org.whispersystems.textsecuregcm.subscriptions.PaymentProvider;
import org.whispersystems.textsecuregcm.subscriptions.PaymentStatus;
import org.whispersystems.textsecuregcm.subscriptions.StripeManager;
import org.whispersystems.textsecuregcm.subscriptions.SubscriptionCurrencyUtil;
import org.whispersystems.textsecuregcm.subscriptions.SubscriptionInvalidAmountException;
import org.whispersystems.textsecuregcm.subscriptions.SubscriptionProcessorException;
@@ -126,7 +126,7 @@ public class OneTimeDonationsGrpcService extends SimpleOneTimeDonationsGrpc.OneT
final OneTimeDonationUtil.OneTimeDonationRequestValidationResult validationResult =
OneTimeDonationUtil.validateOneTimeDonationRequest(
request.getCurrency(),
BigDecimal.valueOf(request.getAmount()),
request.getAmount(),
request.getLevel(),
paymentMethod,
oneTimeDonationConfiguration,
@@ -142,11 +142,15 @@ public class OneTimeDonationsGrpcService extends SimpleOneTimeDonationsGrpc.OneT
case final OneTimeDonationUtil.OneTimeDonationRequestValidationResult.AmountBelowMinimum r ->
CreateBoostResponse.newBuilder()
.setAmountBelowMinimum(AmountBelowMinimumError.newBuilder()
.setMinimum(r.minimum().toString()).build()).build();
.setMinimum(SubscriptionCurrencyUtil.convertPrimaryToMinorUnits(request.getCurrency(),
r.minimum()))
.build()).build();
case final OneTimeDonationUtil.OneTimeDonationRequestValidationResult.AmountAboveSepaLimit r ->
CreateBoostResponse.newBuilder()
.setAmountAboveSepaLimit(AmountAboveSepaLimitError.newBuilder()
.setMaximum(r.maximum().toString()).build()).build();
.setMaximum(SubscriptionCurrencyUtil.convertPrimaryToMinorUnits(
OneTimeDonationUtil.EURO_CURRENCY_CODE, r.maximum()))
.build()).build();
case OneTimeDonationUtil.OneTimeDonationRequestValidationResult.Success _ -> {
try {
final com.stripe.model.PaymentIntent paymentIntent = stripeManager.createPaymentIntent(
@@ -169,7 +173,7 @@ public class OneTimeDonationsGrpcService extends SimpleOneTimeDonationsGrpc.OneT
final OneTimeDonationUtil.OneTimeDonationRequestValidationResult validationResult =
OneTimeDonationUtil.validateOneTimeDonationRequest(
request.getCurrency(),
BigDecimal.valueOf(request.getAmount()),
request.getAmount(),
request.getLevel(),
org.whispersystems.textsecuregcm.subscriptions.PaymentMethod.PAYPAL,
oneTimeDonationConfiguration,
@@ -185,7 +189,9 @@ public class OneTimeDonationsGrpcService extends SimpleOneTimeDonationsGrpc.OneT
case final OneTimeDonationUtil.OneTimeDonationRequestValidationResult.AmountBelowMinimum r ->
CreatePayPalBoostResponse.newBuilder()
.setAmountBelowMinimum(AmountBelowMinimumError.newBuilder()
.setMinimum(r.minimum().toString()).build()).build();
.setMinimum(SubscriptionCurrencyUtil.convertPrimaryToMinorUnits(request.getCurrency(),
r.minimum()))
.build()).build();
case OneTimeDonationUtil.OneTimeDonationRequestValidationResult.AmountAboveSepaLimit _ ->
throw new IllegalStateException("SEPA limit should not trigger for PayPal");
case OneTimeDonationUtil.OneTimeDonationRequestValidationResult.Success _ -> {
@@ -213,7 +219,7 @@ public class OneTimeDonationsGrpcService extends SimpleOneTimeDonationsGrpc.OneT
final OneTimeDonationUtil.OneTimeDonationRequestValidationResult validationResult =
OneTimeDonationUtil.validateOneTimeDonationRequest(
request.getCurrency(),
BigDecimal.valueOf(request.getAmount()),
request.getAmount(),
request.getLevel(),
org.whispersystems.textsecuregcm.subscriptions.PaymentMethod.PAYPAL,
oneTimeDonationConfiguration,
@@ -229,7 +235,9 @@ public class OneTimeDonationsGrpcService extends SimpleOneTimeDonationsGrpc.OneT
case final OneTimeDonationUtil.OneTimeDonationRequestValidationResult.AmountBelowMinimum r ->
ConfirmPayPalBoostResponse.newBuilder()
.setAmountBelowMinimum(AmountBelowMinimumError.newBuilder()
.setMinimum(r.minimum().toString()).build()).build();
.setMinimum(SubscriptionCurrencyUtil.convertPrimaryToMinorUnits(request.getCurrency(),
r.minimum()))
.build()).build();
case OneTimeDonationUtil.OneTimeDonationRequestValidationResult.AmountAboveSepaLimit _ ->
throw new IllegalStateException("SEPA limit should not trigger for PayPal");
case OneTimeDonationUtil.OneTimeDonationRequestValidationResult.Success _ -> {
@@ -1,6 +1,5 @@
package org.whispersystems.textsecuregcm.grpc;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -20,6 +19,7 @@ import org.whispersystems.textsecuregcm.configuration.SubscriptionConfiguration;
import org.whispersystems.textsecuregcm.subscriptions.CustomerAwareSubscriptionPaymentProcessor;
import org.whispersystems.textsecuregcm.subscriptions.PaymentMethod;
import org.whispersystems.textsecuregcm.subscriptions.ReceiptLevel;
import org.whispersystems.textsecuregcm.subscriptions.SubscriptionCurrencyUtil;
public class ProductConfigurationGrpcService extends SimpleProductConfigurationGrpc.ProductConfigurationImplBase {
private final GetConfigurationResponse configurationResponse;
@@ -32,7 +32,8 @@ public class ProductConfigurationGrpcService extends SimpleProductConfigurationG
final long backupMediaStorageAllowanceBytes) {
this.configurationResponse = GetConfigurationResponse.newBuilder()
.setBackup(buildBackupConfiguration(subscriptionConfiguration, backupMediaStorageAllowanceBytes))
.setSepaMaximumEuros(oneTimeDonationConfiguration.sepaMaximumEuros().toString())
.setSepaMaximumEuros(SubscriptionCurrencyUtil.convertPrimaryToMinorUnits(
OneTimeDonationUtil.EURO_CURRENCY_CODE, oneTimeDonationConfiguration.sepaMaximumEuros()))
.putAllCurrencies(buildCurrencyConfigurations(subscriptionConfiguration, oneTimeDonationConfiguration, paymentProcessors))
.putAllBadgeLevels(buildLevelConfigurations(subscriptionConfiguration, oneTimeDonationConfiguration))
.setLogin(buildLoginConfiguration(loginPurchaseConfiguration))
@@ -95,6 +96,7 @@ public class ProductConfigurationGrpcService extends SimpleProductConfigurationG
return LoginConfiguration.newBuilder()
.setLevel(ReceiptLevel.LOGIN.getValue())
.setPlayProductId(loginPurchaseConfiguration.playProductId())
.setPlayOptionId(loginPurchaseConfiguration.playOptionId())
.setAppStoreProductId(loginPurchaseConfiguration.appStoreProductId())
.build();
}
@@ -103,18 +105,20 @@ public class ProductConfigurationGrpcService extends SimpleProductConfigurationG
final String currency,
final org.whispersystems.textsecuregcm.subscriptions.CurrencyConfiguration config) {
final CurrencyConfiguration.Builder builder = CurrencyConfiguration.newBuilder()
.setMinimum(config.minimum().toString())
.setMinimum(SubscriptionCurrencyUtil.convertPrimaryToMinorUnits(currency, config.minimum()))
.addAllSupportedPaymentMethods(config.supportedPaymentMethods().stream()
.map(PaymentMethod::toProtoPaymentMethod)
.toList());
config.oneTime().forEach((levelId, amounts) ->
builder.putOneTime(levelId, AmountList.newBuilder()
.addAllAmounts(amounts.stream().map(BigDecimal::toString).toList())
.addAllAmounts(amounts.stream()
.map(amount -> SubscriptionCurrencyUtil.convertPrimaryToMinorUnits(currency, amount))
.toList())
.build()));
config.subscription()
.forEach((levelId, amount) -> builder.putSubscription(levelId, amount.toString()));
.forEach((levelId, amount) -> builder.putSubscription(levelId, SubscriptionCurrencyUtil.convertPrimaryToMinorUnits(currency, amount)));
config.backupSubscription()
.forEach((levelId, amount) -> builder.putBackupSubscription(levelId, amount.toString()));
.forEach((levelId, amount) -> builder.putBackupSubscription(levelId, SubscriptionCurrencyUtil.convertPrimaryToMinorUnits(currency, amount)));
return builder.build();
}
}
@@ -140,9 +140,8 @@ public class SubscriptionsGrpcService extends SimpleSubscriptionsGrpc.Subscripti
subscriptionManager.updateSubscriber(subscriberCredentials, creationPermitted);
return UpdateSubscriberResponse.newBuilder().setSuccess(Empty.getDefaultInstance()).build();
} catch (final SubscriptionForbiddenException e) {
return UpdateSubscriberResponse.newBuilder().setSubscriberIdMismatch(
FailedUnidentifiedAuthorization.newBuilder().setDescription(e.errorDetail().orElse("")).build()).build();
} catch (final SubscriptionForbiddenException _) {
throw GrpcExceptions.invalidArguments("subscriber-ids must be randomly generated");
} catch (SubscriberIdCreationNotPermittedException _) {
if (request.getDonationPermit().isEmpty()) {
throw GrpcExceptions.invalidArguments("donation permit is required to create a subscriber ID");
@@ -206,11 +205,8 @@ public class SubscriptionsGrpcService extends SimpleSubscriptionsGrpc.Subscripti
return CreatePaymentMethodResponse.newBuilder().setResult(
CreatePaymentMethodResponse.CreatePaymentMethodResult.newBuilder().setClientSecret(token)
.setPaymentProvider(customerAwareSubscriptionPaymentProcessor.getProvider().toProto()).build()).build();
} catch (final SubscriptionNotFoundException e) {
} catch (final SubscriptionNotFoundException | SubscriptionForbiddenException _) {
return CreatePaymentMethodResponse.newBuilder().setSubscriberNotFound(NotFound.newBuilder()).build();
} catch (final SubscriptionForbiddenException e) {
return CreatePaymentMethodResponse.newBuilder().setSubscriberIdMismatch(
FailedUnidentifiedAuthorization.newBuilder().setDescription(e.errorDetail().orElse("")).build()).build();
} catch (final SubscriptionProcessorConflictException e) {
return CreatePaymentMethodResponse.newBuilder().setSubscriptionProcessorConflict(
FailedPrecondition.newBuilder().setDescription(e.errorDetail().orElse("")).build()).build();
@@ -231,12 +227,9 @@ public class SubscriptionsGrpcService extends SimpleSubscriptionsGrpc.Subscripti
return CreatePayPalPaymentMethodResponse.newBuilder().setResult(
CreatePayPalPaymentMethodResponse.CreatePayPalPaymentMethodResult.newBuilder()
.setApprovalUrl(details.approvalUrl()).setToken(details.billingAgreementToken()).build()).build();
} catch (final SubscriptionNotFoundException e) {
} catch (final SubscriptionNotFoundException | SubscriptionForbiddenException _) {
return CreatePayPalPaymentMethodResponse.newBuilder().setSubscriberNotFound(NotFound.newBuilder().build())
.build();
} catch (final SubscriptionForbiddenException e) {
return CreatePayPalPaymentMethodResponse.newBuilder().setSubscriberIdMismatch(
FailedUnidentifiedAuthorization.newBuilder().setDescription(e.errorDetail().orElse("")).build()).build();
} catch (final SubscriptionProcessorConflictException e) {
return CreatePayPalPaymentMethodResponse.newBuilder().setSubscriptionProcessorConflict(
FailedPrecondition.newBuilder().setDescription(e.errorDetail().orElse("")).build()).build();
@@ -267,22 +260,20 @@ public class SubscriptionsGrpcService extends SimpleSubscriptionsGrpc.Subscripti
};
final Subscriptions.Record record = subscriptionManager.getSubscriber(subscriberCredentials);
return record.getProcessorCustomer().map(
processorCustomer -> setDefaultPaymentMethodForCustomer(manager, processorCustomer, paymentMethodId,
record.subscriptionId)).orElseGet(() ->
return record.getProcessorCustomer()
.map(processorCustomer ->
setDefaultPaymentMethodForCustomer(manager, processorCustomer, paymentMethodId, record.subscriptionId))
// a missing customer ID indicates the client made requests out of order,
// and needs to call create_payment_method to create a customer for the given payment method
SetDefaultPaymentMethodResponse.newBuilder().setPaymentMethodNotSetUp(FailedPrecondition.newBuilder().build())
.orElseGet(() -> SetDefaultPaymentMethodResponse.newBuilder()
.setPaymentMethodNotSetUp(FailedPrecondition.newBuilder().build())
.build());
} catch (final SubscriptionNotFoundException e) {
} catch (final SubscriptionNotFoundException | SubscriptionForbiddenException _) {
return SetDefaultPaymentMethodResponse.newBuilder().setSubscriberNotFound(NotFound.newBuilder().build()).build();
} catch (final SubscriptionForbiddenException e) {
return SetDefaultPaymentMethodResponse.newBuilder().setSubscriberIdMismatch(
FailedUnidentifiedAuthorization.newBuilder().setDescription(e.errorDetail().orElse("")).build()).build();
} catch (final SubscriptionProcessorConflictException e) {
} catch (final SubscriptionProcessorConflictException _) {
return SetDefaultPaymentMethodResponse.newBuilder()
.setSubscriptionProcessorConflict(
FailedPrecondition.newBuilder().setDescription(e.errorDetail().orElse("")).build()).build();
.setPaymentMethodNotSetUp(FailedPrecondition.newBuilder().build())
.build();
}
}
@@ -310,16 +301,14 @@ public class SubscriptionsGrpcService extends SimpleSubscriptionsGrpc.Subscripti
request.getSubscriberId().toByteArray(), clock);
try {
final Subscriptions.Record record = subscriptionManager.getSubscriber(subscriberCredentials);
return record.getProcessorCustomer().map(
processorCustomer -> setSubscriptionLevelForCustomer(processorCustomer, subscriberCredentials, record,
request)).orElseGet(() -> SetSubscriptionLevelResponse.newBuilder()
.setPaymentMethodNotSetUp(FailedPrecondition.newBuilder().build()).build());
return record.getProcessorCustomer().map(processorCustomer ->
setSubscriptionLevelForCustomer(processorCustomer, subscriberCredentials, record, request))
.orElseGet(() -> SetSubscriptionLevelResponse.newBuilder()
.setPaymentMethodNotSetUp(FailedPrecondition.newBuilder().build())
.build());
} catch (final SubscriptionNotFoundException e) {
} catch (final SubscriptionNotFoundException | SubscriptionForbiddenException _) {
return SetSubscriptionLevelResponse.newBuilder().setSubscriberNotFound(NotFound.newBuilder().build()).build();
} catch (final SubscriptionForbiddenException e) {
return SetSubscriptionLevelResponse.newBuilder().setSubscriberIdMismatch(
FailedUnidentifiedAuthorization.newBuilder().setDescription(e.errorDetail().orElse("")).build()).build();
}
}
@@ -394,11 +383,8 @@ public class SubscriptionsGrpcService extends SimpleSubscriptionsGrpc.Subscripti
};
return SetIapSubscriptionResponse.newBuilder()
.setSuccess(SetIapSubscriptionResponse.SetIapSubscriptionResult.newBuilder().setLevel(level).build()).build();
} catch (final SubscriptionNotFoundException e) {
} catch (final SubscriptionNotFoundException | SubscriptionForbiddenException _) {
return SetIapSubscriptionResponse.newBuilder().setSubscriberNotFound(NotFound.newBuilder().build()).build();
} catch (final SubscriptionForbiddenException e) {
return SetIapSubscriptionResponse.newBuilder().setSubscriberIdMismatch(
FailedUnidentifiedAuthorization.newBuilder().setDescription(e.errorDetail().orElse("")).build()).build();
} catch (final SubscriptionProcessorConflictException e) {
return SetIapSubscriptionResponse.newBuilder().setSubscriptionProcessorConflict(
FailedPrecondition.newBuilder().setDescription(e.errorDetail().orElse("")).build()).build();
@@ -422,12 +408,9 @@ public class SubscriptionsGrpcService extends SimpleSubscriptionsGrpc.Subscripti
.map(SubscriptionsGrpcService::buildSubscriptionInformationResponse).orElseGet(
() -> GetSubscriptionInformationResponse.newBuilder().setNoSubscription(Empty.getDefaultInstance())
.build());
} catch (final SubscriptionNotFoundException e) {
} catch (final SubscriptionNotFoundException | SubscriptionForbiddenException _) {
return GetSubscriptionInformationResponse.newBuilder().setSubscriberNotFound(NotFound.newBuilder().build())
.build();
} catch (final SubscriptionForbiddenException e) {
return GetSubscriptionInformationResponse.newBuilder().setSubscriberIdMismatch(
FailedUnidentifiedAuthorization.newBuilder().setDescription(e.errorDetail().orElse("")).build()).build();
}
}
@@ -437,7 +420,7 @@ public class SubscriptionsGrpcService extends SimpleSubscriptionsGrpc.Subscripti
final GetSubscriptionInformationResponse.Subscription.Builder subscription = GetSubscriptionInformationResponse.Subscription.newBuilder()
.setLevel(info.level()).setEndOfCurrentPeriod(info.endOfCurrentPeriod().getEpochSecond())
.setActive(info.active()).setCancelAtPeriodEnd(info.cancelAtPeriodEnd()).setCurrency(info.price().currency())
.setAmount(info.price().amount().longValue()).setStatus(toProtoSubscriptionStatus(info.status()))
.setAmount(info.price().amount()).setStatus(toProtoSubscriptionStatus(info.status()))
.setProcessor(info.paymentProvider().toProto()).setPaymentMethod(info.paymentMethod().toProtoPaymentMethod())
.setPaymentProcessing(info.paymentProcessing());
if (info.billingCycleAnchor() != null) {
@@ -458,7 +441,8 @@ public class SubscriptionsGrpcService extends SimpleSubscriptionsGrpc.Subscripti
try {
final SubscriptionManager.ReceiptResult result = subscriptionManager.createReceiptCredentials(
subscriberCredentials, request.getReceiptCredentialRequest().toByteArray(),
r -> SubscriptionsUtil.receiptExpirationWithGracePeriod(subscriptionConfiguration, r));
r -> SubscriptionsUtil.receiptExpirationWithGracePeriod(subscriptionConfiguration, r),
RequestAttributesUtil.getUserAgent().orElse(null));
Metrics.counter(RECEIPT_ISSUED_COUNTER_NAME,
Tags.of(
Tag.of(PROCESSOR_TAG_NAME, result.paymentProvider().toString()),
@@ -487,11 +471,8 @@ public class SubscriptionsGrpcService extends SimpleSubscriptionsGrpc.Subscripti
} catch (final SubscriptionReceiptAlreadyRedeemedException e) {
return GetReceiptCredentialsResponse.newBuilder().setAlreadyRedeemed(FailedPrecondition.newBuilder().build())
.build();
} catch (final SubscriptionNotFoundException e) {
} catch (final SubscriptionNotFoundException | SubscriptionForbiddenException _) {
return GetReceiptCredentialsResponse.newBuilder().setSubscriberNotFound(NotFound.newBuilder().build()).build();
} catch (final SubscriptionForbiddenException e) {
return GetReceiptCredentialsResponse.newBuilder().setSubscriberIdMismatch(
FailedUnidentifiedAuthorization.newBuilder().setDescription(e.errorDetail().orElse("")).build()).build();
}
}
@@ -20,9 +20,11 @@ public class H2FrameProxyHandler extends ChannelInboundHandlerAdapter {
private static final Logger logger = LoggerFactory.getLogger(H2FrameProxyHandler.class);
private static final String WRITABILITY_CHANGED_COUNTER_NAME = MetricsUtil.name(H2FrameProxyHandler.class, "writabilityChanged");
private static final String BACKEND_TAG_NAME = "backend";
private final Channel peerStream;
private final String proxyNameTag;
private final String backendNameTag;
// If we fail to write to the peerStream, we want to close the inbound channel. Rather than allocate a new listener
// that captures the inbound ChannelHandlerContext on every message, we capture the ChannelHandlerContext in
@@ -30,9 +32,10 @@ public class H2FrameProxyHandler extends ChannelInboundHandlerAdapter {
// one channel, but we already have a designated peerStream so this handler is fundamentally single-channel.
private ChannelFutureListener closeInboundOnPeerFailure = null;
public H2FrameProxyHandler(final Channel peerStream, final String proxyNameTag) {
public H2FrameProxyHandler(final Channel peerStream, final String proxyNameTag, final String backendNameTag) {
this.peerStream = peerStream;
this.proxyNameTag = proxyNameTag;
this.backendNameTag = backendNameTag;
}
@Override
@@ -50,8 +53,9 @@ public class H2FrameProxyHandler extends ChannelInboundHandlerAdapter {
@Override
public void channelWritabilityChanged(final ChannelHandlerContext peerCtx) throws Exception {
Metrics.counter(WRITABILITY_CHANGED_COUNTER_NAME,
"isWritable", Boolean.toString(peerCtx.channel().isWritable()),
"proxy", proxyNameTag)
"isWritable", Boolean.toString(peerCtx.channel().isWritable()),
"proxy", proxyNameTag,
BACKEND_TAG_NAME, backendNameTag)
.increment();
ctx.channel().config().setAutoRead(peerStream.isWritable());
super.channelWritabilityChanged(peerCtx);
@@ -145,7 +145,7 @@ public class OmnibusH2StreamHandler extends ChannelInboundHandlerAdapter {
// Connected, open a new H2 stream to the backend so we can proxy the client's frames
logger.trace("Opening a HTTP/2 stream to the backend {}", target);
final Channel backendConnection = connectFuture.channel();
createBackendProxyStream(ctx, backendConnection, headersFrame);
createBackendProxyStream(ctx, backendConnection, headersFrame, backendTag);
});
}
@@ -155,13 +155,15 @@ public class OmnibusH2StreamHandler extends ChannelInboundHandlerAdapter {
/// @param backendConnection An established H2 connection [Channel], on which a new h2 stream will be opened
/// @param headersFrame The first `headersFrame` from the client h2 stream that should be forwarded to the new
/// backend stream
/// @param backendTag The backend this stream targets, for metrics
private void createBackendProxyStream(
final ChannelHandlerContext clientStreamCtx,
final Channel backendConnection,
final Http2HeadersFrame headersFrame) {
final Http2HeadersFrame headersFrame,
final String backendTag) {
new Http2StreamChannelBootstrap(backendConnection)
// Forwards response frames from the backend back to the client stream
.handler(new H2FrameProxyHandler(clientStreamCtx.channel(), "responseStream"))
.handler(new H2FrameProxyHandler(clientStreamCtx.channel(), "responseStream", backendTag))
.open()
.addListener((io.netty.util.concurrent.Future<Http2StreamChannel> streamFuture) -> {
if (!streamFuture.isSuccess()) {
@@ -194,7 +196,7 @@ public class OmnibusH2StreamHandler extends ChannelInboundHandlerAdapter {
clientStreamCtx.pipeline().replace(
OmnibusH2StreamHandler.this,
"backend-to-client-proxy",
new H2FrameProxyHandler(backendStream, "requestStream"));
new H2FrameProxyHandler(backendStream, "requestStream", backendTag));
clientStreamCtx.channel().pipeline().fireChannelRead(headersFrame);
// Resume inbound reads, which should now be forwarded
@@ -5,26 +5,21 @@
package org.whispersystems.textsecuregcm.grpc.net;
import java.net.SocketAddress;
import java.util.List;
import java.util.Map;
public class OmnibusRouter {
public record OmnibusRoute(String prefix, SocketAddress backend) {}
private final List<OmnibusRoute> prefixRoutes;
private final Map<String, SocketAddress> routes;
private final SocketAddress defaultBackend;
public OmnibusRouter(final List<OmnibusRoute> prefixRoutes, final SocketAddress defaultBackend) {
this.prefixRoutes = prefixRoutes;
public OmnibusRouter(final Map<String, SocketAddress> routes, final SocketAddress defaultBackend) {
this.routes = routes;
this.defaultBackend = defaultBackend;
}
SocketAddress match(final String path) {
for (final OmnibusRoute route : prefixRoutes) {
if (path.startsWith(route.prefix)) {
return route.backend;
}
}
return defaultBackend;
SocketAddress match(final String fullPath) {
final int queryIndex = fullPath.indexOf('?');
final String path = queryIndex >= 0 ? fullPath.substring(0, queryIndex) : fullPath;
return routes.getOrDefault(path, defaultBackend);
}
}
@@ -4,6 +4,7 @@
*/
package org.whispersystems.textsecuregcm.grpc.net;
import com.google.common.net.InetAddresses;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.codec.haproxy.HAProxyMessage;
@@ -30,7 +31,8 @@ class ProxyMessageAttributeSetterHandler extends ChannelInboundHandlerAdapter {
try {
final String sourceAddress = proxyMessage.sourceAddress();
if (sourceAddress != null) {
ctx.channel().attr(PROXY_REMOTE_ADDRESS).set(InetAddress.getByName(sourceAddress));
// Assume that the server has been configured to only allow access from a trusted PPv2 provider
ctx.channel().attr(PROXY_REMOTE_ADDRESS).set(InetAddresses.forString(sourceAddress));
} else {
logger.warn("PROXY protocol message has no source address");
}
@@ -5,17 +5,17 @@
package org.whispersystems.textsecuregcm.jetty;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory;
import org.eclipse.jetty.server.ConnectionFactory;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.ForwardedRequestCustomizer;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.util.component.Container;
import org.eclipse.jetty.util.component.LifeCycle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics;
/**
* Uses {@link Container.Listener} to update {@link org.eclipse.jetty.server.HttpConfiguration}
@@ -38,6 +38,20 @@ public class JettyHttpConfigurationCustomizer implements Container.Listener, Lif
// see https://github.com/jetty/jetty.project/issues/1891
logger.info("setNotifyRemoteAsyncErrors(false) for {}", cf);
httpConfiguration.setNotifyRemoteAsyncErrors(false);
httpConfiguration.getCustomizers().stream()
.filter(ForwardedRequestCustomizer.class::isInstance)
.map(ForwardedRequestCustomizer.class::cast)
.forEach(forwardedRequestCustomizer -> {
// If this http configuration supports using proxy-supplied headers, only use X-Forwarded-For
// Disable all headers except for 'Forwarded'
forwardedRequestCustomizer.setForwardedOnly(true);
// Disable 'Forwarded'
forwardedRequestCustomizer.setForwardedHeader(null);
// Enable 'X-Forwarded-For'
forwardedRequestCustomizer.setForwardedForHeader(HttpHeader.X_FORWARDED_FOR.toString());
});
}
}
}
@@ -1,20 +0,0 @@
package org.whispersystems.textsecuregcm.limits;
import java.util.UUID;
public interface MessageDeliveryLoopMonitor {
/**
* Records an attempt to deliver a message with the given GUID to the given account/device pair and returns the number
* of consecutive attempts to deliver the same message and logs a warning if the message appears to be in a delivery
* loop. This method is intended to detect cases where a message remains at the head of a device's queue after
* repeated attempts to deliver the message, and so the given message GUID should be the first message of a "page"
* sent to clients.
*
* @param accountIdentifier the identifier of the destination account
* @param deviceId the destination device's ID within the given account
* @param messageGuid the GUID of the message
* @param userAgent the User-Agent header supplied by the caller
* @param context a human-readable string identifying the mechanism of message delivery (e.g. "rest" or "websocket")
*/
void recordDeliveryAttempt(UUID accountIdentifier, byte deviceId, UUID messageGuid, String userAgent, String context);
}
@@ -1,13 +0,0 @@
package org.whispersystems.textsecuregcm.limits;
import java.util.UUID;
public class NoopMessageDeliveryLoopMonitor implements MessageDeliveryLoopMonitor {
public NoopMessageDeliveryLoopMonitor() {
}
public void recordDeliveryAttempt(final UUID accountIdentifier, final byte deviceId, final UUID messageGuid, final String userAgent, final String context) {
}
}
@@ -65,7 +65,7 @@ public class RateLimiters extends BaseRateLimiters<RateLimiters.For> {
CREATE_DONATION_PERMIT("createDonationCredential", new RateLimiterConfig(30, Duration.ofHours(4), true)),
ONE_TIME_DONATION("oneTimeDonation", new RateLimiterConfig(5, Duration.ofMinutes(1), true)),
ADD_SUBSCRIPTION_PAYMENT_METHOD("addSubscriptionPaymentMethod", new RateLimiterConfig(10, Duration.ofMinutes(1), true)),
CHECK_TOTP("checkTotp", new RateLimiterConfig(5, Duration.ofSeconds(6), false))
CHECK_MFA("checkMfa", new RateLimiterConfig(50, Duration.ofHours(12), false))
;
private final String id;
@@ -252,7 +252,7 @@ public class RateLimiters extends BaseRateLimiters<RateLimiters.For> {
return forDescriptor(For.CREATE_DONATION_PERMIT);
}
public RateLimiter getCheckTotpLimiter() {
return forDescriptor(For.CHECK_TOTP);
public RateLimiter getCheckMfaLimiter() {
return forDescriptor(For.CHECK_MFA);
}
}
@@ -1,73 +0,0 @@
package org.whispersystems.textsecuregcm.limits;
import com.google.common.annotations.VisibleForTesting;
import io.lettuce.core.ScriptOutputType;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.time.Duration;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.redis.ClusterLuaScript;
import org.whispersystems.textsecuregcm.redis.FaultTolerantRedisClusterClient;
public class RedisMessageDeliveryLoopMonitor implements MessageDeliveryLoopMonitor {
private final ClusterLuaScript getDeliveryAttemptsScript;
private static final Duration DELIVERY_ATTEMPTS_COUNTER_TTL = Duration.ofHours(1);
private static final int DELIVERY_LOOP_THRESHOLD = 5;
private static final Logger logger = LoggerFactory.getLogger(MessageDeliveryLoopMonitor.class);
public RedisMessageDeliveryLoopMonitor(final FaultTolerantRedisClusterClient rateLimitCluster) {
try {
getDeliveryAttemptsScript =
ClusterLuaScript.fromResource(rateLimitCluster, "lua/get_delivery_attempt_count.lua", ScriptOutputType.INTEGER);
} catch (final IOException e) {
throw new UncheckedIOException("Failed to load 'get delivery attempt count' script", e);
}
}
/**
* Records an attempt to deliver a message with the given GUID to the given account/device pair and returns the number
* of consecutive attempts to deliver the same message and logs a warning if the message appears to be in a delivery
* loop. This method is intended to detect cases where a message remains at the head of a device's queue after
* repeated attempts to deliver the message, and so the given message GUID should be the first message of a "page"
* sent to clients.
*
* @param accountIdentifier the identifier of the destination account
* @param deviceId the destination device's ID within the given account
* @param messageGuid the GUID of the message
* @param userAgent the User-Agent header supplied by the caller
* @param context a human-readable string identifying the mechanism of message delivery (e.g. "rest" or "websocket")
*/
public void recordDeliveryAttempt(final UUID accountIdentifier,
final byte deviceId,
final UUID messageGuid,
final String userAgent,
final String context) {
incrementDeliveryAttemptCount(accountIdentifier, deviceId, messageGuid)
.thenAccept(deliveryAttemptCount -> {
if (deliveryAttemptCount == DELIVERY_LOOP_THRESHOLD) {
logger.warn("Detected loop delivering message {} via {} to {}:{} ({})",
messageGuid, context, accountIdentifier, deviceId, userAgent);
}
});
}
@VisibleForTesting
CompletableFuture<Long> incrementDeliveryAttemptCount(final UUID accountIdentifier, final byte deviceId, final UUID messageGuid) {
final String firstMessageGuidKey = "firstMessageGuid::{" + accountIdentifier + ":" + deviceId + "}";
final String deliveryAttemptsKey = "firstMessageDeliveryAttempts::{" + accountIdentifier + ":" + deviceId + "}";
return getDeliveryAttemptsScript.executeAsync(
List.of(firstMessageGuidKey, deliveryAttemptsKey),
List.of(messageGuid.toString(), String.valueOf(DELIVERY_ATTEMPTS_COUNTER_TTL.toSeconds())))
.thenApply(result -> (long) result);
}
}
@@ -1,36 +0,0 @@
/*
* Copyright 2023 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.mappers;
import io.dropwizard.jersey.errors.ErrorMessage;
import io.grpc.StatusRuntimeException;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;
@Provider
public class GrpcStatusRuntimeExceptionMapper implements ExceptionMapper<StatusRuntimeException> {
@Override
public Response toResponse(final StatusRuntimeException exception) {
int httpCode = switch (exception.getStatus().getCode()) {
case OK -> 200;
case INVALID_ARGUMENT, FAILED_PRECONDITION, OUT_OF_RANGE -> 400;
case UNAUTHENTICATED -> 401;
case PERMISSION_DENIED -> 403;
case NOT_FOUND -> 404;
case ALREADY_EXISTS, ABORTED -> 409;
case CANCELLED -> 499;
case UNKNOWN, UNIMPLEMENTED, DEADLINE_EXCEEDED, RESOURCE_EXHAUSTED, INTERNAL, UNAVAILABLE, DATA_LOSS -> 500;
};
return Response.status(httpCode)
.entity(new ErrorMessage(httpCode, exception.getMessage()))
.type(MediaType.APPLICATION_JSON_TYPE)
.build();
}
}
@@ -0,0 +1,40 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.mappers;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import javax.annotation.Nullable;
import org.whispersystems.textsecuregcm.auth.MfaFailureException;
import org.whispersystems.textsecuregcm.auth.webauthn.WebAuthnAuthenticationParameters;
public class MfaFailureExceptionMapper implements ExceptionMapper<MfaFailureException> {
@Override
public Response toResponse(final MfaFailureException exception) {
return Response.status(441)
.entity(new MfaFailureResponse(
exception.getWebAuthnParameters() == null
? null
: new WebAuthnAuthenticationParameters(exception.getWebAuthnParameters().challenge(),
exception.getWebAuthnParameters().timeout().toSeconds(),
exception.getWebAuthnParameters().allowedCredentialIds()),
exception.hasTotpKey()))
.build();
}
@Schema(description = """
Information about the account's MFA status.
""")
public record MfaFailureResponse(
@Schema(description = "If the account has a WebAuthn credential, this field contains parameters for an authentication ceremony.")
@Nullable WebAuthnAuthenticationParameters webAuthnParameters,
@Schema(description = "Whether the account has a TOTP key configured")
boolean hasTotpKey) {
}
}
@@ -1,3 +1,8 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.mappers;
import jakarta.ws.rs.core.Response;
@@ -22,12 +22,15 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Collections;
import java.util.HashSet;
import java.util.HexFormat;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.stream.IntStream;
import javax.annotation.Nullable;
import org.apache.commons.lang3.StringUtils;
import org.signal.libsignal.protocol.IdentityKey;
@@ -46,6 +49,8 @@ import org.whispersystems.textsecuregcm.util.ZkCredentialPublicKeyAdapter;
@JsonFilter("Account")
public class Account {
public static final int MAX_MFA_KEY_ID = Byte.MAX_VALUE;
private static final Logger logger = LoggerFactory.getLogger(Account.class);
@JsonProperty
@@ -160,8 +165,8 @@ public class Account {
@Nullable
private TotpKey pendingTotpKey;
@JsonProperty("totp")
private Map<Integer, AnnotatedTotpKey> totpKeys = Collections.emptyMap();
@JsonProperty("mfa")
private Map<Byte, AnnotatedMfaKey> mfaKeys = Collections.emptyMap();
@JsonIgnore
private boolean stale;
@@ -470,10 +475,11 @@ public class Account {
}
}
public void setRegistrationLock(final String registrationLock, final String registrationLockSalt) {
public void setRegistrationLock(@Nullable final String registrationLock, @Nullable final String registrationLockSalt) {
requireNotStale();
if (number == null) {
// Accounts without a phone number can't set a registration lock
if (number == null && (registrationLock != null || registrationLockSalt != null)) {
throw new IllegalArgumentException("Cannot set registration lock on account with no phone number");
}
@@ -668,23 +674,25 @@ public class Account {
return Optional.ofNullable(pendingTotpKey);
}
public int getNextTotpKeyId() {
public byte getNextMfaKeyId() {
requireNotStale();
return totpKeys.keySet().stream()
.mapToInt(i -> i)
.max()
.orElse(-1) + 1;
final Set<Byte> usedKeys = new HashSet<>(mfaKeys.keySet());
return (byte) IntStream.range(0, MAX_MFA_KEY_ID + 1)
.filter(b -> !usedKeys.contains((byte) b))
.findFirst()
.orElseThrow(IllegalStateException::new);
}
public Map<Integer, AnnotatedTotpKey> getTotpKeys() {
public Map<Byte, AnnotatedMfaKey> getMfaKeys() {
requireNotStale();
return totpKeys;
return mfaKeys;
}
public void setTotpKeys(final Map<Integer, AnnotatedTotpKey> totpKeys) {
public void setMfaKeys(final Map<Byte, AnnotatedMfaKey> mfaKeys) {
requireNotStale();
this.totpKeys = totpKeys;
this.mfaKeys = mfaKeys;
}
public void markStale() {
@@ -10,9 +10,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import org.whispersystems.textsecuregcm.util.ThrowingSupplier;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
@@ -47,15 +44,12 @@ public class AccountLockManager {
///
/// @param phoneNumberIdentifiers the phone number identifiers for which to acquire a distributed, pessimistic lock
/// @param task the task to execute once locks have been acquired
/// @param lockAcquisitionExecutor the executor on which to run blocking lock acquire/release tasks. this executor
/// should not use virtual threads.
///
/// @return the value returned by the given {@code task}
///
/// @throws E if an exception is thrown by the given {@code task}
public <V, E extends Exception> V withLock(final Set<UUID> phoneNumberIdentifiers,
final ThrowingSupplier<V, E> task,
final Executor lockAcquisitionExecutor) throws E {
final ThrowingSupplier<V, E> task) throws E {
if (phoneNumberIdentifiers.isEmpty()) {
throw new IllegalArgumentException("List of PNIs to lock must not be empty");
@@ -64,30 +58,22 @@ public class AccountLockManager {
final List<LockItem> lockItems = new ArrayList<>(phoneNumberIdentifiers.size());
try {
// Offload the acquire/release tasks to the dedicated lock acquisition executor. The lock client performs blocking
// operations while holding locks which forces thread pinning when this method runs on a virtual thread.
// https://github.com/awslabs/amazon-dynamodb-lock-client/issues/97
CompletableFuture.runAsync(() -> {
for (final UUID pni : phoneNumberIdentifiers) {
try {
lockItems.add(lockClient.acquireLock(AcquireLockOptions.builder(pni.toString())
.withAcquireReleasedLocksConsistently(true)
.build()));
} catch (final InterruptedException e) {
throw new CompletionException(e);
}
for (final UUID pni : phoneNumberIdentifiers) {
try {
lockItems.add(lockClient.acquireLock(AcquireLockOptions.builder(pni.toString())
.withAcquireReleasedLocksConsistently(true)
.build()));
} catch (final InterruptedException e) {
throw new RuntimeException(e);
}
}, lockAcquisitionExecutor).join();
}
return task.get();
} finally {
CompletableFuture.runAsync(() -> {
for (final LockItem lockItem : lockItems) {
lockClient.releaseLock(ReleaseLockOptions.builder(lockItem)
.withBestEffort(true)
.build());
}
}, lockAcquisitionExecutor).join();
for (final LockItem lockItem : lockItems) {
lockClient.releaseLock(ReleaseLockOptions.builder(lockItem)
.withBestEffort(true)
.build());
}
}
}
@@ -104,15 +90,12 @@ public class AccountLockManager {
///
/// @param account the account for which to acquire a distributed, pessimistic lock
/// @param task the task to execute once locks have been acquired
/// @param lockAcquisitionExecutor the executor on which to run blocking lock acquire/release tasks. this executor
/// should not use virtual threads.
///
/// @return the value returned by the given {@code task}
///
/// @throws E if an exception is thrown by the given {@code task}
public <V, E extends Exception> V withSingleAccountLock(Account account,
final ThrowingSupplier<V, E> task,
final Executor lockAcquisitionExecutor) throws E {
return withLock(Set.of(account.getPhoneNumberIdentifier().orElse(account.getAccountIdentifier())), task, lockAcquisitionExecutor);
public <V, E extends Exception> V withSingleAccountLock(final Account account,
final ThrowingSupplier<V, E> task) throws E {
return withLock(Set.of(account.getPhoneNumberIdentifier().orElse(account.getAccountIdentifier())), task);
}
}
@@ -0,0 +1,14 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.storage;
/// An account was not found when it should have been (e.g. a previous lookup or authentication succeeded)
public class AccountNotFoundException extends RuntimeException {
public AccountNotFoundException() {
super();
}
}
@@ -6,7 +6,6 @@ package org.whispersystems.textsecuregcm.storage;
import static java.util.Objects.requireNonNull;
import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name;
import static org.whispersystems.textsecuregcm.util.Util.getAlternateForms;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectWriter;
@@ -45,6 +44,7 @@ import org.whispersystems.textsecuregcm.util.ExceptionUtils;
import org.whispersystems.textsecuregcm.util.SystemMapper;
import org.whispersystems.textsecuregcm.util.UUIDUtil;
import org.whispersystems.textsecuregcm.util.Util;
import org.whispersystems.textsecuregcm.util.logging.ImpossibleEvents;
import reactor.core.publisher.Flux;
import reactor.core.scheduler.Scheduler;
import software.amazon.awssdk.core.SdkBytes;
@@ -339,12 +339,18 @@ public class Accounts {
// The account was already deleted, and we don't allow re-registering with the same receipt
.orElseThrow(ReceiptAlreadyRedeemedException::new);
// If the account recovery password in the request matches the existing account, this is likely a client retry,
// and we continue to allow for idempotency, otherwise this is an attempt to double-redeem a receipt
final boolean isRetry = existingAccount.getAccountRecoveryPassword()
final boolean accountRecoveryPasswordMatches = existingAccount.getAccountRecoveryPassword()
.map(arp -> PhoneNumberRecoveryPasswordsManager.verify(arp, accountRecoveryPasswordInRequest))
.orElse(false);
// Determine if this request is safe to idempotently succeed. It's safe if:
// - The account recovery password in the request matches the existing account's
// - The existing account does not have any MFA keys. If MFA keys were added to the account the caller should
// have used numberless account recovery rather than using their original receipt
//
// If either of these conditions are not met, the caller is incorrectly using an already redeemed receipt.
final boolean isRetry = accountRecoveryPasswordMatches && existingAccount.getMfaKeys().isEmpty();
if (!isRetry) {
throw new ReceiptAlreadyRedeemedException();
}
@@ -410,6 +416,10 @@ public class Accounts {
accountToCreate.setZkCredentialKey(existingAccount.getZkCredentialKey().orElse(null));
accountToCreate.setZkCredentialKeyRotationId(existingAccount.getZkCredentialKeyRotationId());
// Carry over any existing MFA keys to the new account; we don't need to copy the pending TOTP key since that's
// just a temporary holding place for essentially ephemeral data
accountToCreate.setMfaKeys(new HashMap<>(existingAccount.getMfaKeys()));
final List<TransactWriteItem> writeItems = new ArrayList<>();
// If we're reclaiming an account that already has a username, we'd like to give the re-registering client
@@ -464,7 +474,7 @@ public class Accounts {
&& accountToCreate.getNumber().isPresent()) {
final String existingAccountNumber = existingAccount.getNumber().get();
final String accountToCreateNumber = accountToCreate.getNumber().get();
if (getAlternateForms(existingAccountNumber).contains(accountToCreateNumber)) {
if (Util.getAlternateForms(existingAccountNumber).contains(accountToCreateNumber)) {
final AttributeValue uuidAttr = AttributeValues.fromUUID(existingAccount.getAccountIdentifier());
final AttributeValue numberAttr = AttributeValues.fromString(accountToCreateNumber);
final TransactWriteItem phoneNumberConstraintPut = buildConstraintTablePutIfAbsent(
@@ -1090,7 +1100,7 @@ public class Accounts {
setClauses.add("#number = :number");
final MembershipExpression membershipExpression = maybeExpectedExistingE164
.map(e164 -> MembershipExpression.build(getAlternateForms(e164)))
.map(e164 -> MembershipExpression.build(Util.getAlternateForms(e164)))
.orElseThrow(() -> new IllegalArgumentException("E164 must be present on existing account"));
attrValues.putAll(membershipExpression.values());
@@ -1307,6 +1317,16 @@ public class Accounts {
.map(Accounts::fromItem)));
}
boolean accountExists(final UUID aci) {
final GetItemResponse response = dynamoDbClient.getItem(GetItemRequest.builder()
.tableName(accountsTableName)
.key(Map.of(KEY_ACCOUNT_UUID, AttributeValues.fromUUID(aci)))
.projectionExpression(KEY_ACCOUNT_UUID)
.consistentRead(true)
.build());
return response.hasItem() && !response.item().isEmpty();
}
private TransactWriteItem buildPutDeletedAccount(final UUID aci, final UUID pni) {
return TransactWriteItem.builder()
.put(Put.builder()
@@ -1781,7 +1801,8 @@ public class Accounts {
final String attributeNumber = AttributeValues.getString(item, ATTR_ACCOUNT_E164, null);
if (!account.getNumber().equals(Optional.ofNullable(attributeNumber))) {
log.error("Mismatched phone numbers for account {}. From JSON: {}; from attribute: {}",
ImpossibleEvents.logImpossible(log,
"Mismatched phone numbers for account {}. From JSON: {}; from attribute: {}",
accountIdentifier, account.getNumber(), attributeNumber);
}
@@ -8,11 +8,12 @@ package org.whispersystems.textsecuregcm.storage;
import static java.util.Objects.requireNonNull;
import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name;
import com.eatthepath.otp.HmacOneTimePasswordGenerator;
import com.eatthepath.otp.TimeBasedOneTimePasswordGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.google.common.annotations.VisibleForTesting;
import com.webauthn4j.data.AuthenticationData;
import com.webauthn4j.util.exception.WebAuthnException;
import io.dropwizard.lifecycle.Managed;
import io.lettuce.core.RedisCommandTimeoutException;
import io.lettuce.core.RedisException;
@@ -44,6 +45,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Optional;
import java.util.Queue;
@@ -51,7 +53,6 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@@ -73,6 +74,10 @@ import org.signal.libsignal.zkgroup.receipts.ReceiptCredentialPresentation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager;
import org.whispersystems.textsecuregcm.auth.webauthn.AuthenticationCeremonyParameters;
import org.whispersystems.textsecuregcm.auth.webauthn.RegistrationCeremonyParameters;
import org.whispersystems.textsecuregcm.auth.webauthn.RegistrationCeremonyResult;
import org.whispersystems.textsecuregcm.auth.webauthn.WebAuthnCeremonyManager;
import org.whispersystems.textsecuregcm.controllers.MismatchedDevices;
import org.whispersystems.textsecuregcm.controllers.MismatchedDevicesException;
import org.whispersystems.textsecuregcm.entities.AccountAttributes;
@@ -81,6 +86,7 @@ import org.whispersystems.textsecuregcm.entities.ECSignedPreKey;
import org.whispersystems.textsecuregcm.entities.KEMSignedPreKey;
import org.whispersystems.textsecuregcm.entities.RestoreAccountRequest;
import org.whispersystems.textsecuregcm.entities.TransferArchiveResult;
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
import org.whispersystems.textsecuregcm.identity.ServiceIdentifier;
import org.whispersystems.textsecuregcm.metrics.UserAgentTagUtil;
import org.whispersystems.textsecuregcm.redis.FaultTolerantPubSubConnection;
@@ -144,14 +150,13 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
private final SecureValueRecoveryClient secureValueRecovery2Client;
private final DisconnectionRequestManager disconnectionRequestManager;
private final PhoneNumberRecoveryPasswordsManager phoneNumberRecoveryPasswordsManager;
private final Executor accountLockExecutor;
private final ScheduledExecutorService messagesPollExecutor;
private final ScheduledExecutorService retryExecutor;
private final Clock clock;
private final Duration maxTotpValidationDelay;
private final KeyGenerator totpKeyGenerator;
private final TimeBasedOneTimePasswordGenerator totpGenerator;
private final WebAuthnCeremonyManager webAuthnCeremonyManager;
private final Key verificationTokenKey;
@@ -207,15 +212,13 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
static final String LINK_DEVICE_VERIFICATION_TOKEN_ALGORITHM = "HmacSHA256";
@VisibleForTesting
static final int TOTP_KEY_LENGTH_BITS = 256;
public static final TimeBasedOneTimePasswordGenerator TOTP = new TimeBasedOneTimePasswordGenerator();
@VisibleForTesting
public static final TotpParameters TOTP_PARAMETERS = new TotpParameters(
TimeBasedOneTimePasswordGenerator.TOTP_ALGORITHM_HMAC_SHA256,
HmacOneTimePasswordGenerator.DEFAULT_PASSWORD_LENGTH,
TimeBasedOneTimePasswordGenerator.DEFAULT_TIME_STEP);
private static final TotpParameters TOTP_PARAMETERS =
new TotpParameters(TOTP.getAlgorithm(), TOTP.getPasswordLength(), TOTP.getTimeStep());
public static final int MAX_TOTP_KEYS = 2;
public static final int MAX_MFA_KEYS = 10;
public enum DeletionReason {
ADMIN_DELETED("admin"),
@@ -288,6 +291,12 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
private static class UncheckedTooManyTotpKeysException extends NoStackTraceRuntimeException {
}
private static class UncheckedTooManyMfaKeysException extends NoStackTraceRuntimeException {
}
private static class UncheckedWebAuthnMismatchException extends NoStackTraceRuntimeException {
}
public AccountsManager(final Accounts accounts,
final PhoneNumberIdentifiers phoneNumberIdentifiers,
final FaultTolerantRedisClusterClient cacheCluster,
@@ -301,12 +310,12 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
final SecureValueRecoveryClient secureValueRecovery2Client,
final DisconnectionRequestManager disconnectionRequestManager,
final PhoneNumberRecoveryPasswordsManager phoneNumberRecoveryPasswordsManager,
final Executor accountLockExecutor,
final ScheduledExecutorService messagesPollExecutor,
final ScheduledExecutorService retryExecutor,
final Clock clock,
final byte[] linkDeviceSecret,
final Duration maxTotpValidationDelay) {
final Duration maxTotpValidationDelay,
final WebAuthnCeremonyManager webAuthnCeremonyManager) {
this.accounts = accounts;
this.phoneNumberIdentifiers = phoneNumberIdentifiers;
this.cacheCluster = cacheCluster;
@@ -320,12 +329,11 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
this.secureValueRecovery2Client = secureValueRecovery2Client;
this.disconnectionRequestManager = disconnectionRequestManager;
this.phoneNumberRecoveryPasswordsManager = requireNonNull(phoneNumberRecoveryPasswordsManager);
this.accountLockExecutor = accountLockExecutor;
this.messagesPollExecutor = messagesPollExecutor;
this.retryExecutor = retryExecutor;
this.clock = requireNonNull(clock);
if (maxTotpValidationDelay.compareTo(TOTP_PARAMETERS.timeStep()) > 0) {
if (maxTotpValidationDelay.compareTo(TOTP.getTimeStep()) > 0) {
throw new IllegalArgumentException("Max TOTP validation delay must be less than or equal to TOTP time step");
}
@@ -341,23 +349,26 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
}
try {
this.totpKeyGenerator = KeyGenerator.getInstance(TOTP_PARAMETERS.algorithm());
totpKeyGenerator.init(TOTP_KEY_LENGTH_BITS);
this.totpKeyGenerator = KeyGenerator.getInstance(TOTP.getAlgorithm());
totpKeyGenerator.init(getTotpKeyLengthBits());
} catch (final NoSuchAlgorithmException e) {
throw new AssertionError("Every implementation of the Java platform is required to support the HmacSHA256 KeyGenerator algorithm", e);
}
try {
this.totpGenerator = new TimeBasedOneTimePasswordGenerator(TOTP_PARAMETERS.timeStep(),
TOTP_PARAMETERS.passwordLength(),
TOTP_PARAMETERS.algorithm());
} catch (final NoSuchAlgorithmException e) {
throw new AssertionError("Every implementation of the Java platform is required to support the HmacSHA256 MAC algorithm", e);
}
this.webAuthnCeremonyManager = webAuthnCeremonyManager;
this.pubSubConnection = pubSubRedisClient.createPubSubConnection();
}
@VisibleForTesting
static int getTotpKeyLengthBits() {
try {
// The HOTP/TOTP spec recommends using a key length that's the same as the HMAC block length
return Mac.getInstance(TOTP.getAlgorithm()).getMacLength() * 8;
} catch (final NoSuchAlgorithmException e) {
throw new AssertionError("Algorithm used by TOTP generator not found", e);
}
}
@Override
public void start() {
pubSubConnection.usePubSubConnection(connection -> {
@@ -454,7 +465,7 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
return Metrics.timer(CREATE_TIMER_NAME, HAS_NUMBER_TAG_NAME, "true").record(() -> {
try {
return accountLockManager.withLock(Set.of(pni),
() -> create(Optional.of(number), Optional.of(pni), Optional.empty(), Optional.empty(), accountAttributes, aciIdentityKey, Optional.of(pniIdentityKey), primaryDeviceSpec, userAgent), accountLockExecutor);
() -> create(Optional.of(number), Optional.of(pni), Optional.empty(), Optional.empty(), accountAttributes, aciIdentityKey, Optional.of(pniIdentityKey), primaryDeviceSpec, userAgent));
} catch (final ReceiptAlreadyRedeemedException e) {
throw new AssertionError("ReceiptAlreadyRedeemedException must never be thrown for accounts with numbers");
} catch (final RuntimeException e) {
@@ -522,7 +533,15 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
additionalWriteItems.add(phoneNumberRecoveryPasswordsManager.buildTransactWriteItemForStorePassword(phoneNumberIdentifier, phoneNumberRecoveryPassword))));
if (maybeNumber.isPresent()) {
accounts.create(account, additionalWriteItems);
if (maybeRecentlyDeletedAccountIdentifier.isPresent()) {
// If we are re-using a recently deleted ACI, also obtain a lock for it so that clearing queues for the ACI synchronize against it
accountLockManager.withLock(Set.of(maybeRecentlyDeletedAccountIdentifier.get()), () -> {
accounts.create(account, additionalWriteItems);
return null;
});
} else {
accounts.create(account, additionalWriteItems);
}
} else {
assert accountAttributes.recoveryPassword().isPresent();
accounts.create(account,
@@ -605,7 +624,7 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
reclaimAccount(account, existingAccount, primaryDeviceSpec, accountAttributes);
return account;
}, accountLockExecutor);
});
final PushTokenType pushTokenType = PushTokenType.fromDeviceSpec(primaryDeviceSpec);
final PushTokenType previousPushTokenType = PushTokenType.fromDevice(existingAccount.getPrimaryDevice());
@@ -703,8 +722,7 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
.orElseThrow(() -> new IllegalArgumentException("Account not found: " + accountIdentifier));
return accountLockManager.withSingleAccountLock(account,
() -> addDevice(accountIdentifier, deviceSpec, linkDeviceToken, MAX_UPDATE_ATTEMPTS),
accountLockExecutor);
() -> addDevice(accountIdentifier, deviceSpec, linkDeviceToken, MAX_UPDATE_ATTEMPTS));
}
private Pair<Account, Device> addDevice(final UUID accountIdentifier, final DeviceSpec deviceSpec, final String linkDeviceToken, final int retries)
@@ -901,8 +919,7 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
.orElseThrow(() -> new IllegalArgumentException("Account not found: " + accountIdentifier));
return accountLockManager.withSingleAccountLock(account,
() -> removeDevice(accountIdentifier, deviceId, MAX_UPDATE_ATTEMPTS),
accountLockExecutor);
() -> removeDevice(accountIdentifier, deviceId, MAX_UPDATE_ATTEMPTS));
}
private Account removeDevice(final UUID accountIdentifier, final byte deviceId, final int retries) {
@@ -968,7 +985,7 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
try {
return accountLockManager.withLock(new HashSet<>(List.of(originalPhoneNumberIdentifier, targetPhoneNumberIdentifier)),
() -> changeNumber(account, targetNumber, targetPhoneNumberIdentifier, pniIdentityKey, pniSignedPreKeys, pniPqLastResortPreKeys, pniRegistrationIds), accountLockExecutor);
() -> changeNumber(account, targetNumber, targetPhoneNumberIdentifier, pniIdentityKey, pniSignedPreKeys, pniPqLastResortPreKeys, pniRegistrationIds));
} catch (final RuntimeException e) {
logger.error("Unexpected exception when changing phone number", e);
throw e;
@@ -1034,7 +1051,7 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
return true;
},
a -> accounts.changeNumber(a, targetNumber, targetPhoneNumberIdentifier, maybeDisplacedUuid, keyWriteItems),
() -> accounts.getByAccountIdentifier(uuid).orElseThrow(),
() -> accounts.getByAccountIdentifier(uuid).orElseThrow(AccountNotFoundException::new),
AccountChangeValidator.NUMBER_CHANGE_VALIDATOR);
}
@@ -1137,7 +1154,7 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
_ -> true,
a -> reservedUsernameHash.set(
checkAndReserveNextUsernameHash(a, new ArrayDeque<>(requestedUsernameHashes))),
() -> accounts.getByAccountIdentifier(account.getAccountIdentifier()).orElseThrow(),
() -> accounts.getByAccountIdentifier(account.getAccountIdentifier()).orElseThrow(AccountNotFoundException::new),
AccountChangeValidator.USERNAME_CHANGE_VALIDATOR);
redisDelete(updatedAccount);
@@ -1196,7 +1213,7 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
final Account updatedAccount = updateWithRetries(
_ -> true,
a -> accounts.confirmUsernameHash(a, reservedUsernameHash, encryptedUsername),
() -> accounts.getByAccountIdentifier(account.getAccountIdentifier()).orElseThrow(),
() -> accounts.getByAccountIdentifier(account.getAccountIdentifier()).orElseThrow(AccountNotFoundException::new),
AccountChangeValidator.USERNAME_CHANGE_VALIDATOR);
redisDelete(updatedAccount);
@@ -1207,7 +1224,7 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
public Account clearUsernameHash(final UUID accountIdentifier) {
final Account updatedAccount = updateWithRetries(_ -> true,
accounts::clearUsernameHash,
() -> accounts.getByAccountIdentifier(accountIdentifier).orElseThrow(),
() -> accounts.getByAccountIdentifier(accountIdentifier).orElseThrow(AccountNotFoundException::new),
AccountChangeValidator.USERNAME_CHANGE_VALIDATOR);
redisDelete(updatedAccount);
@@ -1272,7 +1289,7 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
}
return maybeUpdatedAccount;
}, accountLockExecutor);
});
}
/**
@@ -1322,7 +1339,7 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
final Account updatedAccount = updateWithRetries(updater,
persister,
() -> accounts.getByAccountIdentifier(accountIdentifier).orElseThrow(),
() -> accounts.getByAccountIdentifier(accountIdentifier).orElseThrow(AccountNotFoundException::new),
AccountChangeValidator.GENERAL_CHANGE_VALIDATOR);
redisSet(updatedAccount);
@@ -1480,7 +1497,7 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
accountLockManager.withSingleAccountLock(account, () -> {
delete(account);
return null;
}, accountLockExecutor);
});
Metrics.counter(DELETE_COUNTER_NAME,
COUNTRY_CODE_TAG_NAME, Util.getCountryCode(account),
@@ -1494,6 +1511,10 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
}
}
public boolean accountExists(final AciServiceIdentifier accountIdentifier) {
return accounts.accountExists(accountIdentifier.uuid());
}
private void delete(final Account account) {
final List<TransactWriteItem> additionalWriteItems = new ArrayList<>();
@@ -1994,7 +2015,7 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
accountLockManager.withSingleAccountLock(account, () -> {
migrateAccountRecoveryPassword(account.getAccountIdentifier(), MAX_UPDATE_ATTEMPTS);
return null;
}, accountLockExecutor);
});
}
private void migrateAccountRecoveryPassword(final UUID accountIdentifier, final int retries) {
@@ -2029,20 +2050,25 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
/// @see [#confirmPendingTotpKey(UUID, int, Instant, byte[])
///
/// @throws TooManyTotpKeysException if the target account already has at least [#MAX_TOTP_KEYS] TOTP keys
public TotpKey generatePendingTotpKey(final UUID accountIdentifier) throws TooManyTotpKeysException {
/// @throws TooManyMfaKeysException if the target account already has at least [#MAX_MFA_KEYS] total MFA keys
public TotpKey generatePendingTotpKey(final UUID accountIdentifier) throws TooManyTotpKeysException, TooManyMfaKeysException {
final SecretKey secretKey = totpKeyGenerator.generateKey();
final TotpKey pendingTotpKey = new TotpKey(TOTP_PARAMETERS, secretKey.getEncoded());
try {
update(accountIdentifier, account -> {
if (account.getTotpKeys().size() >= MAX_TOTP_KEYS) {
if (account.getMfaKeys().values().stream().filter(AnnotatedTotpKey.class::isInstance).count() >= MAX_TOTP_KEYS) {
throw new UncheckedTooManyTotpKeysException();
} else if (account.getMfaKeys().size() >= MAX_MFA_KEYS) {
throw new UncheckedTooManyMfaKeysException();
}
account.setPendingTotpKey(pendingTotpKey);
});
} catch (final UncheckedTooManyTotpKeysException _) {
throw new TooManyTotpKeysException();
} catch (final UncheckedTooManyMfaKeysException _) {
throw new TooManyMfaKeysException();
}
return pendingTotpKey;
@@ -2059,11 +2085,13 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
/// TOTP password for the given account or for a one-time password previously verified for the given account or empty
/// otherwise
///
/// @throws TooManyMfaKeysException if the target account already has at least [#MAX_MFA_KEYS] total MFA keys
///
/// @see [#generatePendingTotpKey(UUID)
public Optional<Integer> confirmPendingTotpKey(final UUID accountIdentifier,
public Optional<Byte> confirmPendingTotpKey(final UUID accountIdentifier,
final int oneTimePassword,
final Instant timestamp,
final byte[] metadataCiphertext) {
final byte[] metadataCiphertext) throws TooManyMfaKeysException {
final Optional<Account> maybeAccount = accounts.getByAccountIdentifier(accountIdentifier);
@@ -2077,25 +2105,31 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
final TotpKey pendingTotpKey = maybePendingTotpKey.get();
try {
if (totpGenerator.validateOneTimePassword(pendingTotpKey, timestamp, oneTimePassword)) {
if (verifyTotp(pendingTotpKey, timestamp, oneTimePassword)) {
final AtomicInteger keyId = new AtomicInteger();
update(accountIdentifier, account -> {
final Map<Integer, AnnotatedTotpKey> updatedTotpKeys = new HashMap<>(account.getTotpKeys());
final Map<Byte, AnnotatedMfaKey> updatedMfaKeys = new HashMap<>(account.getMfaKeys());
keyId.set(account.getNextTotpKeyId());
if (updatedMfaKeys.size() >= MAX_MFA_KEYS) {
throw new UncheckedTooManyMfaKeysException();
}
updatedTotpKeys.put(keyId.get(),
keyId.set(account.getNextMfaKeyId());
updatedMfaKeys.put((byte) keyId.get(),
new AnnotatedTotpKey(new TotpKey(pendingTotpKey.totpParameters(), pendingTotpKey.encodedKey()), metadataCiphertext));
account.setPendingTotpKey(null);
account.setTotpKeys(updatedTotpKeys);
account.setMfaKeys(updatedMfaKeys);
});
return Optional.of(keyId.get());
return Optional.of((byte) keyId.get());
}
} catch (final InvalidKeyException e) {
ImpossibleEvents.logImpossible(logger, "Invalid pending TOTP key for account {}", accountIdentifier, e);
} catch (final UncheckedTooManyMfaKeysException _) {
throw new TooManyMfaKeysException();
}
}
@@ -2109,11 +2143,12 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
// possible that a user will have iterated through so many keys that they've wrapped around into negative integers,
// but that's not really a practical concern.
return getByAccountIdentifier(accountIdentifier)
.flatMap(account -> account.getTotpKeys().entrySet().stream()
.flatMap(account -> account.getMfaKeys().entrySet().stream()
.filter(entry -> entry.getValue() instanceof AnnotatedTotpKey)
.max(Map.Entry.comparingByKey())
.filter(entry -> {
try {
return totpGenerator.validateOneTimePassword(entry.getValue(), timestamp, oneTimePassword);
return verifyTotp((AnnotatedTotpKey) entry.getValue(), timestamp, oneTimePassword);
} catch (final InvalidKeyException e) {
ImpossibleEvents.logImpossible(logger, "Invalid TOTP key for account {}", accountIdentifier, e);
return false;
@@ -2123,7 +2158,8 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
}
public boolean verifyTotp(final Account account, final Instant validationTimestamp, @Nullable final Integer oneTimePassword) {
if (account.getTotpKeys().isEmpty()) {
final List<AnnotatedTotpKey> totpKeys = account.getMfaKeys().values().stream().filter(AnnotatedTotpKey.class::isInstance).map(AnnotatedTotpKey.class::cast).toList();
if (totpKeys.isEmpty()) {
return oneTimePassword == null;
}
@@ -2132,18 +2168,174 @@ public class AccountsManager extends RedisPubSubAdapter<String, String> implemen
return false;
}
for (final Instant timestamp : new Instant[] { validationTimestamp, validationTimestamp.minus(maxTotpValidationDelay) }) {
for (final SecretKey totpKey : account.getTotpKeys().values()) {
try {
if (totpGenerator.validateOneTimePassword(totpKey, timestamp, oneTimePassword)) {
return true;
}
} catch (final InvalidKeyException e) {
ImpossibleEvents.logImpossible(logger, "Invalid TOTP key for account {}", account.getAccountIdentifier(), e);
for (final SecretKey totpKey : totpKeys) {
try {
if (verifyTotp(totpKey, validationTimestamp, oneTimePassword)) {
return true;
}
} catch (final InvalidKeyException e) {
ImpossibleEvents.logImpossible(logger, "Invalid TOTP key for account {}", account.getAccountIdentifier(), e);
}
}
return false;
}
private boolean verifyTotp(final SecretKey totpKey, final Instant validationTimestamp, final int oneTimePassword) throws InvalidKeyException {
for (final Instant timestamp : new Instant[]{validationTimestamp, validationTimestamp.minus(maxTotpValidationDelay)}) {
if (TOTP.validateOneTimePassword(totpKey, timestamp, oneTimePassword)) {
return true;
}
}
return false;
}
/// Returns server-generated parameters needed to initiate a WebAuthn registration ceremony for the given account.
///
/// @param accountIdentifier the ACI of the account
///
/// @throws TooManyMfaKeysException if the account already has too many MFA keys registered
public RegistrationCeremonyParameters startWebAuthnRegistration(final UUID accountIdentifier)
throws TooManyMfaKeysException {
final Account account = getByAccountIdentifier(accountIdentifier).orElseThrow(AccountNotFoundException::new);
if (account.getMfaKeys().size() >= MAX_MFA_KEYS) {
throw new TooManyMfaKeysException();
}
return webAuthnCeremonyManager.startRegistration(accountIdentifier, getWebAuthnCredentials(account));
}
/// Verifies that the authenticator response for a WebAuthn registration ceremony is valid, then
/// stores the resulting credential in the account.
///
/// @param accountIdentifier the account with which to associate the new credential
/// @param serializedAttestationObject the "attestation object" from the authenticator response, serialized as specified in the WebAuthn TR
/// @param collectedClientDataJson the "collected client data" structure from the authenticator response, serialized as specified in the WebAuthn TR
/// @param metadataCiphertext encrypted user-provided metadata
/// @return the ID of the credential
public Optional<Byte> finishWebAuthnRegistration(
final UUID accountIdentifier,
final byte[] serializedAttestationObject,
final String collectedClientDataJson,
final byte[] metadataCiphertext) throws TooManyMfaKeysException {
try {
final RegistrationCeremonyResult registrationData = webAuthnCeremonyManager.verifyRegistration(
serializedAttestationObject, collectedClientDataJson);
final AnnotatedWebAuthnCredential newCredential = new AnnotatedWebAuthnCredential(
registrationData.attestedCredentialData(),
registrationData.signCount(),
metadataCiphertext);
final AtomicInteger keyId = new AtomicInteger();
update(
accountIdentifier,
account -> {
final Map<Byte, AnnotatedMfaKey> updatedMfaKeys = new HashMap<>(account.getMfaKeys());
final Optional<Byte> existingId = updatedMfaKeys.entrySet().stream()
.flatMap(idAndMfaKey -> {
if (idAndMfaKey.getValue() instanceof AnnotatedWebAuthnCredential credential) {
return Stream.of(new Pair<>(idAndMfaKey.getKey(), credential));
}
return Stream.empty();
})
.filter(idAndCredential -> WebAuthnCeremonyManager.isSameCredential(idAndCredential.second(), newCredential))
.map(Pair::first)
.findFirst();
if (existingId.isPresent()) {
keyId.set(existingId.get());
return false;
}
if (updatedMfaKeys.size() >= MAX_MFA_KEYS) {
throw new UncheckedTooManyMfaKeysException();
}
keyId.set(account.getNextMfaKeyId());
updatedMfaKeys.put((byte) keyId.get(), newCredential);
account.setMfaKeys(updatedMfaKeys);
return true;
});
return Optional.of((byte) keyId.get());
} catch (UncheckedTooManyMfaKeysException _) {
throw new TooManyMfaKeysException();
} catch (WebAuthnException _) {
return Optional.empty();
}
}
/// @return if a WebAuthn credential is registered to the account, parameters to start an authentication ceremony. Otherwise, empty.
public Optional<AuthenticationCeremonyParameters> startWebAuthnAuthentication(final Account account) {
final List<AnnotatedWebAuthnCredential> existingCredentials = getWebAuthnCredentials(account);
if (existingCredentials.isEmpty()) {
return Optional.empty();
}
return Optional.of(webAuthnCeremonyManager.startAuthentication(account.getAccountIdentifier(), existingCredentials));
}
/// @return the updated [Account], if verification succeeded. Otherwise, empty.
public Optional<Account> verifyWebAuthnAuthentication(final Account account, final String authenticationResponseJson) {
try {
final AuthenticationData authenticationData = webAuthnCeremonyManager.parseAuthenticationResponse(authenticationResponseJson);
final Map.Entry<Byte, AnnotatedMfaKey> matchingRecord = account.getMfaKeys().entrySet().stream()
.filter(mfaKey -> {
if (mfaKey.getValue() instanceof AnnotatedWebAuthnCredential credential) {
return Arrays.equals(authenticationData.getCredentialId(), credential.getCredentialId());
}
return false;
})
.findFirst()
.orElseThrow();
final AnnotatedWebAuthnCredential matchingCredential = (AnnotatedWebAuthnCredential) matchingRecord.getValue();
// The credential record's sign counter is updated in place as part of verification, and the stored challenge
// is consumed by the first call. To guard against concurrent updates, we have to both store the expected counter
// and verifyAuthentication() outside the idempotent update() consumer.
final long expectedCounter = matchingCredential.getCounter();
webAuthnCeremonyManager.verifyAuthentication(account.getAccountIdentifier(), matchingCredential, authenticationData);
final Account updatedAccount = update(account.getAccountIdentifier(), a -> {
final Map<Byte, AnnotatedMfaKey> updatedMfaKeys = new HashMap<>(a.getMfaKeys());
if (updatedMfaKeys.get(matchingRecord.getKey()) instanceof AnnotatedWebAuthnCredential credential
&& WebAuthnCeremonyManager.isSameCredential(credential, matchingCredential)
&& credential.getCounter() == expectedCounter) {
// Just in case there was a concurrent metadata update, use the stored credential's
final AnnotatedWebAuthnCredential mergedCredential = matchingCredential.withMetadataCiphertext(
credential.metadataCiphertext());
updatedMfaKeys.put(matchingRecord.getKey(), mergedCredential);
a.setMfaKeys(updatedMfaKeys);
} else {
// the counter changed or the key referenced by the ID changed. We could try to accommodate the latter,
// but it's an unlikely scenario, and we should just restart the ceremony.
throw new UncheckedWebAuthnMismatchException();
}
});
return Optional.of(updatedAccount);
} catch (WebAuthnException | NoSuchElementException | UncheckedWebAuthnMismatchException _) {
return Optional.empty();
}
}
private static List<AnnotatedWebAuthnCredential> getWebAuthnCredentials(final Account account) {
return account.getMfaKeys().values().stream()
.filter(AnnotatedWebAuthnCredential.class::isInstance)
.map(AnnotatedWebAuthnCredential.class::cast)
.toList();
}
}
@@ -0,0 +1,18 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.storage;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, property = "type")
@JsonSubTypes({
@JsonSubTypes.Type(value=AnnotatedTotpKey.class, name = "totp"),
@JsonSubTypes.Type(value=AnnotatedWebAuthnCredential.class, name = "webauthn")})
public sealed interface AnnotatedMfaKey permits AnnotatedTotpKey, AnnotatedWebAuthnCredential {
byte[] metadataCiphertext();
AnnotatedMfaKey withMetadataCiphertext(byte[] newCiphertext);
}
@@ -15,7 +15,7 @@ public record AnnotatedTotpKey(@JsonUnwrapped
TotpKey totpKey,
@JsonProperty("metadata")
byte[] metadataCiphertext) implements SecretKey {
byte[] metadataCiphertext) implements SecretKey, AnnotatedMfaKey {
@Override
public String getAlgorithm() {
@@ -45,4 +45,9 @@ public record AnnotatedTotpKey(@JsonUnwrapped
public int hashCode() {
return Objects.hash(totpKey, Arrays.hashCode(metadataCiphertext));
}
@Override
public AnnotatedMfaKey withMetadataCiphertext(byte[] newCiphertext) {
return new AnnotatedTotpKey(totpKey(), newCiphertext);
}
}
@@ -0,0 +1,129 @@
/**
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.storage;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.webauthn4j.credential.CredentialRecord;
import com.webauthn4j.data.attestation.authenticator.AttestedCredentialData;
import com.webauthn4j.data.client.CollectedClientData;
import java.util.Arrays;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.whispersystems.textsecuregcm.util.ByteArrayAdapter;
public final class AnnotatedWebAuthnCredential implements AnnotatedMfaKey, CredentialRecord {
@JsonSerialize(using = AttestedCredentialDataAdapter.Serializer.class)
@JsonDeserialize(using = AttestedCredentialDataAdapter.Deserializer.class)
private final AttestedCredentialData attestedCredentialData;
private long counter;
@JsonSerialize(using = ByteArrayAdapter.Serializing.class)
@JsonDeserialize(using = ByteArrayAdapter.Deserializing.class)
private final byte[] metadataCiphertext;
@JsonCreator
public AnnotatedWebAuthnCredential(
@JsonProperty("attestedCredentialData") final AttestedCredentialData attestedCredentialData,
@JsonProperty("counter") final long counter,
@JsonProperty("metadataCiphertext") final byte[] metadataCiphertext) {
this.attestedCredentialData = Objects.requireNonNull(attestedCredentialData);
this.counter = counter;
this.metadataCiphertext = metadataCiphertext;
}
@Override
public byte[] metadataCiphertext() {
return metadataCiphertext;
}
public byte[] getCredentialId() {
return attestedCredentialData.getCredentialId();
}
@Override
public AnnotatedWebAuthnCredential withMetadataCiphertext(final byte[] newMetadataCiphertext) {
return new AnnotatedWebAuthnCredential(attestedCredentialData, counter, newMetadataCiphertext);
}
/// Always `null` in this implementation
@Override
public Boolean isUvInitialized() {
return null;
}
@Nonnull
@Override
public AttestedCredentialData getAttestedCredentialData() {
return attestedCredentialData;
}
/// Always `null` in this implementation
@Nullable
@Override
public CollectedClientData getClientData() {
return null;
}
@Override
public long getCounter() {
return counter;
}
/// Always `null` in this implementation
@Override
public Boolean isBackupEligible() {
return null;
}
/// Always `null` in this implementation
@Override
public Boolean isBackedUp() {
return null;
}
@Override
public void setBackedUp(boolean backedUp) {
// not used in this implementation
}
@Override
public void setCounter(final long counter) {
this.counter = counter;
}
@Override
public void setUvInitialized(boolean uvInitialized) {
// not used in this implementation
}
@Override
public void setBackupEligible(boolean ignored) {
// not used in this implementation
}
@Override
public boolean equals(final Object o) {
if (!(o instanceof AnnotatedWebAuthnCredential that)) {
return false;
}
return counter == that.counter
&& Arrays.equals(metadataCiphertext, that.metadataCiphertext)
&& Objects.equals(attestedCredentialData, that.attestedCredentialData);
}
@Override
public int hashCode() {
return Objects.hash(attestedCredentialData, counter, Arrays.hashCode(metadataCiphertext));
}
}
@@ -0,0 +1,50 @@
/**
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.storage;
import java.io.IOException;
import java.util.Base64;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.webauthn4j.converter.AttestedCredentialDataConverter;
import com.webauthn4j.converter.util.ObjectConverter;
import com.webauthn4j.data.attestation.authenticator.AttestedCredentialData;
public class AttestedCredentialDataAdapter {
private static final ObjectConverter OBJECT_CONVERTER = new ObjectConverter();
private static final AttestedCredentialDataConverter ATTESTED_CREDENTIAL_DATA_CONVERTER =
new AttestedCredentialDataConverter(OBJECT_CONVERTER);
public static class Serializer extends JsonSerializer<AttestedCredentialData> {
@Override
public void serialize(final AttestedCredentialData attestedCredentialData, final JsonGenerator jsonGenerator,
final SerializerProvider serializerProvider)
throws IOException {
jsonGenerator.writeString(
Base64.getEncoder()
.withoutPadding()
.encodeToString(ATTESTED_CREDENTIAL_DATA_CONVERTER.convert(attestedCredentialData)));
}
}
public static class Deserializer extends JsonDeserializer<AttestedCredentialData> {
@Override
public AttestedCredentialData deserialize(final JsonParser jsonParser,
final DeserializationContext deserializationContext) throws IOException {
return ATTESTED_CREDENTIAL_DATA_CONVERTER.convert(Base64.getDecoder().decode(jsonParser.getValueAsString()));
}
}
}
@@ -0,0 +1,54 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.storage;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.Metrics;
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
import org.whispersystems.textsecuregcm.storage.foundationdb.FoundationDbMessageStream;
import org.whispersystems.textsecuregcm.util.ExceptionUtils;
import reactor.adapter.JdkFlowAdapter;
import reactor.core.publisher.Flux;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Flow;
public class ConcatenatingMessageStream implements MessageStream {
private final RedisDynamoDbMessageStream redisDynamoDbMessageStream;
private final FoundationDbMessageStream foundationDbMessageStream;
private static final Counter CONFLICTING_CONSUMER_COUNTER =
Metrics.counter(MetricsUtil.name(ConcatenatingMessageStream.class, "conflictingConsumer"));
public ConcatenatingMessageStream(final RedisDynamoDbMessageStream redisDynamoDbMessageStream,
final FoundationDbMessageStream foundationDbMessageStream) {
this.redisDynamoDbMessageStream = redisDynamoDbMessageStream;
this.foundationDbMessageStream = foundationDbMessageStream;
}
@Override
public Flow.Publisher<MessageStreamEntry> getMessages() {
return JdkFlowAdapter.publisherToFlowPublisher(Flux.concat(
JdkFlowAdapter.flowPublisherToFlux(redisDynamoDbMessageStream.getMessages()),
JdkFlowAdapter.flowPublisherToFlux(foundationDbMessageStream.getMessages()))
.doOnError(throwable -> {
if (ExceptionUtils.unwrap(throwable) instanceof ConflictingMessageConsumerException) {
CONFLICTING_CONSUMER_COUNTER.increment();
}
}));
}
@Override
public CompletableFuture<Void> acknowledgeMessage(final UUID messageGuid, final long serverTimestamp) {
return CompletableFuture.allOf(
redisDynamoDbMessageStream.acknowledgeMessage(messageGuid, serverTimestamp),
messageGuid.version() == 8
? foundationDbMessageStream.acknowledgeMessage(messageGuid, serverTimestamp)
: CompletableFuture.completedFuture(null));
}
}
@@ -34,11 +34,11 @@ import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.entities.MessageProtos.Envelope;
import org.whispersystems.textsecuregcm.experiment.ExperimentEnrollmentManager;
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
import org.whispersystems.textsecuregcm.identity.IdentityType;
import org.whispersystems.textsecuregcm.identity.ServiceIdentifier;
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
import org.whispersystems.textsecuregcm.push.RedisMessageAvailabilityManager;
import org.whispersystems.textsecuregcm.storage.foundationdb.FoundationDbMessageStore;
import org.whispersystems.textsecuregcm.util.ExceptionUtils;
import org.whispersystems.textsecuregcm.util.UUIDUtil;
import reactor.core.observability.micrometer.Micrometer;
import reactor.core.publisher.Flux;
@@ -73,6 +73,9 @@ public class MessagesManager {
@VisibleForTesting
static final String MIRROR_READS_EXPERIMENT_NAME = "foundationDbMirrorReads";
@VisibleForTesting
static final String READ_LIVE_MESSAGES_FROM_FOUNDATIONDB_EXPERIMENT_NAME = "foundationDbReadLiveMessages";
private final MessagesDynamoDb messagesDynamoDb;
private final MessagesCache messagesCache;
private final FoundationDbMessageStore foundationDbMessageStore;
@@ -132,7 +135,7 @@ public class MessagesManager {
foundationDbInsertFuture =
foundationDbMessageStore.insert(new AciServiceIdentifier(accountIdentifier), minimizedMessagesByDeviceId)
.exceptionally(e -> {
if (e instanceof FDBException fdbException) {
if (ExceptionUtils.unwrap(e) instanceof final FDBException fdbException) {
Metrics.counter(INSERT_FDB_EXCEPTIONS_COUNTER_NAME, "code", String.valueOf(fdbException.getCode()))
.increment();
} else {
@@ -142,49 +145,60 @@ public class MessagesManager {
e);
}
return Collections.emptyMap();
throw ExceptionUtils.wrap(e);
});
} else {
foundationDbInsertFuture = CompletableFuture.completedFuture(Collections.emptyMap());
}
return foundationDbInsertFuture.thenCompose(foundationDbInsertResults ->
CompletableFuture.allOf(messagesByDeviceId.entrySet().stream()
.map(deviceIdAndMessage -> {
final byte deviceId = deviceIdAndMessage.getKey();
return foundationDbInsertFuture.thenCompose(foundationDbInsertResults -> {
final boolean useFoundationDbPresence =
experimentEnrollmentManager.isEnrolled(accountIdentifier, READ_LIVE_MESSAGES_FROM_FOUNDATIONDB_EXPERIMENT_NAME);
// Multi-recipient messages will have both a "shared MRM key" and actual message content; we only
// need/want the former for Redis
final Envelope message = deviceIdAndMessage.getValue().hasSharedMrmKey()
? deviceIdAndMessage.getValue().toBuilder().clearContent().build()
: deviceIdAndMessage.getValue();
if (useFoundationDbPresence) {
foundationDbInsertResults.forEach((deviceId, insertResult) ->
devicePresenceById.put(deviceId, insertResult.present()));
}
final UUID messageGuid = Optional.ofNullable(foundationDbInsertResults.get(deviceId))
.flatMap(FoundationDbMessageStore.InsertResult::messageGuid)
.orElseGet(UUID::randomUUID);
return CompletableFuture.allOf(messagesByDeviceId.entrySet().stream()
.map(deviceIdAndMessage -> {
final byte deviceId = deviceIdAndMessage.getKey();
return messagesCache.insert(messageGuid, accountIdentifier, deviceId, message)
.thenAccept(present -> {
if (message.hasSourceServiceId()) {
final ServiceIdentifier sourceServiceIdentifier =
ServiceIdentifier.fromByteString(message.getSourceServiceId());
// Multi-recipient messages will have both a "shared MRM key" and actual message content; we only
// need/want the former for Redis
final Envelope message = deviceIdAndMessage.getValue().hasSharedMrmKey()
? deviceIdAndMessage.getValue().toBuilder().clearContent().build()
: deviceIdAndMessage.getValue();
if (!accountIdentifier.equals(sourceServiceIdentifier.uuid())) {
// Note that this is an asynchronous, best-effort, fire-and-forget operation
reportMessageManager.store(sourceServiceIdentifier.toServiceIdentifierString(), messageGuid);
}
}
final UUID messageGuid = Optional.ofNullable(foundationDbInsertResults.get(deviceId))
.flatMap(FoundationDbMessageStore.InsertResult::messageGuid)
.orElseGet(UUID::randomUUID);
devicePresenceById.put(deviceId, present);
return messagesCache.insert(messageGuid, accountIdentifier, deviceId, message)
.thenAccept(present -> {
if (message.hasSourceServiceId()) {
final ServiceIdentifier sourceServiceIdentifier =
ServiceIdentifier.fromByteString(message.getSourceServiceId());
if (foundationDbInsertResults.containsKey(deviceId)) {
Metrics.counter(PRESENCE_MATCH_COUNTER_NAME,
"match", String.valueOf(present == foundationDbInsertResults.get(deviceId).present()))
.increment();
}
});
})
.toArray(CompletableFuture[]::new)))
if (!accountIdentifier.equals(sourceServiceIdentifier.uuid())) {
// Note that this is an asynchronous, best-effort, fire-and-forget operation
reportMessageManager.store(sourceServiceIdentifier.toServiceIdentifierString(), messageGuid);
}
}
if (!useFoundationDbPresence) {
devicePresenceById.put(deviceId, present);
}
if (foundationDbInsertResults.containsKey(deviceId)) {
Metrics.counter(PRESENCE_MATCH_COUNTER_NAME,
"match", String.valueOf(present == foundationDbInsertResults.get(deviceId).present()))
.increment();
}
});
})
.toArray(CompletableFuture[]::new));
})
.thenApply(ignored -> devicePresenceById);
}
@@ -287,9 +301,17 @@ public class MessagesManager {
}
public MessageStream getMessages(final UUID destinationUuid, final Device destinationDevice) {
if (experimentEnrollmentManager.isEnrolled(destinationUuid, READ_LIVE_MESSAGES_FROM_FOUNDATIONDB_EXPERIMENT_NAME)) {
return new ConcatenatingMessageStream(
new RedisDynamoDbMessageStream(messagesDynamoDb, messagesCache, redisMessageAvailabilityManager,
destinationUuid, destinationDevice, true),
foundationDbMessageStore.getMessages(new AciServiceIdentifier(destinationUuid), destinationDevice.getId())
);
}
final RedisDynamoDbMessageStream redisDynamoDbMessageStream =
new RedisDynamoDbMessageStream(messagesDynamoDb, messagesCache, redisMessageAvailabilityManager,
destinationUuid, destinationDevice);
destinationUuid, destinationDevice, false);
return new MirroringMessageStream(
redisDynamoDbMessageStream,
@@ -5,21 +5,38 @@
package org.whispersystems.textsecuregcm.storage;
import com.apple.foundationdb.FDBException;
import com.google.common.hash.HashCode;
import com.google.common.hash.Hashing;
import com.google.protobuf.CodedOutputStream;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.DistributionSummary;
import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Tags;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Flow;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.Metrics;
import jakarta.annotation.Nullable;
import org.reactivestreams.Subscription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.entities.MessageProtos;
import org.whispersystems.textsecuregcm.experiment.ExperimentEnrollmentManager;
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
import org.whispersystems.textsecuregcm.storage.foundationdb.FoundationDbMessageStream;
import org.whispersystems.textsecuregcm.util.ExceptionUtils;
import org.whispersystems.textsecuregcm.util.UUIDUtil;
import reactor.adapter.JdkFlowAdapter;
import reactor.core.publisher.BaseSubscriber;
import reactor.core.publisher.SignalType;
/// A temporary message stream that can mirror message acknowledgements (deletion requests) to FoundationDB
public class MirroringMessageStream implements MessageStream {
@@ -36,12 +53,66 @@ public class MirroringMessageStream implements MessageStream {
private static final Logger logger = LoggerFactory.getLogger(MirroringMessageStream.class);
private static class FoundationDbSubscriber extends BaseSubscriber<MessageStreamEntry> {
private static final Counter MESSAGE_MISMATCHES_COUNTER =
Metrics.counter(MetricsUtil.name(MirroringMessageStream.class, "messageMismatches"));
private static final String STREAM_AGREEMENTS = MetricsUtil.name(MirroringMessageStream.class, "streamAgreements");
private static final String MISSING_MESSAGES_COUNTER =
MetricsUtil.name(MirroringMessageStream.class, "missingMessages");
private static final DistributionSummary MISSING_MESSAGE_AGE_DISTRIBUTION =
DistributionSummary.builder(MetricsUtil.name(MirroringMessageStream.class, "missingMessageAge"))
.register(Metrics.globalRegistry);
private static final int MAX_WINDOW_SIZE = 1024;
private final Map<UUID, HashCode> redisDynamoMessageWindow = new HashMap<>();
private final Map<UUID, HashCode> foundationDbMessageWindow = new HashMap<>();
private boolean stopAgreementVerification = false;
@Nullable
private Tags agreementFailureTags;
private final Set<UUID> recentFoundationDbUuids = Collections.newSetFromMap(new LinkedHashMap<>() {
@Override
protected boolean removeEldestEntry(final Map.Entry<UUID, Boolean> eldest) {
return size() > MAX_WINDOW_SIZE;
}
});
private final Set<UUID> recentRedisDynamoEphemeralUuids = Collections.newSetFromMap(new LinkedHashMap<>() {
@Override
protected boolean removeEldestEntry(final Map.Entry<UUID, Boolean> eldest) {
return size() > MAX_WINDOW_SIZE;
}
});
private enum Stream {
REDIS_DYNAMO("redisDynamo"),
FOUNDATION_DB("foundationDb");
private final String name;
Stream(final String name) {
this.name = name;
}
}
private final FoundationDbSubscriber subscriber = new FoundationDbSubscriber();
private class FoundationDbSubscriber extends BaseSubscriber<MessageStreamEntry> {
public void handleRedisDynamoDbMessageStreamEntry(final MessageStreamEntry messageStreamEntry) {
final boolean isMirroredMessage = switch (messageStreamEntry) {
case MessageStreamEntry.Envelope envelopeEntry ->
UUIDUtil.fromByteString(envelopeEntry.message().getServerGuid()).version() == 8;
case final MessageStreamEntry.Envelope envelopeEntry -> {
final boolean isUUIDv8 = UUIDUtil.fromByteString(envelopeEntry.message().getServerGuid()).version() == 8;
if (isUUIDv8) {
verifyMessageAgreement(envelopeEntry, Stream.REDIS_DYNAMO);
}
yield isUUIDv8;
}
case MessageStreamEntry.QueueEmpty _ -> true;
};
@@ -59,13 +130,29 @@ public class MirroringMessageStream implements MessageStream {
@Override
protected void hookOnError(final Throwable throwable) {
switch (throwable) {
switch (ExceptionUtils.unwrap(throwable)) {
case ConflictingMessageConsumerException _ -> CONFLICTING_CONSUMER_COUNTER.increment();
case FDBException _ -> {
// FDBExceptions are already instrumented by metrics, so do nothing
}
default -> super.hookOnError(throwable);
}
}
protected void hookOnNext(final MessageStreamEntry messageStreamEntry) {
if (messageStreamEntry instanceof final MessageStreamEntry.Envelope envelope) {
verifyMessageAgreement(envelope, Stream.FOUNDATION_DB);
}
}
@Override
protected void hookFinally(final SignalType type) {
super.hookFinally(type);
publishStreamAgreementMetrics();
}
}
public MirroringMessageStream(final RedisDynamoDbMessageStream redisDynamoDbMessageStream,
final FoundationDbMessageStream foundationDbMessageStream,
final ExperimentEnrollmentManager experimentEnrollmentManager,
@@ -82,9 +169,9 @@ public class MirroringMessageStream implements MessageStream {
@Override
public Flow.Publisher<MessageStreamEntry> getMessages() {
final FoundationDbSubscriber subscriber = new FoundationDbSubscriber();
if (experimentEnrollmentManager.isEnrolled(accountIdentifier.uuid(), MessagesManager.MIRROR_READS_EXPERIMENT_NAME)) {
if (experimentEnrollmentManager.isEnrolled(accountIdentifier.uuid(),
MessagesManager.MIRROR_READS_EXPERIMENT_NAME)) {
JdkFlowAdapter.flowPublisherToFlux(foundationDbMessageStream.getMessages())
.subscribe(subscriber);
@@ -107,17 +194,142 @@ public class MirroringMessageStream implements MessageStream {
// All messages stored in FoundationDB use version 8 UUIDs; if a message has a version 4 UUID, then it only exists
// in Redis/DynamoDB
if (messageGuid.version() == 8 &&
experimentEnrollmentManager.isEnrolled(accountIdentifier.uuid(), MessagesManager.MIRROR_DELETIONS_EXPERIMENT_NAME)) {
experimentEnrollmentManager.isEnrolled(accountIdentifier.uuid(),
MessagesManager.MIRROR_DELETIONS_EXPERIMENT_NAME)) {
foundationDbMessageStream.acknowledgeMessage(messageGuid, serverTimestamp)
.whenComplete((_, throwable) -> {
if (throwable != null) {
logger.warn("Failed to delete message {}/{}/{} from FoundationDb", accountIdentifier.uuid(), deviceId,
messageGuid, throwable);
}
});
if (experimentEnrollmentManager.isEnrolled(accountIdentifier.uuid(), MessagesManager.MIRROR_READS_EXPERIMENT_NAME)
&&
messageNotDeliveredOnFoundationDbStream(messageGuid)) {
foundationDbMessageStream.acknowledgeAndGetMessage(messageGuid)
.thenAccept(deleteMessage -> {
if (deleteMessage.isEmpty()) {
handleMissingFoundationDbMessage(messageGuid, serverTimestamp);
return;
}
verifyMessageAgreement(deleteMessage.get(), Stream.FOUNDATION_DB);
})
.whenComplete((_, throwable) -> {
if (throwable != null) {
logger.warn("Failed to delete message {}/{}/{} from FoundationDb", accountIdentifier.uuid(), deviceId,
messageGuid, throwable);
}
});
} else {
foundationDbMessageStream.acknowledgeMessage(messageGuid, serverTimestamp)
.whenComplete((_, throwable) -> {
if (throwable != null) {
logger.warn("Failed to delete message {}/{}/{} from FoundationDb", accountIdentifier.uuid(), deviceId,
messageGuid, throwable);
}
});
}
}
return redisDynamoDbMessageStream.acknowledgeMessage(messageGuid, serverTimestamp);
}
private synchronized void verifyMessageAgreement(final MessageStreamEntry.Envelope envelope,
final Stream stream) {
if (stopAgreementVerification) {
return;
}
final UUID messageUUID = UUIDUtil.fromByteString(envelope.message().getServerGuid());
if (envelope.message().getEphemeral()) {
// We don't compare ephemeral messages across streams because the two systems have different ways of handling and
// delivering ephemeral messages. However, we track recently seen ephemeral UUIDs on the Redis/Dynamo stream
// to answer whether a message missing from FoundationDB was ephemeral or not.
if (stream == Stream.REDIS_DYNAMO) {
recentRedisDynamoEphemeralUuids.add(messageUUID);
}
return;
}
// There could be a race where a FoundationDB message is delivered on the stream right after it was acknowledged,
// so we don't want to add it to the window again; check it against a set of recently seen UUIDs before adding.
if (Stream.FOUNDATION_DB == stream && !recentFoundationDbUuids.add(messageUUID)) {
return;
}
final Map<UUID, HashCode> thisStreamWindow;
final Map<UUID, HashCode> otherStreamWindow;
if (Stream.REDIS_DYNAMO == stream) {
thisStreamWindow = redisDynamoMessageWindow;
otherStreamWindow = foundationDbMessageWindow;
} else {
thisStreamWindow = foundationDbMessageWindow;
otherStreamWindow = redisDynamoMessageWindow;
}
final HashCode thisStreamMessageHashCode = hashCode(envelope.message());
final HashCode otherStreamMessageHashCode = otherStreamWindow.remove(messageUUID);
if (otherStreamMessageHashCode != null) {
if (!otherStreamMessageHashCode.equals(thisStreamMessageHashCode)) {
MESSAGE_MISMATCHES_COUNTER.increment();
}
} else {
thisStreamWindow.put(messageUUID, thisStreamMessageHashCode);
if (thisStreamWindow.size() >= MAX_WINDOW_SIZE) {
// Stream is way ahead of the other, stop comparing further
stopAgreementVerification = true;
thisStreamWindow.clear();
otherStreamWindow.clear();
recentFoundationDbUuids.clear();
setAgreementFailure(Tags.of("reason", "overflow", "stream", stream.name));
}
}
}
private synchronized boolean messageNotDeliveredOnFoundationDbStream(final UUID messageGuid) {
return redisDynamoMessageWindow.containsKey(messageGuid);
}
private synchronized void setAgreementFailure(final Tags tags) {
if (agreementFailureTags == null) {
agreementFailureTags = tags;
}
}
private synchronized void publishStreamAgreementMetrics() {
Tags tags = Tags.of("success", String.valueOf(agreementFailureTags == null));
if (agreementFailureTags != null) {
tags = tags.and(agreementFailureTags);
}
Metrics.counter(STREAM_AGREEMENTS, tags).increment();
}
private synchronized void handleMissingFoundationDbMessage(final UUID messageGuid, final long serverTimestamp) {
final Boolean ephemeral;
if (redisDynamoMessageWindow.containsKey(messageGuid)) {
// The comparison window always contains non-ephemeral messages since we ignore ephemeral messages for comparison
ephemeral = false;
} else if (recentRedisDynamoEphemeralUuids.contains(messageGuid)) {
ephemeral = true;
} else {
ephemeral = null;
}
setAgreementFailure(Tags.of("reason", "missingMessages"));
Metrics.counter(MISSING_MESSAGES_COUNTER, "ephemeral", ephemeral == null ? "unknown" : ephemeral.toString())
.increment();
MISSING_MESSAGE_AGE_DISTRIBUTION.record(System.currentTimeMillis() - serverTimestamp);
}
private static HashCode hashCode(final MessageProtos.Envelope envelope) {
final byte[] serialized = new byte[envelope.getSerializedSize()];
final CodedOutputStream codedOutputStream = CodedOutputStream.newInstance(serialized);
codedOutputStream.useDeterministicSerialization();
try {
envelope.writeTo(codedOutputStream);
codedOutputStream.flush();
} catch (final IOException e) {
throw new UncheckedIOException(e);
}
return Hashing.murmur3_128().hashBytes(serialized);
}
}
@@ -51,6 +51,8 @@ public class OneTimeDonationsManager {
final GetItemResponse getItemResponse = dynamoDbClient.getItem(getItemRequest);
if (!getItemResponse.hasItem()) {
// This can happen if the upstream call races the asynchronous webhook that notifies of payment success,
// and usually the `paidAt` will be within a few seconds of the fallback
Metrics.counter(ONETIME_DONATION_NOT_FOUND_COUNTER_NAME, Tags.of("processor", paymentProvider.name())).increment();
return fallbackTimestamp;
}
@@ -43,7 +43,7 @@ public class PhoneNumberIdentifiers {
private final String tableName;
@VisibleForTesting
static final String KEY_E164 = "P";
public static final String KEY_E164 = "P";
@VisibleForTesting
static final String INDEX_NAME = "pni_to_p";
@VisibleForTesting
@@ -183,7 +183,8 @@ public class PhoneNumberIdentifiers {
* @return The provided PNI if the update occurred, or the existing PNI associated with originalPhoneNumber
*/
@VisibleForTesting
CompletableFuture<UUID> setPni(final String originalPhoneNumber, final List<String> allPhoneNumberForms,
public CompletableFuture<UUID> setPni(final String originalPhoneNumber,
final List<String> allPhoneNumberForms,
final UUID pni) {
if (!originalPhoneNumber.equals(allPhoneNumberForms.getFirst())) {
throw new IllegalArgumentException("allPhoneNumberForms must start with the target phoneNumber");
@@ -20,9 +20,9 @@ import reactor.core.observability.micrometer.Micrometer;
import reactor.core.publisher.BaseSubscriber;
import reactor.core.publisher.Flux;
/// A Redis/DynamoDB message publisher produces a non-terminating stream of messages for a specific device. It listens
/// for message availability signals from [RedisMessageAvailabilityManager] and emits new messages to its subscriber
/// when available.
/// A Redis/DynamoDB message publisher produces an optionally-terminating stream of messages for a specific device. It
/// listens for message availability signals from [RedisMessageAvailabilityManager] and emits new messages to its
/// subscriber when available.
///
/// This publisher supports only a single subscriber. It assumes that subscribers acknowledge (delete) messages as they
/// read the messages, and may emit duplicate messages if subscribers do not acknowledge messages before requesting more
@@ -36,6 +36,8 @@ class RedisDynamoDbMessagePublisher implements MessageAvailabilityListener, Flow
private final UUID accountIdentifier;
private final Device device;
private final boolean terminateOnQueueEmpty;
// Indicates which data source(s) we think might contain messages for the destination device. Messages initially land
// in Redis, but are eventually "persisted" to DynamoDB. This state changes in response to signals this publisher
// receives as a MessageAvailabilityListener. As an initial state, we assume that we have messages in both DynamoDB
@@ -133,13 +135,15 @@ class RedisDynamoDbMessagePublisher implements MessageAvailabilityListener, Flow
final MessagesCache messagesCache,
final RedisMessageAvailabilityManager redisMessageAvailabilityManager,
final UUID accountIdentifier,
final Device device) {
final Device device,
final boolean terminateOnQueueEmpty) {
this.messagesDynamoDb = messagesDynamoDb;
this.messagesCache = messagesCache;
this.redisMessageAvailabilityManager = redisMessageAvailabilityManager;
this.accountIdentifier = accountIdentifier;
this.device = device;
this.terminateOnQueueEmpty = terminateOnQueueEmpty;
}
@Override
@@ -151,9 +155,12 @@ class RedisDynamoDbMessagePublisher implements MessageAvailabilityListener, Flow
this.subscriber = subscriber;
// Listen for signals indicating that new messages are available in Redis, that messages have been persisted from
// Redis to DynamoDB, or that there's a conflicting message reader connected somewhere else
redisMessageAvailabilityManager.handleClientConnected(accountIdentifier, device.getId(), this);
if (!terminateOnQueueEmpty) {
// If we're trying to follow a live stream of messages, then listen for signals indicating that new messages are
// available in Redis, that messages have been persisted from Redis to DynamoDB, or that there's a conflicting
// message reader connected somewhere else
redisMessageAvailabilityManager.handleClientConnected(accountIdentifier, device.getId(), this);
}
subscriber.onSubscribe(new Flow.Subscription() {
@Override
@@ -216,6 +223,11 @@ class RedisDynamoDbMessagePublisher implements MessageAvailabilityListener, Flow
return false;
}
// Don't send a "queue empty" signal if we're supposed to terminate when the queue is empty
if (terminateOnQueueEmpty) {
return false;
}
// The machinery that produces messages won't activate until we have a subscriber
assert subscriber != null;
@@ -249,6 +261,24 @@ class RedisDynamoDbMessagePublisher implements MessageAvailabilityListener, Flow
return;
}
if (acknowledgedEntries < publishedEntries) {
// To avoid double-reading messages from data stores that don't support cursors, don't get a new message source
// unless all previously-published signals have been acknowledged (when messages are acknowledged, we'll come back
// to this point with a higher value for `acknowledgedEntries` via `handleMessageAcknowledged`)
return;
}
if (terminateOnQueueEmpty && queueEmptySignalState == QueueEmptySignalState.PENDING) {
// If we've acknowledged everything we've published and we're ready to send a "queue empty" signal, we can use the
// "ready to send a 'queue empty' signal" state as our cue to terminate the subscription
assert subscriber != null;
subscriber.onComplete();
terminate();
return;
}
if (storedMessageState == StoredMessageState.EMPTY) {
// We don't think there are any messages in either message source; don't do anything until the situation changes
// (when new messages arrive, we'll come back to this point with a non-empty stored message state)
@@ -261,13 +291,6 @@ class RedisDynamoDbMessagePublisher implements MessageAvailabilityListener, Flow
return;
}
if (acknowledgedEntries < publishedEntries) {
// To avoid double-reading messages from data stores that don't support cursors, don't get a new message source
// unless all previously-published signals have been acknowledged (when messages are acknowledged, we'll come back
// to this point with a higher value for `acknowledgedEntries` via `handleMessageAcknowledged`)
return;
}
// We maybe be able to skip reading from DynamoDB entirely if we think messages are only stored in Redis
final Publisher<MessageProtos.Envelope> dynamoPublisher =
storedMessageState == StoredMessageState.PERSISTED_NEW_MESSAGES_AVAILABLE
@@ -9,7 +9,6 @@ import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Flow;
import com.google.common.annotations.VisibleForTesting;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.Metrics;
import org.whispersystems.textsecuregcm.push.RedisMessageAvailabilityManager;
import org.whispersystems.textsecuregcm.util.UUIDUtil;
@@ -41,13 +40,15 @@ public class RedisDynamoDbMessageStream implements MessageStream {
final MessagesCache messagesCache,
final RedisMessageAvailabilityManager redisMessageAvailabilityManager,
final UUID accountIdentifier,
final Device device) {
final Device device,
final boolean terminateOnQueueEmpty) {
this(messagesDynamoDb, messagesCache, accountIdentifier, device, new RedisDynamoDbMessagePublisher(messagesDynamoDb,
messagesCache,
redisMessageAvailabilityManager,
accountIdentifier,
device));
device,
terminateOnQueueEmpty));
}
@VisibleForTesting
@@ -1,14 +0,0 @@
/*
* Copyright 2021 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.storage;
public class RefreshingAccountNotFoundException extends RuntimeException {
public RefreshingAccountNotFoundException(final String message) {
super(message);
}
}
@@ -0,0 +1,57 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.storage;
import java.util.Optional;
import java.util.UUID;
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
import org.whispersystems.textsecuregcm.identity.ServiceIdentifier;
import org.whispersystems.textsecuregcm.util.Util;
public class ReportMessageHelper {
private static final Logger logger = LoggerFactory.getLogger(ReportMessageHelper.class);
public static void reportMessage(final ServiceIdentifier sourceServiceIdentifier,
final AciServiceIdentifier reporterServiceIdentifier,
final UUID messageGuid,
@Nullable final byte[] reportSpamToken,
@Nullable final String userAgent,
final AccountsManager accountsManager,
final PhoneNumberIdentifiers phoneNumberIdentifiers,
final ReportMessageManager reportMessageManager) {
final Optional<String> maybeSourceNumber;
final Optional<UUID> maybeSourcePni;
final boolean sourceAccountDeleted;
final Optional<Account> sourceAccount = accountsManager.getByServiceIdentifier(sourceServiceIdentifier);
if (sourceAccount.isEmpty()) {
logger.warn("Could not find source: {}", sourceServiceIdentifier);
maybeSourcePni = accountsManager.findRecentlyDeletedPhoneNumberIdentifier(sourceServiceIdentifier.uuid());
maybeSourceNumber = maybeSourcePni.flatMap(pni ->
Util.getCanonicalNumber(phoneNumberIdentifiers.getPhoneNumber(pni).join()));
sourceAccountDeleted = true;
} else {
maybeSourceNumber = sourceAccount.flatMap(Account::getNumber);
maybeSourcePni = sourceAccount.flatMap(Account::getPhoneNumberIdentifier);
sourceAccountDeleted = false;
}
reportMessageManager.report(maybeSourceNumber,
sourceServiceIdentifier.uuid(),
maybeSourcePni,
messageGuid,
reporterServiceIdentifier.uuid(),
Optional.ofNullable(reportSpamToken),
userAgent,
sourceAccountDeleted);
}
}
@@ -23,6 +23,7 @@ import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
import org.whispersystems.textsecuregcm.metrics.UserAgentTagUtil;
import org.whispersystems.textsecuregcm.redis.FaultTolerantRedisClusterClient;
import org.whispersystems.textsecuregcm.util.UUIDUtil;
import javax.annotation.Nullable;
public class ReportMessageManager {
@@ -61,17 +62,17 @@ public class ReportMessageManager {
}
}
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
public void report(final Optional<String> sourceNumber,
final Optional<UUID> sourceAci,
final UUID sourceAci,
final Optional<UUID> sourcePni,
final UUID messageGuid,
final UUID reporterUuid,
final Optional<byte[]> reportSpamToken,
final String reporterUserAgent,
@Nullable final String reporterUserAgent,
final boolean sourceAccountDeleted) {
final boolean found = sourceAci.map(uuid -> reportMessageDynamoDb.remove(hash(messageGuid, uuid.toString())))
.orElse(false);
final boolean found = reportMessageDynamoDb.remove(hash(messageGuid, sourceAci.toString()));
Metrics.counter(REPORT_MESSAGE_COUNTER_NAME,
Tags.of(FOUND_MESSAGE_TAG, String.valueOf(found),
@@ -87,11 +88,11 @@ public class ReportMessageManager {
connection.sync().expire(reportedSenderKey, counterTtl.toSeconds());
});
sourceAci.ifPresent(aci -> {
final String reportedSenderKey = getReportedSenderAciKey(aci);
{
final String reportedSenderKey = getReportedSenderAciKey(sourceAci);
connection.sync().pfadd(reportedSenderKey, reporterUuid.toString());
connection.sync().expire(reportedSenderKey, counterTtl.toSeconds());
});
}
});
reportedMessageListeners.forEach(listener -> {
@@ -4,6 +4,9 @@
*/
package org.whispersystems.textsecuregcm.storage;
import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Tag;
import io.micrometer.core.instrument.Tags;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.time.Instant;
@@ -15,17 +18,21 @@ import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.signal.libsignal.zkgroup.InvalidInputException;
import org.signal.libsignal.zkgroup.VerificationFailedException;
import org.signal.libsignal.zkgroup.receipts.ReceiptCredentialRequest;
import org.signal.libsignal.zkgroup.receipts.ReceiptCredentialResponse;
import org.signal.libsignal.zkgroup.receipts.ServerZkReceiptOperations;
import org.whispersystems.textsecuregcm.controllers.RateLimitExceededException;
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
import org.whispersystems.textsecuregcm.metrics.UserAgentTagUtil;
import org.whispersystems.textsecuregcm.subscriptions.AppleAppStoreManager;
import org.whispersystems.textsecuregcm.subscriptions.CustomerAwareSubscriptionPaymentProcessor;
import org.whispersystems.textsecuregcm.subscriptions.GooglePlayBillingManager;
import org.whispersystems.textsecuregcm.subscriptions.PaymentProvider;
import org.whispersystems.textsecuregcm.subscriptions.ProcessorCustomer;
import org.whispersystems.textsecuregcm.subscriptions.ReceiptLevel;
import org.whispersystems.textsecuregcm.subscriptions.SubscriberIdCreationNotPermittedException;
import org.whispersystems.textsecuregcm.subscriptions.SubscriptionForbiddenException;
import org.whispersystems.textsecuregcm.subscriptions.SubscriptionInformation;
@@ -53,6 +60,9 @@ import org.whispersystems.textsecuregcm.util.ua.ClientPlatform;
*/
public class SubscriptionManager {
private static final String RECEIPT_ALREADY_REDEEMED_COUNTER_NAME = MetricsUtil.name(SubscriptionManager.class,
"receiptAlreadyRedeemed");
private final Subscriptions subscriptions;
private final EnumMap<PaymentProvider, SubscriptionPaymentProcessor> processors;
private final ServerZkReceiptOperations zkReceiptOperations;
@@ -177,6 +187,7 @@ public class SubscriptionManager {
* @param expiration A function that takes a
* {@link CustomerAwareSubscriptionPaymentProcessor.ReceiptItem} and returns the
* expiration time of the receipt
* @param userAgent The requesting client's user agent
* @return the requested ZK receipt credential
* @throws SubscriptionForbiddenException if the subscriber credentials were incorrect
* @throws SubscriptionNotFoundException if the subscriber did not exist or did not have a
@@ -193,7 +204,8 @@ public class SubscriptionManager {
public ReceiptResult createReceiptCredentials(
final SubscriberCredentials subscriberCredentials,
final byte[] receiptCredentialRequestBytes,
final Function<CustomerAwareSubscriptionPaymentProcessor.ReceiptItem, Instant> expiration)
final Function<CustomerAwareSubscriptionPaymentProcessor.ReceiptItem, Instant> expiration,
@Nullable final String userAgent)
throws SubscriptionForbiddenException, SubscriptionNotFoundException, SubscriptionInvalidArgumentsException, SubscriptionPaymentRequiredException, RateLimitExceededException, SubscriptionReceiptRequestedForOpenPaymentException, SubscriptionReceiptAlreadyRedeemedException {
final Subscriptions.Record record = getSubscriber(subscriberCredentials);
if (record.subscriptionId == null) {
@@ -222,6 +234,12 @@ public class SubscriptionManager {
} catch (final VerificationFailedException e) {
throw new SubscriptionInvalidArgumentsException("receipt credential request failed verification", e);
} catch (final WriteConflictException _) {
Metrics.counter(RECEIPT_ALREADY_REDEEMED_COUNTER_NAME, Tags.of(
Tag.of("receiptLevel", ReceiptLevel.lookupLevel(receipt.level())
.map(ReceiptLevel::name)
.orElse("n/a")),
UserAgentTagUtil.getPlatformTag(userAgent)))
.increment();
throw new SubscriptionReceiptAlreadyRedeemedException();
}
return new ReceiptResult(receiptCredentialResponse, receipt, processor);
@@ -248,8 +266,7 @@ public class SubscriptionManager {
* @param <E> An exception thrown by the paymentSetupFunction
* @return The return value of the paymentSetupFunction
* @throws SubscriptionForbiddenException if the subscriber credentials were incorrect
* @throws SubscriptionNotFoundException if the subscriber did not exist or did not have a subscription
* attached
* @throws SubscriptionNotFoundException if the subscriber did not exist
* @throws SubscriptionProcessorConflictException if the new payment processor does not match the existing processor associated with
* the subscriberId
*/
@@ -373,8 +390,8 @@ public class SubscriptionManager {
* play store
* @return the subscription level for the accepted subscription
* @throws SubscriptionForbiddenException if the subscriber credentials were incorrect
* @throws SubscriptionNotFoundException if the subscriber did not exist or did not have a subscription
* attached
* @throws SubscriptionNotFoundException if the subscriber did not exist, or the purchaseToken was not found
* in the play store
* @throws SubscriptionProcessorConflictException if the new payment processor does not match the existing processor associated with
* the subscriberId
* @throws SubscriptionPaymentRequiredException if the subscription is not in a state that grants the user an
@@ -426,7 +443,8 @@ public class SubscriptionManager {
* the app store
* @return the subscription level for the accepted subscription
* @throws SubscriptionForbiddenException if the subscriber credentials are incorrect
* @throws SubscriptionNotFoundException if the originalTransactionId does not exist
* @throws SubscriptionNotFoundException if the subscriber did not exist, or the originalTransactionId does
* not exist
* @throws SubscriptionProcessorConflictException if the new payment processor does not match the existing processor associated with
* the subscriber
* @throws SubscriptionInvalidArgumentsException if the originalTransactionId is malformed or does not represent a
@@ -30,8 +30,6 @@ import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import software.amazon.awssdk.services.dynamodb.model.ConditionalCheckFailedException;
import software.amazon.awssdk.services.dynamodb.model.GetItemRequest;
import software.amazon.awssdk.services.dynamodb.model.GetItemResponse;
import software.amazon.awssdk.services.dynamodb.model.QueryRequest;
import software.amazon.awssdk.services.dynamodb.model.QueryResponse;
import software.amazon.awssdk.services.dynamodb.model.ReturnValue;
import software.amazon.awssdk.services.dynamodb.model.UpdateItemRequest;
import software.amazon.awssdk.services.dynamodb.model.UpdateItemResponse;
@@ -168,37 +166,6 @@ public class Subscriptions {
this.client = Objects.requireNonNull(client);
}
/**
* Looks in the GSI for a record with the given customer id and returns the user id.
*/
public byte[] getSubscriberUserByProcessorCustomer(ProcessorCustomer processorCustomer) {
QueryRequest query = QueryRequest.builder()
.tableName(table)
.indexName(INDEX_NAME)
.keyConditionExpression("#processor_customer_id = :processor_customer_id")
.projectionExpression("#user")
.expressionAttributeNames(Map.of(
"#processor_customer_id", KEY_PROCESSOR_ID_CUSTOMER_ID,
"#user", KEY_USER))
.expressionAttributeValues(Map.of(
":processor_customer_id", b(processorCustomer.toDynamoBytes())))
.build();
final QueryResponse queryResponse = client.query(query);
int count = queryResponse.count();
if (count == 0) {
return null;
} else if (count > 1) {
logger.error("expected invariant of 1-1 subscriber-customer violated for customer {} ({})",
processorCustomer.customerId(), processorCustomer.processor());
throw new IllegalStateException(
"expected invariant of 1-1 subscriber-customer violated for customer " + processorCustomer);
} else {
Map<String, AttributeValue> result = queryResponse.items().getFirst();
return result.get(KEY_USER).b().asByteArray();
}
}
public static class GetResult {
public static final GetResult NOT_STORED = new GetResult(Type.NOT_STORED, null);
@@ -0,0 +1,11 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.storage;
import org.whispersystems.textsecuregcm.util.NoStackTraceException;
public class TooManyMfaKeysException extends NoStackTraceException {
}
@@ -0,0 +1,171 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.storage.foundationdb;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.FDBException;
import com.apple.foundationdb.ReadTransaction;
import com.apple.foundationdb.Transaction;
import io.github.resilience4j.bulkhead.Bulkhead;
import io.github.resilience4j.circuitbreaker.CircuitBreaker;
import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Tags;
import jakarta.annotation.Nullable;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.LongAdder;
import java.util.function.Function;
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
import org.whispersystems.textsecuregcm.util.ExceptionUtils;
import org.whispersystems.textsecuregcm.util.ResilienceUtil;
public class FaultTolerantDatabase {
private final Database database;
private final CircuitBreaker circuitBreaker;
private final Bulkhead bulkhead;
private final LongAdder concurrentTransactionCount;
private static final String TRANSACTION_ERRORS_COUNTER = MetricsUtil.name(FaultTolerantDatabase.class, "transactionErrors");
public FaultTolerantDatabase(
final Database database,
final String name,
@Nullable final String circuitBreakerConfigurationName,
@Nullable final String bulkheadConfigurationName) {
this.database = database;
this.circuitBreaker = circuitBreakerConfigurationName != null
? ResilienceUtil.getCircuitBreakerRegistry().circuitBreaker(name, circuitBreakerConfigurationName)
: ResilienceUtil.getCircuitBreakerRegistry().circuitBreaker(name);
this.bulkhead = bulkheadConfigurationName != null
? ResilienceUtil.getBulkheadRegistry().bulkhead(name, bulkheadConfigurationName)
: ResilienceUtil.getBulkheadRegistry().bulkhead(name);
this.concurrentTransactionCount =
Metrics.gauge(MetricsUtil.name(getClass(), "concurrentTransactions"), Tags.of("name", name), new LongAdder());
}
public <T> T run(final Function<? super Transaction, T> retryable, final Context context) {
try {
concurrentTransactionCount.increment();
return bulkhead.executeSupplier(() -> circuitBreaker.executeSupplier(() -> database.run(retryable)));
} catch (final Exception e) {
if (e instanceof final FDBException fdbException) {
Metrics.counter(TRANSACTION_ERRORS_COUNTER,
"context", context.getName(),
"code", String.valueOf(fdbException.getCode())
).increment();
}
throw e;
} finally {
concurrentTransactionCount.decrement();
}
}
/// Returns a cancellation-safe version of the result from [Database#runAsync(Function)]. Since the final stage
/// of the result from [Database#runAsync(Function)] is a cleanup stage that closes the transaction, the
/// transaction leaks if the future gets cancelled and the cleanup stage is skipped. So, we add another dummy stage
/// that serves as the cancellation target and the cleanup can proceed as normal.
///
/// @param retryable the block of transaction logic to execute
/// @param <T> the return type of retryable
/// @return a cancellation-safe version of the future returned from [Database#runAsync(Function)]
public <T> CompletableFuture<T> runAsync(final Function<? super Transaction, ? extends CompletableFuture<T>> retryable,
final Context context) {
concurrentTransactionCount.increment();
final CompletableFuture<T> runAsyncFuture = bulkhead.executeCompletionStage(() -> circuitBreaker.executeCompletionStage(() -> database.runAsync(retryable)
.whenComplete((_, throwable) -> {
if (throwable != null && ExceptionUtils.unwrap(throwable) instanceof final FDBException fdbException) {
Metrics.counter(TRANSACTION_ERRORS_COUNTER,
"context", context.getName(),
"code", String.valueOf(fdbException.getCode())
).increment();
}
})
.thenApply(Function.identity())))
.toCompletableFuture();
runAsyncFuture.whenComplete((_, _) -> concurrentTransactionCount.decrement());
return runAsyncFuture;
}
public <T> T read(final Function<? super ReadTransaction, T> retryable, final Context context) {
try {
concurrentTransactionCount.increment();
return bulkhead.executeSupplier(() -> circuitBreaker.executeSupplier(() -> database.read(retryable)));
} catch (final Exception e) {
if (e instanceof final FDBException fdbException) {
Metrics.counter(TRANSACTION_ERRORS_COUNTER,
"context", context.getName(),
"code", String.valueOf(fdbException.getCode())
).increment();
}
throw e;
} finally {
concurrentTransactionCount.decrement();
}
}
public <T> CompletableFuture<T> readAsync(
final Function<? super ReadTransaction, ? extends CompletableFuture<T>> retryable,
final Context context) {
concurrentTransactionCount.increment();
final CompletableFuture<T> readAsyncFuture = bulkhead.executeCompletionStage(() -> circuitBreaker.executeCompletionStage(() -> database.readAsync(retryable)
.whenComplete((_, throwable) -> {
if (throwable != null && ExceptionUtils.unwrap(throwable) instanceof final FDBException fdbException) {
Metrics.counter(TRANSACTION_ERRORS_COUNTER,
"context", context.getName(),
"code", String.valueOf(fdbException.getCode())
).increment();
}
})))
.toCompletableFuture();
readAsyncFuture.whenComplete((_, _) -> concurrentTransactionCount.decrement());
return readAsyncFuture;
}
public enum Context {
INSERT_MESSAGE_BATCH("insertMessageBatch"),
GET_MESSAGES_BATCH("getMessagesBatch"),
SET_PRESENCE("setPresence"),
GET_PRESENCE("getPresence"),
CLEAR_PRESENCE("clearPresence"),
CLEAR_ACCOUNT_SUBSPACE("clearAccountSubspace"),
CLEAR_DEVICE_SUBSPACE("clearDeviceSubspace"),
CLEAR_EXPIRED_MESSAGES("clearExpiredMessages"),
CLEAR_EXPIRED_VERSIONSTAMPS("clearExpiredVersionstamps"),
GET_END_OF_QUEUE("getEndOfQueue"),
ESTIMATE_QUEUE_SIZE("estimateQueueSize"),
ESTIMATE_QUEUE_SIZE_AND_RANGE_SPLITS("estimateQueueSizeAndRangeSplits"),
GET_RANGE_SPLITS("getRangeSplits"),
TRIM_QUEUE("trimQueue"),
DELETE_MESSAGE("deleteMessage"),
READ_ACIS("readAcis"),
READ_STATUS("readStatus"),
READ_VERSIONSTAMP("readVersionstamp"),
RECORD_VERSIONSTAMP_AND_TIME("recordVersionstampAndTime"),
TEST("test");
private final String name;
Context(final String name) {
this.name = name;
}
public String getName() {
return name;
}
}
}
@@ -0,0 +1,72 @@
package org.whispersystems.textsecuregcm.storage.foundationdb;
import com.apple.foundationdb.Database;
import io.dropwizard.lifecycle.Managed;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.Map;
import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Timer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
public class FoundationDBWarmup implements Managed {
private final Map<String, FaultTolerantDatabase> databasesByName;
private static final Duration RETRY_DELAY = Duration.ofMillis(500);
private static final int MAX_ATTEMPTS = 3;
private static final Logger LOGGER = LoggerFactory.getLogger(FoundationDBWarmup.class);
private static final Timer WARMUP_TIMER = Metrics.timer(MetricsUtil.name(FoundationDBWarmup.class, "warmupTimer"));
private static final byte[] STATUS_JSON_KEY;
static {
final byte[] suffix = "/status/json".getBytes(StandardCharsets.US_ASCII);
STATUS_JSON_KEY = new byte[suffix.length + 2];
STATUS_JSON_KEY[0] = (byte) 0xff;
STATUS_JSON_KEY[1] = (byte) 0xff;
System.arraycopy(suffix, 0, STATUS_JSON_KEY, 2, suffix.length);
}
public FoundationDBWarmup(final Map<String, FaultTolerantDatabase> databasesByName) {
this.databasesByName = databasesByName;
}
@Override
public void start() throws Exception {
databasesByName.forEach(this::readStatusKey);
}
/// Warm up the connection to a FoundationDB database by reading its status key. We retry a limited number of times so
/// that we don't block the readiness probe in case a single shard is unavailable.
///
/// @param databaseName the name of the database to read from
/// @param database the FoundationDB [Database] instance
private void readStatusKey(final String databaseName, final FaultTolerantDatabase database) {
int attempts = 0;
final Timer.Sample sample = Timer.start();
while (true) {
try {
database.readAsync(transaction -> transaction.get(STATUS_JSON_KEY), FaultTolerantDatabase.Context.READ_STATUS).join();
sample.stop(WARMUP_TIMER);
return;
} catch (final Exception e) {
attempts++;
if (attempts == MAX_ATTEMPTS) {
LOGGER.warn("Failed to read status key at startup for shard {}", databaseName, e);
return;
}
try {
Thread.sleep(RETRY_DELAY);
} catch (final InterruptedException ex) {
throw new RuntimeException(ex);
}
}
}
}
}
@@ -1,6 +1,5 @@
package org.whispersystems.textsecuregcm.storage.foundationdb;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.KeySelector;
import com.apple.foundationdb.StreamingMode;
import com.apple.foundationdb.Transaction;
@@ -35,7 +34,7 @@ import reactor.core.publisher.Mono;
/// catching up to end-of-queue,and an infinite stream for live updates.
class FoundationDbMessagePublisher {
private final Database database;
private final FaultTolerantDatabase database;
private final Clock clock;
/// Keeps track of the key from which to start reading on the next iteration
private volatile KeySelector beginKeyCursor;
@@ -123,12 +122,10 @@ class FoundationDbMessagePublisher {
MESSAGE_AVAILABLE_WATCH_TRIGGERED,
/// Internal self-trigger used to immediately transition to the next state.
INTERNAL_TRIGGER,
/// An error occurred during fetching from FoundationDB or publishing messages to the sink.
FETCH_OR_PUBLISH_ERROR_OCCURRED
}
FoundationDbMessagePublisher(
final Database database,
final FaultTolerantDatabase database,
final Clock clock,
final KeySelector beginKeyInclusive,
final KeySelector endKeyExclusive,
@@ -175,7 +172,7 @@ class FoundationDbMessagePublisher {
/// cases when callers need to "catch up" on stored messages without following fresh updates (for example, when a
/// client first connects and needs to load stored messages before receiving a "live" stream of new messages).
public static FoundationDbMessagePublisher createFinitePublisher(
final Database database,
final FaultTolerantDatabase database,
final Clock clock,
final KeySelector beginKeyInclusive,
final KeySelector endKeyExclusive) {
@@ -195,7 +192,7 @@ class FoundationDbMessagePublisher {
/// It waits for new messages and publishes them in a loop. Useful when a client has finished receiving its stored
/// messages and is now waiting for a live stream of new messages.
public static FoundationDbMessagePublisher createInfinitePublisher(
final Database database,
final FaultTolerantDatabase database,
final Clock clock,
final KeySelector beginKeyInclusive,
final KeySelector endKeyExclusive,
@@ -252,7 +249,6 @@ class FoundationDbMessagePublisher {
transitionStateOnEvent(Event.INTERNAL_TRIGGER);
}
case MESSAGE_AVAILABLE_WATCH_TRIGGERED -> setState(State.MESSAGE_AVAILABLE_SIGNAL_BUFFERED, event);
case FETCH_OR_PUBLISH_ERROR_OCCURRED -> setState(State.ERROR, event);
default -> knownTransition = false;
}
}
@@ -312,7 +308,7 @@ class FoundationDbMessagePublisher {
throw new IllegalArgumentException("Max messages must be positive");
}
return FoundationDbUtil.safeRunAsync(database, transaction -> {
return database.runAsync(transaction -> {
final CompletableFuture<Void> checkPresenceFuture;
if (!terminateOnQueueEmpty) {
@@ -339,7 +335,7 @@ class FoundationDbMessagePublisher {
return keyValues;
});
})
}, FaultTolerantDatabase.Context.GET_MESSAGES_BATCH)
.thenApply(keyValues -> {
if (keyValues.size() < maxMessages) {
transitionStateOnEvent(Event.FETCHED_ALL_AVAILABLE_MESSAGES);
@@ -391,7 +387,7 @@ class FoundationDbMessagePublisher {
/// operation returns fewer items than the batch size, we infer that we have fetched all available messages and
/// [Event#FETCHED_ALL_AVAILABLE_MESSAGES] is sent to the state machine. See [#getMessagesBatch(int)] for details.
/// Additionally, after we successfully publish the batch of messages, {@link Event#PUBLISHED_MESSAGES} is emitted. If
/// there's an error while fetching or publishing, [Event#FETCH_OR_PUBLISH_ERROR_OCCURRED] is emitted instead.
/// there's an error while fetching or publishing, the stream is terminated with the error.
private void emitMessages() {
final int maxMessages = Math.min(getOutstandingDemand(), MAX_MESSAGES_PER_PAGE);
@@ -402,8 +398,7 @@ class FoundationDbMessagePublisher {
transitionStateOnEvent(Event.PUBLISHED_MESSAGES);
})
.exceptionally(t -> {
transitionStateOnEvent(Event.FETCH_OR_PUBLISH_ERROR_OCCURRED);
emitter.error(ExceptionUtils.unwrap(t));
terminateWithError(ExceptionUtils.unwrap(t));
return null;
});
}
@@ -489,10 +484,10 @@ class FoundationDbMessagePublisher {
return CompletableFuture.failedFuture(new IllegalStateException("Publisher already terminated"));
}
return FoundationDbUtil.safeRunAsync(database, transaction -> {
return database.runAsync(transaction -> {
transaction.set(presenceKey, FoundationDbMessageStore.getPresenceValue(clock.instant(), streamId));
return CompletableFuture.completedFuture(null);
});
}, FaultTolerantDatabase.Context.SET_PRESENCE);
}
@VisibleForTesting
@@ -501,11 +496,11 @@ class FoundationDbMessagePublisher {
renewPresenceFuture.cancel(true);
renewPresenceFuture.whenComplete((_, _) ->
FoundationDbUtil.safeRunAsync(database, transaction -> transaction.get(presenceKey).thenAccept(presenceValue -> {
database.runAsync(transaction -> transaction.get(presenceKey).thenAccept(presenceValue -> {
if (!isPresenceContested(presenceValue)) {
transaction.clear(presenceKey);
}
}))
}), FaultTolerantDatabase.Context.CLEAR_PRESENCE)
.whenComplete((_, throwable) -> {
if (throwable != null) {
LOGGER.warn("Failed to clear presence on disposal", throwable);
@@ -526,7 +521,7 @@ class FoundationDbMessagePublisher {
@VisibleForTesting
synchronized void terminateWithError(final Throwable throwable) {
if (state != State.TERMINATED && state != State.ERROR) {
if (state != State.TERMINATED && state != State.ERROR && !emitter.isCancelled()) {
setState(State.ERROR, Event.INTERNAL_TRIGGER);
emitter.error(throwable);
}
@@ -2,7 +2,6 @@ package org.whispersystems.textsecuregcm.storage.foundationdb;
import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.KeyArrayResult;
import com.apple.foundationdb.MutationType;
import com.apple.foundationdb.Range;
@@ -12,6 +11,7 @@ import com.apple.foundationdb.tuple.Tuple;
import com.apple.foundationdb.tuple.Versionstamp;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.hash.Hashing;
import com.google.protobuf.InvalidProtocolBufferException;
import io.dropwizard.util.DataSize;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.DistributionSummary;
@@ -19,6 +19,7 @@ import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Tag;
import io.micrometer.core.instrument.Tags;
import io.micrometer.core.instrument.Timer;
import java.io.UncheckedIOException;
import java.nio.ByteBuffer;
import java.time.Clock;
import java.time.Duration;
@@ -70,8 +71,8 @@ import reactor.util.function.Tuples;
/// * {versionstamp_2} => envelope_2
public class FoundationDbMessageStore {
private final Database[][] databasesByEpoch;
private final Map<Database, VersionstampClock> versionstampClocks;
private final FaultTolerantDatabase[][] databasesByEpoch;
private final Map<FaultTolerantDatabase, VersionstampClock> versionstampClocks;
private final int[] liveEpochs;
private final int activeEpoch;
private final VersionstampUUIDCipher versionstampUUIDCipher;
@@ -85,7 +86,7 @@ public class FoundationDbMessageStore {
private static final byte[] SERVER_ID = UUIDUtil.toBytes(UUID.randomUUID());
private static final int PRESENCE_VALUE_LENGTH = 28;
private static final Subspace MESSAGES_SUBSPACE = new Subspace(Tuple.from("M"));
public static final Subspace MESSAGES_SUBSPACE = new Subspace(Tuple.from("M"));
@VisibleForTesting
static final Duration PRESENCE_STALE_THRESHOLD = Duration.ofMinutes(5);
@@ -130,7 +131,7 @@ public class FoundationDbMessageStore {
boolean present) {
}
public FoundationDbMessageStore(final Map<Integer, List<Database>> databasesByEpochMap,
public FoundationDbMessageStore(final Map<Integer, List<FaultTolerantDatabase>> databasesByEpochMap,
final int activeEpoch,
final VersionstampUUIDCipher versionstampUUIDCipher,
final ScheduledExecutorService presenceRenewalExecutorService,
@@ -138,10 +139,10 @@ public class FoundationDbMessageStore {
final Duration batchPriorityTransactionTimeout,
final long batchPriorityTransactionRetryLimit) {
final Database[][] databasesByEpochArray = new Database[MAX_EPOCHS][];
final FaultTolerantDatabase[][] databasesByEpochArray = new FaultTolerantDatabase[MAX_EPOCHS][];
databasesByEpochMap.forEach((epoch, databases) ->
databasesByEpochArray[epoch] = databases.toArray(Database[]::new));
databasesByEpochArray[epoch] = databases.toArray(FaultTolerantDatabase[]::new));
this.databasesByEpoch = databasesByEpochArray;
this.liveEpochs = IntStream.range(0, MAX_EPOCHS).filter(e -> databasesByEpochArray[e] != null).toArray();
@@ -303,7 +304,7 @@ public class FoundationDbMessageStore {
}
return CompletableFuture.completedFuture(Optional.<Versionstamp>empty());
});
})
}, FaultTolerantDatabase.Context.INSERT_MESSAGE_BATCH)
.thenCompose(Function.identity())
.thenApply(maybeVersionstamp -> insertFuturesByAci.entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, entry -> {
@@ -394,28 +395,57 @@ public class FoundationDbMessageStore {
return databasesByEpoch[getConfigurationEpoch(versionstamp)][getShardId(versionstamp)].runAsync(transaction -> {
transaction.clear(messageKey);
return CompletableFuture.completedFuture(null);
})
}, FaultTolerantDatabase.Context.DELETE_MESSAGE)
.thenRun(() -> {
sample.stop(DELETE_MESSAGE_TIMER);
DELETE_MESSAGE_COUNTER.increment();
});
}
CompletableFuture<Optional<FoundationDbMessageStreamEntry.Message>> deleteAndGet(final AciServiceIdentifier aci, final byte deviceId, final UUID messageGuid) {
return deleteAndGet(aci, deviceId, versionstampUUIDCipher.decryptVersionstamp(messageGuid, aci.uuid(), deviceId));
}
CompletableFuture<Optional<FoundationDbMessageStreamEntry.Message>> deleteAndGet(final AciServiceIdentifier aci, final byte deviceId, final Versionstamp versionstamp) {
final Timer.Sample sample = Timer.start();
final byte[] messageKey = getDeviceQueueSubspace(aci, deviceId).pack(Tuple.from(versionstamp));
return databasesByEpoch[getConfigurationEpoch(versionstamp)][getShardId(versionstamp)].runAsync(
transaction -> transaction.get(messageKey)
.thenApply(value -> {
if (value == null) {
return Optional.<byte[]>empty();
}
transaction.clear(messageKey);
return Optional.of(value);
}), FaultTolerantDatabase.Context.DELETE_MESSAGE)
.whenComplete((_, _) -> sample.stop(DELETE_MESSAGE_TIMER))
.thenApply(maybeValue -> maybeValue.map(value -> {
DELETE_MESSAGE_COUNTER.increment();
try {
return new FoundationDbMessageStreamEntry.Message(versionstamp, MessageProtos.Envelope.parseFrom(value));
} catch (final InvalidProtocolBufferException e) {
throw new UncheckedIOException(e);
}
}));
}
public void clearAll(final AciServiceIdentifier aci) {
doForAllDatabasesWithMessages(aci, database -> database.run(transaction -> {
transaction.clear(getAccountSubspace(aci).range());
return null;
}));
}, FaultTolerantDatabase.Context.CLEAR_ACCOUNT_SUBSPACE));
}
public void clearAll(final AciServiceIdentifier aci, final byte deviceId) {
doForAllDatabasesWithMessages(aci, database -> database.run(transaction -> {
transaction.clear(getDeviceSubspace(aci, deviceId).range());
return null;
}));
}, FaultTolerantDatabase.Context.CLEAR_DEVICE_SUBSPACE));
}
private void doForAllDatabasesWithMessages(final AciServiceIdentifier aci, final Consumer<Database> action) {
private void doForAllDatabasesWithMessages(final AciServiceIdentifier aci, final Consumer<FaultTolerantDatabase> action) {
IntStream.range(0, databasesByEpoch.length)
.filter(epoch -> databasesByEpoch[epoch] != null)
.mapToObj(epoch -> databasesByEpoch[epoch][hashAciToShardNumber(aci, epoch)])
@@ -427,9 +457,9 @@ public class FoundationDbMessageStore {
return getMessages(aci, deviceId, Util.NOOP);
}
Database[] getDatabasesByEpochForAci(final AciServiceIdentifier aci) {
FaultTolerantDatabase[] getDatabasesByEpochForAci(final AciServiceIdentifier aci) {
// For each configured database epoch, which database held (or holds) the messages for this ACI/device pair?
final Database[] databasesForQueueByEpoch = new Database[databasesByEpoch.length];
final FaultTolerantDatabase[] databasesForQueueByEpoch = new FaultTolerantDatabase[databasesByEpoch.length];
for (final int epoch : liveEpochs) {
databasesForQueueByEpoch[epoch] = getShardForAci(aci, epoch);
@@ -443,7 +473,7 @@ public class FoundationDbMessageStore {
final byte deviceId,
final Runnable doAfterCleanup) {
final Database[] databasesForQueueByEpoch = getDatabasesByEpochForAci(aci);
final FaultTolerantDatabase[] databasesForQueueByEpoch = getDatabasesByEpochForAci(aci);
return new FoundationDbMessageStream(this,
aci,
@@ -489,7 +519,7 @@ public class FoundationDbMessageStore {
/// after it will not be. Deletion depends on the underlying [versionstamp clocks][VersionstampClock] being kept up to
/// date.
public void deleteMessagesBefore(final Map<AciServiceIdentifier, List<Byte>> accountDeviceIdentifiers, final Instant cutoffTime) {
final Map<Database, List<Subspace>> queueSubspacesToTrimByDatabase = new IdentityHashMap<>();
final Map<FaultTolerantDatabase, List<Subspace>> queueSubspacesToTrimByDatabase = new IdentityHashMap<>();
accountDeviceIdentifiers.forEach((aci, deviceIds) -> {
for (final byte deviceId : deviceIds) {
@@ -515,7 +545,7 @@ public class FoundationDbMessageStore {
new Range(queueSubspace.getKey(), queueSubspace.pack(Tuple.from(cutoffVersionstamp))));
}
return null;
}));
}, FaultTolerantDatabase.Context.CLEAR_EXPIRED_MESSAGES));
});
}
@@ -524,15 +554,14 @@ public class FoundationDbMessageStore {
}
@VisibleForTesting
Database getShardForAci(final AciServiceIdentifier aci, final int epoch) {
FaultTolerantDatabase getShardForAci(final AciServiceIdentifier aci, final int epoch) {
return getDatabases(epoch)[hashAciToShardNumber(aci, epoch)];
}
private Database[] getDatabases(final int epoch) {
private FaultTolerantDatabase[] getDatabases(final int epoch) {
if (databasesByEpoch[epoch] == null) {
throw new IllegalStateException("Epoch (%d) not in static configuration".formatted(epoch));
}
return databasesByEpoch[epoch];
}
@@ -575,9 +604,9 @@ public class FoundationDbMessageStore {
}
@VisibleForTesting
record QueueSizeAndRangeSplitPoints(long estimatedQueueSize, Map<Database, List<byte[]>> splitPointsByDatabase) {}
record QueueSizeAndRangeSplitPoints(long estimatedQueueSize, Map<FaultTolerantDatabase, List<byte[]>> splitPointsByDatabase) {}
private Flux<Database> getDistinctDatabasesForAci(final AciServiceIdentifier aci) {
private Flux<FaultTolerantDatabase> getDistinctDatabasesForAci(final AciServiceIdentifier aci) {
return Flux.fromStream(Arrays.stream(getDatabasesByEpochForAci(aci)).filter(Objects::nonNull).distinct());
}
@@ -590,7 +619,7 @@ public class FoundationDbMessageStore {
final Range deviceQueueRange = getDeviceQueueSubspace(aci, deviceId).range();
return getDistinctDatabasesForAci(aci)
.flatMap(database -> Mono.fromFuture(() -> FoundationDbUtil.safeRunAsync(database, transaction -> transaction.getEstimatedRangeSizeBytes(deviceQueueRange))))
.flatMap(database -> Mono.fromFuture(() -> database.runAsync(transaction -> transaction.getEstimatedRangeSizeBytes(deviceQueueRange), FaultTolerantDatabase.Context.ESTIMATE_QUEUE_SIZE)))
.reduce(0L, Long::sum);
}
@@ -615,17 +644,17 @@ public class FoundationDbMessageStore {
}
private CompletableFuture<Pair<Long, KeyArrayResult>> estimateQueueSizeAndRangeSplitsForDatabase(
final Database database,
final FaultTolerantDatabase database,
final AciServiceIdentifier aci,
final byte deviceId,
final long rangeSplitChunkSize) {
return FoundationDbUtil.safeRunAsync(database, transaction -> {
return database.runAsync( transaction -> {
final Range deviceQueueRange = getDeviceQueueSubspace(aci, deviceId).range();
final CompletableFuture<Long> estimatedQueueSizeFuture = transaction.getEstimatedRangeSizeBytes(deviceQueueRange);
final CompletableFuture<KeyArrayResult> rangeSplitPointsFuture = transaction.getRangeSplitPoints(deviceQueueRange, rangeSplitChunkSize);
return estimatedQueueSizeFuture.thenCombine(rangeSplitPointsFuture, Pair::new);
});
}, FaultTolerantDatabase.Context.ESTIMATE_QUEUE_SIZE_AND_RANGE_SPLITS);
}
public Mono<Void> trimQueue(final AciServiceIdentifier aci,
@@ -650,7 +679,7 @@ public class FoundationDbMessageStore {
return Mono.empty();
}
final List<Database> orderedDatabases;
final List<FaultTolerantDatabase> orderedDatabases;
{
// Trim messages from the database(s) in the inactive epoch(s) before trimming from the database in the active epoch
final List<Integer> orderedEpochsToTrim = new ArrayList<>(Arrays.stream(liveEpochs)
@@ -707,18 +736,23 @@ public class FoundationDbMessageStore {
});
}
private CompletableFuture<Void> trimQueue(final Database database, final Range range) {
return FoundationDbUtil.safeRunAsync(database, transaction -> {
private CompletableFuture<Void> trimQueue(final FaultTolerantDatabase database, final Range range) {
return database.runAsync(transaction -> {
transaction.options().setPriorityBatch();
transaction.options().setTimeout(batchPriorityTransactionTimeout.toMillis());
transaction.options().setRetryLimit(batchPriorityTransactionRetryLimit);
transaction.clear(range);
return CompletableFuture.completedFuture(null);
});
}, FaultTolerantDatabase.Context.TRIM_QUEUE);
}
private static Subspace getAccountSubspace(final AciServiceIdentifier aci) {
return MESSAGES_SUBSPACE.get(aci.uuid());
@VisibleForTesting
public static Subspace getAccountSubspace(final AciServiceIdentifier aci) {
return getAccountSubspace(MESSAGES_SUBSPACE, aci);
}
public static Subspace getAccountSubspace(final Subspace messagesSubspace, final AciServiceIdentifier aci) {
return messagesSubspace.get(aci.uuid());
}
@VisibleForTesting
@@ -2,7 +2,6 @@ package org.whispersystems.textsecuregcm.storage.foundationdb;
import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.KeySelector;
import com.apple.foundationdb.StreamingMode;
import com.apple.foundationdb.subspace.Subspace;
@@ -42,7 +41,7 @@ public class FoundationDbMessageStream implements MessageStream {
private final Subspace deviceQueueSubspace;
private final byte[] presenceKey;
private final byte[] messagesAvailableWatchKey;
private final Database[] databasesByEpoch;
private final FaultTolerantDatabase[] databasesByEpoch;
private final MessageGuidCodec messageGuidCodec;
/// The maximum number of messages we will fetch per range query operation to avoid excessive memory consumption
private final Flow.Publisher<MessageStreamEntry> messageStreamPublisher;
@@ -71,7 +70,7 @@ public class FoundationDbMessageStream implements MessageStream {
FoundationDbMessageStream(final FoundationDbMessageStore foundationDbMessageStore,
final AciServiceIdentifier aciServiceIdentifier,
final byte deviceId,
final Database[] databasesByEpoch,
final FaultTolerantDatabase[] databasesByEpoch,
final MessageGuidCodec messageGuidCodec,
final Runnable doAfterCleanup,
final ScheduledExecutorService presenceRenewalExecutorService,
@@ -126,7 +125,7 @@ public class FoundationDbMessageStream implements MessageStream {
private Flux<FoundationDbMessageStreamEntry> createFoundationDbMessagePublisher() {
// This may seem like an odd construction since it looks like we could also just do `Flux#fromArray`, but
// `Flux#fromArray` cannot handle `null` elements
final List<Database> databases = Arrays.stream(databasesByEpoch).filter(Objects::nonNull).distinct().toList();
final List<FaultTolerantDatabase> databases = Arrays.stream(databasesByEpoch).filter(Objects::nonNull).distinct().toList();
return Flux.fromIterable(databases)
.flatMap(database -> Mono.fromFuture(() -> getEndOfQueueKeyExclusive(database))
@@ -136,7 +135,7 @@ public class FoundationDbMessageStream implements MessageStream {
@SuppressWarnings("unchecked") final Flux<FoundationDbMessageStreamEntry.Message>[] finitePublishers =
endOfQueueKeysByDatabase.entrySet().stream()
.map(entry -> {
final Database database = entry.getKey();
final FaultTolerantDatabase database = entry.getKey();
final Optional<KeySelector> maybeEndOfQueueKeyExclusive = entry.getValue();
return maybeEndOfQueueKeyExclusive
@@ -165,7 +164,7 @@ public class FoundationDbMessageStream implements MessageStream {
@SuppressWarnings("unchecked") final Flux<FoundationDbMessageStreamEntry.Message>[] infinitePublishers =
endOfQueueKeysByDatabase.entrySet().stream()
.map(entry -> {
final Database database = entry.getKey();
final FaultTolerantDatabase database = entry.getKey();
final Optional<KeySelector> maybeEndOfQueueKeyExclusive = entry.getValue();
final KeySelector infinitePublisherBeginKey = maybeEndOfQueueKeyExclusive
@@ -204,9 +203,9 @@ public class FoundationDbMessageStream implements MessageStream {
/// subsequent scan.
///
/// @return a [KeySelector] for the first key greater than the current greatest key in the device queue.
private CompletableFuture<Optional<KeySelector>> getEndOfQueueKeyExclusive(final Database database) {
return FoundationDbUtil.safeRunAsync(database, transaction ->
transaction.getRange(deviceQueueSubspace.range(), 1, true, StreamingMode.EXACT).asList())
private CompletableFuture<Optional<KeySelector>> getEndOfQueueKeyExclusive(final FaultTolerantDatabase database) {
return database.runAsync(transaction ->
transaction.getRange(deviceQueueSubspace.range(), 1, true, StreamingMode.EXACT).asList(), FaultTolerantDatabase.Context.GET_END_OF_QUEUE)
.<Optional<KeySelector>>thenApply(items -> {
if (items.isEmpty()) {
return Optional.empty();
@@ -227,4 +226,17 @@ public class FoundationDbMessageStream implements MessageStream {
return foundationDbMessageStore.delete(aciServiceIdentifier, deviceId, messageGuid);
}
public CompletableFuture<Optional<MessageStreamEntry.Envelope>> acknowledgeAndGetMessage(final UUID messageGuid) {
messageAcknowledgedCounter.increment();
return foundationDbMessageStore.deleteAndGet(aciServiceIdentifier, deviceId, messageGuid)
.thenApply(foundationDbMessageStreamEntry -> foundationDbMessageStreamEntry.map(m -> {
final MessageStreamEntry messageStreamEntry = m.toMessageStreamEntry(messageGuidCodec);
if (!(messageStreamEntry instanceof MessageStreamEntry.Envelope)) {
throw new AssertionError("Expected MessageStreamEntry.Envelope, got " + messageStreamEntry);
}
return (MessageStreamEntry.Envelope) messageStreamEntry;
}));
}
}
@@ -1,24 +0,0 @@
package org.whispersystems.textsecuregcm.storage.foundationdb;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.Transaction;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
public class FoundationDbUtil {
/// Returns a cancellation-safe version of the result from [Database#runAsync(Function)]. Since the final stage
/// of the result from [Database#runAsync(Function)] is a cleanup stage that closes the transaction, the
/// transaction leaks if the future gets cancelled and the cleanup stage is skipped. So, we add another dummy stage
/// that serves as the cancellation target and the cleanup can proceed as normal.
///
/// @param database the FoundationDB database instance
/// @param retryable the block of transaction logic to execute
/// @param <T> the return type of retryable
/// @return a cancellation-safe version of the future returned from [Database#runAsync(Function)]
public static <T> CompletableFuture<T> safeRunAsync(final Database database,
final Function<? super Transaction, ? extends CompletableFuture<T>> retryable) {
return database.runAsync(retryable)
.thenApply(Function.identity());
}
}
@@ -5,7 +5,6 @@
package org.whispersystems.textsecuregcm.storage.foundationdb;
import com.apple.foundationdb.Database;
import com.apple.foundationdb.KeyValue;
import com.apple.foundationdb.MutationType;
import com.apple.foundationdb.subspace.Subspace;
@@ -29,15 +28,15 @@ public class VersionstampClock {
@VisibleForTesting
static final Subspace SUBSPACE = new Subspace(Tuple.from("V"));
private final Database database;
private final FaultTolerantDatabase database;
private final Clock clock;
public VersionstampClock(final Database database) {
public VersionstampClock(final FaultTolerantDatabase database) {
this(database, Clock.systemUTC());
}
@VisibleForTesting
public VersionstampClock(final Database database, final Clock clock) {
public VersionstampClock(final FaultTolerantDatabase database, final Clock clock) {
this.database = database;
this.clock = clock;
}
@@ -54,7 +53,7 @@ public class VersionstampClock {
Tuple.from(Versionstamp.incomplete()).packWithVersionstamp());
return transaction.getVersionstamp();
})
}, FaultTolerantDatabase.Context.RECORD_VERSIONSTAMP_AND_TIME)
.thenApply(Versionstamp::complete)
.join();
}
@@ -77,7 +76,7 @@ public class VersionstampClock {
}
return Optional.empty();
});
}, FaultTolerantDatabase.Context.READ_VERSIONSTAMP);
}
/// Remove any entries from the versionstamp-clock namespace that are strictly older than the given timestamp
@@ -87,7 +86,7 @@ public class VersionstampClock {
database.run(transaction -> {
transaction.clear(SUBSPACE.getKey(), getTimestampKey(oldestRetainedEntryTimestamp));
return null;
});
}, FaultTolerantDatabase.Context.CLEAR_EXPIRED_VERSIONSTAMPS);
}
private byte[] getTimestampKey(final Instant timestamp) {
@@ -14,7 +14,6 @@ import com.apple.itunes.storekit.model.Type;
import io.micrometer.core.instrument.Tags;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@@ -219,10 +218,10 @@ public class AppleAppStoreManager implements SubscriptionPaymentProcessor, OneTi
}
private SubscriptionPrice getSubscriptionPrice(final AppleAppStoreDecodedTransaction tx) {
final BigDecimal amount = new BigDecimal(tx.transaction().getPrice()).scaleByPowerOfTen(-3);
return new SubscriptionPrice(
tx.transaction().getCurrency().toUpperCase(Locale.ROOT),
SubscriptionCurrencyUtil.convertConfiguredAmountToApiAmount(tx.transaction().getCurrency(), amount));
SubscriptionCurrencyUtil.convertAppleMoneyToMinorUnits(
tx.transaction().getCurrency(), tx.transaction().getPrice()));
}
private ReceiptLevel getLevel(final JWSTransactionDecodedPayload tx) {
Loaded 100 of 199 files, more files were not shown because too many files have changed in this diff. Show more