Compare commits

...

14 Commits

Author SHA1 Message Date
Daniel García e45dab2fa2
Merge branch 'main' into passkey-login 2 days ago
Daniel García ec005eba90
Resend the verification email on passkey login 2 days ago
Mathijs van Veluw dbd7829ed1
Misc updates and fixes (#8006) 3 days ago
Daniel García b91cab3c24
Update web vault to v2026.11.0, Playwright tests and dependencies (#8002) 4 days ago
Daniel García b12874bd83
Align several API responses and request checks with upstream (#8001) 4 days ago
Steven Haigh 07c6b00da7
Support IPC on Web UI for sync (un)lock (#8000) 4 days ago
Tom 384fe6b442
Add the Autotype GA policy (policy 23) (#7994) 4 days ago
Timshel 6f7a7f7034
Improve Playwright tests (#7752) 5 days ago
maximilize cdf2035433
Do not fail login when push device registration fails (#7378) 5 days ago
Timshel 010c269e37
Improve and expand kdf_upgrade (#7855) 5 days ago
Tom c6e7da4b5c
Add the Send controls policy (policy 21) (#7519) 5 days ago
Steven Haigh 0a4909cfe0
Start support for sync (un)lock in 2026.11.0 onwards (#7986) 5 days ago
Dan Molik 2c9b7c06a9
Return an error instead of panicking on invalid attachment/cipher input (#7989) 5 days ago
Mathijs van Veluw baff1cabae
Misc updates (#7980) 1 week ago
  1. 14
      .env.template
  2. 3
      .github/workflows/build.yml
  3. 12
      .github/workflows/release.yml
  4. 7
      .github/workflows/sdk-live-tests.yml
  5. 2
      .github/workflows/trivy.yml
  6. 2
      .github/workflows/typos.yml
  7. 2
      .github/workflows/zizmor.yml
  8. 2
      .pre-commit-config.yaml
  9. 5
      .typos.toml
  10. 250
      Cargo.lock
  11. 10
      Cargo.toml
  12. 1
      THREAT_MODEL.md
  13. 4
      docker/DockerSettings.yaml
  14. 12
      docker/Dockerfile.alpine
  15. 12
      docker/Dockerfile.debian
  16. 2
      playwright/README.md
  17. 6
      playwright/compose/playwright/Dockerfile
  18. 2
      playwright/compose/warden/build.sh
  19. 16
      playwright/docker-compose.yml
  20. 8
      playwright/global-utils.ts
  21. 1394
      playwright/package-lock.json
  22. 10
      playwright/package.json
  23. 5
      playwright/playwright.config.ts
  24. 2
      playwright/test.env
  25. 2
      playwright/tests/collection.spec.ts
  26. 21
      playwright/tests/cyphers.spec.ts
  27. 12
      playwright/tests/organization.smtp.spec.ts
  28. 4
      playwright/tests/secrets.spec.ts
  29. 4
      playwright/tests/send.spec.ts
  30. 17
      playwright/tests/setups/orgs.ts
  31. 4
      playwright/tests/sso_organization.spec.ts
  32. 4
      src/api/admin.rs
  33. 129
      src/api/core/accounts.rs
  34. 63
      src/api/core/ciphers.rs
  35. 78
      src/api/core/organizations.rs
  36. 59
      src/api/core/sends.rs
  37. 4
      src/api/core/two_factor/authenticator.rs
  38. 4
      src/api/core/two_factor/duo.rs
  39. 4
      src/api/core/two_factor/email.rs
  40. 5
      src/api/core/two_factor/mod.rs
  41. 22
      src/api/core/two_factor/webauthn.rs
  42. 5
      src/api/core/two_factor/yubikey.rs
  43. 14
      src/api/core/webauthn_login.rs
  44. 30
      src/api/icons.rs
  45. 64
      src/api/identity.rs
  46. 4
      src/api/mod.rs
  47. 69
      src/config.rs
  48. 21
      src/db/models/auth_request.rs
  49. 6
      src/db/models/collection.rs
  50. 56
      src/db/models/org_policy.rs
  51. 289
      src/db/models/org_policy/send_controls.rs
  52. 6
      src/db/models/organization.rs
  53. 33
      src/db/models/user.rs
  54. 5
      src/sso_client.rs
  55. 664
      src/static/global_domains.json
  56. BIN
      src/static/images/fallback-icon.png
  57. 4
      src/static/scripts/datatables.css
  58. 78
      src/static/scripts/datatables.js
  59. 8
      src/util.rs

14
.env.template

@ -338,6 +338,8 @@
## "local" accepts it from any non global address, which covers a reverse proxy running on the same ## "local" accepts it from any non global address, which covers a reverse proxy running on the same
## host or container network. Use "all" to accept it from anywhere, or list the addresses of your ## host or container network. Use "all" to accept it from anywhere, or list the addresses of your
## proxy as IPs and CIDR ranges if it connects from a public address. ## proxy as IPs and CIDR ranges if it connects from a public address.
## Non global addresses include the 6to4, Teredo and local-use NAT64 ranges, which can carry clients from anywhere:
## if those can reach Vaultwarden, list your proxy instead of using "local", or those clients can set the header.
## For a list header like X-Forwarded-For, the client IP is the rightmost address that isn't one of ## For a list header like X-Forwarded-For, the client IP is the rightmost address that isn't one of
## these proxies, so with several proxies in a row (a CDN in front of nginx, for example) list all of them. ## these proxies, so with several proxies in a row (a CDN in front of nginx, for example) list all of them.
# IP_HEADER_TRUSTED_PROXIES=local # IP_HEADER_TRUSTED_PROXIES=local
@ -383,6 +385,7 @@
## Enabling this will cause the internal HTTP client to refuse to connect to any non-global IP address. ## Enabling this will cause the internal HTTP client to refuse to connect to any non-global IP address.
## Useful to secure your internal environment: See https://en.wikipedia.org/wiki/Reserved_IP_addresses for a list of IPs which it will block ## Useful to secure your internal environment: See https://en.wikipedia.org/wiki/Reserved_IP_addresses for a list of IPs which it will block
## Requests through an outbound proxy (HTTP_PROXY, HTTPS_PROXY or ALL_PROXY) aren't checked, because the proxy resolves the names.
# HTTP_REQUEST_BLOCK_NON_GLOBAL_IPS=true # HTTP_REQUEST_BLOCK_NON_GLOBAL_IPS=true
## Client Settings ## Client Settings
@ -406,6 +409,8 @@
## - "pm-30529-webauthn-related-origins": Allow passkeys stored in the vault to be used on related origins listed in a site's /.well-known/webauthn file (Browser >= 2026.2.0) ## - "pm-30529-webauthn-related-origins": Allow passkeys stored in the vault to be used on related origins listed in a site's /.well-known/webauthn file (Browser >= 2026.2.0)
## - "pm-32009-new-item-types": Enable new item types: Bank Account, Driver's License, and Passport (Clients >= 2026.4.0) ## - "pm-32009-new-item-types": Enable new item types: Bank Account, Driver's License, and Passport (Clients >= 2026.4.0)
## - "pm-34171-card-scanner": Enable the new card scanner feature on mobile (Android >= 2026.4.1, iOS >= 2026.4.1) ## - "pm-34171-card-scanner": Enable the new card scanner feature on mobile (Android >= 2026.4.1, iOS >= 2026.4.1)
## - "pm-31885-send-controls": Use the Send controls policy, which replaces the Remove Send and Send options policies (Web vault >= 2026.4.0, Android >= 2026.8.0, iOS >= 2026.7.1)
## The web vault, browser, desktop and CLI clients after 2026.10 always use it, only older versions and the mobile apps still read this flag.
## - "enable-basic-auth-response": Enable HTTP Basic Auth autofill in the browser extension (Browser >= 2026.9.0) ## - "enable-basic-auth-response": Enable HTTP Basic Auth autofill in the browser extension (Browser >= 2026.9.0)
## - "undetermined-cipher-scenario-logic": Enable the rewritten add/update login notification triggering logic in the browser extension (Browser >= 2026.2.0) ## - "undetermined-cipher-scenario-logic": Enable the rewritten add/update login notification triggering logic in the browser extension (Browser >= 2026.2.0)
## - "biometrics-sdk-ipc": Enable biometric unlock over the SDK IPC framework (Desktop >= 2026.9.0, Browser >= 2026.9.0) ## - "biometrics-sdk-ipc": Enable biometric unlock over the SDK IPC framework (Desktop >= 2026.9.0, Browser >= 2026.9.0)
@ -415,6 +420,8 @@
## - "pm-27278-v2-password-registration": Register new accounts with v2 encryption. (Web >= 2026.6.4, Desktop/Browser/CLI >= 2026.7.0, Android >= 2026.4.1, iOS >= 2026.5.1) ## - "pm-27278-v2-password-registration": Register new accounts with v2 encryption. (Web >= 2026.6.4, Desktop/Browser/CLI >= 2026.7.0, Android >= 2026.4.1, iOS >= 2026.5.1)
## - "enable-account-encryption-v2-jit-password-registration": Give SSO users who set their master password on their first login v2 encryption. (Web >= 2026.1.1, Desktop/Browser/CLI >= 2026.1.0, Android >= 2026.4.1, iOS >= 2026.6.0) ## - "enable-account-encryption-v2-jit-password-registration": Give SSO users who set their master password on their first login v2 encryption. (Web >= 2026.1.1, Desktop/Browser/CLI >= 2026.1.0, Android >= 2026.4.1, iOS >= 2026.6.0)
## These two flags can't be undone: a v2 account stays v2, and it can only log in from clients that are 2026.10.1 or newer (2026.10.2 for the desktop app), so the versions above are only enough to create one. ## These two flags can't be undone: a v2 account stays v2, and it can only log in from clients that are 2026.10.1 or newer (2026.10.2 for the desktop app), so the versions above are only enough to create one.
## - "innovation-sprint-shared-unlock-part-2": Enable shared unlock between extension / web / desktop in >= 2026.11.0
## - "content-script-ipc-channel-framework": Enable shared unlock on the web UI in web builds >= 2026.11.0
# EXPERIMENTAL_CLIENT_FEATURE_FLAGS= # EXPERIMENTAL_CLIENT_FEATURE_FLAGS=
## Require new device emails. When a user logs in an email is required to be sent. ## Require new device emails. When a user logs in an email is required to be sent.
@ -520,7 +527,7 @@
## Enforce that the Single Org policy is enabled before setting the Reset Password policy ## Enforce that the Single Org policy is enabled before setting the Reset Password policy
## Bitwarden enforces this by default. In Vaultwarden we encouraged to use multiple organizations because groups were not available. ## Bitwarden enforces this by default. In Vaultwarden we encouraged to use multiple organizations because groups were not available.
## Setting this to true will enforce the Single Org Policy to be enabled before you can enable the Reset Password policy. ## Setting this to true will enforce the Single Org Policy to be enabled before you can enable the Reset Password policy.
# ENFORCE_SINGLE_ORG_WITH_RESET_PW_POLICY=false # ENFORCE_SINGLE_ORG_WITH_RESET_PW_POLICY=true
## Prefer IPv6 (AAAA) resolving ## Prefer IPv6 (AAAA) resolving
## This settings configures the DNS resolver to resolve IPv6 first, and if not available try IPv4 ## This settings configures the DNS resolver to resolve IPv6 first, and if not available try IPv4
@ -641,6 +648,11 @@
## Keep in mind that when a server drifts out of time, valid codes could be marked as invalid. ## Keep in mind that when a server drifts out of time, valid codes could be marked as invalid.
## In any case, if a code has been used it can not be used again, also codes which predates it will be invalid. ## In any case, if a code has been used it can not be used again, also codes which predates it will be invalid.
# AUTHENTICATOR_DISABLE_TIME_DRIFT=false # AUTHENTICATOR_DISABLE_TIME_DRIFT=false
##
## WebAuthn Settings
## Enable WebAuthn 2FA prefer user verification
## Sets user verification to preferred instead of discouraged, improving compatibility with some security keys.
WEBAUTHN_2FA_PREFER_USER_VERIFICATION=false
## Passkey login extra origins ## Passkey login extra origins
## Origins that may log in with a passkey besides the vault and the official Chromium extensions (Chrome Web Store, ## Origins that may log in with a passkey besides the vault and the official Chromium extensions (Chrome Web Store,

3
.github/workflows/build.yml

@ -120,6 +120,9 @@ jobs:
# Set as the default toolchain # Set as the default toolchain
rustup default "${RUST_TOOLCHAIN}" rustup default "${RUST_TOOLCHAIN}"
# rust-cache keys on every installed toolchain, so the runner image's stable would change the key on each image update
rustup toolchain uninstall stable
# Show environment # Show environment
- name: "Show environment" - name: "Show environment"
run: | run: |

12
.github/workflows/release.yml

@ -106,7 +106,7 @@ jobs:
# Login to Docker Hub # Login to Docker Hub
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0 uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
@ -121,7 +121,7 @@ jobs:
# Login to GitHub Container Registry # Login to GitHub Container Registry
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0 uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
@ -137,7 +137,7 @@ jobs:
# Login to Quay.io # Login to Quay.io
- name: Login to Quay.io - name: Login to Quay.io
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0 uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with: with:
registry: quay.io registry: quay.io
username: ${{ secrets.QUAY_USERNAME }} username: ${{ secrets.QUAY_USERNAME }}
@ -272,7 +272,7 @@ jobs:
# Login to Docker Hub # Login to Docker Hub
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0 uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
@ -287,7 +287,7 @@ jobs:
# Login to GitHub Container Registry # Login to GitHub Container Registry
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0 uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
@ -303,7 +303,7 @@ jobs:
# Login to Quay.io # Login to Quay.io
- name: Login to Quay.io - name: Login to Quay.io
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # v4.7.0 uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with: with:
registry: quay.io registry: quay.io
username: ${{ secrets.QUAY_USERNAME }} username: ${{ secrets.QUAY_USERNAME }}

7
.github/workflows/sdk-live-tests.yml

@ -1,5 +1,8 @@
name: SDK live tests name: SDK live tests
permissions: {} permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# Runs the live-server end-to-end tests of bitwarden/sdk-internal against this branch, see tools/sdk-live-tests/run.sh. # Runs the live-server end-to-end tests of bitwarden/sdk-internal against this branch, see tools/sdk-live-tests/run.sh.
# By default it tests the latest @bitwarden/sdk-internal on npm, which the SDK publishes for every commit to its main # By default it tests the latest @bitwarden/sdk-internal on npm, which the SDK publishes for every commit to its main
@ -104,6 +107,8 @@ jobs:
rustup target add wasm32-unknown-unknown rustup target add wasm32-unknown-unknown
rustup component add rust-src rustup component add rust-src
fi fi
# rust-cache keys on every installed toolchain, so the runner image's stable would change the key on each image update
rustup toolchain uninstall stable
# One cache per SDK source, so that neither restores the other's. # One cache per SDK source, so that neither restores the other's.
# Only save caches on main to save cache space. # Only save caches on main to save cache space.
@ -128,7 +133,7 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/main' }} save-if: ${{ github.ref == 'refs/heads/main' }}
- name: "Setup Node" - name: "Setup Node"
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with: with:
node-version-file: sdk-internal/.nvmrc node-version-file: sdk-internal/.nvmrc

2
.github/workflows/trivy.yml

@ -50,6 +50,6 @@ jobs:
severity: CRITICAL,HIGH severity: CRITICAL,HIGH
- name: Upload Trivy scan results to GitHub Security tab - name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1 uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with: with:
sarif_file: 'trivy-results.sarif' sarif_file: 'trivy-results.sarif'

2
.github/workflows/typos.yml

@ -23,4 +23,4 @@ jobs:
# When this version is updated, do not forget to update this in `.pre-commit-config.yaml` too # When this version is updated, do not forget to update this in `.pre-commit-config.yaml` too
- name: Spell Check Repo - name: Spell Check Repo
uses: crate-ci/typos@7f9d0819ca1c008ade73f4b41fa9d258d48f605b # v1.51.1 uses: crate-ci/typos@276087d9a4f06398b3e04825487805e2d7375888 # v1.52.2

2
.github/workflows/zizmor.yml

@ -24,7 +24,7 @@ jobs:
persist-credentials: false persist-credentials: false
- name: Run zizmor - name: Run zizmor
uses: zizmorcore/zizmor-action@53290badfa369cb0bf7ad16342cb62c2fa47ac7b # v0.8.0 uses: zizmorcore/zizmor-action@45d7276c9ca790aabd705e31ca99c6185c3e76dd # v0.8.1
with: with:
# intentionally not scanning the entire repository, # intentionally not scanning the entire repository,
# since it contains integration tests. # since it contains integration tests.

2
.pre-commit-config.yaml

@ -18,7 +18,7 @@ repos:
# When this version is updated, do not forget to update this in `.github/workflows/typos.yaml` too # When this version is updated, do not forget to update this in `.github/workflows/typos.yaml` too
- repo: https://github.com/crate-ci/typos - repo: https://github.com/crate-ci/typos
rev: 7f9d0819ca1c008ade73f4b41fa9d258d48f605b # v1.51.1 rev: 276087d9a4f06398b3e04825487805e2d7375888 # v1.52.2
hooks: hooks:
- id: typos - id: typos
always_run: true always_run: true

5
.typos.toml

@ -1,7 +1,8 @@
[files] [files]
extend-exclude = [ extend-exclude = [
".git/", ".git/**",
"playwright/", "target/**",
"playwright/**",
"*.js", # Ignore all JavaScript files "*.js", # Ignore all JavaScript files
"!admin*.js", # Except our own JavaScript files "!admin*.js", # Except our own JavaScript files
] ]

250
Cargo.lock

@ -10,11 +10,12 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]] [[package]]
name = "ahash" name = "ahash"
version = "0.8.12" version = "0.8.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" checksum = "0fca89247609239eeb6915e6991111866b92d7b31025e69302bbf430cc4d2c38"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"getrandom 0.4.3",
"once_cell", "once_cell",
"version_check", "version_check",
"zerocopy", "zerocopy",
@ -61,9 +62,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.104" version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" checksum = "2cb931c189b85683d69a5cfad41d4d418671e1ac413dd209f3f2fc31e3cfd902"
[[package]] [[package]]
name = "ar_archive_writer" name = "ar_archive_writer"
@ -159,9 +160,9 @@ dependencies = [
[[package]] [[package]]
name = "async-compression" name = "async-compression"
version = "0.4.52" version = "0.4.53"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ad47a740fb906fffdd891e8b6d5fde2511600f7bfaebd68939fa08a14999459" checksum = "7bde8322bfc31ade96978b8d3c06be0fd60401192e7ddb9a0b2de5e215d22e61"
dependencies = [ dependencies = [
"compression-codecs", "compression-codecs",
"compression-core", "compression-core",
@ -279,7 +280,7 @@ dependencies = [
"futures-core", "futures-core",
"futures-io", "futures-io",
"futures-lite", "futures-lite",
"gloo-timers", "gloo-timers 0.3.0",
"kv-log-macro", "kv-log-macro",
"log", "log",
"memchr", "memchr",
@ -335,6 +336,12 @@ version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d2050892d4691cf110586070786712b504985a4d37ed64a9cd8a402718e1706" checksum = "5d2050892d4691cf110586070786712b504985a4d37ed64a9cd8a402718e1706"
[[package]]
name = "asyncband"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e53c31fb18f42e765610b2146531390e56966f601d8ffca530d292a34fe4218"
[[package]] [[package]]
name = "atomic" name = "atomic"
version = "0.6.1" version = "0.6.1"
@ -474,9 +481,9 @@ dependencies = [
[[package]] [[package]]
name = "aws-sdk-sts" name = "aws-sdk-sts"
version = "1.127.0" version = "1.128.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35d50661cd8816b7f23a652391c5b6f3645fce499e62e8fc5b3ed4145c5248f7" checksum = "29c357588cdf8c9ae96c0d9930fff757f9b678d06b8f68d8e37a1278fe034912"
dependencies = [ dependencies = [
"arc-swap", "arc-swap",
"aws-credential-types", "aws-credential-types",
@ -648,9 +655,9 @@ dependencies = [
[[package]] [[package]]
name = "aws-smithy-types" name = "aws-smithy-types"
version = "1.9.4" version = "1.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aff4bf014c512840b2bba80a20417b723cbd6a0a65c02e2d81f50b4268aedfc7" checksum = "2085f9721fb3755821f8db7611a67ed15f4d6fdba6785b4db8ed7cd18eebee0f"
dependencies = [ dependencies = [
"base64-simd", "base64-simd",
"bytes", "bytes",
@ -822,9 +829,9 @@ dependencies = [
[[package]] [[package]]
name = "brotli-decompressor" name = "brotli-decompressor"
version = "6.3.2" version = "6.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc031cd87c6529082b0b65c604e86af0ed7744841b17ccfe60b1e31fa606179e" checksum = "664148598c930650998ef56df301329ffe7b4cdb02d49b2a3fca3bcaf2185bcb"
dependencies = [ dependencies = [
"alloc-no-stdlib", "alloc-no-stdlib",
"alloc-stdlib", "alloc-stdlib",
@ -875,9 +882,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.11.2" version = "1.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ef9e3e8154a45c7a95cff4c1299702106ad94062d7bb85fdc5d3a5afd91d45" checksum = "02f0e023adb368345ce0ca6cdfc0f24a06554468d0e8503e14a0841de79bfa69"
dependencies = [ dependencies = [
"find-msvc-tools", "find-msvc-tools",
"jobserver", "jobserver",
@ -956,9 +963,9 @@ dependencies = [
[[package]] [[package]]
name = "compression-codecs" name = "compression-codecs"
version = "0.4.47" version = "0.4.48"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84f840cff84d10085260e460023934d0af699e71212b09b2a41452e8bd9cda43" checksum = "5e41632c2efd201c62f1432f7cbee121b97878eab579da9d85676573d1fd33b9"
dependencies = [ dependencies = [
"brotli", "brotli",
"compression-core", "compression-core",
@ -997,21 +1004,20 @@ checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a"
[[package]] [[package]]
name = "const-random" name = "const-random"
version = "0.1.18" version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" checksum = "d38d4bb3e79c716fd0330d8da84171b0135e59e01076e99f22b75a64c56e952c"
dependencies = [ dependencies = [
"const-random-macro", "const-random-macro",
] ]
[[package]] [[package]]
name = "const-random-macro" name = "const-random-macro"
version = "0.1.16" version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" checksum = "d66bb491e9fc48cb3fed9d57df886880a751d540d645ebc86b6d9d35b8fa8457"
dependencies = [ dependencies = [
"getrandom 0.2.17", "getrandom 0.4.3",
"once_cell",
"tiny-keccak", "tiny-keccak",
] ]
@ -1026,9 +1032,9 @@ dependencies = [
[[package]] [[package]]
name = "cookie" name = "cookie"
version = "0.18.2" version = "0.18.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a373e3602691c3cdea496d2f0ee5935151e6168fe87739483c463db1b2f2f87" checksum = "d55f2d6c30eeec7d5c6f98bd4395d4abb1895629eab97ee6522d340623615f8a"
dependencies = [ dependencies = [
"percent-encoding", "percent-encoding",
"time", "time",
@ -1121,9 +1127,9 @@ dependencies = [
[[package]] [[package]]
name = "crc32fast" name = "crc32fast"
version = "1.5.5" version = "1.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64" checksum = "fd9ae8fcb3ea71b0b26338b4ffb13006bb175de8fd07921089a906ce7e5e6945"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
] ]
@ -1894,9 +1900,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]] [[package]]
name = "form_urlencoded" name = "form_urlencoded"
version = "1.2.2" version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e"
dependencies = [ dependencies = [
"percent-encoding", "percent-encoding",
] ]
@ -1990,6 +1996,10 @@ name = "futures-timer"
version = "3.0.4" version = "3.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af43fadb8a98512d547e37b4e92e0ced13e205c061b87b4623eff01d918d6968" checksum = "af43fadb8a98512d547e37b4e92e0ced13e205c061b87b4623eff01d918d6968"
dependencies = [
"gloo-timers 0.4.1",
"send_wrapper",
]
[[package]] [[package]]
name = "futures-util" name = "futures-util"
@ -2090,6 +2100,18 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "gloo-timers"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4460540da666acdb5722b2a62ac47d18f627fcfc0c728d04dc7226b3f6d40a7"
dependencies = [
"futures-channel",
"futures-core",
"js-sys",
"wasm-bindgen",
]
[[package]] [[package]]
name = "governor" name = "governor"
version = "0.10.4" version = "0.10.4"
@ -2213,9 +2235,9 @@ dependencies = [
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.17.1" version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" checksum = "735eaa21a6a5ffb2e84362faaeb90c05ba8e19797ca30428478cb6ea3a4921bc"
[[package]] [[package]]
name = "heck" name = "heck"
@ -2409,9 +2431,9 @@ dependencies = [
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "1.12.0" version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" checksum = "229c6ff5584df4c6becbfe00567128bac768c8cd32ebc8a8366bd81ed072e8f3"
dependencies = [ dependencies = [
"atomic-waker", "atomic-waker",
"bytes", "bytes",
@ -2622,7 +2644,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown 0.17.1", "hashbrown 0.17.2",
"serde", "serde",
"serde_core", "serde_core",
] ]
@ -2687,9 +2709,9 @@ version = "0.2.46"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "175dc66334db3b9ab9985bf8b61cfed50dc16d20964bb47f9e479adcae984a7f" checksum = "175dc66334db3b9ab9985bf8b61cfed50dc16d20964bb47f9e479adcae984a7f"
dependencies = [ dependencies = [
"jiff-core", "jiff-core 0.1.8",
"jiff-static", "jiff-static 0.2.46",
"jiff-tzdb-platform", "jiff-tzdb-platform 0.1.3",
"js-sys", "js-sys",
"log", "log",
"portable-atomic", "portable-atomic",
@ -2699,6 +2721,22 @@ dependencies = [
"windows-link", "windows-link",
] ]
[[package]]
name = "jiff"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "107f2e89536b6818514025f6787b0d94d819e54fe3b40365275fc753de485b3f"
dependencies = [
"jiff-core 1.0.2",
"jiff-static 1.0.3",
"jiff-tzdb-platform 1.0.0",
"log",
"portable-atomic",
"portable-atomic-util",
"serde_core",
"windows-link",
]
[[package]] [[package]]
name = "jiff-core" name = "jiff-core"
version = "0.1.8" version = "0.1.8"
@ -2708,31 +2746,67 @@ dependencies = [
"log", "log",
] ]
[[package]]
name = "jiff-core"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d44c923edf2bf456a982253f1a9ee1f6e89e421dffd0065d9b9a581da0def58f"
dependencies = [
"log",
]
[[package]] [[package]]
name = "jiff-static" name = "jiff-static"
version = "0.2.46" version = "0.2.46"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7b1af7547d47354bc438d797e3854601bde8f8d185780c5ba4ab27afa54f1ba" checksum = "c7b1af7547d47354bc438d797e3854601bde8f8d185780c5ba4ab27afa54f1ba"
dependencies = [ dependencies = [
"jiff-core", "jiff-core 0.1.8",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.119", "syn 2.0.119",
] ]
[[package]]
name = "jiff-static"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4996f71e569e3a3e32b925c28ef8f0027dc30bb1d594b33eeda409eea185f5c8"
dependencies = [
"jiff-core 1.0.2",
"proc-macro2",
"quote",
"syn 3.0.10",
]
[[package]] [[package]]
name = "jiff-tzdb" name = "jiff-tzdb"
version = "0.1.10" version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0980fca2cc272465bd60e82397607ba9f33add9e48defd77923301bbd03808f2" checksum = "0980fca2cc272465bd60e82397607ba9f33add9e48defd77923301bbd03808f2"
[[package]]
name = "jiff-tzdb"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12e71a1b68a875a44a33bb7a1dd84392cb77145a3367a552a3cfe6a4f5cf3afc"
[[package]] [[package]]
name = "jiff-tzdb-platform" name = "jiff-tzdb-platform"
version = "0.1.3" version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8"
dependencies = [ dependencies = [
"jiff-tzdb", "jiff-tzdb 0.1.10",
]
[[package]]
name = "jiff-tzdb-platform"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc65b284afcfa8f6cf189c7274c805505314a7ab975c60e1f548bff56525420e"
dependencies = [
"jiff-tzdb 1.0.0",
] ]
[[package]] [[package]]
@ -3029,7 +3103,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec54a4ea92c533f8ed6b8c80dc4bbd60f5b578b173399d92f19bfb5a34bd99a3" checksum = "ec54a4ea92c533f8ed6b8c80dc4bbd60f5b578b173399d92f19bfb5a34bd99a3"
dependencies = [ dependencies = [
"serde", "serde",
"toml 1.2.1+spec-1.1.0", "toml 1.2.2+spec-1.1.0",
] ]
[[package]] [[package]]
@ -3365,12 +3439,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33d5a635dfea36a7a0c3bbb2ca34c97af17f98dd69b0cdf31a1d436a346e0a12" checksum = "33d5a635dfea36a7a0c3bbb2ca34c97af17f98dd69b0cdf31a1d436a346e0a12"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"asyncband", "asyncband 0.7.4",
"base64 0.23.1", "base64 0.23.1",
"bytes", "bytes",
"futures", "futures",
"http 1.5.0", "http 1.5.0",
"jiff", "jiff 0.2.46",
"log", "log",
"md-5", "md-5",
"percent-encoding", "percent-encoding",
@ -3855,9 +3929,9 @@ checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.17" version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752"
[[package]] [[package]]
name = "pin-utils" name = "pin-utils"
@ -3978,9 +4052,9 @@ dependencies = [
[[package]] [[package]]
name = "pq-sys" name = "pq-sys"
version = "0.7.8" version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "297a95d6f2378891f949d9556723e15140e50d29eac07458dabcee8688995b1d" checksum = "b3bc77e8957fcd07d9768dc26486b07e39339693e21d3c5564be908ef6911540"
dependencies = [ dependencies = [
"libc", "libc",
"pkg-config", "pkg-config",
@ -4325,12 +4399,15 @@ dependencies = [
[[package]] [[package]]
name = "reqsign-aws-core" name = "reqsign-aws-core"
version = "3.2.0" version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d38c902d8ec745bd9eadd1abbcbe227f4c1fc2926b2ec8929f89234af3114500" checksum = "163fc123fc7cf763a7c7f00f56825100e5dba5002c682eaa46f0bcd789d01bcd"
dependencies = [ dependencies = [
"asyncband 0.8.0",
"bytes", "bytes",
"form_urlencoded", "form_urlencoded",
"futures",
"futures-timer",
"hex", "hex",
"http 1.5.0", "http 1.5.0",
"log", "log",
@ -4346,9 +4423,9 @@ dependencies = [
[[package]] [[package]]
name = "reqsign-aws-v4" name = "reqsign-aws-v4"
version = "3.3.1" version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "906bfd028f96bfe73fdb892ce26f3b3f99b4f30feb9bd024be58bd6657f68b2b" checksum = "acf0c8db7ea8b38ef70375e273b4992227f8c2e57ee8f0df2201b41ccbf1d7c1"
dependencies = [ dependencies = [
"bytes", "bytes",
"http 1.5.0", "http 1.5.0",
@ -4361,18 +4438,18 @@ dependencies = [
[[package]] [[package]]
name = "reqsign-core" name = "reqsign-core"
version = "3.3.2" version = "3.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85fed85c436b6b920e4b36310f699a77771a91e38ae483df48447bd7d162671c" checksum = "a1eb4e857da46e242365c17ad0bc8ed2899d7c04b38add449c21a309b8776786"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"asyncband", "asyncband 0.8.0",
"base64 0.23.1", "base64 0.23.1",
"bytes", "bytes",
"hex", "hex",
"hmac 0.13.0", "hmac 0.13.0",
"http 1.5.0", "http 1.5.0",
"jiff", "jiff 1.0.3",
"log", "log",
"percent-encoding", "percent-encoding",
"sha1 0.11.0", "sha1 0.11.0",
@ -4382,9 +4459,9 @@ dependencies = [
[[package]] [[package]]
name = "reqsign-file-read-tokio" name = "reqsign-file-read-tokio"
version = "3.0.7" version = "3.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "586a8e198057773f9616901fd723a4bc186812b9765bc0f20368661d6169d906" checksum = "686019cebfbebec6a07da664ff3aece6c3214bb3537687aac6eb2da3d31b516f"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"reqsign-core", "reqsign-core",
@ -4486,9 +4563,9 @@ dependencies = [
[[package]] [[package]]
name = "rocket" name = "rocket"
version = "0.5.3" version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a6f52722cade6c6423d6ad9ee5560a9ca2d888894f1bfef97f5b7f61c84f16b" checksum = "b994aab1e1d2342ede2ee7a9be3aa18fc9eaa1c819d9a4b83cb6c5899f345bf8"
dependencies = [ dependencies = [
"async-stream", "async-stream",
"async-trait", "async-trait",
@ -4524,9 +4601,9 @@ dependencies = [
[[package]] [[package]]
name = "rocket_codegen" name = "rocket_codegen"
version = "0.5.3" version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0df92d0cfe50ffd2b125dc8f5aa6ecbfa85f9e5f87aeceb46ca2fed8260d4fb" checksum = "45c73d9cca43eac063ffb1e7f6b2ba52c777d8c5e63dbc6268610e3c8e217154"
dependencies = [ dependencies = [
"devise", "devise",
"glob", "glob",
@ -4542,9 +4619,9 @@ dependencies = [
[[package]] [[package]]
name = "rocket_http" name = "rocket_http"
version = "0.5.3" version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92f626b274f1d3ade7e1162782e99dd920d04f797ea820ef75f3ffa5e8c2b78f" checksum = "e87495dd15914c130bd1f90bba3c53f2b32535fc3b0203bf7a885c1259d973a3"
dependencies = [ dependencies = [
"cookie", "cookie",
"either", "either",
@ -4886,6 +4963,12 @@ version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
[[package]]
name = "send_wrapper"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.229" version = "1.0.229"
@ -5001,9 +5084,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_with" name = "serde_with"
version = "3.24.0" version = "3.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df9adc193c780ef8f159aee8b61e2d5801aaa555e6eb0947fe45530ec506296f" checksum = "56cb1ca7c93ae63d6439b5250f6b6b040f7e121f32e5dd2f5d523dd4149b3204"
dependencies = [ dependencies = [
"base64 0.23.1", "base64 0.23.1",
"bs58", "bs58",
@ -5011,7 +5094,8 @@ dependencies = [
"hex", "hex",
"indexmap 1.9.3", "indexmap 1.9.3",
"indexmap 2.14.2", "indexmap 2.14.2",
"jiff", "jiff 0.2.46",
"jiff 1.0.3",
"schemars 0.9.0", "schemars 0.9.0",
"schemars 1.2.3", "schemars 1.2.3",
"serde_core", "serde_core",
@ -5022,9 +5106,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_with_macros" name = "serde_with_macros"
version = "3.24.0" version = "3.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e17bbc68e28663bbbb90df47e058aa7eda4fb445b89fe70457bb94fbccf6e49" checksum = "cff15a7c864bbec77d9586ca6822bc7c369bdf19e9243134a62b0b51ce26b31f"
dependencies = [ dependencies = [
"darling 0.24.1", "darling 0.24.1",
"proc-macro2", "proc-macro2",
@ -5623,9 +5707,9 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "1.2.1+spec-1.1.0" version = "1.2.2+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5755c51863cdac711f1956baf8eb9588e060755f7d3c4c979e70ea1e1f32cd7" checksum = "5426cb1b964690d913f6c5c1a1ae0b42f428ec506bb4d452876d7a209c9bca3b"
dependencies = [ dependencies = [
"serde_core", "serde_core",
"serde_spanned 1.1.3", "serde_spanned 1.1.3",
@ -5668,9 +5752,9 @@ dependencies = [
[[package]] [[package]]
name = "toml_parser" name = "toml_parser"
version = "1.1.5+spec-1.1.0" version = "1.1.6+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" checksum = "e6769c452d71ba30696c6b37770c439a9cc9110f47f7d5cdbeda79840ef5ea31"
dependencies = [ dependencies = [
"winnow 1.0.5", "winnow 1.0.5",
] ]
@ -5844,9 +5928,9 @@ dependencies = [
[[package]] [[package]]
name = "ucd-trie" name = "ucd-trie"
version = "0.1.7" version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" checksum = "8f20bdbfc9915686faa18fb5bbe8b4552778505defbf9f12289beefbc44092a6"
[[package]] [[package]]
name = "uncased" name = "uncased"
@ -5884,9 +5968,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]] [[package]]
name = "url" name = "url"
version = "2.5.8" version = "2.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a"
dependencies = [ dependencies = [
"form_urlencoded", "form_urlencoded",
"idna", "idna",
@ -6040,9 +6124,9 @@ checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64"
[[package]] [[package]]
name = "walkdir" name = "walkdir"
version = "2.5.0" version = "2.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" checksum = "b42e295b7452c4604982280d8586001fcad9b8b201cac67bca9771e7a7475403"
dependencies = [ dependencies = [
"same-file", "same-file",
"winapi-util", "winapi-util",
@ -6626,18 +6710,18 @@ dependencies = [
[[package]] [[package]]
name = "zerocopy" name = "zerocopy"
version = "0.8.63" version = "0.8.64"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" checksum = "ed43f3060383c64b000f3c630550aebdfa9d3b76d48de32390483dd2cc7e0865"
dependencies = [ dependencies = [
"zerocopy-derive", "zerocopy-derive",
] ]
[[package]] [[package]]
name = "zerocopy-derive" name = "zerocopy-derive"
version = "0.8.63" version = "0.8.64"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" checksum = "a5cbd820fe3e35fb38c83b6dc7e6b1618bc46e0cd10073ae94e8d52dc468d8b9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -6720,9 +6804,9 @@ dependencies = [
[[package]] [[package]]
name = "zlib-rs" name = "zlib-rs"
version = "0.6.8" version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" checksum = "aa76918995d776d9dd34d371030be228d021137449771493d56e29f77e4148ac"
[[package]] [[package]]
name = "zmij" name = "zmij"

10
Cargo.toml

@ -82,7 +82,7 @@ num-derive = "0.5.1"
bigdecimal = "0.4.11" bigdecimal = "0.4.11"
# Web framework # Web framework
rocket = { version = "0.5.3", default-features = false, features = ["json", "tls"] } rocket = { version = "0.5.4", default-features = false, features = ["json", "tls"] }
rocket_ws = { version = "0.2.0" } rocket_ws = { version = "0.2.0" }
# WebSockets libraries # WebSockets libraries
@ -161,7 +161,7 @@ webauthn-rs-core = "0.5.5"
serde_cbor_2 = { version = "0.13.0", optional = true } serde_cbor_2 = { version = "0.13.0", optional = true }
# Handling of URL's for WebAuthn and favicons # Handling of URL's for WebAuthn and favicons
url = "2.5.8" url = "2.5.9"
# Email libraries # Email libraries
lettre = { version = "0.11.24", default-features = false, features = [ lettre = { version = "0.11.24", default-features = false, features = [
@ -217,7 +217,7 @@ bytes = "1.12.2"
svg-hush = "0.9.7" svg-hush = "0.9.7"
# Used for custom short lived cookie jar during favicon extraction # Used for custom short lived cookie jar during favicon extraction
cookie = "0.18.2" cookie = "0.18.3"
cookie_store = "0.22.1" cookie_store = "0.22.1"
# Used by U2F, JWT and PostgreSQL # Used by U2F, JWT and PostgreSQL
@ -270,8 +270,8 @@ aws-config = { version = "1.13.3", optional = true, default-features = false, fe
] } ] }
aws-credential-types = { version = "1.3.1", optional = true } aws-credential-types = { version = "1.3.1", optional = true }
aws-smithy-runtime-api = { version = "1.22.0", optional = true } aws-smithy-runtime-api = { version = "1.22.0", optional = true }
reqsign-aws-v4 = { version = "3.3.1", optional = true } reqsign-aws-v4 = { version = "3.5.0", optional = true }
reqsign-core = { version = "3.3.2", optional = true } reqsign-core = { version = "3.3.4", optional = true }
# Strip debuginfo from the release builds # Strip debuginfo from the release builds
# The debug symbols are to provide better panic traces # The debug symbols are to provide better panic traces

1
THREAT_MODEL.md

@ -81,6 +81,7 @@ These are intended behavior or outside this model. Several match upstream Bitwar
- Attacks that need a missing or misconfigured reverse proxy, such as one not sending `X-Forwarded-Proto` (it decides the admin cookie's `Secure` flag). - Attacks that need a missing or misconfigured reverse proxy, such as one not sending `X-Forwarded-Proto` (it decides the admin cookie's `Secure` flag).
- Attacks that need another component to break its own specification, such as a NAT64 translator that forwards the `64:ff9b::/96` prefix to private addresses, against RFC 6052. - Attacks that need another component to break its own specification, such as a NAT64 translator that forwards the `64:ff9b::/96` prefix to private addresses, against RFC 6052.
- Outbound requests to the SSO provider, Yubico server or S3 endpoint the operator configures, which skip the outbound filter and can be on the internal network. - Outbound requests to the SSO provider, Yubico server or S3 endpoint the operator configures, which skip the outbound filter and can be on the internal network.
- Requests sent through an outbound proxy (`HTTP_PROXY`, `HTTPS_PROXY` or `ALL_PROXY`). The proxy resolves names itself, so `HTTP_REQUEST_BLOCK_NON_GLOBAL_IPS` can't check where they go. Configure the proxy so it can't reach anything sensitive, or so it blocks internal addresses.
- File permissions in the data folder. Host security belongs to the operator. - File permissions in the data folder. Host security belongs to the operator.
- Attacks that need physical access to a user's device. - Attacks that need physical access to a user's device.
- Self-exploitation, where someone can only affect their own account, such as self-XSS or weak KDF settings they choose. - Self-exploitation, where someone can only affect their own account, such as self-XSS or weak KDF settings they choose.

4
docker/DockerSettings.yaml

@ -1,6 +1,6 @@
--- ---
vault_version: "v2026.10.1" vault_version: "v2026.11.0"
vault_image_digest: "sha256:7baaa7d5349742548b6c44e557c1512157b22010cdf314ccc399ffdcacb5eb52" vault_image_digest: "sha256:b3e7e1607a6a3c4521cd801d5e3e79ab201d27cb59bfd6e6bd204308b42dc7a9"
# Cross Compile Docker Helper Scripts v1.10.0 # Cross Compile Docker Helper Scripts v1.10.0
# We use the linux/amd64 platform shell scripts since there is no difference between the different platform scripts # We use the linux/amd64 platform shell scripts since there is no difference between the different platform scripts
# https://github.com/tonistiigi/xx | https://hub.docker.com/r/tonistiigi/xx/tags # https://github.com/tonistiigi/xx | https://hub.docker.com/r/tonistiigi/xx/tags

12
docker/Dockerfile.alpine

@ -19,15 +19,15 @@
# - From https://hub.docker.com/r/vaultwarden/web-vault/tags, # - From https://hub.docker.com/r/vaultwarden/web-vault/tags,
# click the tag name to view the digest of the image it currently points to. # click the tag name to view the digest of the image it currently points to.
# - From the command line: # - From the command line:
# $ docker pull docker.io/vaultwarden/web-vault:v2026.10.1 # $ docker pull docker.io/vaultwarden/web-vault:v2026.11.0
# $ docker image inspect --format "{{.RepoDigests}}" docker.io/vaultwarden/web-vault:v2026.10.1 # $ docker image inspect --format "{{.RepoDigests}}" docker.io/vaultwarden/web-vault:v2026.11.0
# [docker.io/vaultwarden/web-vault@sha256:7baaa7d5349742548b6c44e557c1512157b22010cdf314ccc399ffdcacb5eb52] # [docker.io/vaultwarden/web-vault@sha256:b3e7e1607a6a3c4521cd801d5e3e79ab201d27cb59bfd6e6bd204308b42dc7a9]
# #
# - Conversely, to get the tag name from the digest: # - Conversely, to get the tag name from the digest:
# $ docker image inspect --format "{{.RepoTags}}" docker.io/vaultwarden/web-vault@sha256:7baaa7d5349742548b6c44e557c1512157b22010cdf314ccc399ffdcacb5eb52 # $ docker image inspect --format "{{.RepoTags}}" docker.io/vaultwarden/web-vault@sha256:b3e7e1607a6a3c4521cd801d5e3e79ab201d27cb59bfd6e6bd204308b42dc7a9
# [docker.io/vaultwarden/web-vault:v2026.10.1] # [docker.io/vaultwarden/web-vault:v2026.11.0]
# #
FROM --platform=linux/amd64 docker.io/vaultwarden/web-vault@sha256:7baaa7d5349742548b6c44e557c1512157b22010cdf314ccc399ffdcacb5eb52 AS vault FROM --platform=linux/amd64 docker.io/vaultwarden/web-vault@sha256:b3e7e1607a6a3c4521cd801d5e3e79ab201d27cb59bfd6e6bd204308b42dc7a9 AS vault
########################## ALPINE BUILD IMAGES ########################## ########################## ALPINE BUILD IMAGES ##########################
## NOTE: The Alpine Base Images do not support other platforms then linux/amd64 and linux/arm64 ## NOTE: The Alpine Base Images do not support other platforms then linux/amd64 and linux/arm64

12
docker/Dockerfile.debian

@ -19,15 +19,15 @@
# - From https://hub.docker.com/r/vaultwarden/web-vault/tags, # - From https://hub.docker.com/r/vaultwarden/web-vault/tags,
# click the tag name to view the digest of the image it currently points to. # click the tag name to view the digest of the image it currently points to.
# - From the command line: # - From the command line:
# $ docker pull docker.io/vaultwarden/web-vault:v2026.10.1 # $ docker pull docker.io/vaultwarden/web-vault:v2026.11.0
# $ docker image inspect --format "{{.RepoDigests}}" docker.io/vaultwarden/web-vault:v2026.10.1 # $ docker image inspect --format "{{.RepoDigests}}" docker.io/vaultwarden/web-vault:v2026.11.0
# [docker.io/vaultwarden/web-vault@sha256:7baaa7d5349742548b6c44e557c1512157b22010cdf314ccc399ffdcacb5eb52] # [docker.io/vaultwarden/web-vault@sha256:b3e7e1607a6a3c4521cd801d5e3e79ab201d27cb59bfd6e6bd204308b42dc7a9]
# #
# - Conversely, to get the tag name from the digest: # - Conversely, to get the tag name from the digest:
# $ docker image inspect --format "{{.RepoTags}}" docker.io/vaultwarden/web-vault@sha256:7baaa7d5349742548b6c44e557c1512157b22010cdf314ccc399ffdcacb5eb52 # $ docker image inspect --format "{{.RepoTags}}" docker.io/vaultwarden/web-vault@sha256:b3e7e1607a6a3c4521cd801d5e3e79ab201d27cb59bfd6e6bd204308b42dc7a9
# [docker.io/vaultwarden/web-vault:v2026.10.1] # [docker.io/vaultwarden/web-vault:v2026.11.0]
# #
FROM --platform=linux/amd64 docker.io/vaultwarden/web-vault@sha256:7baaa7d5349742548b6c44e557c1512157b22010cdf314ccc399ffdcacb5eb52 AS vault FROM --platform=linux/amd64 docker.io/vaultwarden/web-vault@sha256:b3e7e1607a6a3c4521cd801d5e3e79ab201d27cb59bfd6e6bd204308b42dc7a9 AS vault
########################## Cross Compile Docker Helper Scripts ########################## ########################## Cross Compile Docker Helper Scripts ##########################
## We use the linux/amd64 no matter which Build Platform, since these are all bash scripts ## We use the linux/amd64 no matter which Build Platform, since these are all bash scripts

2
playwright/README.md

@ -12,7 +12,7 @@ Databases (`Mariadb`, `Mysql` and `Postgres`) and `Playwright` will run in conta
### Running Playwright outside docker ### Running Playwright outside docker
It's possible to run `Playwright` outside of the container, this remove the need to rebuild the image for each change. It's possible to run `Playwright` outside of the container, this remove the need to rebuild the image for each change.
You'll additionally need `nodejs` then run: You'll additionally need `nodejs` 24 or newer, then run:
```bash ```bash
npm ci --ignore-scripts --allow-git=none --allow-remote=none npm ci --ignore-scripts --allow-git=none --allow-remote=none

6
playwright/compose/playwright/Dockerfile

@ -1,4 +1,4 @@
FROM docker.io/library/debian:trixie-slim FROM docker.io/library/node:26-trixie-slim
SHELL ["/bin/bash", "-o", "pipefail", "-c"] SHELL ["/bin/bash", "-o", "pipefail", "-c"]
@ -19,8 +19,6 @@ RUN apt-get update \
git \ git \
libmariadb-dev-compat \ libmariadb-dev-compat \
libpq5 \ libpq5 \
nodejs \
npm \
openssl \ openssl \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
@ -36,5 +34,5 @@ COPY compose ./compose
COPY *.ts test.env ./ COPY *.ts test.env ./
COPY tests ./tests COPY tests ./tests
ENTRYPOINT ["/usr/bin/npx", "playwright"] ENTRYPOINT ["/usr/local/bin/npx", "playwright"]
CMD ["test"] CMD ["test"]

2
playwright/compose/warden/build.sh

@ -24,7 +24,7 @@ if [[ ! -z "$REPO_URL" ]] && [[ ! -z "$COMMIT_HASH" ]] ; then
fi fi
# Lower the KDF iterations default for faster tests. # Lower the KDF iterations default for faster tests.
sed -i 's/(6e5,2e6,6e5)/(1e5,2e6,1e5)/' /web-vault/app/main.*.js sed -i 's/(6e5,2e6,6e5)/(6e3,2e6,6e3)/' /web-vault/app/main.*.js
# Generate a self signed cert # Generate a self signed cert
mkdir -p /data/ssl; cd /data/ssl mkdir -p /data/ssl; cd /data/ssl

16
playwright/docker-compose.yml

@ -6,6 +6,8 @@ services:
build: build:
context: .. context: ..
dockerfile: Dockerfile dockerfile: Dockerfile
args:
DB: sqlite,mysql,postgresql,unsafe_test_mode
entrypoint: /bin/bash entrypoint: /bin/bash
restart: "no" restart: "no"
@ -23,12 +25,14 @@ services:
env_file: ${DC_ENV_FILE:-.env} env_file: ${DC_ENV_FILE:-.env}
environment: environment:
- ADMIN_TOKEN - ADMIN_TOKEN
- CLIENT_KDF_ITER
- DATABASE_URL - DATABASE_URL
- CLIENT_SUPPRESS_ONBOARDING - CLIENT_SUPPRESS_ONBOARDING
- EMAIL_2FA_AUTO_FALLBACK - EMAIL_2FA_AUTO_FALLBACK
- I_REALLY_WANT_VOLATILE_STORAGE - I_REALLY_WANT_VOLATILE_STORAGE
- LOG_LEVEL - LOG_LEVEL
- LOGIN_RATELIMIT_MAX_BURST - LOGIN_RATELIMIT_MAX_BURST
- PASSWORD_ITERATIONS
- SMTP_HOST - SMTP_HOST
- SMTP_FROM - SMTP_FROM
- SMTP_DEBUG - SMTP_DEBUG
@ -61,7 +65,7 @@ services:
Mariadb: Mariadb:
profiles: ["playwright"] profiles: ["playwright"]
container_name: playwright_mariadb container_name: playwright_mariadb
image: mariadb:12.2.2 image: mariadb:12.3.3
env_file: test.env env_file: test.env
healthcheck: healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
@ -73,7 +77,7 @@ services:
Mysql: Mysql:
profiles: ["playwright"] profiles: ["playwright"]
container_name: playwright_mysql container_name: playwright_mysql
image: mysql:9.7.0 image: mysql:9.7.4
env_file: test.env env_file: test.env
healthcheck: healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"] test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
@ -85,7 +89,7 @@ services:
Postgres: Postgres:
profiles: ["playwright"] profiles: ["playwright"]
container_name: playwright_postgres container_name: playwright_postgres
image: postgres:18.4 image: postgres:18.7
env_file: test.env env_file: test.env
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"] test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
@ -97,7 +101,7 @@ services:
Maildev: Maildev:
profiles: ["vaultwarden", "maildev"] profiles: ["vaultwarden", "maildev"]
container_name: maildev container_name: maildev
image: timshel/maildev:3.2.19 image: timshel/maildev:3.3.8
ports: ports:
- ${SMTP_PORT}:1025 - ${SMTP_PORT}:1025
- 1080:1080 - 1080:1080
@ -105,7 +109,7 @@ services:
Keycloak: Keycloak:
profiles: ["keycloak", "vaultwarden"] profiles: ["keycloak", "vaultwarden"]
container_name: keycloak-${ENV:-dev} container_name: keycloak-${ENV:-dev}
image: quay.io/keycloak/keycloak:26.6.2 image: quay.io/keycloak/keycloak:26.8.2
network_mode: "host" network_mode: "host"
command: command:
- start-dev - start-dev
@ -120,7 +124,7 @@ services:
context: compose/keycloak context: compose/keycloak
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
KEYCLOAK_VERSION: 26.6.2 KEYCLOAK_VERSION: 26.8.2
depends_on: depends_on:
- Keycloak - Keycloak
restart: "no" restart: "no"

8
playwright/global-utils.ts

@ -221,13 +221,15 @@ export async function restartVault(page: Page, testInfo: TestInfo, env, resetDB:
} }
export async function checkNotification(page: Page, hasText: string) { export async function checkNotification(page: Page, hasText: string) {
await expect(page.locator('bit-toast', { hasText })).toBeVisible(); const toast = page.locator('bit-toast', { hasText });
await expect(toast).toBeVisible();
// An open dialog marks the toasts aria-hidden and covers them: find the button by CSS and dispatch the click.
try { try {
await page.locator('bit-toast', { hasText }).getByRole('button', { name: 'Close' }).click({force: true, timeout: 10_000}); await toast.locator('button[aria-label="Close"]').dispatchEvent('click', undefined, { timeout: 5_000 });
} catch (error) { } catch (error) {
console.log(`Closing notification failed but it should now be invisible (${error})`); console.log(`Closing notification failed but it should now be invisible (${error})`);
} }
await expect(page.locator('bit-toast', { hasText })).toHaveCount(0); await expect(toast).toHaveCount(0);
} }
export async function cleanLanding(page: Page) { export async function cleanLanding(page: Page) {

1394
playwright/package-lock.json

File diff suppressed because it is too large

10
playwright/package.json

@ -8,14 +8,14 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"@playwright/test": "1.60.0", "@playwright/test": "1.65.1",
"dotenv": "17.4.2", "dotenv": "17.4.2",
"dotenv-expand": "13.0.0", "dotenv-expand": "13.0.0",
"maildev": "npm:@timshel_npm/maildev@3.2.19" "maildev": "npm:@timshel_npm/maildev@3.3.8"
}, },
"dependencies": { "dependencies": {
"mysql2": "3.22.3", "mysql2": "3.24.6",
"otpauth": "9.5.1", "otpauth": "9.6.0",
"pg": "8.21.0" "pg": "8.23.1"
} }
} }

5
playwright/playwright.config.ts

@ -26,14 +26,15 @@ export default defineConfig({
* But short action/nav/expect timeouts to fail on specific step (raise locally if not enough). * But short action/nav/expect timeouts to fail on specific step (raise locally if not enough).
*/ */
timeout: 240 * 1000, timeout: 240 * 1000,
actionTimeout: 40 * 1000,
navigationTimeout: 40 * 1000,
expect: { timeout: 40 * 1000 }, expect: { timeout: 40 * 1000 },
"permissions": ["clipboard-read"], "permissions": ["clipboard-read"],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: { use: {
actionTimeout: 40 * 1000,
navigationTimeout: 40 * 1000,
/* Base URL to use in actions like `await page.goto('/')`. */ /* Base URL to use in actions like `await page.goto('/')`. */
baseURL: process.env.DOMAIN, baseURL: process.env.DOMAIN,
browserName: 'firefox', browserName: 'firefox',

2
playwright/test.env

@ -58,6 +58,8 @@ LOG_LEVEL=info,oidcwarden::sso=debug
LOGIN_RATELIMIT_MAX_BURST=100 LOGIN_RATELIMIT_MAX_BURST=100
ADMIN_TOKEN=admin ADMIN_TOKEN=admin
CLIENT_SUPPRESS_ONBOARDING=true CLIENT_SUPPRESS_ONBOARDING=true
PASSWORD_ITERATIONS=6000
CLIENT_KDF_ITER=6000
SMTP_SECURITY=off SMTP_SECURITY=off
SMTP_PORT=${MAILDEV_SMTP_PORT} SMTP_PORT=${MAILDEV_SMTP_PORT}

2
playwright/tests/collection.spec.ts

@ -21,7 +21,7 @@ test('Create', async ({ page }) => {
await orgs.create(test, page, 'New organisation'); await orgs.create(test, page, 'New organisation');
await test.step('Create Collection', async () => { await test.step('Create Collection', async () => {
await page.getByRole('button', { name: 'New', exact: true }).click(); await page.getByRole('button', { name: /^(New|Add)$/ }).click();
await page.getByRole('menuitem', { name: 'Collection' }).click(); await page.getByRole('menuitem', { name: 'Collection' }).click();
await page.getByRole('textbox', { name: 'Name * (required)', exact: true }).fill('RandomCollec'); await page.getByRole('textbox', { name: 'Name * (required)', exact: true }).fill('RandomCollec');
await page.getByRole('button', { name: 'Save' }).click(); await page.getByRole('button', { name: 'Save' }).click();

21
playwright/tests/cyphers.spec.ts

@ -24,12 +24,16 @@ test('Change Key settings', async ({ page }) => {
await page.getByRole('link', { name: 'Security' }).click(); await page.getByRole('link', { name: 'Security' }).click();
await page.getByRole('link', { name: 'Keys' }).click(); await page.getByRole('link', { name: 'Keys' }).click();
// V2 accounts (pm-27278-v2-password-registration) register with Argon2id, V1 ones with PBKDF2
await page.locator('.ng-arrow-wrapper').click();
await page.getByRole('option', { name: 'PBKDF2 SHA-256' }).click();
await page.getByRole('spinbutton', { name: 'KDF iterations * (required)'}).fill('700000'); await page.getByRole('spinbutton', { name: 'KDF iterations * (required)'}).fill('700000');
await page.getByRole('button', { name: 'Update encryption settings' }).click(); await page.getByRole('button', { name: 'Update encryption settings' }).click();
await page.getByRole('textbox', { name: 'Master password * (required)' }).fill(users.user1.password); await page.getByRole('textbox', { name: 'Master password * (required)' }).fill(users.user1.password);
await page.getByRole('button', { name: 'Update settings' }).click(); await page.getByRole('button', { name: 'Update settings' }).click();
await page.getByRole('heading', { name: 'Log in' }).click(); await kdfChanged(test, page);
}); });
await logUser(test, page, users.user1); await logUser(test, page, users.user1);
@ -49,8 +53,21 @@ test('Change Key settings', async ({ page }) => {
await page.getByRole('button', { name: 'Update encryption settings' }).click(); await page.getByRole('button', { name: 'Update encryption settings' }).click();
await page.getByRole('textbox', { name: 'Master password * (required)' }).fill(users.user1.password); await page.getByRole('textbox', { name: 'Master password * (required)' }).fill(users.user1.password);
await page.getByRole('button', { name: 'Update settings' }).click(); await page.getByRole('button', { name: 'Update settings' }).click();
await page.getByRole('heading', { name: 'Log in' }).click(); await kdfChanged(test, page);
}); });
await logUser(test, page, users.user1); await logUser(test, page, users.user1);
}); });
// Before web vault 2026.10 a KDF change logged the user out, with "Please log back in." in the toast.
async function kdfChanged(test, page: Page) {
const toast = page.locator('bit-toast', { hasText: 'Encryption key settings changed' });
await expect(toast).toBeVisible();
const loggedOut = await toast.filter({ hasText: 'Please log back in' }).count() > 0;
await utils.checkNotification(page, 'Encryption key settings changed');
if (loggedOut) {
await expect(page.getByRole('heading', { name: 'Log in' })).toBeVisible();
} else {
await utils.logout(test, page, users.user1);
}
}

12
playwright/tests/organization.smtp.spec.ts

@ -42,11 +42,19 @@ test('Invite users', async ({ page }) => {
await createAccount(test, page, users.user1, mail1Buffer); await createAccount(test, page, users.user1, mail1Buffer);
await orgs.create(test, page, 'Test'); await orgs.create(test, page, 'Test');
await orgs.policies(test, page, 'Test');
// Account recovery requires the Single organisation policy (ENFORCE_SINGLE_ORG_WITH_RESET_PW_POLICY)
await test.step(`Set single organisation`, async () => {
await page.getByRole('button', { name: 'Single organisation' }).click();
await orgs.enablePolicy(page);
await page.getByRole('button', { name: 'Save' }).click();
await utils.checkNotification(page, 'Edited policy Single organisation');
});
await test.step(`Set account recovery`, async () => { await test.step(`Set account recovery`, async () => {
await orgs.policies(test, page, 'Test');
await page.getByRole('button', { name: 'Account recovery' }).click(); await page.getByRole('button', { name: 'Account recovery' }).click();
await page.getByRole('checkbox', { name: 'Turn on' }).check(); await orgs.enablePolicy(page);
await page.getByRole('checkbox', { name: 'Automatically enroll new' }).check(); await page.getByRole('checkbox', { name: 'Automatically enroll new' }).check();
await page.getByRole('button', { name: 'Save' }).click(); await page.getByRole('button', { name: 'Save' }).click();
await utils.checkNotification(page, 'Edited policy Account recovery'); await utils.checkNotification(page, 'Edited policy Account recovery');

4
playwright/tests/secrets.spec.ts

@ -26,7 +26,7 @@ test('Password', async ({ context, page }, testInfo: TestInfo) => {
await logUser(test, page, users.user1); await logUser(test, page, users.user1);
await test.step('Create password entry', async () => { await test.step('Create password entry', async () => {
await page.getByRole('button', { name: 'New item' }).click(); await page.getByRole('button', { name: /^(New|Add) item$/ }).click();
await page.getByRole('textbox', { name: 'Item name * (required)' }).fill(label); await page.getByRole('textbox', { name: 'Item name * (required)' }).fill(label);
await page.getByRole('textbox', { name: 'Username' }).fill(users.user1.name); await page.getByRole('textbox', { name: 'Username' }).fill(users.user1.name);
await page.getByRole('textbox', { name: 'Password' }).fill(users.user1.password); await page.getByRole('textbox', { name: 'Password' }).fill(users.user1.password);
@ -71,7 +71,7 @@ test('SSH Key', async ({ context, page }, testInfo: TestInfo) => {
await logUser(test, page, users.user1); await logUser(test, page, users.user1);
const privateKey = await test.step('Create key entry', async () => { const privateKey = await test.step('Create key entry', async () => {
await page.getByRole('button', { name: 'New', exact: true }).click(); await page.getByRole('button', { name: /^(New|Add)$/ }).click();
await page.getByRole('menuitem', { name: 'SSH key' }).click(); await page.getByRole('menuitem', { name: 'SSH key' }).click();
await page.getByRole('textbox', { name: 'Item name * (required)' }).fill('Test SSH key'); await page.getByRole('textbox', { name: 'Item name * (required)' }).fill('Test SSH key');
await page.getByRole('button', { name: 'Save' }).click(); await page.getByRole('button', { name: 'Save' }).click();

4
playwright/tests/send.spec.ts

@ -21,7 +21,7 @@ test('Send', async ({ browser, page }) => {
await page.getByRole('link', { name: 'Send' }).click(); await page.getByRole('link', { name: 'Send' }).click();
await expect(page.locator('#main-content').getByText('Send', { exact: true })).toBeVisible(); await expect(page.locator('#main-content').getByText('Send', { exact: true })).toBeVisible();
await page.getByRole('button', { name: 'New Send', exact: true }).click(); await page.getByRole('button', { name: /^(New|Create) Send$/ }).click();
await page.getByRole('menuitem', { name: 'Text' }).click(); await page.getByRole('menuitem', { name: 'Text' }).click();
await page.getByRole('textbox', { name: 'Send name * (required)' }).fill('Test'); await page.getByRole('textbox', { name: 'Send name * (required)' }).fill('Test');
@ -46,7 +46,7 @@ test('Send', async ({ browser, page }) => {
await page.getByRole('link', { name: 'Send' }).click(); await page.getByRole('link', { name: 'Send' }).click();
await expect(page.locator('#main-content').getByText('Send', { exact: true })).toBeVisible(); await expect(page.locator('#main-content').getByText('Send', { exact: true })).toBeVisible();
await page.getByRole('button', { name: 'New' }).click(); await page.getByRole('button', { name: /\b(New|Create)$/ }).click();
await page.getByRole('menuitem', { name: 'Text' }).click(); await page.getByRole('menuitem', { name: 'Text' }).click();
await page.getByRole('textbox', { name: 'Send name * (required)' }).fill('Password'); await page.getByRole('textbox', { name: 'Send name * (required)' }).fill('Password');

17
playwright/tests/setups/orgs.ts

@ -29,6 +29,11 @@ export async function policies(test, page: Page, name: string) {
}); });
} }
// Web vault 2026.10 replaced the "Turn on" checkbox with an "Enable policy" switch, whose thumb covers the input.
export async function enablePolicy(page: Page) {
await page.getByRole('checkbox', { name: 'Turn on' }).or(page.getByRole('switch', { name: 'Enable policy' })).check({ force: true });
}
export async function members(test, page: Page, name: string) { export async function members(test, page: Page, name: string) {
await test.step(`Navigate to ${name} members`, async () => { await test.step(`Navigate to ${name} members`, async () => {
await page.locator('a').filter({ hasText: 'Admin Console' }).first().click(); await page.locator('a').filter({ hasText: 'Admin Console' }).first().click();
@ -46,13 +51,19 @@ export async function invite(test, page: Page, name: string, email: string) {
await expect(page.getByRole('heading', { name: 'Members' })).toBeVisible(); await expect(page.getByRole('heading', { name: 'Members' })).toBeVisible();
await page.getByRole('button', { name: 'Invite member' }).click(); await page.getByRole('button', { name: 'Invite member' }).click();
await page.getByRole('textbox', { name: 'Email * (required)', exact: true }).fill(email); await page.getByRole('textbox', { name: 'Email * (required)', exact: true }).fill(email);
// Web vault 2026.10 moved collections from a tab into "More settings" and renamed Save to Invite.
const moreSettings = page.getByRole('button', { name: 'More settings' });
if (await moreSettings.count() > 0) {
await moreSettings.click();
} else {
await page.getByRole('tab', { name: 'Collections' }).click(); await page.getByRole('tab', { name: 'Collections' }).click();
await page.getByRole('combobox', { name: 'Permission' }).click(); }
await page.getByTestId('permission').getByRole('combobox').click();
await page.getByText('Edit items', { exact: true }).click(); await page.getByText('Edit items', { exact: true }).click();
await page.getByRole('combobox', { name: 'Select collections' }).click(); await page.getByRole('combobox', { name: /^(Select collections|Collections)/ }).click();
await page.getByLabel('Options List').getByText('Default collection').click(); await page.getByLabel('Options List').getByText('Default collection').click();
await page.getByRole('columnheader', { name: 'Collection', exact: true }).click(); await page.getByRole('columnheader', { name: 'Collection', exact: true }).click();
await page.getByRole('button', { name: 'Save' }).click(); await page.getByRole('button', { name: /^(Save|Invite)$/ }).click();
await utils.checkNotification(page, 'User(s) invited'); await utils.checkNotification(page, 'User(s) invited');
}); });
} }

4
playwright/tests/sso_organization.spec.ts

@ -55,9 +55,9 @@ test('Activate password policy', async ({ page }) => {
await test.step(`Set master password policy`, async () => { await test.step(`Set master password policy`, async () => {
await page.getByRole('button', { name: 'Master password requirements' }).click(); await page.getByRole('button', { name: 'Master password requirements' }).click();
await page.getByRole('checkbox', { name: 'Turn on' }).check(); await orgs.enablePolicy(page);
await page.getByRole('checkbox', { name: 'Require existing members to' }).check(); await page.getByRole('checkbox', { name: 'Require existing members to' }).check();
await page.getByRole('spinbutton', { name: 'Minimum length' }).fill('42'); await page.getByRole('spinbutton', { name: /^Minimum (character )?length/ }).fill('42');
await page.getByRole('button', { name: 'Save' }).click(); await page.getByRole('button', { name: 'Save' }).click();
await utils.checkNotification(page, 'Edited policy Master password requirements.'); await utils.checkNotification(page, 'Edited policy Master password requirements.');
}); });

4
src/api/admin.rs

@ -99,8 +99,8 @@ static CAN_BACKUP: LazyLock<bool> = LazyLock::new(|| ACTIVE_DB_TYPE.get().is_som
static CAN_BACKUP: LazyLock<bool> = LazyLock::new(|| false); static CAN_BACKUP: LazyLock<bool> = LazyLock::new(|| false);
#[get("/")] #[get("/")]
fn admin_disabled() -> &'static str { fn admin_disabled() -> (Status, &'static str) {
"The admin panel is disabled, please configure the 'ADMIN_TOKEN' variable to enable it" (Status::NotFound, "The admin panel is disabled, please configure the 'ADMIN_TOKEN' variable to enable it")
} }
const COOKIE_NAME: &str = "VW_ADMIN"; const COOKIE_NAME: &str = "VW_ADMIN";

129
src/api/core/accounts.rs

@ -21,10 +21,10 @@ use crate::{
db::{ db::{
DbConn, DbPool, DbConn, DbPool,
models::{ models::{
AuthRequest, AuthRequestId, Cipher, CipherId, Device, DeviceId, DeviceType, DeviceWithAuthRequest, AuthRequest, AuthRequestId, Cipher, CipherId, Device, DeviceId, DeviceWithAuthRequest, EmergencyAccess,
EmergencyAccess, EmergencyAccessId, EventType, Folder, FolderId, Invitation, KeyId, Membership, EmergencyAccessId, EventType, Folder, FolderId, Invitation, KeyId, Membership, MembershipId, OrgPolicy,
MembershipId, OrgPolicy, OrgPolicyType, Organization, OrganizationId, Send, SendId, SignatureAlgorithm, OrgPolicyType, Organization, OrganizationId, Send, SendId, SignatureAlgorithm, User, UserId, UserKdfType,
User, UserId, UserKdfType, UserSignatureKeyPair, WebauthnCredential, UserSignatureKeyPair, WebauthnCredential,
}, },
}, },
mail, mail,
@ -909,7 +909,9 @@ async fn get_keys(headers: Headers, conn: DbConn) -> JsonResult {
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
struct PostKeysData { struct PostKeysData {
// Required like upstream, even next to `accountKeys` // Required like upstream, even next to `accountKeys`
#[serde(alias = "PublicKey")]
public_key: Option<String>, public_key: Option<String>,
#[serde(alias = "EncryptedPrivateKey")]
encrypted_private_key: Option<String>, encrypted_private_key: Option<String>,
account_keys: Option<AccountKeysData>, account_keys: Option<AccountKeysData>,
// The id of the user key these account keys belong to, only honored for v2 `accountKeys` // The id of the user key these account keys belong to, only honored for v2 `accountKeys`
@ -1039,8 +1041,8 @@ async fn post_password(data: Json<ChangePassData>, headers: Headers, conn: DbCon
} }
fn set_kdf_data(user: &mut User, data: &KDFData) -> EmptyResult { fn set_kdf_data(user: &mut User, data: &KDFData) -> EmptyResult {
if data.kdf == UserKdfType::Pbkdf2 as i32 && data.kdf_iterations < 100_000 { if data.kdf == UserKdfType::Pbkdf2 as i32 && data.kdf_iterations < CONFIG.client_kdf_iter() {
err!("PBKDF2 KDF iterations must be at least 100000.") err!(format!("PBKDF2 KDF iterations must be at least {}.", CONFIG.client_kdf_iter()))
} }
if data.kdf == UserKdfType::Argon2id as i32 { if data.kdf == UserKdfType::Argon2id as i32 {
@ -1885,7 +1887,7 @@ async fn post_sstamp(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbCo
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
let mut user = headers.user; let mut user = headers.user;
data.validate(&user, true, &conn).await?; data.validate(&mut user, true, &conn).await?;
user.reset_security_stamp(&conn).await?; user.reset_security_stamp(&conn).await?;
let save_result = user.save(&conn).await; let save_result = user.save(&conn).await;
@ -2143,9 +2145,9 @@ async fn post_delete_account(
#[delete("/accounts", data = "<data>")] #[delete("/accounts", data = "<data>")]
async fn delete_account(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn, nt: Notify<'_>) -> EmptyResult { async fn delete_account(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn, nt: Notify<'_>) -> EmptyResult {
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
let user = headers.user; let mut user = headers.user;
data.validate(&user, true, &conn).await?; data.validate(&mut user, true, &conn).await?;
// The devices are deleted together with the user, so check for push devices beforehand // The devices are deleted together with the user, so check for push devices beforehand
let has_push_device = CONFIG.push_enabled() && Device::check_user_has_push_device(&user.uuid, &conn).await; let has_push_device = CONFIG.push_enabled() && Device::check_user_has_push_device(&user.uuid, &conn).await;
@ -2226,15 +2228,15 @@ fn unknown_email_kdf(email: &str) -> (i32, i32, Option<i32>, Option<i32>) {
const PBKDF2: i32 = UserKdfType::Pbkdf2 as i32; const PBKDF2: i32 = UserKdfType::Pbkdf2 as i32;
const ARGON2ID: i32 = UserKdfType::Argon2id as i32; const ARGON2ID: i32 = UserKdfType::Argon2id as i32;
// Same list as upstream, the default is in it twice to give it more weight // Same list as upstream, the default is in it twice to give it more weight
const KDF_SETTINGS: [(i32, i32, Option<i32>, Option<i32>); 6] = [ let kdf_settings: [(i32, i32, Option<i32>, Option<i32>); 6] = [
(User::CLIENT_KDF_TYPE_DEFAULT, User::CLIENT_KDF_ITER_DEFAULT, None, None), (User::CLIENT_KDF_TYPE_DEFAULT, CONFIG.client_kdf_iter(), None, None),
(User::CLIENT_KDF_TYPE_DEFAULT, User::CLIENT_KDF_ITER_DEFAULT, None, None), (User::CLIENT_KDF_TYPE_DEFAULT, CONFIG.client_kdf_iter(), None, None),
(PBKDF2, 100_000, None, None), (PBKDF2, 100_000, None, None),
(PBKDF2, 5_000, None, None), (PBKDF2, 5_000, None, None),
(ARGON2ID, 3, Some(64), Some(4)), (ARGON2ID, 3, Some(64), Some(4)),
(ARGON2ID, 6, Some(32), Some(4)), (ARGON2ID, 6, Some(32), Some(4)),
]; ];
KDF_SETTINGS[crate::auth::prelogin_kdf_index(email, KDF_SETTINGS.len())] kdf_settings[crate::auth::prelogin_kdf_index(email, kdf_settings.len())]
} }
pub async fn prelogin(data: Json<PreloginData>, ip: ClientIp, conn: DbConn) -> JsonResult { pub async fn prelogin(data: Json<PreloginData>, ip: ClientIp, conn: DbConn) -> JsonResult {
@ -2271,19 +2273,6 @@ struct SecretVerificationRequest {
master_password_hash: String, master_password_hash: String,
} }
// Change the KDF Iterations if necessary
pub async fn kdf_upgrade(user: &mut User, pwd_hash: &str, conn: &DbConn) -> ApiResult<()> {
if user.password_iterations < CONFIG.password_iterations() {
user.password_iterations = CONFIG.password_iterations();
user.set_password(pwd_hash, None, false, None, conn).await?;
if let Err(e) = user.save(conn).await {
error!("Error updating user: {e:#?}");
}
}
Ok(())
}
#[post("/accounts/verify-password", data = "<data>")] #[post("/accounts/verify-password", data = "<data>")]
async fn verify_password(data: Json<SecretVerificationRequest>, headers: Headers, conn: DbConn) -> JsonResult { async fn verify_password(data: Json<SecretVerificationRequest>, headers: Headers, conn: DbConn) -> JsonResult {
let data: SecretVerificationRequest = data.into_inner(); let data: SecretVerificationRequest = data.into_inner();
@ -2293,7 +2282,7 @@ async fn verify_password(data: Json<SecretVerificationRequest>, headers: Headers
err!("Invalid password") err!("Invalid password")
} }
kdf_upgrade(&mut user, &data.master_password_hash, &conn).await?; user.check_persist_kdf_upgrade(&data.master_password_hash, &conn).await?;
Ok(Json(master_password_policy(&user, &conn).await)) Ok(Json(master_password_policy(&user, &conn).await))
} }
@ -2302,7 +2291,7 @@ async fn update_api_key(data: Json<PasswordOrOtpData>, rotate: bool, headers: He
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
let mut user = headers.user; let mut user = headers.user;
data.validate(&user, true, &conn).await?; data.validate(&mut user, true, &conn).await?;
if rotate || user.api_key.is_none() { if rotate || user.api_key.is_none() {
user.api_key = Some(crypto::generate_api_key()); user.api_key = Some(crypto::generate_api_key());
@ -2527,19 +2516,7 @@ async fn post_auth_request(
) )
.await; .await;
Ok(Json(json!({ Ok(Json(auth_request.to_json()))
"id": auth_request.uuid,
"publicKey": auth_request.public_key,
"requestDeviceType": DeviceType::from_i32(auth_request.device_type).to_string(),
"requestIpAddress": auth_request.request_ip,
"key": null,
"masterPasswordHash": null,
"creationDate": format_date(&auth_request.creation_date),
"responseDate": null,
"requestApproved": false,
"origin": CONFIG.domain_origin(),
"object": "auth-request"
})))
} }
#[get("/auth-requests/<auth_request_id>")] #[get("/auth-requests/<auth_request_id>")]
@ -2549,21 +2526,7 @@ async fn get_auth_request(auth_request_id: AuthRequestId, headers: Headers, conn
err!("AuthRequest doesn't exist", "Record not found or user uuid does not match") err!("AuthRequest doesn't exist", "Record not found or user uuid does not match")
}; };
let response_date_utc = auth_request.response_date.map(|response_date| format_date(&response_date)); Ok(Json(auth_request.to_json()))
Ok(Json(json!({
"id": &auth_request_id,
"publicKey": auth_request.public_key,
"requestDeviceType": DeviceType::from_i32(auth_request.device_type).to_string(),
"requestIpAddress": auth_request.request_ip,
"key": auth_request.enc_key,
"masterPasswordHash": auth_request.master_password_hash,
"creationDate": format_date(&auth_request.creation_date),
"responseDate": response_date_utc,
"requestApproved": auth_request.approved,
"origin": CONFIG.domain_origin(),
"object":"auth-request"
})))
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
@ -2598,15 +2561,14 @@ async fn put_auth_request(
err!("An authentication request with the same device already exists") err!("An authentication request with the same device already exists")
} }
let response_date = Utc::now().naive_utc(); // Set the date now so that the response returns it
let response_date_utc = format_date(&response_date); auth_request.response_date = Some(Utc::now().naive_utc());
if data.request_approved { if data.request_approved {
auth_request.approved = Some(data.request_approved); auth_request.approved = Some(data.request_approved);
auth_request.enc_key = Some(data.key); auth_request.enc_key = Some(data.key);
auth_request.master_password_hash = data.master_password_hash; auth_request.master_password_hash = data.master_password_hash;
auth_request.response_device_id = Some(data.device_identifier.clone()); auth_request.response_device_id = Some(data.device_identifier.clone());
auth_request.response_date = Some(response_date);
auth_request.save(&conn).await?; auth_request.save(&conn).await?;
ant.send_auth_response(&auth_request.user_uuid, &auth_request.uuid).await; ant.send_auth_response(&auth_request.user_uuid, &auth_request.uuid).await;
@ -2633,19 +2595,7 @@ async fn put_auth_request(
.await; .await;
} }
Ok(Json(json!({ Ok(Json(auth_request.to_json()))
"id": &auth_request_id,
"publicKey": auth_request.public_key,
"requestDeviceType": DeviceType::from_i32(auth_request.device_type).to_string(),
"requestIpAddress": auth_request.request_ip,
"key": auth_request.enc_key,
"masterPasswordHash": auth_request.master_password_hash,
"creationDate": format_date(&auth_request.creation_date),
"responseDate": response_date_utc,
"requestApproved": auth_request.approved,
"origin": CONFIG.domain_origin(),
"object":"auth-request"
})))
} }
#[get("/auth-requests/<auth_request_id>/response?<code>")] #[get("/auth-requests/<auth_request_id>/response?<code>")]
@ -2668,21 +2618,7 @@ async fn get_auth_request_response(
err!("AuthRequest doesn't exist", "Invalid device, IP or code") err!("AuthRequest doesn't exist", "Invalid device, IP or code")
} }
let response_date_utc = auth_request.response_date.map(|response_date| format_date(&response_date)); Ok(Json(auth_request.to_json()))
Ok(Json(json!({
"id": &auth_request_id,
"publicKey": auth_request.public_key,
"requestDeviceType": DeviceType::from_i32(auth_request.device_type).to_string(),
"requestIpAddress": auth_request.request_ip,
"key": auth_request.enc_key,
"masterPasswordHash": auth_request.master_password_hash,
"creationDate": format_date(&auth_request.creation_date),
"responseDate": response_date_utc,
"requestApproved": auth_request.approved,
"origin": CONFIG.domain_origin(),
"object":"auth-request"
})))
} }
// Now unused but not yet removed // Now unused but not yet removed
@ -2700,23 +2636,8 @@ async fn get_auth_requests_pending(headers: Headers, conn: DbConn) -> JsonResult
"data": auth_requests "data": auth_requests
.iter() .iter()
.filter(|request| request.approved.is_none()) .filter(|request| request.approved.is_none())
.map(|request| { .map(AuthRequest::to_json)
let response_date_utc = request.response_date.map(|response_date| format_date(&response_date)); .collect::<Vec<Value>>(),
json!({
"id": request.uuid,
"publicKey": request.public_key,
"requestDeviceType": DeviceType::from_i32(request.device_type).to_string(),
"requestIpAddress": request.request_ip,
"key": request.enc_key,
"masterPasswordHash": request.master_password_hash,
"creationDate": format_date(&request.creation_date),
"responseDate": response_date_utc,
"requestApproved": request.approved,
"origin": CONFIG.domain_origin(),
"object":"auth-request"
})
}).collect::<Vec<Value>>(),
"continuationToken": null, "continuationToken": null,
"object": "list" "object": "list"
}))) })))

63
src/api/core/ciphers.rs

@ -1,6 +1,7 @@
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use chrono::{NaiveDateTime, Utc}; use chrono::{NaiveDateTime, Utc};
use rocket::{ use rocket::{
Route, Route,
form::{Form, FromForm}, form::{Form, FromForm},
@ -12,7 +13,7 @@ use serde_json::Value;
use crate::{ use crate::{
CONFIG, CONFIG,
api::{self, ApiResult, EmptyResult, JsonResult, Notify, PasswordOrOtpData, UpdateType, core::log_event}, api::{self, EmptyResult, JsonResult, Notify, PasswordOrOtpData, UpdateType, core::log_event},
auth::ClientVersion, auth::ClientVersion,
auth::{Headers, OrgIdGuard, OwnerHeaders}, auth::{Headers, OrgIdGuard, OwnerHeaders},
config::PathType, config::PathType,
@ -845,7 +846,7 @@ pub async fn seed_cipher(
user_id: &UserId, user_id: &UserId,
folder_ids: &HashMap<FolderId, FolderId>, folder_ids: &HashMap<FolderId, FolderId>,
conn: &DbConn, conn: &DbConn,
) -> ApiResult<CipherId> { ) -> api::ApiResult<CipherId> {
// Not in the request model, but a trashed cipher has to stay trashed // Not in the request model, but a trashed cipher has to stay trashed
let deleted_at = encrypted.get("deletedDate").and_then(Value::as_str).map(parse_seed_date).transpose()?; let deleted_at = encrypted.get("deletedDate").and_then(Value::as_str).map(parse_seed_date).transpose()?;
let mut data: CipherData = serde_json::from_value(encrypted)?; let mut data: CipherData = serde_json::from_value(encrypted)?;
@ -892,7 +893,7 @@ pub async fn seed_cipher(
} }
#[cfg(feature = "unsafe_test_mode")] #[cfg(feature = "unsafe_test_mode")]
fn parse_seed_date(date: &str) -> ApiResult<NaiveDateTime> { fn parse_seed_date(date: &str) -> api::ApiResult<NaiveDateTime> {
match chrono::DateTime::parse_from_rfc3339(date) { match chrono::DateTime::parse_from_rfc3339(date) {
Ok(date) => Ok(date.naive_utc()), Ok(date) => Ok(date.naive_utc()),
Err(e) => err!(format!("Invalid date {}: {e}", date.escape_debug())), Err(e) => err!(format!("Invalid date {}: {e}", date.escape_debug())),
@ -1521,6 +1522,13 @@ async fn share_cipher_by_uuid(
false, false,
) )
.await?; .await?;
// The moved attachments now count against the organization's limit
if transfer_cipher {
let moved: i64 = Attachment::find_by_cipher(&cipher.uuid, conn).await.iter().map(|a| a.file_size).sum();
if moved > 0 {
check_attachment_space(&cipher, moved, moved, conn).await?;
}
}
for col_id in &shared_to_collections { for col_id in &shared_to_collections {
CollectionCipher::save(&cipher.uuid, col_id, conn).await?; CollectionCipher::save(&cipher.uuid, col_id, conn).await?;
} }
@ -1622,17 +1630,17 @@ enum FileUploadType {
// Azure = 1, // only used upstream // Azure = 1, // only used upstream
} }
/// Remaining attachment storage in bytes for the cipher's owner, `None` when unlimited. /// Fails when `size` more bytes don't fit in the attachment storage of the cipher's owner.
/// `size_adjust` credits a v2 attachment whose record already counts as used. /// `size_adjust` credits bytes already counted as used, such as a v2 attachment's reserved record.
async fn attachment_size_limit(cipher: &Cipher, size_adjust: i64, conn: &DbConn) -> ApiResult<Option<i64>> { async fn check_attachment_space(cipher: &Cipher, size: i64, size_adjust: i64, conn: &DbConn) -> EmptyResult {
let (limit_kb, already_used) = if let Some(ref user_id) = cipher.user_uuid { let (limit_kb, already_used) = if let Some(ref user_id) = cipher.user_uuid {
let Some(limit_kb) = CONFIG.user_attachment_limit() else { let Some(limit_kb) = CONFIG.user_attachment_limit() else {
return Ok(None); return Ok(());
}; };
(limit_kb, Attachment::size_by_user(user_id, conn).await) (limit_kb, Attachment::size_by_user(user_id, conn).await)
} else if let Some(ref org_id) = cipher.organization_uuid { } else if let Some(ref org_id) = cipher.organization_uuid {
let Some(limit_kb) = CONFIG.org_attachment_limit() else { let Some(limit_kb) = CONFIG.org_attachment_limit() else {
return Ok(None); return Ok(());
}; };
(limit_kb, Attachment::size_by_org(org_id, conn).await) (limit_kb, Attachment::size_by_org(org_id, conn).await)
} else { } else {
@ -1652,8 +1660,11 @@ async fn attachment_size_limit(cipher: &Cipher, size_adjust: i64, conn: &DbConn)
if left <= 0 { if left <= 0 {
err!("Attachment storage limit reached! Delete some attachments to free up space") err!("Attachment storage limit reached! Delete some attachments to free up space")
} }
if size > left {
err!("Attachment storage limit exceeded with this file");
}
Ok(Some(left)) Ok(())
} }
/// v2 API for creating an attachment associated with a cipher. /// v2 API for creating an attachment associated with a cipher.
@ -1691,16 +1702,12 @@ async fn post_attachment_v2(
err!("Max file size is 525 MB.") err!("Max file size is 525 MB.")
} }
if let Some(size_limit) = attachment_size_limit(&cipher, 0, &conn).await? check_attachment_space(&cipher, file_size, 0, &conn).await?;
&& file_size > size_limit
{
err!("Attachment storage limit exceeded with this file");
}
let attachment_id = crypto::generate_attachment_id(); let attachment_id = crypto::generate_attachment_id();
let attachment = let attachment =
Attachment::new(attachment_id.clone(), cipher.uuid.clone(), data.file_name, file_size, Some(data.key)); Attachment::new(attachment_id.clone(), cipher.uuid.clone(), data.file_name, file_size, Some(data.key));
attachment.save(&conn).await.expect("Error saving attachment"); attachment.save(&conn).await?;
notify_attachment_created(&cipher, &headers, &conn, &nt).await; notify_attachment_created(&cipher, &headers, &conn, &nt).await;
let url = format!("/ciphers/{}/attachment/{attachment_id}", cipher.uuid); let url = format!("/ciphers/{}/attachment/{attachment_id}", cipher.uuid);
@ -1765,11 +1772,7 @@ async fn save_attachment(
Some(a) => a.file_size, // v2 API Some(a) => a.file_size, // v2 API
}; };
if let Some(size_limit) = attachment_size_limit(&cipher, size_adjust, &conn).await? check_attachment_space(&cipher, size, size_adjust, &conn).await?;
&& size > size_limit
{
err!("Attachment storage limit exceeded with this file");
}
let file_id = match &attachment { let file_id = match &attachment {
Some(attachment) => attachment.id.clone(), // v2 API Some(attachment) => attachment.id.clone(), // v2 API
@ -1794,7 +1797,7 @@ async fn save_attachment(
if size != attachment.file_size { if size != attachment.file_size {
// Update the attachment with the actual file size. // Update the attachment with the actual file size.
attachment.file_size = size; attachment.file_size = size;
attachment.save(&conn).await.expect("Error updating attachment"); attachment.save(&conn).await?;
} }
} else { } else {
attachment.delete(&conn).await.ok(); attachment.delete(&conn).await.ok();
@ -1816,7 +1819,7 @@ async fn save_attachment(
} }
let attachment = let attachment =
Attachment::new(file_id.clone(), cipher_id.clone(), encrypted_filename.unwrap(), size, data.key); Attachment::new(file_id.clone(), cipher_id.clone(), encrypted_filename.unwrap(), size, data.key);
attachment.save(&conn).await.expect("Error saving attachment"); attachment.save(&conn).await?;
} }
save_temp_file(&PathType::Attachments, &format!("{cipher_id}/{file_id}"), data.data, true).await?; save_temp_file(&PathType::Attachments, &format!("{cipher_id}/{file_id}"), data.data, true).await?;
@ -2208,6 +2211,16 @@ async fn move_cipher_selected(
let data = data.into_inner(); let data = data.into_inner();
let user_id = &headers.user.uuid; let user_id = &headers.user.uuid;
// Validate the cipher IDs are well-formed before they reach the query.
// Unlike path parameters (UuidFromParam), IDs deserialized from a JSON body
// are not checked, so a malformed value (e.g. one containing a NUL byte)
// would otherwise reach the database and error out.
for cipher_id in &data.ids {
if uuid::Uuid::parse_str(cipher_id.as_ref()).is_err() {
err!("Invalid cipher ID provided")
}
}
if let Some(ref folder_id) = data.folder_id if let Some(ref folder_id) = data.folder_id
&& Folder::find_by_uuid_and_user(folder_id, user_id, &conn).await.is_none() && Folder::find_by_uuid_and_user(folder_id, user_id, &conn).await.is_none()
{ {
@ -2295,9 +2308,9 @@ async fn purge_org_vault(
} }
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
let user = headers.user; let mut user = headers.user;
data.validate(&user, true, &conn).await?; data.validate(&mut user, true, &conn).await?;
match Membership::find_confirmed_by_user_and_org(&user.uuid, &organization.org_id, &conn).await { match Membership::find_confirmed_by_user_and_org(&user.uuid, &organization.org_id, &conn).await {
Some(member) if member.atype == MembershipType::Owner => { Some(member) if member.atype == MembershipType::Owner => {
@ -2331,7 +2344,7 @@ async fn purge_personal_vault(
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
let mut user = headers.user; let mut user = headers.user;
data.validate(&user, true, &conn).await?; data.validate(&mut user, true, &conn).await?;
for cipher in Cipher::find_owned_by_user(&user.uuid, &conn).await { for cipher in Cipher::find_owned_by_user(&user.uuid, &conn).await {
cipher.delete(&conn).await?; cipher.delete(&conn).await?;

78
src/api/core/organizations.rs

@ -120,11 +120,12 @@ struct OrgData {
plan_type: NumberOrString, plan_type: NumberOrString,
} }
#[derive(Deserialize, Debug)] #[derive(Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
struct OrganizationUpdateData { struct OrganizationUpdateData {
billing_email: String, billing_email: String,
name: String, name: String,
keys: Option<OrgKeyData>,
} }
#[derive(Deserialize)] #[derive(Deserialize)]
@ -160,18 +161,24 @@ impl FullCollectionData {
#[derive(Deserialize)] #[derive(Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
struct CollectionGroupData { struct CollectionGroupData {
#[serde(default)]
hide_passwords: bool, hide_passwords: bool,
id: GroupId, id: GroupId,
#[serde(default)]
read_only: bool, read_only: bool,
#[serde(default)]
manage: bool, manage: bool,
} }
#[derive(Deserialize)] #[derive(Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
struct CollectionMembershipData { struct CollectionMembershipData {
#[serde(default)]
hide_passwords: bool, hide_passwords: bool,
id: MembershipId, id: MembershipId,
#[serde(default)]
read_only: bool, read_only: bool,
#[serde(default)]
manage: bool, manage: bool,
} }
@ -235,12 +242,14 @@ async fn delete_organization(
headers: OwnerHeaders, headers: OwnerHeaders,
conn: DbConn, conn: DbConn,
) -> EmptyResult { ) -> EmptyResult {
let mut user = headers.user;
if org_id != headers.org_id { if org_id != headers.org_id {
err!("Organization not found", "Organization id's do not match"); err!("Organization not found", "Organization id's do not match");
} }
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
data.validate(&headers.user, true, &conn).await?; data.validate(&mut user, true, &conn).await?;
match Organization::find_by_uuid(&org_id, &conn).await { match Organization::find_by_uuid(&org_id, &conn).await {
None => err!("Organization not found"), None => err!("Organization not found"),
@ -307,6 +316,16 @@ async fn put_organization(
org.name = data.name; org.name = data.name;
org.billing_email = data.billing_email.to_lowercase(); org.billing_email = data.billing_email.to_lowercase();
if let Some(keys) = data.keys
&& !keys.public_key.trim().is_empty()
&& !keys.encrypted_private_key.trim().is_empty()
&& org.public_key.as_deref().is_none_or(|k| k.trim().is_empty())
&& org.private_key.as_deref().is_none_or(|k| k.trim().is_empty())
{
org.public_key = Some(keys.public_key);
org.private_key = Some(keys.encrypted_private_key);
}
org.save(&conn).await?; org.save(&conn).await?;
log_event( log_event(
@ -2292,7 +2311,9 @@ async fn post_bulk_collections(data: Json<BulkCollectionsData>, headers: Headers
// Only act on existing cipher uuid's // Only act on existing cipher uuid's
// Do not abort the operation just ignore it, it could be a cipher was just deleted for example // Do not abort the operation just ignore it, it could be a cipher was just deleted for example
if let Some(cipher) = Cipher::find_by_uuid_and_org(cipher_id, &data.organization_id, &conn).await if let Some(cipher) = Cipher::find_by_uuid_and_org(cipher_id, &data.organization_id, &conn).await
&& cipher.is_write_accessible_to_user(&headers.user.uuid, CipherAccessScope::OrganizationAdmin, &conn).await && cipher
.is_in_editable_collection_by_user(&headers.user.uuid, CipherAccessScope::OrganizationAdmin, &conn)
.await
{ {
// When selecting a specific collection from the left filter list, and use the bulk option, you can remove an item from that collection // When selecting a specific collection from the left filter list, and use the bulk option, you can remove an item from that collection
// In these cases the client will call this endpoint twice, once for adding the new collections and a second for deleting. // In these cases the client will call this endpoint twice, once for adding the new collections and a second for deleting.
@ -2316,7 +2337,10 @@ async fn list_policies(org_id: OrganizationId, headers: ManagePoliciesHeaders, c
if org_id != headers.org_id { if org_id != headers.org_id {
err!("Organization not found", "Organization id's do not match"); err!("Organization not found", "Organization id's do not match");
} }
let policies = OrgPolicy::find_by_org(&org_id, &conn).await; let mut policies = OrgPolicy::find_by_org(&org_id, &conn).await;
if !policies.iter().any(|p| p.has_type(OrgPolicyType::SendControls)) {
policies.push(OrgPolicy::synthesize_send_controls(&org_id, &policies));
}
let policies_json: Vec<Value> = policies.iter().map(OrgPolicy::to_json).collect(); let policies_json: Vec<Value> = policies.iter().map(OrgPolicy::to_json).collect();
Ok(Json(json!({ Ok(Json(json!({
@ -2339,9 +2363,15 @@ async fn list_policies_token(org_id: OrganizationId, token: &str, conn: DbConn)
return Ok(Json(json!({}))); return Ok(Json(json!({})));
} }
// TODO: We receive the invite token as ?token=<>, validate it contains the org id let Some(member) = Membership::find_by_uuid_and_org(&invite.member_id, &org_id, &conn).await else {
err!("Organization not found", "The invited membership no longer exists")
};
if member.user_uuid != invite.sub || member.status != MembershipStatus::Invited as i32 {
err!("Organization not found", "The membership is not a pending invitation of this user")
}
let policies = OrgPolicy::find_by_org(&org_id, &conn).await; let policies = OrgPolicy::find_by_org(&org_id, &conn).await;
let policies_json: Vec<Value> = policies.iter().map(OrgPolicy::to_json).collect(); let policies_json: Vec<Value> = policies.iter().filter(|p| p.enabled).map(OrgPolicy::to_json).collect();
Ok(Json(json!({ Ok(Json(json!({
"data": policies_json, "data": policies_json,
@ -2387,9 +2417,13 @@ async fn get_policy(org_id: OrganizationId, pol_type: i32, headers: ManagePolici
err!("Invalid or unsupported policy type") err!("Invalid or unsupported policy type")
}; };
let policy = OrgPolicy::find_by_org_and_type(&org_id, pol_type_enum, &conn) let policy = match OrgPolicy::find_by_org_and_type(&org_id, pol_type_enum, &conn).await {
.await Some(p) => p,
.unwrap_or_else(|| OrgPolicy::new(org_id.clone(), pol_type_enum, false, "null".to_owned())); None if pol_type_enum == OrgPolicyType::SendControls => {
OrgPolicy::synthesize_send_controls(&org_id, &OrgPolicy::find_by_org(&org_id, &conn).await)
}
None => OrgPolicy::new(org_id.clone(), pol_type_enum, false, "null".to_owned()),
};
Ok(Json(policy.to_json())) Ok(Json(policy.to_json()))
} }
@ -2453,7 +2487,6 @@ async fn put_policy(
// Vaultwarden encouraged to use multiple orgs instead of groups because groups were not available in the past // Vaultwarden encouraged to use multiple orgs instead of groups because groups were not available in the past
// Now that groups are available we can enforce this option when wanted. // Now that groups are available we can enforce this option when wanted.
// We put this behind a config option to prevent breaking current installation. // We put this behind a config option to prevent breaking current installation.
// Maybe we want to enable this by default in the future, but currently it is disabled by default.
if CONFIG.enforce_single_org_with_reset_pw_policy() { if CONFIG.enforce_single_org_with_reset_pw_policy() {
if pol_type_enum == OrgPolicyType::ResetPassword && data.enabled { if pol_type_enum == OrgPolicyType::ResetPassword && data.enabled {
let single_org_policy_enabled = OrgPolicy::find_by_org_and_type(&org_id, OrgPolicyType::SingleOrg, &conn) let single_org_policy_enabled = OrgPolicy::find_by_org_and_type(&org_id, OrgPolicyType::SingleOrg, &conn)
@ -2529,13 +2562,15 @@ async fn put_policy(
.await?; .await?;
} }
let policy_data = OrgPolicy::send_policy_data(pol_type_enum, data.data)?;
let mut policy = match current_policy { let mut policy = match current_policy {
Some(p) => p, Some(p) => p,
None => OrgPolicy::new(org_id.clone(), pol_type_enum, false, "{}".to_owned()), None => OrgPolicy::new(org_id.clone(), pol_type_enum, false, "{}".to_owned()),
}; };
policy.enabled = data.enabled; policy.enabled = data.enabled;
policy.data = serde_json::to_string(&data.data)?; policy.data = serde_json::to_string(&policy_data)?;
policy.save(&conn).await?; policy.save(&conn).await?;
log_event( log_event(
@ -2549,6 +2584,8 @@ async fn put_policy(
) )
.await; .await;
OrgPolicy::sync_send_policies(&policy, &conn).await?;
Ok(Json(policy.to_json())) Ok(Json(policy.to_json()))
} }
@ -2987,8 +3024,11 @@ impl GroupRequest {
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
struct CollectionData { struct CollectionData {
id: CollectionId, id: CollectionId,
#[serde(default)]
read_only: bool, read_only: bool,
#[serde(default)]
hide_passwords: bool, hide_passwords: bool,
#[serde(default)]
manage: bool, manage: bool,
} }
@ -3707,12 +3747,13 @@ async fn put_reset_password_enrollment(
data: Json<OrganizationUserResetPasswordEnrollmentRequest>, data: Json<OrganizationUserResetPasswordEnrollmentRequest>,
conn: DbConn, conn: DbConn,
) -> EmptyResult { ) -> EmptyResult {
if user_id != headers.user.uuid { let mut membership = headers.membership;
let mut user = headers.user;
if user_id != user.uuid {
err!("User to enroll isn't member of required organization", "The user_id and acting user do not match"); err!("User to enroll isn't member of required organization", "The user_id and acting user do not match");
} }
let mut membership = headers.membership;
check_reset_password_applicable(&org_id, &conn).await?; check_reset_password_applicable(&org_id, &conn).await?;
let reset_request = data.into_inner(); let reset_request = data.into_inner();
@ -3727,7 +3768,7 @@ async fn put_reset_password_enrollment(
master_password_hash: reset_request.master_password_hash, master_password_hash: reset_request.master_password_hash,
otp: reset_request.otp, otp: reset_request.otp,
} }
.validate(&headers.user, true, &conn) .validate(&mut user, true, &conn)
.await?; .await?;
} }
@ -3743,8 +3784,7 @@ async fn put_reset_password_enrollment(
EventType::OrganizationUserResetPasswordWithdraw EventType::OrganizationUserResetPasswordWithdraw
}; };
log_event(event_type, &membership.uuid, &org_id, &headers.user.uuid, headers.device.atype, &headers.ip.ip, &conn) log_event(event_type, &membership.uuid, &org_id, &user.uuid, headers.device.atype, &headers.ip.ip, &conn).await;
.await;
Ok(()) Ok(())
} }
@ -3778,10 +3818,10 @@ async fn api_key(
err!("Organization not found", "Organization id's do not match"); err!("Organization not found", "Organization id's do not match");
} }
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
let user = headers.user; let mut user = headers.user;
// Validate the owner users password/otp // Validate the owner users password/otp
data.validate(&user, true, &conn).await?; data.validate(&mut user, true, &conn).await?;
let org_api_key = if let Some(mut org_api_key) = OrganizationApiKey::find_by_org_uuid(org_id, &conn).await { let org_api_key = if let Some(mut org_api_key) = OrganizationApiKey::find_by_org_uuid(org_id, &conn).await {
if rotate { if rotate {

59
src/api/core/sends.rs

@ -15,7 +15,7 @@ use crate::{
config::PathType, config::PathType,
db::{ db::{
DbConn, DbPool, DbConn, DbPool,
models::{Device, OrgPolicy, OrgPolicyType, Send, SendFileId, SendId, SendType, UserId}, models::{Device, OrgPolicy, Send, SendFileId, SendId, SendType, UserId},
}, },
util::{NumberOrString, save_temp_file}, util::{NumberOrString, save_temp_file},
}; };
@ -89,40 +89,16 @@ pub struct SendData {
pub id: Option<SendId>, pub id: Option<SendId>,
} }
/// Enforces the `Disable Send` policy. A non-owner/admin user belonging to /// Enforces the Send policies (`Send controls` and the legacy `Disable Send` and `Send Options` it
/// an org with this policy enabled isn't allowed to create new Sends or /// absorbs) on the Send as it would be saved. Deleting a Send is always allowed.
/// modify existing ones, but is allowed to delete them.
///
/// Ref: https://bitwarden.com/help/article/policies/#disable-send
/// ///
/// There is also a Vaultwarden-specific `sends_allowed` config setting that /// There is also a Vaultwarden-specific `sends_allowed` config setting that
/// controls this policy globally. /// controls this policy globally.
async fn enforce_disable_send_policy(headers: &Headers, conn: &DbConn) -> EmptyResult { async fn enforce_send_policy(send: &Send, headers: &Headers, conn: &DbConn) -> EmptyResult {
let user_id = &headers.user.uuid; if !CONFIG.sends_allowed() {
if !CONFIG.sends_allowed()
|| OrgPolicy::is_applicable_to_user(user_id, OrgPolicyType::DisableSend, None, conn).await
{
err!("Due to an Enterprise Policy, you are only able to delete an existing Send.") err!("Due to an Enterprise Policy, you are only able to delete an existing Send.")
} }
Ok(()) OrgPolicy::check_send(&headers.user.uuid, send, conn).await
}
/// Enforces the `DisableHideEmail` option of the `Send Options` policy.
/// A non-owner/admin user belonging to an org with this option enabled isn't
/// allowed to hide their email address from the recipient of a Bitwarden Send,
/// but is allowed to remove this option from an existing Send.
///
/// Ref: https://bitwarden.com/help/article/policies/#send-options
async fn enforce_disable_hide_email_policy(data: &SendData, headers: &Headers, conn: &DbConn) -> EmptyResult {
let user_id = &headers.user.uuid;
let hide_email = data.hide_email.unwrap_or(false);
if hide_email && OrgPolicy::is_hide_email_disabled(user_id, conn).await {
err!(
"Due to an Enterprise Policy, you are not allowed to hide your email address \
from recipients when creating or editing a Send."
)
}
Ok(())
} }
/// Stores a text Send that is already encrypted, as [`create_send`] does, for the test seeder (`unsafe_test_mode`). /// Stores a text Send that is already encrypted, as [`create_send`] does, for the test seeder (`unsafe_test_mode`).
@ -205,16 +181,14 @@ async fn get_send(send_id: SendId, headers: Headers, conn: DbConn) -> JsonResult
#[post("/sends", data = "<data>")] #[post("/sends", data = "<data>")]
async fn post_send(data: Json<SendData>, headers: Headers, conn: DbConn, nt: Notify<'_>) -> JsonResult { async fn post_send(data: Json<SendData>, headers: Headers, conn: DbConn, nt: Notify<'_>) -> JsonResult {
enforce_disable_send_policy(&headers, &conn).await?;
let data: SendData = data.into_inner(); let data: SendData = data.into_inner();
enforce_disable_hide_email_policy(&data, &headers, &conn).await?;
if data.r#type == SendType::File as i32 { if data.r#type == SendType::File as i32 {
err!("File sends should use /api/sends/file/v2") err!("File sends should use /api/sends/file/v2")
} }
let mut send = create_send(data, headers.user.uuid)?; let mut send = create_send(data, headers.user.uuid.clone())?;
enforce_send_policy(&send, &headers, &conn).await?;
send.save(&conn).await?; send.save(&conn).await?;
nt.send_send_update( nt.send_send_update(
UpdateType::SyncSendCreate, UpdateType::SyncSendCreate,
@ -236,16 +210,12 @@ struct UploadDataV2<'f> {
// Upstream: https://github.com/bitwarden/server/blob/9ebe16587175b1c0e9208f84397bb75d0d595510/src/Api/Tools/Controllers/SendsController.cs#L165 // Upstream: https://github.com/bitwarden/server/blob/9ebe16587175b1c0e9208f84397bb75d0d595510/src/Api/Tools/Controllers/SendsController.cs#L165
#[post("/sends/file/v2", data = "<data>")] #[post("/sends/file/v2", data = "<data>")]
async fn post_send_file_v2(data: Json<SendData>, headers: Headers, conn: DbConn) -> JsonResult { async fn post_send_file_v2(data: Json<SendData>, headers: Headers, conn: DbConn) -> JsonResult {
enforce_disable_send_policy(&headers, &conn).await?;
let data = data.into_inner(); let data = data.into_inner();
if data.r#type != SendType::File as i32 { if data.r#type != SendType::File as i32 {
err!("Send content is not a file"); err!("Send content is not a file");
} }
enforce_disable_hide_email_policy(&data, &headers, &conn).await?;
let file_length = if let Some(m) = &data.file_length { let file_length = if let Some(m) = &data.file_length {
m.into_i64()? m.into_i64()?
} else { } else {
@ -276,7 +246,8 @@ async fn post_send_file_v2(data: Json<SendData>, headers: Headers, conn: DbConn)
err!("Send storage limit exceeded with this file"); err!("Send storage limit exceeded with this file");
} }
let mut send = create_send(data, headers.user.uuid)?; let mut send = create_send(data, headers.user.uuid.clone())?;
enforce_send_policy(&send, &headers, &conn).await?;
let file_id = crate::crypto::generate_send_file_id(); let file_id = crate::crypto::generate_send_file_id();
@ -316,8 +287,6 @@ async fn post_send_file_v2_data(
conn: DbConn, conn: DbConn,
nt: Notify<'_>, nt: Notify<'_>,
) -> EmptyResult { ) -> EmptyResult {
enforce_disable_send_policy(&headers, &conn).await?;
let data = data.into_inner(); let data = data.into_inner();
let Some(send) = Send::find_by_uuid_and_user(&send_id, &headers.user.uuid, &conn).await else { let Some(send) = Send::find_by_uuid_and_user(&send_id, &headers.user.uuid, &conn).await else {
@ -327,6 +296,7 @@ async fn post_send_file_v2_data(
if send.atype != SendType::File as i32 { if send.atype != SendType::File as i32 {
err!("Send is not a file type send."); err!("Send is not a file type send.");
} }
enforce_send_policy(&send, &headers, &conn).await?;
let Ok(send_data) = serde_json::from_str::<SendFileData>(&send.data) else { let Ok(send_data) = serde_json::from_str::<SendFileData>(&send.data) else {
err!("Unable to decode send data as json.") err!("Unable to decode send data as json.")
@ -475,10 +445,7 @@ async fn download_send(send_id: SendId, file_id: SendFileId, t: &str) -> Option<
#[put("/sends/<send_id>", data = "<data>")] #[put("/sends/<send_id>", data = "<data>")]
async fn put_send(send_id: SendId, data: Json<SendData>, headers: Headers, conn: DbConn, nt: Notify<'_>) -> JsonResult { async fn put_send(send_id: SendId, data: Json<SendData>, headers: Headers, conn: DbConn, nt: Notify<'_>) -> JsonResult {
enforce_disable_send_policy(&headers, &conn).await?;
let data: SendData = data.into_inner(); let data: SendData = data.into_inner();
enforce_disable_hide_email_policy(&data, &headers, &conn).await?;
let Some(mut send) = Send::find_by_uuid_and_user(&send_id, &headers.user.uuid, &conn).await else { let Some(mut send) = Send::find_by_uuid_and_user(&send_id, &headers.user.uuid, &conn).await else {
err!("Send not found", "Send send_id is invalid or does not belong to user") err!("Send not found", "Send send_id is invalid or does not belong to user")
@ -541,6 +508,7 @@ async fn update_send_from_data(
send.set_password(Some(&password)); send.set_password(Some(&password));
} }
enforce_send_policy(send, headers, conn).await?;
send.save(conn).await?; send.save(conn).await?;
if ut != UpdateType::None { if ut != UpdateType::None {
nt.send_send_update(ut, send, &send.update_users_revision(conn).await, &headers.device, conn).await; nt.send_send_update(ut, send, &send.update_users_revision(conn).await, &headers.device, conn).await;
@ -569,13 +537,12 @@ async fn delete_send(send_id: SendId, headers: Headers, conn: DbConn, nt: Notify
#[put("/sends/<send_id>/remove-password")] #[put("/sends/<send_id>/remove-password")]
async fn put_remove_password(send_id: SendId, headers: Headers, conn: DbConn, nt: Notify<'_>) -> JsonResult { async fn put_remove_password(send_id: SendId, headers: Headers, conn: DbConn, nt: Notify<'_>) -> JsonResult {
enforce_disable_send_policy(&headers, &conn).await?;
let Some(mut send) = Send::find_by_uuid_and_user(&send_id, &headers.user.uuid, &conn).await else { let Some(mut send) = Send::find_by_uuid_and_user(&send_id, &headers.user.uuid, &conn).await else {
err!("Send not found", "Invalid send uuid, or does not belong to user") err!("Send not found", "Invalid send uuid, or does not belong to user")
}; };
send.set_password(None); send.set_password(None);
enforce_send_policy(&send, &headers, &conn).await?;
send.save(&conn).await?; send.save(&conn).await?;
nt.send_send_update( nt.send_send_update(
UpdateType::SyncSendUpdate, UpdateType::SyncSendUpdate,

4
src/api/core/two_factor/authenticator.rs

@ -20,9 +20,9 @@ pub fn routes() -> Vec<Route> {
#[post("/two-factor/get-authenticator", data = "<data>")] #[post("/two-factor/get-authenticator", data = "<data>")]
async fn generate_authenticator(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn) -> JsonResult { async fn generate_authenticator(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn) -> JsonResult {
let user = headers.user; let mut user = headers.user;
data.validate(&user, false, &conn).await?; data.validate(&mut user, false, &conn).await?;
let twofactor = TwoFactor::find_by_user_and_type(&user.uuid, TwoFactorType::Authenticator, &conn).await; let twofactor = TwoFactor::find_by_user_and_type(&user.uuid, TwoFactorType::Authenticator, &conn).await;

4
src/api/core/two_factor/duo.rs

@ -43,9 +43,9 @@ const DISABLED_MESSAGE_DEFAULT: &str = "<To use the global Duo keys, please leav
#[post("/two-factor/get-duo", data = "<data>")] #[post("/two-factor/get-duo", data = "<data>")]
async fn get_duo(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn) -> JsonResult { async fn get_duo(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn) -> JsonResult {
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
let user = headers.user; let mut user = headers.user;
data.validate(&user, false, &conn).await?; data.validate(&mut user, false, &conn).await?;
let (enabled, duo) = match get_user_duo_data(&user.uuid, &conn).await { let (enabled, duo) = match get_user_duo_data(&user.uuid, &conn).await {
DuoStatus::Global(_) => (true, Some(DuoData::secret())), DuoStatus::Global(_) => (true, Some(DuoData::secret())),

4
src/api/core/two_factor/email.rs

@ -154,9 +154,9 @@ pub async fn send_token(user_id: &UserId, conn: &DbConn) -> EmptyResult {
#[post("/two-factor/get-email", data = "<data>")] #[post("/two-factor/get-email", data = "<data>")]
async fn get_email(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn) -> JsonResult { async fn get_email(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn) -> JsonResult {
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
let user = headers.user; let mut user = headers.user;
data.validate(&user, false, &conn).await?; data.validate(&mut user, false, &conn).await?;
let (enabled, mfa_email) = let (enabled, mfa_email) =
if let Some(x) = TwoFactor::find_by_user_and_type(&user.uuid, TwoFactorType::Email, &conn).await { if let Some(x) = TwoFactor::find_by_user_and_type(&user.uuid, TwoFactorType::Email, &conn).await {

5
src/api/core/two_factor/mod.rs

@ -104,9 +104,9 @@ async fn get_twofactor(headers: Headers, conn: DbConn) -> Json<Value> {
#[post("/two-factor/get-recover", data = "<data>")] #[post("/two-factor/get-recover", data = "<data>")]
async fn get_recover(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn) -> JsonResult { async fn get_recover(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn) -> JsonResult {
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
let user = headers.user; let mut user = headers.user;
data.validate(&user, true, &conn).await?; data.validate(&mut user, true, &conn).await?;
Ok(Json(json!({ Ok(Json(json!({
"code": user.totp_recover, "code": user.totp_recover,
@ -129,6 +129,7 @@ pub async fn check_2fa_state(user: &User, device_type: i32, ip: &std::net::IpAdd
if TwoFactor::find_by_user(&user.uuid, conn).await.is_empty() { if TwoFactor::find_by_user(&user.uuid, conn).await.is_empty() {
enforce_2fa_policy(user, &user.uuid, device_type, ip, true, conn).await?; enforce_2fa_policy(user, &user.uuid, device_type, ip, true, conn).await?;
} }
Ok(()) Ok(())
} }

22
src/api/core/two_factor/webauthn.rs

@ -46,6 +46,14 @@ static WEBAUTHN: LazyLock<Webauthn> = LazyLock::new(|| {
webauthn.build().expect("Building Webauthn failed") webauthn.build().expect("Building Webauthn failed")
}); });
fn user_verification_policy() -> UserVerificationPolicy {
if CONFIG.webauthn_2fa_prefer_user_verification() {
UserVerificationPolicy::Preferred
} else {
UserVerificationPolicy::Discouraged_DO_NOT_USE
}
}
pub fn routes() -> Vec<Route> { pub fn routes() -> Vec<Route> {
routes![ routes![
get_webauthn, get_webauthn,
@ -123,9 +131,9 @@ async fn get_webauthn(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbC
} }
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
let user = headers.user; let mut user = headers.user;
data.validate(&user, false, &conn).await?; data.validate(&mut user, false, &conn).await?;
let (enabled, registrations) = get_webauthn_registrations(&user.uuid, &conn).await?; let (enabled, registrations) = get_webauthn_registrations(&user.uuid, &conn).await?;
let keys: Vec<i32> = registrations.iter().map(|r| r.id).collect(); let keys: Vec<i32> = registrations.iter().map(|r| r.id).collect();
@ -161,7 +169,8 @@ async fn generate_webauthn_challenge(data: Json<VerificationTokenData>, headers:
)?; )?;
let mut state = serde_json::to_value(&state)?; let mut state = serde_json::to_value(&state)?;
state["rs"]["policy"] = Value::String("discouraged".to_owned()); let user_verification_policy = user_verification_policy();
state["rs"]["policy"] = serde_json::to_value(user_verification_policy)?;
state["rs"]["extensions"].as_object_mut().unwrap().clear(); state["rs"]["extensions"].as_object_mut().unwrap().clear();
let type_ = TwoFactorType::WebauthnRegisterChallenge; let type_ = TwoFactorType::WebauthnRegisterChallenge;
@ -171,7 +180,7 @@ async fn generate_webauthn_challenge(data: Json<VerificationTokenData>, headers:
// we need to modify some of the default settings defined by `start_passkey_registration()`. // we need to modify some of the default settings defined by `start_passkey_registration()`.
challenge.public_key.extensions = None; challenge.public_key.extensions = None;
if let Some(asc) = challenge.public_key.authenticator_selection.as_mut() { if let Some(asc) = challenge.public_key.authenticator_selection.as_mut() {
asc.user_verification = UserVerificationPolicy::Discouraged_DO_NOT_USE; asc.user_verification = user_verification_policy;
} }
let mut challenge_value = serde_json::to_value(challenge.public_key)?; let mut challenge_value = serde_json::to_value(challenge.public_key)?;
@ -425,13 +434,14 @@ pub async fn generate_webauthn_login(user_id: &UserId, conn: &DbConn) -> JsonRes
// Modify to discourage user verification // Modify to discourage user verification
let mut state = serde_json::to_value(&state)?; let mut state = serde_json::to_value(&state)?;
state["ast"]["policy"] = Value::String("discouraged".to_owned()); let user_verification_policy = user_verification_policy();
state["ast"]["policy"] = serde_json::to_value(user_verification_policy)?;
// Add appid, this is only needed for U2F compatibility, so maybe it can be removed as well // Add appid, this is only needed for U2F compatibility, so maybe it can be removed as well
let app_id = format!("{}/app-id.json", CONFIG.domain()); let app_id = format!("{}/app-id.json", CONFIG.domain());
state["ast"]["appid"] = Value::String(app_id.clone()); state["ast"]["appid"] = Value::String(app_id.clone());
response.public_key.user_verification = UserVerificationPolicy::Discouraged_DO_NOT_USE; response.public_key.user_verification = user_verification_policy;
response response
.public_key .public_key
.extensions .extensions

5
src/api/core/two_factor/yubikey.rs

@ -122,9 +122,9 @@ async fn generate_yubikey(data: Json<PasswordOrOtpData>, headers: Headers, conn:
get_yubico_credentials()?; get_yubico_credentials()?;
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
let user = headers.user; let mut user = headers.user;
data.validate(&user, false, &conn).await?; data.validate(&mut user, false, &conn).await?;
let user_id = &user.uuid; let user_id = &user.uuid;
@ -148,6 +148,7 @@ async fn generate_yubikey(data: Json<PasswordOrOtpData>, headers: Headers, conn:
#[post("/two-factor/yubikey", data = "<data>")] #[post("/two-factor/yubikey", data = "<data>")]
async fn activate_yubikey(data: Json<EnableYubikeyData>, headers: Headers, conn: DbConn) -> JsonResult { async fn activate_yubikey(data: Json<EnableYubikeyData>, headers: Headers, conn: DbConn) -> JsonResult {
let data: EnableYubikeyData = data.into_inner(); let data: EnableYubikeyData = data.into_inner();
let yubikeys = parse_yubikeys(&data); let yubikeys = parse_yubikeys(&data);
let mut user = headers.user; let mut user = headers.user;

14
src/api/core/webauthn_login.rs

@ -258,8 +258,8 @@ async fn get_api_webauthn(headers: Headers, conn: DbConn) -> Json<Value> {
async fn post_attestation_options(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn) -> JsonResult { async fn post_attestation_options(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn) -> JsonResult {
check_passkey_creation_allowed()?; check_passkey_creation_allowed()?;
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
let user = headers.user; let mut user = headers.user;
data.validate(&user, true, &conn).await?; data.validate(&mut user, true, &conn).await?;
let exclude = WebauthnCredential::find_by_user(&user.uuid, &conn) let exclude = WebauthnCredential::find_by_user(&user.uuid, &conn)
.await .await
@ -299,9 +299,10 @@ async fn post_attestation_options(data: Json<PasswordOrOtpData>, headers: Header
async fn post_assertion_options(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn) -> JsonResult { async fn post_assertion_options(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbConn) -> JsonResult {
check_webauthn_supported()?; check_webauthn_supported()?;
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
data.validate(&headers.user, true, &conn).await?; let mut user = headers.user;
data.validate(&mut user, true, &conn).await?;
assertion_options(TokenScope::UpdateKeySet, Some(&headers.user.uuid)) assertion_options(TokenScope::UpdateKeySet, Some(&user.uuid))
} }
#[derive(Deserialize)] #[derive(Deserialize)]
@ -401,9 +402,10 @@ async fn delete_credential(
conn: DbConn, conn: DbConn,
) -> EmptyResult { ) -> EmptyResult {
let data: PasswordOrOtpData = data.into_inner(); let data: PasswordOrOtpData = data.into_inner();
data.validate(&headers.user, true, &conn).await?; let mut user = headers.user;
data.validate(&mut user, true, &conn).await?;
if !WebauthnCredential::delete_by_uuid_and_user(&id, &headers.user.uuid, &conn).await? { if !WebauthnCredential::delete_by_uuid_and_user(&id, &user.uuid, &conn).await? {
err_code!("Credential not found.", Status::NotFound.code) err_code!("Credential not found.", Status::NotFound.code)
} }
Ok(()) Ok(())

30
src/api/icons.rs

@ -13,7 +13,11 @@ use reqwest::{
Client, Response, Client, Response,
header::{self, HeaderMap, HeaderValue}, header::{self, HeaderMap, HeaderValue},
}; };
use rocket::{Route, http::ContentType, response::Redirect}; use rocket::{
Route,
http::ContentType,
response::{Redirect, status::NotFound},
};
use svg_hush::{Filter, data_url_filter}; use svg_hush::{Filter, data_url_filter};
use crate::{ use crate::{
@ -106,33 +110,21 @@ fn icon_external(host: &str) -> Cached<Option<Redirect>> {
} }
#[get("/<host>/icon.png")] #[get("/<host>/icon.png")]
async fn icon_internal(host: &str) -> Cached<(ContentType, Vec<u8>)> { async fn icon_internal(host: &str) -> Result<Cached<(ContentType, Vec<u8>)>, Cached<NotFound<()>>> {
const FALLBACK_ICON: &[u8] = include_bytes!("../static/images/fallback-icon.png"); let not_found = || Cached::ttl(NotFound(()), CONFIG.icon_cache_negttl(), true);
let Ok(host) = get_valid_host(host) else { let Ok(host) = get_valid_host(host) else {
warn!("Invalid host: {}", host.escape_debug()); warn!("Invalid host: {}", host.escape_debug());
return Cached::ttl( return Err(not_found());
(ContentType::new("image", "png"), FALLBACK_ICON.to_vec()),
CONFIG.icon_cache_negttl(),
true,
);
}; };
if should_block_host(&host).is_err() { if should_block_host(&host).is_err() {
warn!("Blocked address: {host}"); warn!("Blocked address: {host}");
return Cached::ttl( return Err(not_found());
(ContentType::new("image", "png"), FALLBACK_ICON.to_vec()),
CONFIG.icon_cache_negttl(),
true,
);
} }
match get_icon(&host.to_string()).await { let (icon, icon_type) = get_icon(&host.to_string()).await.ok_or_else(not_found)?;
Some((icon, icon_type)) => { Ok(Cached::ttl((ContentType::new("image", icon_type), icon), CONFIG.icon_cache_ttl(), true))
Cached::ttl((ContentType::new("image", icon_type), icon), CONFIG.icon_cache_ttl(), true)
}
_ => Cached::ttl((ContentType::new("image", "png"), FALLBACK_ICON.to_vec()), CONFIG.icon_cache_negttl(), true),
}
} }
async fn get_icon(domain: &str) -> Option<(Vec<u8>, String)> { async fn get_icon(domain: &str) -> Option<(Vec<u8>, String)> {

64
src/api/identity.rs

@ -14,7 +14,7 @@ use crate::{
api::{ api::{
ApiResult, EmptyResult, JsonResult, ApiResult, EmptyResult, JsonResult,
core::{ core::{
accounts::{PreloginData, RegisterData, kdf_upgrade, prelogin, register}, accounts::{PreloginData, RegisterData, prelogin, register},
log_user_event, log_user_event,
two_factor::{ two_factor::{
authenticator, duo_oidc, email, enforce_2fa_policy, is_twofactor_provider_usable, webauthn, yubikey, authenticator, duo_oidc, email, enforce_2fa_policy, is_twofactor_provider_usable, webauthn, yubikey,
@ -475,32 +475,11 @@ async fn password_login(
// Change the KDF Iterations (only when not logging in with an auth request) // Change the KDF Iterations (only when not logging in with an auth request)
if data.auth_request.is_none() { if data.auth_request.is_none() {
kdf_upgrade(&mut user, password, conn).await?; user.check_persist_kdf_upgrade(password, conn).await?;
} }
let now = Utc::now().naive_utc();
if user.verified_at.is_none() && CONFIG.mail_enabled() && CONFIG.signups_verify() { if user.verified_at.is_none() && CONFIG.mail_enabled() && CONFIG.signups_verify() {
if user resend_verify_email(&mut user, conn).await;
.last_verifying_at
.is_none_or(|d| now.signed_duration_since(d).num_seconds() > i64::from(CONFIG.signups_verify_resend_time()))
{
let resend_limit = i32::from(CONFIG.signups_verify_resend_limit());
if resend_limit == 0 || user.login_verify_count < resend_limit {
// We want to send another email verification if we require signups to verify
// their email address, and we haven't sent them a reminder in a while...
user.last_verifying_at = Some(now);
user.login_verify_count += 1;
if let Err(e) = user.save(conn).await {
error!("Error updating user: {e:#?}");
}
if let Err(e) = mail::send_verify_email(&user.email, &user.uuid).await {
error!("Error auto-sending email verification email: {e:#?}");
}
}
}
// We still want the login to fail until they actually verified the email address // We still want the login to fail until they actually verified the email address
err!( err!(
@ -548,7 +527,7 @@ async fn passkey_login(
err!("Passkey login is not available") err!("Passkey login is not available")
} }
let (user, credential) = webauthn_login::assert_login( let (mut user, credential) = webauthn_login::assert_login(
data.token.as_deref().unwrap_or_default(), data.token.as_deref().unwrap_or_default(),
data.device_response.as_deref().unwrap_or_default(), data.device_response.as_deref().unwrap_or_default(),
&ip.ip, &ip.ip,
@ -573,9 +552,11 @@ async fn passkey_login(
check_client_version(&user, client_header)?; check_client_version(&user, client_header)?;
if user.verified_at.is_none() && CONFIG.mail_enabled() && CONFIG.signups_verify() { if user.verified_at.is_none() && CONFIG.mail_enabled() && CONFIG.signups_verify() {
resend_verify_email(&mut user, conn).await;
err!( err!(
"Please verify your email before trying again.", "Please verify your email before trying again.",
format!("IP: {}. Username: {log_username}.", ip.ip), format!("IP: {}. Username: {}.", ip.ip, user.email.escape_debug()),
ErrorEvent { ErrorEvent {
event: EventType::UserFailedLogIn event: EventType::UserFailedLogIn
} }
@ -598,6 +579,30 @@ async fn passkey_login(
Ok(result) Ok(result)
} }
/// For a login refused because the email isn't verified yet: sends another verification email, at most once per
/// `SIGNUPS_VERIFY_RESEND_TIME` and `SIGNUPS_VERIFY_RESEND_LIMIT` times in all (0 for no limit).
async fn resend_verify_email(user: &mut User, conn: &DbConn) {
let now = Utc::now().naive_utc();
if user
.last_verifying_at
.is_none_or(|d| now.signed_duration_since(d).num_seconds() > i64::from(CONFIG.signups_verify_resend_time()))
{
let resend_limit = i32::from(CONFIG.signups_verify_resend_limit());
if resend_limit == 0 || user.login_verify_count < resend_limit {
user.last_verifying_at = Some(now);
user.login_verify_count += 1;
if let Err(e) = user.save(conn).await {
error!("Error updating user: {e:#?}");
}
if let Err(e) = mail::send_verify_email(&user.email, &user.uuid).await {
error!("Error auto-sending email verification email: {e:#?}");
}
}
}
}
/// Like upstream's `ClientVersionValidator`, every login needs the `Bitwarden-Client-Version` header, and a V2 account /// Like upstream's `ClientVersionValidator`, every login needs the `Bitwarden-Client-Version` header, and a V2 account
/// ([`User::has_v2_encryption`]) a client of at least 2026.10.1 (2026.10.2 for the desktop app). Called right after the /// ([`User::has_v2_encryption`]) a client of at least 2026.10.1 (2026.10.2 for the desktop app). Called right after the
/// credentials are checked, like upstream, so that it doesn't tell anyone else which accounts are V2. /// credentials are checked, like upstream, so that it doesn't tell anyone else which accounts are V2.
@ -684,7 +689,12 @@ async fn authenticated_response(
// register push device // register push device
if !device.is_new() { if !device.is_new() {
register_push_device(device, conn).await?; // Registering the device for push is best-effort: a failure talking to the
// push relay/identity server must not turn a successful authentication into
// an error (see #7371). This mirrors the new-device email handling above.
if let Err(e) = register_push_device(device, conn).await {
error!("An error occurred while registering the device for push notifications: {e}");
}
} }
// Save to update `device.updated_at` to track usage and toggle new status // Save to update `device.updated_at` to track usage and toggle new status

4
src/api/mod.rs

@ -63,7 +63,7 @@ impl PasswordOrOtpData {
/// Tokens used via this struct can be used multiple times during the process /// Tokens used via this struct can be used multiple times during the process
/// First for the validation to continue, after that to enable or validate the following actions /// First for the validation to continue, after that to enable or validate the following actions
/// This is different per caller, so it can be adjusted to delete the token or not /// This is different per caller, so it can be adjusted to delete the token or not
pub async fn validate(&self, user: &User, delete_if_valid: bool, conn: &DbConn) -> EmptyResult { pub async fn validate(&self, user: &mut User, delete_if_valid: bool, conn: &DbConn) -> EmptyResult {
use crate::api::core::two_factor::protected_actions::validate_protected_action_otp; use crate::api::core::two_factor::protected_actions::validate_protected_action_otp;
match (self.master_password_hash.as_deref(), self.otp.as_deref()) { match (self.master_password_hash.as_deref(), self.otp.as_deref()) {
@ -71,6 +71,8 @@ impl PasswordOrOtpData {
if !user.check_valid_password(pw_hash) { if !user.check_valid_password(pw_hash) {
err!("Invalid password"); err!("Invalid password");
} }
user.check_persist_kdf_upgrade(pw_hash, conn).await?;
} }
(None, Some(otp)) => { (None, Some(otp)) => {
validate_protected_action_otp(otp, &user.uuid, delete_if_valid, conn).await?; validate_protected_action_otp(otp, &user.uuid, delete_if_valid, conn).await?;

69
src/config.rs

@ -71,9 +71,16 @@ macro_rules! make_config {
( @type $ty:ty, option) => { Option<$ty> }; ( @type $ty:ty, option) => { Option<$ty> };
( @type $ty:ty, $id:ident) => { $ty }; ( @type $ty:ty, $id:ident) => { $ty };
// Options that only builds with the `unsafe_test_mode` feature read
( @test_only test_def ) => { true };
( @test_only $none_action:ident ) => { false };
// Generate the values depending on none_action // Generate the values depending on none_action
( @build $value:expr, $config:expr, option, ) => { $value }; ( @build $value:expr, $config:expr, option, ) => { $value };
( @build $value:expr, $config:expr, def, $default:expr ) => { $value.unwrap_or($default) }; ( @build $value:expr, $config:expr, def, $default:expr ) => { $value.unwrap_or($default) };
( @build $value:expr, $config:expr, test_def, $default:expr ) => {
if cfg!(feature = "unsafe_test_mode") { $value.unwrap_or($default) } else { $default }
};
( @build $value:expr, $config:expr, auto, $default_fn:expr ) => {{ ( @build $value:expr, $config:expr, auto, $default_fn:expr ) => {{
match $value { match $value {
Some(v) => v, Some(v) => v,
@ -286,6 +293,22 @@ macro_rules! make_config {
)+)+ )+)+
} }
/// Warns about each set `test_def` option in a build without the `unsafe_test_mode` feature, which ignores them.
fn warn_test_only_options(&self) {
if cfg!(feature = "unsafe_test_mode") {
return;
}
$($(
if make_config! { @test_only $none_action } && self.$name.is_some() {
// We can't use warn! here because logging isn't setup yet.
println!(
"[WARNING] {} is only read by builds with the `unsafe_test_mode` feature, ignoring it.",
pastey::paste!(stringify!([<$name:upper>]))
);
}
)+)+
}
/// Merges the values of both builders into a new builder. /// Merges the values of both builders into a new builder.
/// If both have the same element, `other` wins. /// If both have the same element, `other` wins.
fn merge(&self, other: &Self, show_overrides: bool, overrides: &mut Vec<&str>) -> Self { fn merge(&self, other: &Self, show_overrides: bool, overrides: &mut Vec<&str>) -> Self {
@ -352,6 +375,8 @@ macro_rules! make_config {
r#type: &'static str, r#type: &'static str,
doc: ElementDoc, doc: ElementDoc,
overridden: bool, overridden: bool,
#[serde(skip)]
test_only: bool,
} }
#[derive(Serialize)] #[derive(Serialize)]
@ -411,10 +436,20 @@ macro_rules! make_config {
r#type: get_form_type(stringify!($ty)), r#type: get_form_type(stringify!($ty)),
doc: get_doc(concat!($($doc),+)), doc: get_doc(concat!($($doc),+)),
overridden: overridden.contains(&pastey::paste!(stringify!([<$name:upper>]))), overridden: overridden.contains(&pastey::paste!(stringify!([<$name:upper>]))),
test_only: make_config! { @test_only $none_action },
}, },
)+], // End of elements repetition )+], // End of elements repetition
}, },
)+]; // End of groups repetition )+]; // End of groups repetition
// Options only test builds read aren't shown in the others
let data: Vec<GroupData> = data
.into_iter()
.map(|mut group| {
group.elements.retain(|e| !e.test_only || cfg!(feature = "unsafe_test_mode"));
group
})
.collect();
serde_json::to_value(data).unwrap() serde_json::to_value(data).unwrap()
} }
@ -513,6 +548,8 @@ macro_rules! make_config {
// //
// Where action applied when the value wasn't provided and can be: // Where action applied when the value wasn't provided and can be:
// def: Use a default value // def: Use a default value
// test_def: Use a default value, which only builds with the `unsafe_test_mode` feature let you change. Other builds
// warn at startup when it's set, ignore it, and don't show it in the admin panel
// auto: Value is auto generated based on other values // auto: Value is auto generated based on other values
// option: Value is optional // option: Value is optional
// generated: Value is always autogenerated and it's original value ignored // generated: Value is always autogenerated and it's original value ignored
@ -682,6 +719,8 @@ make_config! {
client { client {
/// Control whether clients onboarding interstitials are suppressed |> post-login welcome dialogs, extension install prompts, setup extension redirects, and premium upsell modals /// Control whether clients onboarding interstitials are suppressed |> post-login welcome dialogs, extension install prompts, setup extension redirects, and premium upsell modals
client_suppress_onboarding: bool, true, def, false; client_suppress_onboarding: bool, true, def, false;
/// In most cases this value is set by the client |> Will block clients from setting too low of a value in `accounts::post_kdf`
client_kdf_iter: i32, false, test_def, 600_000;
}, },
/// Advanced settings /// Advanced settings
@ -697,6 +736,7 @@ make_config! {
/// running on the same host or container network), the string "all" to accept it from anywhere, /// running on the same host or container network), the string "all" to accept it from anywhere,
/// or a comma separated list of IPs and CIDR ranges. For a list header like X-Forwarded-For, the /// or a comma separated list of IPs and CIDR ranges. For a list header like X-Forwarded-For, the
/// client IP is the rightmost address that isn't a trusted proxy, so list every proxy in the chain. /// client IP is the rightmost address that isn't a trusted proxy, so list every proxy in the chain.
/// "local" also trusts 6to4, Teredo and local-use NAT64 addresses, which can carry clients from anywhere.
ip_header_trusted_proxies: String, true, def, "local".to_owned(); ip_header_trusted_proxies: String, true, def, "local".to_owned();
/// Icon service |> The predefined icon services are: internal, bitwarden, duckduckgo, google. /// Icon service |> The predefined icon services are: internal, bitwarden, duckduckgo, google.
/// To specify a custom icon service, set a URL template with exactly one instance of `{}`, /// To specify a custom icon service, set a URL template with exactly one instance of `{}`,
@ -731,7 +771,8 @@ make_config! {
/// Useful to hide other servers in the local network. Check the WIKI for more details /// Useful to hide other servers in the local network. Check the WIKI for more details
http_request_block_regex: String, true, option; http_request_block_regex: String, true, option;
/// Block non global IPs |> Enabling this will cause the internal HTTP client to refuse to connect to any non global IP address. /// Block non global IPs |> Enabling this will cause the internal HTTP client to refuse to connect to any non global IP address.
/// Useful to secure your internal environment: See https://en.wikipedia.org/wiki/Reserved_IP_addresses for a list of IPs which it will block /// Useful to secure your internal environment: See https://en.wikipedia.org/wiki/Reserved_IP_addresses for a list of IPs which it will block.
/// Requests through an outbound proxy (HTTP_PROXY, HTTPS_PROXY or ALL_PROXY) aren't checked, because the proxy resolves the names.
http_request_block_non_global_ips: bool, true, auto, |c| c.icon_blacklist_non_global_ips; http_request_block_non_global_ips: bool, true, auto, |c| c.icon_blacklist_non_global_ips;
/// Disable Two-Factor remember |> Enabling this would force the users to use a second factor to login every time. /// Disable Two-Factor remember |> Enabling this would force the users to use a second factor to login every time.
@ -740,6 +781,9 @@ make_config! {
/// Two-Factor remember duration |> Number of days before a remembered Two-Factor login expires (min: 1, max: 90). /// Two-Factor remember duration |> Number of days before a remembered Two-Factor login expires (min: 1, max: 90).
two_factor_remember_days: i64, true, def, 30; two_factor_remember_days: i64, true, def, 30;
/// Enable WebAuthn 2FA prefer user verification |> Sets user verification to preferred instead of discouraged, improving compatibility with some security keys.
webauthn_2fa_prefer_user_verification: bool, true, def, false;
/// Disable authenticator time drifted codes to be valid |> Enabling this only allows the current TOTP code to be valid /// Disable authenticator time drifted codes to be valid |> Enabling this only allows the current TOTP code to be valid
/// TOTP codes of the previous and next 30 seconds will be invalid. /// TOTP codes of the previous and next 30 seconds will be invalid.
authenticator_disable_time_drift: bool, true, def, false; authenticator_disable_time_drift: bool, true, def, false;
@ -836,7 +880,7 @@ make_config! {
/// Enforce Single Org with Reset Password Policy |> Enforce that the Single Org policy is enabled before setting the Reset Password policy /// Enforce Single Org with Reset Password Policy |> Enforce that the Single Org policy is enabled before setting the Reset Password policy
/// Bitwarden enforces this by default. In Vaultwarden we encouraged to use multiple organizations because groups were not available. /// Bitwarden enforces this by default. In Vaultwarden we encouraged to use multiple organizations because groups were not available.
/// Setting this to true will enforce the Single Org Policy to be enabled before you can enable the Reset Password policy. /// Setting this to true will enforce the Single Org Policy to be enabled before you can enable the Reset Password policy.
enforce_single_org_with_reset_pw_policy: bool, false, def, false; enforce_single_org_with_reset_pw_policy: bool, false, def, true;
/// Prefer IPv6 (AAAA) resolving |> This settings configures the DNS resolver to resolve IPv6 first, and if not available try IPv4 /// Prefer IPv6 (AAAA) resolving |> This settings configures the DNS resolver to resolve IPv6 first, and if not available try IPv4
/// This could be useful in IPv6 only environments. /// This could be useful in IPv6 only environments.
@ -966,6 +1010,17 @@ make_config! {
}, },
} }
fn check_iterations(iterations: i32, key: &str) -> Result<(), Error> {
if iterations < 100_000 {
#[cfg(feature = "unsafe_test_mode")]
println!("[WARNING] {key} should be at least 100000 or higher. The default is 600000!");
#[cfg(not(feature = "unsafe_test_mode"))]
err!(format!("{key} should be at least 100000 or higher. The default is 600000!"));
}
Ok(())
}
fn validate_config(cfg: &ConfigItems, on_update: bool) -> Result<(), Error> { fn validate_config(cfg: &ConfigItems, on_update: bool) -> Result<(), Error> {
// Validate connection URL is valid and DB feature is enabled // Validate connection URL is valid and DB feature is enabled
#[cfg(sqlite)] #[cfg(sqlite)]
@ -1000,9 +1055,8 @@ fn validate_config(cfg: &ConfigItems, on_update: bool) -> Result<(), Error> {
} }
} }
if cfg.password_iterations < 100_000 { check_iterations(cfg.password_iterations, "PASSWORD_ITERATIONS")?;
err!("PASSWORD_ITERATIONS should be at least 100000 or higher. The default is 600000!"); check_iterations(cfg.client_kdf_iter, "CLIENT_KDF_ITER")?;
}
let limit = 256; let limit = 256;
if !(1..=limit).contains(&cfg.database_max_conns) { if !(1..=limit).contains(&cfg.database_max_conns) {
@ -1519,6 +1573,7 @@ pub const SUPPORTED_FEATURE_FLAGS: &[&str] = &[
"windows-desktop-autotype", "windows-desktop-autotype",
"windows-desktop-autotype-ga", "windows-desktop-autotype-ga",
// Key Management Team // Key Management Team
"innovation-sprint-shared-unlock-part-2",
"biometrics-sdk-ipc", "biometrics-sdk-ipc",
"windows-native-credential-sync", "windows-native-credential-sync",
"macos-native-credential-sync", "macos-native-credential-sync",
@ -1528,6 +1583,9 @@ pub const SUPPORTED_FEATURE_FLAGS: &[&str] = &[
"pm-34171-card-scanner", "pm-34171-card-scanner",
// Platform Team // Platform Team
"pm-30529-webauthn-related-origins", "pm-30529-webauthn-related-origins",
"content-script-ipc-channel-framework",
// Tools Team: read by the clients up to 2026.10 and by the Android and iOS apps
"pm-31885-send-controls",
// Vault Team // Vault Team
"pm-32009-new-item-types", "pm-32009-new-item-types",
]; ];
@ -1568,6 +1626,7 @@ impl Config {
// Fill any missing with defaults // Fill any missing with defaults
let config = builder.build(); let config = builder.build();
if !SKIP_CONFIG_VALIDATION.load(Ordering::Relaxed) { if !SKIP_CONFIG_VALIDATION.load(Ordering::Relaxed) {
builder.warn_test_only_options();
validate_config(&config, false)?; validate_config(&config, false)?;
} }

21
src/db/models/auth_request.rs

@ -4,6 +4,7 @@ use diesel::prelude::*;
use serde_json::Value; use serde_json::Value;
use crate::{ use crate::{
CONFIG,
api::{ApiResult, EmptyResult}, api::{ApiResult, EmptyResult},
crypto::ct_eq, crypto::ct_eq,
db::{DbConn, schema::auth_requests}, db::{DbConn, schema::auth_requests},
@ -12,7 +13,7 @@ use crate::{
}; };
use macros::UuidFromParam; use macros::UuidFromParam;
use super::{DeviceId, OrganizationId, UserId}; use super::{DeviceId, DeviceType, OrganizationId, UserId};
#[derive(Identifiable, Queryable, Insertable, AsChangeset, Deserialize, Serialize)] #[derive(Identifiable, Queryable, Insertable, AsChangeset, Deserialize, Serialize)]
#[diesel(table_name = auth_requests)] #[diesel(table_name = auth_requests)]
@ -73,6 +74,24 @@ impl AuthRequest {
} }
} }
pub fn to_json(&self) -> Value {
json!({
"id": self.uuid,
"publicKey": self.public_key,
"requestDeviceIdentifier": self.request_device_identifier,
"requestDeviceTypeValue": self.device_type,
"requestDeviceType": DeviceType::from_i32(self.device_type).to_string(),
"requestIpAddress": self.request_ip,
"key": self.enc_key,
"masterPasswordHash": self.master_password_hash,
"creationDate": format_date(&self.creation_date),
"responseDate": self.response_date.as_ref().map(format_date),
"requestApproved": self.approved.unwrap_or(false),
"origin": CONFIG.domain_origin(),
"object": "auth-request"
})
}
pub fn to_json_for_pending_device(&self) -> Value { pub fn to_json_for_pending_device(&self) -> Value {
json!({ json!({
"id": self.uuid, "id": self.uuid,

6
src/db/models/collection.rs

@ -995,11 +995,7 @@ impl CollectionMembership {
"id": self.membership_uuid, "id": self.membership_uuid,
"readOnly": self.read_only, "readOnly": self.read_only,
"hidePasswords": self.hide_passwords, "hidePasswords": self.hide_passwords,
"manage": membership_type >= MembershipType::Admin "manage": membership_type >= MembershipType::Admin || self.manage,
|| self.manage
|| (membership_type == MembershipType::Manager
&& !self.read_only
&& !self.hide_passwords),
}) })
} }
} }

56
src/db/models/org_policy.rs

@ -17,7 +17,9 @@ use crate::{
use super::{Membership, MembershipId, MembershipStatus, MembershipType, OrganizationId, TwoFactor, UserId}; use super::{Membership, MembershipId, MembershipStatus, MembershipType, OrganizationId, TwoFactor, UserId};
#[derive(Identifiable, Queryable, Insertable, AsChangeset)] mod send_controls;
#[derive(Clone, Identifiable, Queryable, Insertable, AsChangeset)]
#[diesel(table_name = org_policies)] #[diesel(table_name = org_policies)]
#[diesel(primary_key(uuid))] #[diesel(primary_key(uuid))]
pub struct OrgPolicy { pub struct OrgPolicy {
@ -29,7 +31,7 @@ pub struct OrgPolicy {
pub revision_date: NaiveDateTime, pub revision_date: NaiveDateTime,
} }
// https://github.com/bitwarden/server/blob/9ebe16587175b1c0e9208f84397bb75d0d595510/src/Core/AdminConsole/Enums/PolicyType.cs // https://github.com/bitwarden/server/blob/b0f5bc64436a2457e1e8898e65c7e9e40ba94d7a/src/Core/AdminConsole/Enums/PolicyType.cs
#[derive(Copy, Clone, Eq, PartialEq, num_derive::FromPrimitive)] #[derive(Copy, Clone, Eq, PartialEq, num_derive::FromPrimitive)]
pub enum OrgPolicyType { pub enum OrgPolicyType {
TwoFactorAuthentication = 0, TwoFactorAuthentication = 0,
@ -53,13 +55,14 @@ pub enum OrgPolicyType {
// AutoConfirm = 18, // Not supported (not implemented yet) // AutoConfirm = 18, // Not supported (not implemented yet)
// BlockClaimedDomainAccountCreation = 19, // Not supported (Not AGPLv3 Licensed) // BlockClaimedDomainAccountCreation = 19, // Not supported (Not AGPLv3 Licensed)
OrganizationUserNotification = 20, OrganizationUserNotification = 20,
// SendControls = 21, // Not supported yet SendControls = 21,
FillAssist = 22, FillAssist = 22,
AutotypeGaPolicy = 23,
} }
// https://github.com/bitwarden/server/blob/9ebe16587175b1c0e9208f84397bb75d0d595510/src/Core/AdminConsole/Models/Data/Organizations/Policies/SendOptionsPolicyData.cs#L5 // https://github.com/bitwarden/server/blob/9ebe16587175b1c0e9208f84397bb75d0d595510/src/Core/AdminConsole/Models/Data/Organizations/Policies/SendOptionsPolicyData.cs#L5
#[derive(Deserialize)] #[derive(Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(default, rename_all = "camelCase")]
pub struct SendOptionsPolicyData { pub struct SendOptionsPolicyData {
#[serde(rename = "disableHideEmail", alias = "DisableHideEmail")] #[serde(rename = "disableHideEmail", alias = "DisableHideEmail")]
pub disable_hide_email: bool, pub disable_hide_email: bool,
@ -270,28 +273,6 @@ impl OrgPolicy {
.await .await
} }
pub async fn find_confirmed_by_user_and_active_policy(
user_uuid: &UserId,
policy_type: OrgPolicyType,
conn: &DbConn,
) -> Vec<Self> {
conn.run(move |conn| {
org_policies::table
.inner_join(
users_organizations::table.on(users_organizations::org_uuid
.eq(org_policies::org_uuid)
.and(users_organizations::user_uuid.eq(user_uuid))),
)
.filter(users_organizations::status.eq(MembershipStatus::Confirmed as i32))
.filter(org_policies::atype.eq(policy_type as i32))
.filter(org_policies::enabled.eq(true))
.select(org_policies::all_columns)
.load::<Self>(conn)
.expect("Error loading org_policy")
})
.await
}
/// Returns true if the user belongs to an org that has enabled the specified policy type, /// Returns true if the user belongs to an org that has enabled the specified policy type,
/// and the user is not an owner or admin of that org. This is only useful for checking /// and the user is not an owner or admin of that org. This is only useful for checking
/// applicability of policy types that have these particular semantics. /// applicability of policy types that have these particular semantics.
@ -381,27 +362,6 @@ impl OrgPolicy {
false false
} }
/// Returns true if the user belongs to an org that has enabled the `DisableHideEmail`
/// option of the `Send Options` policy, and the user is not an owner or admin of that org.
pub async fn is_hide_email_disabled(user_uuid: &UserId, conn: &DbConn) -> bool {
for policy in Self::find_confirmed_by_user_and_active_policy(user_uuid, OrgPolicyType::SendOptions, conn).await
{
if let Some(user) = Membership::find_confirmed_by_user_and_org(user_uuid, &policy.org_uuid, conn).await
&& user.atype < MembershipType::Admin
{
match serde_json::from_str::<SendOptionsPolicyData>(&policy.data) {
Ok(opts) => {
if opts.disable_hide_email {
return true;
}
}
_ => error!("Failed to deserialize SendOptionsPolicyData: {}", policy.data),
}
}
}
false
}
pub async fn is_enabled_for_member(member_uuid: &MembershipId, policy_type: OrgPolicyType, conn: &DbConn) -> bool { pub async fn is_enabled_for_member(member_uuid: &MembershipId, policy_type: OrgPolicyType, conn: &DbConn) -> bool {
if let Some(member) = Membership::find_by_uuid(member_uuid, conn).await if let Some(member) = Membership::find_by_uuid(member_uuid, conn).await
&& let Some(policy) = Self::find_by_org_and_type(&member.org_uuid, policy_type, conn).await && let Some(policy) = Self::find_by_org_and_type(&member.org_uuid, policy_type, conn).await

289
src/db/models/org_policy/send_controls.rs

@ -0,0 +1,289 @@
//! The Send controls policy (21) absorbs the legacy `Disable Send` (6) and `Send Options` (7) policies.
//! Like upstream, the three are kept in sync in both directions, so clients that only know the legacy
//! policies keep enforcing the same rules, and Sends are checked against all of them.
//!
//! https://github.com/bitwarden/server/tree/04a4d7548b07d18ab7327ddaae81a05fd893a820/src/Core/AdminConsole/OrganizationFeatures/Policies
use chrono::TimeDelta;
use diesel::prelude::*;
use num_traits::FromPrimitive;
use serde::Deserialize;
use serde_json::Value;
use super::{OrgPolicy, OrgPolicyType, SendOptionsPolicyData};
use crate::{
api::{ApiResult, EmptyResult},
db::{
DbConn,
models::{MembershipStatus, MembershipType, OrganizationId, Send, SendType, UserId},
schema::{org_policies, users_organizations},
},
};
const SEND_POLICIES: [i32; 3] =
[OrgPolicyType::DisableSend as i32, OrgPolicyType::SendOptions as i32, OrgPolicyType::SendControls as i32];
// SendWhoCanAccessType. Specific people requires Sends with email verification, which are not supported.
const ACCESS_ANY: i32 = 0;
const ACCESS_PASSWORD: i32 = 1;
const ACCESS_SPECIFIC_PEOPLE: i32 = 2;
// https://github.com/bitwarden/server/blob/04a4d7548b07d18ab7327ddaae81a05fd893a820/src/Core/AdminConsole/Models/Data/Organizations/Policies/SendControlsPolicyData.cs
#[derive(Default, Deserialize, Serialize)]
#[serde(default, rename_all = "camelCase")]
struct SendControlsPolicyData {
#[serde(alias = "DisableSend")]
disable_send: bool,
#[serde(alias = "DisableHideEmail")]
disable_hide_email: bool,
#[serde(alias = "WhoCanAccess")]
who_can_access: Option<i32>,
#[serde(alias = "AllowedDomains")]
allowed_domains: Option<String>,
#[serde(alias = "DeletionHours")]
deletion_hours: Option<i32>,
#[serde(alias = "AllowedSendTypes")]
allowed_send_types: Option<Vec<i32>>,
}
impl SendControlsPolicyData {
/// Validates the data an organization saves. Requiring email verification, which allowed domains
/// depend on, would leave members unable to create any Send, so it is refused.
fn parse(data: Option<&Value>) -> ApiResult<Self> {
let data = match Option::<Self>::deserialize(data.unwrap_or(&Value::Null)) {
Ok(data) => data.unwrap_or_default(),
Err(e) => err!(format!("Invalid Send controls policy data: {e}")),
};
match data.who_can_access {
None | Some(ACCESS_ANY | ACCESS_PASSWORD) => (),
Some(ACCESS_SPECIFIC_PEOPLE) => {
err!("Sends with email verification are not supported, so that access type cannot be required")
}
Some(_) => err!("Invalid Send controls access type"),
}
if data.allowed_domains.is_some() {
err!("Allowed domains require Sends with email verification, which are not supported")
}
if data.deletion_hours.is_some_and(|hours| hours < 1) {
err!("The maximum lifetime of a Send has to be at least one hour")
}
// Current clients may also list Item Sends (2), which can not be created here.
if let Some(types) = &data.allowed_send_types
&& (types.iter().any(|t| !(0..=2).contains(t))
|| !types.iter().any(|t| *t == SendType::Text as i32 || *t == SendType::File as i32))
{
err!("The allowed Send types have to include Text or File")
}
Ok(data)
}
/// Every organization's restrictions apply, so a less strict organization never relaxes a stricter
/// one, independent of the order the policies are loaded in.
fn merge(&mut self, other: Self) {
self.disable_send |= other.disable_send;
self.disable_hide_email |= other.disable_hide_email;
self.who_can_access = self.who_can_access.max(other.who_can_access);
self.deletion_hours = match (self.deletion_hours, other.deletion_hours) {
(Some(a), Some(b)) => Some(a.min(b)),
(a, b) => a.or(b),
};
self.allowed_send_types = match (self.allowed_send_types.take(), other.allowed_send_types) {
(Some(a), Some(b)) => Some(a.into_iter().filter(|t| b.contains(t)).collect()),
(a, b) => a.or(b),
};
}
/// Checks the Send as it would be saved, like upstream's `SendValidationService`.
fn check_send(&self, send: &Send) -> EmptyResult {
if self.disable_send {
err!("Due to an Enterprise Policy, you are only able to delete an existing Send.")
}
if self.disable_hide_email && send.hide_email.unwrap_or(false) {
err!(
"Due to an Enterprise Policy, you are not allowed to hide your email address \
from recipients when creating or editing a Send."
)
}
if self.who_can_access == Some(ACCESS_PASSWORD) && send.password_hash.is_none() {
err!("Due to an Enterprise policy your Sends must be protected by password")
}
if let Some(types) = &self.allowed_send_types
&& !types.contains(&send.atype)
{
let names: Vec<&str> = types
.iter()
.map(|t| match *t {
0 => "Text",
1 => "File",
_ => "Unknown",
})
.collect();
err!(format!("Due to an Enterprise policy your Sends must be of the following types: {}", names.join(", ")))
}
// Upstream allows for up to a minute of skew between the deletion and the creation date.
if let Some(hours) = self.deletion_hours
&& send.deletion_date - send.creation_date - TimeDelta::minutes(1) > TimeDelta::hours(i64::from(hours))
{
let (duration, unit) = if hours >= 24 {
(hours / 24, "day")
} else {
(hours, "hour")
};
let plural = if duration > 1 {
"s"
} else {
""
};
err!(format!(
"Due to an Enterprise policy your Sends must have deletion dates no more than {duration} {unit}{plural} from their creation dates"
))
}
Ok(())
}
}
/// Whether an enabled `Send Options` policy disables hiding the email. Unreadable data keeps the option on.
fn hide_email_disabled(policy: &OrgPolicy) -> bool {
policy.enabled
&& serde_json::from_str::<Option<SendOptionsPolicyData>>(&policy.data).map_or_else(
|_| {
error!("Failed to deserialize SendOptionsPolicyData: {}", policy.data);
true
},
|data| data.is_some_and(|d| d.disable_hide_email),
)
}
/// The options of the legacy policies, as Send controls holds them. A disabled `Send Options` policy
/// counts as off, so a later save of Send controls does not switch its stored option back on.
fn legacy_send_options(policies: &[OrgPolicy]) -> (bool, bool) {
let disable_send = policies.iter().any(|p| p.has_type(OrgPolicyType::DisableSend) && p.enabled);
let disable_hide_email = policies.iter().any(|p| p.has_type(OrgPolicyType::SendOptions) && hide_email_disabled(p));
(disable_send, disable_hide_email)
}
/// Mirrors a saved Send policy into the others, like upstream's `SendControlsSyncPolicyEvent`,
/// `DisableSendSyncPolicyEvent` and `SendOptionsSyncPolicyEvent`, and returns the policies to save.
/// `policies` are the organization's policies, including the saved one.
fn mirror_send_policies(saved: &OrgPolicy, policies: &[OrgPolicy]) -> ApiResult<Vec<OrgPolicy>> {
let find_or_new = |policy_type| {
policies
.iter()
.find(|p| p.has_type(policy_type))
.cloned()
.unwrap_or_else(|| OrgPolicy::new(saved.org_uuid.clone(), policy_type, false, String::from("null")))
};
if saved.has_type(OrgPolicyType::SendControls) {
let data = saved.send_controls_data();
let mut disable_send = find_or_new(OrgPolicyType::DisableSend);
disable_send.enabled = saved.enabled && data.disable_send;
let mut send_options = find_or_new(OrgPolicyType::SendOptions);
send_options.enabled = saved.enabled && data.disable_hide_email;
send_options.data = serde_json::to_string(&SendOptionsPolicyData {
disable_hide_email: data.disable_hide_email,
})?;
return Ok(vec![disable_send, send_options]);
}
let mut controls = find_or_new(OrgPolicyType::SendControls);
let mut data = controls.send_controls_data();
(data.disable_send, data.disable_hide_email) = legacy_send_options(policies);
// Turning a legacy policy off must not switch off the restrictions only Send controls has.
controls.enabled |= data.disable_send || data.disable_hide_email;
controls.data = serde_json::to_string(&data)?;
Ok(vec![controls])
}
impl OrgPolicy {
/// Stored data was validated when saved; data that can not be read blocks Sends instead of allowing them.
fn send_controls_data(&self) -> SendControlsPolicyData {
let data = serde_json::from_str::<Value>(&self.data).ok();
data.and_then(|data| SendControlsPolicyData::parse(Some(&data)).ok()).unwrap_or_else(|| {
error!("Invalid Send controls policy data, blocking Sends: {}", self.data);
SendControlsPolicyData {
disable_send: true,
..Default::default()
}
})
}
/// Validates the data of a Send policy before it is saved and returns the data to store.
pub fn send_policy_data(policy_type: OrgPolicyType, data: Option<Value>) -> ApiResult<Option<Value>> {
match policy_type {
OrgPolicyType::SendControls => {
Ok(Some(serde_json::to_value(SendControlsPolicyData::parse(data.as_ref())?)?))
}
OrgPolicyType::SendOptions => {
if let Some(value) = &data
&& let Err(e) = Option::<SendOptionsPolicyData>::deserialize(value)
{
err!(format!("Invalid Send options policy data: {e}"))
}
Ok(data)
}
_ => Ok(data),
}
}
/// Keeps Send controls and the legacy Send policies in sync after one of them was saved.
pub async fn sync_send_policies(saved: &Self, conn: &DbConn) -> EmptyResult {
if !SEND_POLICIES.contains(&saved.atype) {
return Ok(());
}
for mut policy in mirror_send_policies(saved, &Self::find_by_org(&saved.org_uuid, conn).await)? {
policy.save(conn).await?;
}
Ok(())
}
/// Upstream's `PolicyQuery`: until Send controls is saved, it is derived from the legacy policies, so the
/// current policy editor shows what is enforced instead of turning it off on the next save.
pub fn synthesize_send_controls(org_id: &OrganizationId, policies: &[Self]) -> Self {
let (disable_send, disable_hide_email) = legacy_send_options(policies);
let data = SendControlsPolicyData {
disable_send,
disable_hide_email,
..Default::default()
};
Self::new(
org_id.clone(),
OrgPolicyType::SendControls,
disable_send || disable_hide_email,
json!(data).to_string(),
)
}
/// Enforces the Send policies of every organization in which the user is an accepted or confirmed
/// member below Admin on the Send as it would be saved. Deleting a Send stays possible.
pub async fn check_send(user_id: &UserId, send: &Send, conn: &DbConn) -> EmptyResult {
let policies = conn
.run(move |conn| {
org_policies::table
.inner_join(users_organizations::table.on(users_organizations::org_uuid.eq(org_policies::org_uuid)))
.filter(users_organizations::user_uuid.eq(user_id))
.filter(
users_organizations::status
.eq_any([MembershipStatus::Accepted as i32, MembershipStatus::Confirmed as i32]),
)
// Owners and admins are exempt. The numbers of MembershipType are not its order.
.filter(users_organizations::atype.ne(MembershipType::Owner as i32))
.filter(users_organizations::atype.ne(MembershipType::Admin as i32))
.filter(org_policies::enabled.eq(true))
.filter(org_policies::atype.eq_any(SEND_POLICIES))
.select(org_policies::all_columns)
.load::<Self>(conn)
})
.await?;
let mut controls = SendControlsPolicyData::default();
for policy in policies {
match OrgPolicyType::from_i32(policy.atype) {
Some(OrgPolicyType::DisableSend) => controls.disable_send = true,
Some(OrgPolicyType::SendOptions) => controls.disable_hide_email |= hide_email_disabled(&policy),
_ => controls.merge(policy.send_controls_data()),
}
}
controls.check_send(send)
}
}

6
src/db/models/organization.rs

@ -811,6 +811,7 @@ impl Membership {
"useResetPassword": CONFIG.mail_enabled(), "useResetPassword": CONFIG.mail_enabled(),
"ssoBound": false, // Not supported "ssoBound": false, // Not supported
"useSso": false, // Not supported "useSso": false, // Not supported
"ssoEnabled": false,
"useKeyConnector": false, "useKeyConnector": false,
"useSecretsManager": false, // Not supported (Not AGPLv3 Licensed) "useSecretsManager": false, // Not supported (Not AGPLv3 Licensed)
"usePasswordManager": true, "usePasswordManager": true,
@ -824,6 +825,7 @@ impl Membership {
"useOrganizationDomains": false, // Not supported (Linked to SSO) "useOrganizationDomains": false, // Not supported (Linked to SSO)
"usePam": false, // Not supported "usePam": false, // Not supported
"usePhishingBlocker": false, "usePhishingBlocker": false,
"useAutomaticUserConfirmation": false,
"organizationUserId": self.uuid, "organizationUserId": self.uuid,
"providerId": null, "providerId": null,
@ -831,6 +833,7 @@ impl Membership {
"providerType": null, "providerType": null,
"familySponsorshipFriendlyName": null, "familySponsorshipFriendlyName": null,
"familySponsorshipAvailable": false, "familySponsorshipAvailable": false,
"isAdminInitiated": false,
"productTierType": 3, // Enterprise tier "productTierType": 3, // Enterprise tier
"keyConnectorEnabled": false, "keyConnectorEnabled": false,
"keyConnectorUrl": null, "keyConnectorUrl": null,
@ -838,6 +841,7 @@ impl Membership {
"familySponsorshipValidUntil": null, "familySponsorshipValidUntil": null,
"familySponsorshipToDelete": null, "familySponsorshipToDelete": null,
"accessSecretsManager": false, "accessSecretsManager": false,
"accessPam": false,
// limit collection creation to managers with access_all permission to prevent issues // limit collection creation to managers with access_all permission to prevent issues
"limitCollectionCreation": self.atype < MembershipType::Manager || !self.access_all, "limitCollectionCreation": self.atype < MembershipType::Manager || !self.access_all,
"limitCollectionDeletion": true, "limitCollectionDeletion": true,
@ -905,7 +909,7 @@ impl Membership {
"id": cu.collection_uuid, "id": cu.collection_uuid,
"readOnly": cu.read_only, "readOnly": cu.read_only,
"hidePasswords": cu.hide_passwords, "hidePasswords": cu.hide_passwords,
"manage": cu.manage || (self.atype == MembershipType::Manager && !cu.read_only && !cu.hide_passwords), "manage": cu.manage,
}) })
}) })
.collect() .collect()

33
src/db/models/user.rs

@ -2,6 +2,7 @@ use chrono::{NaiveDateTime, TimeDelta, Utc};
use derive_more::{AsRef, Deref, Display, From}; use derive_more::{AsRef, Deref, Display, From};
use diesel::prelude::*; use diesel::prelude::*;
use serde_json::Value; use serde_json::Value;
use std::cmp;
use crate::{ use crate::{
CONFIG, CONFIG,
@ -133,7 +134,6 @@ impl UserStampException {
/// Local methods /// Local methods
impl User { impl User {
pub const CLIENT_KDF_TYPE_DEFAULT: i32 = UserKdfType::Pbkdf2 as i32; pub const CLIENT_KDF_TYPE_DEFAULT: i32 = UserKdfType::Pbkdf2 as i32;
pub const CLIENT_KDF_ITER_DEFAULT: i32 = 600_000;
pub fn new(email: &str, name: Option<String>) -> Self { pub fn new(email: &str, name: Option<String>) -> Self {
let now = Utc::now().naive_utc(); let now = Utc::now().naive_utc();
@ -171,7 +171,7 @@ impl User {
excluded_globals: "[]".to_owned(), excluded_globals: "[]".to_owned(),
client_kdf_type: Self::CLIENT_KDF_TYPE_DEFAULT, client_kdf_type: Self::CLIENT_KDF_TYPE_DEFAULT,
client_kdf_iter: Self::CLIENT_KDF_ITER_DEFAULT, client_kdf_iter: CONFIG.client_kdf_iter(),
client_kdf_memory: None, client_kdf_memory: None,
client_kdf_parallelism: None, client_kdf_parallelism: None,
@ -248,6 +248,7 @@ impl User {
allow_next_route: Option<Vec<String>>, allow_next_route: Option<Vec<String>>,
conn: &DbConn, conn: &DbConn,
) -> EmptyResult { ) -> EmptyResult {
self.password_iterations = cmp::max(self.password_iterations, CONFIG.password_iterations());
self.password_hash = self.password_hash =
crypto::hash_password(password.as_bytes(), &self.salt, self.password_iterations.cast_unsigned()); crypto::hash_password(password.as_bytes(), &self.salt, self.password_iterations.cast_unsigned());
@ -477,6 +478,34 @@ impl User {
} }
} }
pub async fn check_persist_kdf_upgrade(&mut self, pwd_hash: &str, conn: &DbConn) -> EmptyResult {
if self.password_iterations < CONFIG.password_iterations() {
let old_iteration = self.password_iterations;
let old_hash = self.password_hash.clone();
self.set_password(pwd_hash, None, false, None, conn).await?;
conn.run(move |conn| {
diesel::update(
users::table
.filter(users::uuid.eq(&self.uuid))
.filter(users::password_iterations.eq(old_iteration))
.filter(users::password_hash.eq(old_hash)),
)
.set((
users::updated_at.eq(Utc::now().naive_utc()),
users::password_iterations.eq(&self.password_iterations),
users::password_hash.eq(&self.password_hash),
))
.execute(conn)
.map_res("Error updating user KDF iterations")
})
.await
} else {
Ok(())
}
}
pub async fn delete(&self, conn: &DbConn) -> EmptyResult { pub async fn delete(&self, conn: &DbConn) -> EmptyResult {
for member in Membership::find_confirmed_by_user(&self.uuid, conn).await { for member in Membership::find_confirmed_by_user(&self.uuid, conn).await {
if member.atype == MembershipType::Owner if member.atype == MembershipType::Owner

5
src/sso_client.rs

@ -246,14 +246,13 @@ impl Client {
let mut exchange = self.core_client.exchange_code(oidc_code); let mut exchange = self.core_client.exchange_code(oidc_code);
Self::check_client_verifier(&client_verifier, sso_auth)?;
if CONFIG.sso_pkce() { if CONFIG.sso_pkce() {
exchange = exchange.set_pkce_verifier(PkceCodeVerifier::new(client_verifier.into())); exchange = exchange.set_pkce_verifier(PkceCodeVerifier::new(client_verifier.into()));
} else {
Self::check_client_verifier(&client_verifier, sso_auth)?;
} }
match exchange.request_async(&self.http_client).await { match exchange.request_async(&self.http_client).await {
Err(err) => err!(format!("Failed to contact token endpoint: {:?}", err)), Err(err) => err!(format!("Failed to contact token endpoint: {err}")),
Ok(token_response) => { Ok(token_response) => {
let oidc_nonce = Nonce::new(sso_auth.nonce.clone()); let oidc_nonce = Nonce::new(sso_auth.nonce.clone());

664
src/static/global_domains.json

@ -1,31 +1,4 @@
[ [
{
"type": 2,
"domains": [
"ameritrade.com",
"tdameritrade.com"
],
"excluded": false
},
{
"type": 3,
"domains": [
"bankofamerica.com",
"bofa.com",
"mbna.com",
"usecfo.com"
],
"excluded": false
},
{
"type": 4,
"domains": [
"sprint.com",
"sprintpcs.com",
"nextel.com"
],
"excluded": false
},
{ {
"type": 0, "type": 0,
"domains": [ "domains": [
@ -43,15 +16,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 5,
"domains": [
"wellsfargo.com",
"wf.com",
"wellsfargoadvisors.com"
],
"excluded": false
},
{ {
"type": 6, "type": 6,
"domains": [ "domains": [
@ -61,40 +25,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 7,
"domains": [
"accountonline.com",
"citi.com",
"citibank.com",
"citicards.com",
"citibankonline.com"
],
"excluded": false
},
{
"type": 8,
"domains": [
"cnet.com",
"cnettv.com",
"com.com",
"download.com",
"news.com",
"search.com",
"upload.com"
],
"excluded": false
},
{
"type": 9,
"domains": [
"bananarepublic.com",
"gap.com",
"oldnavy.com",
"piperlime.com"
],
"excluded": false
},
{ {
"type": 10, "type": 10,
"domains": [ "domains": [
@ -116,32 +46,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 11,
"domains": [
"ua2go.com",
"ual.com",
"united.com",
"unitedwifi.com"
],
"excluded": false
},
{
"type": 12,
"domains": [
"overture.com",
"yahoo.com"
],
"excluded": false
},
{
"type": 13,
"domains": [
"zonealarm.com",
"zonelabs.com"
],
"excluded": false
},
{ {
"type": 14, "type": 14,
"domains": [ "domains": [
@ -150,39 +54,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 15,
"domains": [
"avon.com",
"youravon.com"
],
"excluded": false
},
{
"type": 16,
"domains": [
"diapers.com",
"soap.com",
"wag.com",
"yoyo.com",
"beautybar.com",
"casa.com",
"afterschool.com",
"vine.com",
"bookworm.com",
"look.com",
"vinemarket.com"
],
"excluded": false
},
{
"type": 17,
"domains": [
"1800contacts.com",
"800contacts.com"
],
"excluded": false
},
{ {
"type": 18, "type": 18,
"domains": [ "domains": [
@ -208,149 +79,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 19,
"domains": [
"cox.com",
"cox.net",
"coxbusiness.com"
],
"excluded": false
},
{
"type": 20,
"domains": [
"mynortonaccount.com",
"norton.com"
],
"excluded": false
},
{
"type": 21,
"domains": [
"verizon.com",
"verizon.net"
],
"excluded": false
},
{
"type": 22,
"domains": [
"rakuten.com",
"buy.com"
],
"excluded": false
},
{
"type": 23,
"domains": [
"siriusxm.com",
"sirius.com"
],
"excluded": false
},
{
"type": 24,
"domains": [
"ea.com",
"origin.com",
"play4free.com",
"tiberiumalliance.com"
],
"excluded": false
},
{
"type": 25,
"domains": [
"37signals.com",
"basecamp.com",
"basecamphq.com",
"highrisehq.com"
],
"excluded": false
},
{
"type": 26,
"domains": [
"steampowered.com",
"steamcommunity.com",
"steamgames.com"
],
"excluded": false
},
{
"type": 27,
"domains": [
"chart.io",
"chartio.com"
],
"excluded": false
},
{
"type": 28,
"domains": [
"gotomeeting.com",
"citrixonline.com"
],
"excluded": false
},
{
"type": 29,
"domains": [
"gogoair.com",
"gogoinflight.com"
],
"excluded": false
},
{
"type": 30,
"domains": [
"mysql.com",
"oracle.com"
],
"excluded": false
},
{
"type": 31,
"domains": [
"discover.com",
"discovercard.com"
],
"excluded": false
},
{
"type": 32,
"domains": [
"dcu.org",
"dcu-online.org"
],
"excluded": false
},
{
"type": 33,
"domains": [
"healthcare.gov",
"cuidadodesalud.gov",
"cms.gov"
],
"excluded": false
},
{
"type": 34,
"domains": [
"pepco.com",
"pepcoholdings.com"
],
"excluded": false
},
{
"type": 35,
"domains": [
"century21.com",
"21online.com"
],
"excluded": false
},
{ {
"type": 36, "type": 36,
"domains": [ "domains": [
@ -360,38 +88,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 37,
"domains": [
"cricketwireless.com",
"aiowireless.com"
],
"excluded": false
},
{
"type": 38,
"domains": [
"mandtbank.com",
"mtb.com"
],
"excluded": false
},
{
"type": 39,
"domains": [
"dropbox.com",
"getdropbox.com"
],
"excluded": false
},
{
"type": 40,
"domains": [
"snapfish.com",
"snapfish.ca"
],
"excluded": false
},
{ {
"type": 41, "type": 41,
"domains": [ "domains": [
@ -402,33 +98,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 42,
"domains": [
"playstation.com",
"sonyentertainmentnetwork.com"
],
"excluded": false
},
{
"type": 43,
"domains": [
"mercadolivre.com",
"mercadolivre.com.br",
"mercadolibre.com",
"mercadolibre.com.ar",
"mercadolibre.com.mx"
],
"excluded": false
},
{
"type": 44,
"domains": [
"zendesk.com",
"zopim.com"
],
"excluded": false
},
{ {
"type": 45, "type": 45,
"domains": [ "domains": [
@ -437,60 +106,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 46,
"domains": [
"railnation.ru",
"railnation.de",
"rail-nation.com",
"railnation.gr",
"railnation.us",
"trucknation.de",
"traviangames.com"
],
"excluded": false
},
{
"type": 47,
"domains": [
"wpcu.coop",
"wpcuonline.com"
],
"excluded": false
},
{
"type": 48,
"domains": [
"mathletics.com",
"mathletics.com.au",
"mathletics.co.uk"
],
"excluded": false
},
{
"type": 49,
"domains": [
"discountbank.co.il",
"telebank.co.il"
],
"excluded": false
},
{
"type": 50,
"domains": [
"mi.com",
"xiaomi.com"
],
"excluded": false
},
{
"type": 52,
"domains": [
"postepay.it",
"poste.it"
],
"excluded": false
},
{ {
"type": 51, "type": 51,
"domains": [ "domains": [
@ -499,15 +114,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 53,
"domains": [
"skysports.com",
"skybet.com",
"skyvegas.com"
],
"excluded": false
},
{ {
"type": 54, "type": 54,
"domains": [ "domains": [
@ -519,62 +125,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 55,
"domains": [
"pokemon-gl.com",
"pokemon.com"
],
"excluded": false
},
{
"type": 56,
"domains": [
"myuv.com",
"uvvu.com"
],
"excluded": false
},
{
"type": 58,
"domains": [
"mdsol.com",
"imedidata.com"
],
"excluded": false
},
{
"type": 57,
"domains": [
"bank-yahav.co.il",
"bankhapoalim.co.il"
],
"excluded": false
},
{
"type": 59,
"domains": [
"sears.com",
"shld.net"
],
"excluded": false
},
{
"type": 60,
"domains": [
"xiami.com",
"alipay.com"
],
"excluded": false
},
{
"type": 61,
"domains": [
"belkin.com",
"seedonk.com"
],
"excluded": false
},
{ {
"type": 62, "type": 62,
"domains": [ "domains": [
@ -583,14 +133,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 63,
"domains": [
"shopify.com",
"myshopify.com"
],
"excluded": false
},
{ {
"type": 64, "type": 64,
"domains": [ "domains": [
@ -620,30 +162,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 65,
"domains": [
"techdata.com",
"techdata.ch"
],
"excluded": false
},
{
"type": 66,
"domains": [
"schwab.com",
"schwabplan.com"
],
"excluded": false
},
{
"type": 68,
"domains": [
"tesla.com",
"teslamotors.com"
],
"excluded": false
},
{ {
"type": 69, "type": 69,
"domains": [ "domains": [
@ -654,31 +172,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 70,
"domains": [
"taxact.com",
"taxactonline.com"
],
"excluded": false
},
{
"type": 71,
"domains": [
"mediawiki.org",
"wikibooks.org",
"wikidata.org",
"wikimedia.org",
"wikinews.org",
"wikipedia.org",
"wikiquote.org",
"wikisource.org",
"wikiversity.org",
"wikivoyage.org",
"wiktionary.org"
],
"excluded": false
},
{ {
"type": 72, "type": 72,
"domains": [ "domains": [
@ -738,38 +231,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 73,
"domains": [
"eventbrite.at",
"eventbrite.be",
"eventbrite.ca",
"eventbrite.ch",
"eventbrite.cl",
"eventbrite.co",
"eventbrite.co.nz",
"eventbrite.co.uk",
"eventbrite.com",
"eventbrite.com.ar",
"eventbrite.com.au",
"eventbrite.com.br",
"eventbrite.com.mx",
"eventbrite.com.pe",
"eventbrite.de",
"eventbrite.dk",
"eventbrite.es",
"eventbrite.fi",
"eventbrite.fr",
"eventbrite.hk",
"eventbrite.ie",
"eventbrite.it",
"eventbrite.nl",
"eventbrite.pt",
"eventbrite.se",
"eventbrite.sg"
],
"excluded": false
},
{ {
"type": 74, "type": 74,
"domains": [ "domains": [
@ -791,56 +252,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 76,
"domains": [
"envato.com",
"themeforest.net",
"codecanyon.net",
"videohive.net",
"audiojungle.net",
"graphicriver.net",
"photodune.net",
"3docean.net"
],
"excluded": false
},
{
"type": 77,
"domains": [
"x10hosting.com",
"x10premium.com"
],
"excluded": false
},
{
"type": 78,
"domains": [
"dnsomatic.com",
"opendns.com",
"umbrella.com"
],
"excluded": false
},
{
"type": 79,
"domains": [
"cagreatamerica.com",
"canadaswonderland.com",
"carowinds.com",
"cedarfair.com",
"cedarpoint.com",
"dorneypark.com",
"kingsdominion.com",
"knotts.com",
"miadventure.com",
"schlitterbahn.com",
"valleyfair.com",
"visitkingsisland.com",
"worldsoffun.com"
],
"excluded": false
},
{ {
"type": 80, "type": 80,
"domains": [ "domains": [
@ -849,23 +260,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 81,
"domains": [
"discordapp.com",
"discord.com"
],
"excluded": false
},
{
"type": 82,
"domains": [
"netcup.de",
"netcup.eu",
"customercontrolpanel.de"
],
"excluded": false
},
{ {
"type": 83, "type": 83,
"domains": [ "domains": [
@ -894,14 +288,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 84,
"domains": [
"sonyentertainmentnetwork.com",
"sony.com"
],
"excluded": false
},
{ {
"type": 85, "type": 85,
"domains": [ "domains": [
@ -911,37 +297,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 86,
"domains": [
"ubisoft.com",
"ubi.com"
],
"excluded": false
},
{
"type": 87,
"domains": [
"transferwise.com",
"wise.com"
],
"excluded": false
},
{
"type": 88,
"domains": [
"takeaway.com",
"just-eat.dk",
"just-eat.no",
"just-eat.fr",
"just-eat.ch",
"lieferando.de",
"lieferando.at",
"thuisbezorgd.nl",
"pyszne.pl"
],
"excluded": false
},
{ {
"type": 89, "type": 89,
"domains": [ "domains": [
@ -954,25 +309,6 @@
], ],
"excluded": false "excluded": false
}, },
{
"type": 90,
"domains": [
"pinterest.com",
"pinterest.com.au",
"pinterest.cl",
"pinterest.de",
"pinterest.dk",
"pinterest.es",
"pinterest.fr",
"pinterest.co.uk",
"pinterest.jp",
"pinterest.co.kr",
"pinterest.nz",
"pinterest.pt",
"pinterest.se"
],
"excluded": false
},
{ {
"type": 91, "type": 91,
"domains": [ "domains": [

BIN
src/static/images/fallback-icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

4
src/static/scripts/datatables.css

@ -4,10 +4,10 @@
* *
* To rebuild or modify this file with the latest versions of the included * To rebuild or modify this file with the latest versions of the included
* software please visit: * software please visit:
* https://datatables.net/download/#bs5/dt-3.1.4 * https://datatables.net/download/#bs5/dt-3.1.5
* *
* Included libraries: * Included libraries:
* DataTables 3.1.4 * DataTables 3.1.5
*/ */
/*! DataTables Bootstrap 5 integration /*! DataTables Bootstrap 5 integration

78
src/static/scripts/datatables.js

@ -4,13 +4,13 @@
* *
* To rebuild or modify this file with the latest versions of the included * To rebuild or modify this file with the latest versions of the included
* software please visit: * software please visit:
* https://datatables.net/download/#bs5/dt-3.1.4 * https://datatables.net/download/#bs5/dt-3.1.5
* *
* Included libraries: * Included libraries:
* DataTables 3.1.4 * DataTables 3.1.5
*/ */
/*! DataTables 3.1.4 /*! DataTables 3.1.5
* Copyright (c) SpryMedia Ltd - datatables.net/license * Copyright (c) SpryMedia Ltd - datatables.net/license
*/ */
@ -22,9 +22,6 @@
}); });
} }
else if (typeof exports === 'object') { else if (typeof exports === 'object') {
// CommonJS
var cjsRequires = function (root) { };
if (typeof window === 'undefined') { if (typeof window === 'undefined') {
module.exports = function (root) { module.exports = function (root) {
if (! root) { if (! root) {
@ -33,12 +30,10 @@
root = window; root = window;
} }
cjsRequires(root);
return factory(root, root.document); return factory(root, root.document);
}; };
} }
else { else {
cjsRequires(window);
module.exports = factory(window, window.document); module.exports = factory(window, window.document);
} }
} }
@ -276,7 +271,7 @@ function dom(input) {
* @returns true if an HTML element was passed in * @returns true if an HTML element was passed in
*/ */
function element(input) { function element(input) {
return typeof input === 'object' && input.nodeName; return input && typeof input === 'object' && input.nodeName;
} }
/** /**
* Check if a value is empty or not. Note that a string with `-` is considered * Check if a value is empty or not. Note that a string with `-` is considered
@ -767,7 +762,7 @@ function ajax(optionsIn) {
// noop // noop
} }
} }
if (statusText === 'success') { if (statusText === 'success' || statusText === 'nocontent') {
callback(options.success, responseData, statusText, xhr); callback(options.success, responseData, statusText, xhr);
} }
else { else {
@ -8720,7 +8715,7 @@ const ext = {
/** /**
* DataTables build type (expanded by the download builder) * DataTables build type (expanded by the download builder)
*/ */
builder: 'bs5/dt-3.1.4', builder: 'bs5/dt-3.1.5',
/** /**
* Buttons. For use with the Buttons extension for DataTables. This is * Buttons. For use with the Buttons extension for DataTables. This is
* defined here so other extensions can define buttons regardless of load * defined here so other extensions can define buttons regardless of load
@ -8866,7 +8861,7 @@ const ext = {
* Software version * Software version
* @type string * @type string
*/ */
version: '3.1.4' version: '3.1.5'
}; };
// //
// Backwards compatibility. Alias to pre 1.10 Hungarian notation counter parts // Backwards compatibility. Alias to pre 1.10 Hungarian notation counter parts
@ -9535,8 +9530,10 @@ register('ready()', function (fn) {
fn.call(api); fn.call(api);
} }
else { else {
this.on('init.dt.DT', function () { this.on('init.dt.DT', function (e, s) {
if (ctx.includes(s)) {
fn.call(api); fn.call(api);
}
}); });
} }
}); });
@ -10803,14 +10800,12 @@ function selectRows(settings, selector, opts) {
} }
} }
// ID selector. Want to always be able to select rows by id, regardless // ID selector. Want to always be able to select rows by id, regardless
// of if the tr element has been created or not, so can't rely upon // of if the tr element has been created or not, so can't rely upon the
// jQuery here - hence a custom implementation. This does not match // DOM here - hence a custom implementation. In HTML5 the ID can be
// Sizzle's fast selector or HTML4 - in HTML5 the ID can be anything, // anything, but to select it using a CSS selector engine it would need
// but to select it using a CSS selector engine (like Sizzle or // to need to be escaped for some characters. DataTables simplifies this
// querySelect) it would need to need to be escaped for some characters. // for row selectors since you can select only a row. A # indicates an
// DataTables simplifies this for row selectors since you can select // id any anything that follows is the id - unescaped.
// only a row. A # indicates an id any anything that follows is the id -
// unescaped.
if (typeof sel === 'string') { if (typeof sel === 'string') {
if (sel.charAt(0) === '#') { if (sel.charAt(0) === '#') {
// get row index from id // get row index from id
@ -10818,6 +10813,13 @@ function selectRows(settings, selector, opts) {
if (rowObj !== undefined) { if (rowObj !== undefined) {
return [rowObj.idx]; return [rowObj.idx];
} }
// If it was a basic ID selector, and it didn't match, in the
// above, then return here, as it won't match at all. Note that
// this check is slightly less restrictive than CSS IDs, in that
// it allows a leading digit or dash to be used.
if (sel.match(/^#[a-zA-Z0-9_-]*$/)) {
return [];
}
// need to fall through to selector in case there is DOM id that // need to fall through to selector in case there is DOM id that
// matches // matches
} }
@ -12506,19 +12508,22 @@ const DataTable = function (selector, options) {
if (factory(selector, options)) { if (factory(selector, options)) {
return DataTable; return DataTable;
} }
// Allow access to the API from the core class
this.api = () => {
return new Api(selector);
};
// Backwards compatibility with this "class" being exposed as // Backwards compatibility with this "class" being exposed as
// `$().dataTable()`. We can't simply provide that as a wrapper, as there // `$().dataTable()`. We can't simply provide that as a wrapper, as there
// are properties on this class which are expected to be exposed. // are properties on this class which are expected to be exposed.
if (typeof this.jquery === 'string') { if (typeof this.jquery === 'string') {
let els = this.toArray();
// Typescript doesn't like the `return api` from the constructor, but is // Typescript doesn't like the `return api` from the constructor, but is
// it valid Javascript, and allows backwards compatibility, hence the any // it valid Javascript, and allows backwards compatibility, hence the any
new DataTable(this.toArray(), selector); // note argument shift new DataTable(els, selector); // note argument shift
// jQuery specific api method
this.api = () => new Api(els);
return this; return this;
} }
// Allow access to the API from the core class
this.api = () => {
return new Api(selector);
};
var emptyInit = options === undefined; var emptyInit = options === undefined;
let tableEls = Dom.s(selector); let tableEls = Dom.s(selector);
let len = tableEls.count(); let len = tableEls.count();
@ -12963,13 +12968,6 @@ return DataTable;
}); });
} }
else if (typeof exports === 'object') { else if (typeof exports === 'object') {
// CommonJS
var cjsRequires = function (root) {
if (! root.DataTable) {
require('datatables.net')(root);
}
};
if (typeof window === 'undefined') { if (typeof window === 'undefined') {
module.exports = function (root) { module.exports = function (root) {
if (! root) { if (! root) {
@ -12978,13 +12976,19 @@ return DataTable;
root = window; root = window;
} }
cjsRequires(root); var DataTable = root.DataTable ?
return factory(root, root.document, root.DataTable); root.DataTable :
require('datatables.net')(root);
return factory(root, root.document, DataTable);
}; };
} }
else { else {
cjsRequires(window); var DataTable = window.DataTable ?
module.exports = factory(window, window.document, window.DataTable); window.DataTable :
require('datatables.net');
module.exports = factory(window, window.document, DataTable);
} }
} }
else { else {

8
src/util.rs

@ -147,7 +147,7 @@ impl Cors {
// Check a request's `Origin` header against the list of allowed origins. // Check a request's `Origin` header against the list of allowed origins.
// If a match exists, return it. Otherwise, return None. // If a match exists, return it. Otherwise, return None.
fn get_allowed_origin(headers: &HeaderMap<'_>) -> Option<String> { fn get_allowed_origin(headers: &HeaderMap<'_>, allow_sso: bool) -> Option<String> {
let origin = Self::get_header(headers, "Origin"); let origin = Self::get_header(headers, "Origin");
let safari_extension_origin = "file://"; let safari_extension_origin = "file://";
let desktop_custom_file_origin = "bw-desktop-file://bundle"; let desktop_custom_file_origin = "bw-desktop-file://bundle";
@ -155,7 +155,7 @@ impl Cors {
if origin == CONFIG.domain_origin() if origin == CONFIG.domain_origin()
|| origin == safari_extension_origin || origin == safari_extension_origin
|| origin == desktop_custom_file_origin || origin == desktop_custom_file_origin
|| (CONFIG.sso_enabled() && origin == CONFIG.sso_authority()) || (allow_sso && CONFIG.sso_enabled() && origin == CONFIG.sso_authority())
{ {
Some(origin) Some(origin)
} else { } else {
@ -175,8 +175,10 @@ impl Fairing for Cors {
async fn on_response<'r>(&self, request: &'r Request<'_>, response: &mut Response<'r>) { async fn on_response<'r>(&self, request: &'r Request<'_>, response: &mut Response<'r>) {
let req_headers = request.headers(); let req_headers = request.headers();
// The admin panel authenticates with a cookie, so the SSO provider's pages must not reach it
let allow_sso = !request.uri().path().as_str().starts_with(&format!("{}/admin", CONFIG.domain_path()));
if let Some(origin) = Self::get_allowed_origin(req_headers) { if let Some(origin) = Self::get_allowed_origin(req_headers, allow_sso) {
response.set_header(Header::new("Access-Control-Allow-Origin", origin)); response.set_header(Header::new("Access-Control-Allow-Origin", origin));
} }

Loading…
Cancel
Save