mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-05-31 16:00:14 +03:00
Compare commits
7 Commits
feecfb20da
..
1.35.4
| Author | SHA1 | Date | |
|---|---|---|---|
| c555f7d198 | |||
| 74819b95bd | |||
| da2af3d362 | |||
| 1583fe4af3 | |||
| 36f0620fd1 | |||
| 3cd2d4afe7 | |||
| d09c45bb63 |
@@ -87,7 +87,7 @@ jobs:
|
|||||||
|
|
||||||
# Only install the clippy and rustfmt components on the default rust-toolchain
|
# Only install the clippy and rustfmt components on the default rust-toolchain
|
||||||
- name: "Install rust-toolchain version"
|
- name: "Install rust-toolchain version"
|
||||||
uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # master @ Dec 16, 2025, 6:11 PM GMT+1
|
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master @ Feb 13, 2026, 3:46 AM GMT+1
|
||||||
if: ${{ matrix.channel == 'rust-toolchain' }}
|
if: ${{ matrix.channel == 'rust-toolchain' }}
|
||||||
with:
|
with:
|
||||||
toolchain: "${{steps.toolchain.outputs.RUST_TOOLCHAIN}}"
|
toolchain: "${{steps.toolchain.outputs.RUST_TOOLCHAIN}}"
|
||||||
@@ -97,7 +97,7 @@ jobs:
|
|||||||
|
|
||||||
# Install the any other channel to be used for which we do not execute clippy and rustfmt
|
# Install the any other channel to be used for which we do not execute clippy and rustfmt
|
||||||
- name: "Install MSRV version"
|
- name: "Install MSRV version"
|
||||||
uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # master @ Dec 16, 2025, 6:11 PM GMT+1
|
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # master @ Feb 13, 2026, 3:46 AM GMT+1
|
||||||
if: ${{ matrix.channel != 'rust-toolchain' }}
|
if: ${{ matrix.channel != 'rust-toolchain' }}
|
||||||
with:
|
with:
|
||||||
toolchain: "${{steps.toolchain.outputs.RUST_TOOLCHAIN}}"
|
toolchain: "${{steps.toolchain.outputs.RUST_TOOLCHAIN}}"
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ jobs:
|
|||||||
|
|
||||||
# Login to Docker Hub
|
# Login to Docker Hub
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
@@ -117,7 +117,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@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
@@ -133,7 +133,7 @@ jobs:
|
|||||||
|
|
||||||
# Login to Quay.io
|
# Login to Quay.io
|
||||||
- name: Login to Quay.io
|
- name: Login to Quay.io
|
||||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
|
||||||
with:
|
with:
|
||||||
registry: quay.io
|
registry: quay.io
|
||||||
username: ${{ secrets.QUAY_USERNAME }}
|
username: ${{ secrets.QUAY_USERNAME }}
|
||||||
@@ -233,7 +233,7 @@ jobs:
|
|||||||
|
|
||||||
# Upload artifacts to Github Actions and Attest the binaries
|
# Upload artifacts to Github Actions and Attest the binaries
|
||||||
- name: Attest binaries
|
- name: Attest binaries
|
||||||
uses: actions/attest-build-provenance@00014ed6ed5efc5b1ab7f7f34a39eb55d41aa4f8 # v3.1.0
|
uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0
|
||||||
with:
|
with:
|
||||||
subject-path: vaultwarden-${{ env.NORMALIZED_ARCH }}
|
subject-path: vaultwarden-${{ env.NORMALIZED_ARCH }}
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ jobs:
|
|||||||
|
|
||||||
# Login to Docker Hub
|
# Login to Docker Hub
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
@@ -280,7 +280,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@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
@@ -296,7 +296,7 @@ jobs:
|
|||||||
|
|
||||||
# Login to Quay.io
|
# Login to Quay.io
|
||||||
- name: Login to Quay.io
|
- name: Login to Quay.io
|
||||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
|
||||||
with:
|
with:
|
||||||
registry: quay.io
|
registry: quay.io
|
||||||
username: ${{ secrets.QUAY_USERNAME }}
|
username: ${{ secrets.QUAY_USERNAME }}
|
||||||
@@ -358,7 +358,7 @@ jobs:
|
|||||||
# Attest container images
|
# Attest container images
|
||||||
- name: Attest - docker.io - ${{ matrix.base_image }}
|
- name: Attest - docker.io - ${{ matrix.base_image }}
|
||||||
if: ${{ env.HAVE_DOCKERHUB_LOGIN == 'true' && env.DIGEST_SHA != ''}}
|
if: ${{ env.HAVE_DOCKERHUB_LOGIN == 'true' && env.DIGEST_SHA != ''}}
|
||||||
uses: actions/attest-build-provenance@00014ed6ed5efc5b1ab7f7f34a39eb55d41aa4f8 # v3.1.0
|
uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0
|
||||||
with:
|
with:
|
||||||
subject-name: ${{ vars.DOCKERHUB_REPO }}
|
subject-name: ${{ vars.DOCKERHUB_REPO }}
|
||||||
subject-digest: ${{ env.DIGEST_SHA }}
|
subject-digest: ${{ env.DIGEST_SHA }}
|
||||||
@@ -366,7 +366,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Attest - ghcr.io - ${{ matrix.base_image }}
|
- name: Attest - ghcr.io - ${{ matrix.base_image }}
|
||||||
if: ${{ env.HAVE_GHCR_LOGIN == 'true' && env.DIGEST_SHA != ''}}
|
if: ${{ env.HAVE_GHCR_LOGIN == 'true' && env.DIGEST_SHA != ''}}
|
||||||
uses: actions/attest-build-provenance@00014ed6ed5efc5b1ab7f7f34a39eb55d41aa4f8 # v3.1.0
|
uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0
|
||||||
with:
|
with:
|
||||||
subject-name: ${{ vars.GHCR_REPO }}
|
subject-name: ${{ vars.GHCR_REPO }}
|
||||||
subject-digest: ${{ env.DIGEST_SHA }}
|
subject-digest: ${{ env.DIGEST_SHA }}
|
||||||
@@ -374,7 +374,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Attest - quay.io - ${{ matrix.base_image }}
|
- name: Attest - quay.io - ${{ matrix.base_image }}
|
||||||
if: ${{ env.HAVE_QUAY_LOGIN == 'true' && env.DIGEST_SHA != ''}}
|
if: ${{ env.HAVE_QUAY_LOGIN == 'true' && env.DIGEST_SHA != ''}}
|
||||||
uses: actions/attest-build-provenance@00014ed6ed5efc5b1ab7f7f34a39eb55d41aa4f8 # v3.1.0
|
uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0
|
||||||
with:
|
with:
|
||||||
subject-name: ${{ vars.QUAY_REPO }}
|
subject-name: ${{ vars.QUAY_REPO }}
|
||||||
subject-digest: ${{ env.DIGEST_SHA }}
|
subject-digest: ${{ env.DIGEST_SHA }}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # 0.33.1
|
uses: aquasecurity/trivy-action@c1824fd6edce30d7ab345a9989de00bbd46ef284 # 0.34.0
|
||||||
env:
|
env:
|
||||||
TRIVY_DB_REPOSITORY: docker.io/aquasec/trivy-db:2,public.ecr.aws/aquasecurity/trivy-db:2,ghcr.io/aquasecurity/trivy-db:2
|
TRIVY_DB_REPOSITORY: docker.io/aquasec/trivy-db:2,public.ecr.aws/aquasecurity/trivy-db:2,ghcr.io/aquasecurity/trivy-db:2
|
||||||
TRIVY_JAVA_DB_REPOSITORY: docker.io/aquasec/trivy-java-db:1,public.ecr.aws/aquasecurity/trivy-java-db:1,ghcr.io/aquasecurity/trivy-java-db:1
|
TRIVY_JAVA_DB_REPOSITORY: docker.io/aquasec/trivy-java-db:1,public.ecr.aws/aquasecurity/trivy-java-db:1,ghcr.io/aquasecurity/trivy-java-db:1
|
||||||
@@ -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@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10
|
uses: github/codeql-action/upload-sarif@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3
|
||||||
with:
|
with:
|
||||||
sarif_file: 'trivy-results.sarif'
|
sarif_file: 'trivy-results.sarif'
|
||||||
|
|||||||
@@ -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@65120634e79d8374d1aa2f27e54baa0c364fff5a # v1.42.1
|
uses: crate-ci/typos@57b11c6b7e54c402ccd9cda953f1072ec4f78e33 # v1.43.5
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Run zizmor
|
- name: Run zizmor
|
||||||
uses: zizmorcore/zizmor-action@135698455da5c3b3e55f73f4419e481ab68cdd95 # v0.4.1
|
uses: zizmorcore/zizmor-action@0dce2577a4760a2749d8cfb7a84b7d5585ebcb7d # v0.5.0
|
||||||
with:
|
with:
|
||||||
# intentionally not scanning the entire repository,
|
# intentionally not scanning the entire repository,
|
||||||
# since it contains integration tests.
|
# since it contains integration tests.
|
||||||
|
|||||||
@@ -53,6 +53,6 @@ repos:
|
|||||||
- "cd docker && make"
|
- "cd docker && make"
|
||||||
# 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: 65120634e79d8374d1aa2f27e54baa0c364fff5a # v1.42.1
|
rev: 57b11c6b7e54c402ccd9cda953f1072ec4f78e33 # v1.43.5
|
||||||
hooks:
|
hooks:
|
||||||
- id: typos
|
- id: typos
|
||||||
|
|||||||
Generated
+407
-272
File diff suppressed because it is too large
Load Diff
+16
-16
@@ -1,6 +1,6 @@
|
|||||||
[workspace.package]
|
[workspace.package]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.90.0"
|
rust-version = "1.91.0"
|
||||||
license = "AGPL-3.0-only"
|
license = "AGPL-3.0-only"
|
||||||
repository = "https://github.com/dani-garcia/vaultwarden"
|
repository = "https://github.com/dani-garcia/vaultwarden"
|
||||||
publish = false
|
publish = false
|
||||||
@@ -78,7 +78,7 @@ rmpv = "1.3.1" # MessagePack library
|
|||||||
dashmap = "6.1.0"
|
dashmap = "6.1.0"
|
||||||
|
|
||||||
# Async futures
|
# Async futures
|
||||||
futures = "0.3.31"
|
futures = "0.3.32"
|
||||||
tokio = { version = "1.49.0", features = ["rt-multi-thread", "fs", "io-util", "parking_lot", "time", "signal", "net"] }
|
tokio = { version = "1.49.0", features = ["rt-multi-thread", "fs", "io-util", "parking_lot", "time", "signal", "net"] }
|
||||||
tokio-util = { version = "0.7.18", features = ["compat"]}
|
tokio-util = { version = "0.7.18", features = ["compat"]}
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ serde_json = "1.0.149"
|
|||||||
|
|
||||||
# A safe, extensible ORM and Query builder
|
# A safe, extensible ORM and Query builder
|
||||||
# Currently pinned diesel to v2.3.3 as newer version break MySQL/MariaDB compatibility
|
# Currently pinned diesel to v2.3.3 as newer version break MySQL/MariaDB compatibility
|
||||||
diesel = { version = "2.3.5", features = ["chrono", "r2d2", "numeric"] }
|
diesel = { version = "2.3.6", features = ["chrono", "r2d2", "numeric"] }
|
||||||
diesel_migrations = "2.3.1"
|
diesel_migrations = "2.3.1"
|
||||||
|
|
||||||
derive_more = { version = "2.1.1", features = ["from", "into", "as_ref", "deref", "display"] }
|
derive_more = { version = "2.1.1", features = ["from", "into", "as_ref", "deref", "display"] }
|
||||||
@@ -98,17 +98,17 @@ diesel-derive-newtype = "2.1.2"
|
|||||||
libsqlite3-sys = { version = "0.35.0", features = ["bundled"], optional = true }
|
libsqlite3-sys = { version = "0.35.0", features = ["bundled"], optional = true }
|
||||||
|
|
||||||
# Crypto-related libraries
|
# Crypto-related libraries
|
||||||
rand = "0.9.2"
|
rand = "0.10.0"
|
||||||
ring = "0.17.14"
|
ring = "0.17.14"
|
||||||
subtle = "2.6.1"
|
subtle = "2.6.1"
|
||||||
|
|
||||||
# UUID generation
|
# UUID generation
|
||||||
uuid = { version = "1.19.0", features = ["v4"] }
|
uuid = { version = "1.21.0", features = ["v4"] }
|
||||||
|
|
||||||
# Date and time libraries
|
# Date and time libraries
|
||||||
chrono = { version = "0.4.43", features = ["clock", "serde"], default-features = false }
|
chrono = { version = "0.4.43", features = ["clock", "serde"], default-features = false }
|
||||||
chrono-tz = "0.10.4"
|
chrono-tz = "0.10.4"
|
||||||
time = "0.3.45"
|
time = "0.3.47"
|
||||||
|
|
||||||
# Job scheduler
|
# Job scheduler
|
||||||
job_scheduler_ng = "2.4.0"
|
job_scheduler_ng = "2.4.0"
|
||||||
@@ -117,7 +117,7 @@ job_scheduler_ng = "2.4.0"
|
|||||||
data-encoding = "2.10.0"
|
data-encoding = "2.10.0"
|
||||||
|
|
||||||
# JWT library
|
# JWT library
|
||||||
jsonwebtoken = { version = "10.2.0", features = ["use_pem", "rust_crypto"], default-features = false }
|
jsonwebtoken = { version = "10.3.0", features = ["use_pem", "rust_crypto"], default-features = false }
|
||||||
|
|
||||||
# TOTP library
|
# TOTP library
|
||||||
totp-lite = "2.0.1"
|
totp-lite = "2.0.1"
|
||||||
@@ -149,17 +149,17 @@ hickory-resolver = "0.25.2"
|
|||||||
|
|
||||||
# Favicon extraction libraries
|
# Favicon extraction libraries
|
||||||
html5gum = "0.8.3"
|
html5gum = "0.8.3"
|
||||||
regex = { version = "1.12.2", features = ["std", "perf", "unicode-perl"], default-features = false }
|
regex = { version = "1.12.3", features = ["std", "perf", "unicode-perl"], default-features = false }
|
||||||
data-url = "0.3.2"
|
data-url = "0.3.2"
|
||||||
bytes = "1.11.0"
|
bytes = "1.11.1"
|
||||||
svg-hush = "0.9.5"
|
svg-hush = "0.9.6"
|
||||||
|
|
||||||
# Cache function results (Used for version check and favicon fetching)
|
# Cache function results (Used for version check and favicon fetching)
|
||||||
cached = { version = "0.56.0", features = ["async"] }
|
cached = { version = "0.56.0", features = ["async"] }
|
||||||
|
|
||||||
# Used for custom short lived cookie jar during favicon extraction
|
# Used for custom short lived cookie jar during favicon extraction
|
||||||
cookie = "0.18.1"
|
cookie = "0.18.1"
|
||||||
cookie_store = "0.22.0"
|
cookie_store = "0.22.1"
|
||||||
|
|
||||||
# Used by U2F, JWT and PostgreSQL
|
# Used by U2F, JWT and PostgreSQL
|
||||||
openssl = "0.10.75"
|
openssl = "0.10.75"
|
||||||
@@ -172,7 +172,7 @@ pastey = "0.2.1"
|
|||||||
governor = "0.10.4"
|
governor = "0.10.4"
|
||||||
|
|
||||||
# OIDC for SSO
|
# OIDC for SSO
|
||||||
openidconnect = { version = "4.0.1", features = ["reqwest", "native-tls"] }
|
openidconnect = { version = "4.0.1", features = ["reqwest", "rustls-tls"] }
|
||||||
mini-moka = "0.10.3"
|
mini-moka = "0.10.3"
|
||||||
|
|
||||||
# Check client versions for specific features.
|
# Check client versions for specific features.
|
||||||
@@ -197,10 +197,10 @@ grass_compiler = { version = "0.13.4", default-features = false }
|
|||||||
opendal = { version = "0.55.0", features = ["services-fs"], default-features = false }
|
opendal = { version = "0.55.0", features = ["services-fs"], default-features = false }
|
||||||
|
|
||||||
# For retrieving AWS credentials, including temporary SSO credentials
|
# For retrieving AWS credentials, including temporary SSO credentials
|
||||||
anyhow = { version = "1.0.100", optional = true }
|
anyhow = { version = "1.0.101", optional = true }
|
||||||
aws-config = { version = "1.8.12", features = ["behavior-version-latest", "rt-tokio", "credentials-process", "sso"], default-features = false, optional = true }
|
aws-config = { version = "1.8.14", features = ["behavior-version-latest", "rt-tokio", "credentials-process", "sso"], default-features = false, optional = true }
|
||||||
aws-credential-types = { version = "1.2.11", optional = true }
|
aws-credential-types = { version = "1.2.13", optional = true }
|
||||||
aws-smithy-runtime-api = { version = "1.10.0", optional = true }
|
aws-smithy-runtime-api = { version = "1.11.5", optional = true }
|
||||||
http = { version = "1.4.0", optional = true }
|
http = { version = "1.4.0", optional = true }
|
||||||
reqsign = { version = "0.16.5", optional = true }
|
reqsign = { version = "0.16.5", optional = true }
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
---
|
---
|
||||||
vault_version: "v2025.12.2"
|
vault_version: "v2026.1.1"
|
||||||
vault_image_digest: "sha256:3c9aec4924c4f529af5e48888cfddd559e553ee62ce3e81372b50103bbaf20f7"
|
vault_image_digest: "sha256:062fcf0d5dc37247dae61b0ee1ba5d20f9296e290d7ad1f6114ea5888f5738a7"
|
||||||
# Cross Compile Docker Helper Scripts v1.9.0
|
# Cross Compile Docker Helper Scripts v1.9.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
|
||||||
xx_image_digest: "sha256:c64defb9ed5a91eacb37f96ccc3d4cd72521c4bd18d5442905b95e2226b0e707"
|
xx_image_digest: "sha256:c64defb9ed5a91eacb37f96ccc3d4cd72521c4bd18d5442905b95e2226b0e707"
|
||||||
rust_version: 1.92.0 # Rust version to be used
|
rust_version: 1.93.1 # Rust version to be used
|
||||||
debian_version: trixie # Debian release name to be used
|
debian_version: trixie # Debian release name to be used
|
||||||
alpine_version: "3.23" # Alpine version to be used
|
alpine_version: "3.23" # Alpine version to be used
|
||||||
# For which platforms/architectures will we try to build images
|
# For which platforms/architectures will we try to build images
|
||||||
|
|||||||
+10
-10
@@ -19,23 +19,23 @@
|
|||||||
# - 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:v2025.12.2
|
# $ docker pull docker.io/vaultwarden/web-vault:v2026.1.1
|
||||||
# $ docker image inspect --format "{{.RepoDigests}}" docker.io/vaultwarden/web-vault:v2025.12.2
|
# $ docker image inspect --format "{{.RepoDigests}}" docker.io/vaultwarden/web-vault:v2026.1.1
|
||||||
# [docker.io/vaultwarden/web-vault@sha256:3c9aec4924c4f529af5e48888cfddd559e553ee62ce3e81372b50103bbaf20f7]
|
# [docker.io/vaultwarden/web-vault@sha256:062fcf0d5dc37247dae61b0ee1ba5d20f9296e290d7ad1f6114ea5888f5738a7]
|
||||||
#
|
#
|
||||||
# - 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:3c9aec4924c4f529af5e48888cfddd559e553ee62ce3e81372b50103bbaf20f7
|
# $ docker image inspect --format "{{.RepoTags}}" docker.io/vaultwarden/web-vault@sha256:062fcf0d5dc37247dae61b0ee1ba5d20f9296e290d7ad1f6114ea5888f5738a7
|
||||||
# [docker.io/vaultwarden/web-vault:v2025.12.2]
|
# [docker.io/vaultwarden/web-vault:v2026.1.1]
|
||||||
#
|
#
|
||||||
FROM --platform=linux/amd64 docker.io/vaultwarden/web-vault@sha256:3c9aec4924c4f529af5e48888cfddd559e553ee62ce3e81372b50103bbaf20f7 AS vault
|
FROM --platform=linux/amd64 docker.io/vaultwarden/web-vault@sha256:062fcf0d5dc37247dae61b0ee1ba5d20f9296e290d7ad1f6114ea5888f5738a7 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
|
||||||
## And for Alpine we define all build images here, they will only be loaded when actually used
|
## And for Alpine we define all build images here, they will only be loaded when actually used
|
||||||
FROM --platform=$BUILDPLATFORM ghcr.io/blackdex/rust-musl:x86_64-musl-stable-1.92.0 AS build_amd64
|
FROM --platform=$BUILDPLATFORM ghcr.io/blackdex/rust-musl:x86_64-musl-stable-1.93.1 AS build_amd64
|
||||||
FROM --platform=$BUILDPLATFORM ghcr.io/blackdex/rust-musl:aarch64-musl-stable-1.92.0 AS build_arm64
|
FROM --platform=$BUILDPLATFORM ghcr.io/blackdex/rust-musl:aarch64-musl-stable-1.93.1 AS build_arm64
|
||||||
FROM --platform=$BUILDPLATFORM ghcr.io/blackdex/rust-musl:armv7-musleabihf-stable-1.92.0 AS build_armv7
|
FROM --platform=$BUILDPLATFORM ghcr.io/blackdex/rust-musl:armv7-musleabihf-stable-1.93.1 AS build_armv7
|
||||||
FROM --platform=$BUILDPLATFORM ghcr.io/blackdex/rust-musl:arm-musleabi-stable-1.92.0 AS build_armv6
|
FROM --platform=$BUILDPLATFORM ghcr.io/blackdex/rust-musl:arm-musleabi-stable-1.93.1 AS build_armv6
|
||||||
|
|
||||||
########################## BUILD IMAGE ##########################
|
########################## BUILD IMAGE ##########################
|
||||||
# hadolint ignore=DL3006
|
# hadolint ignore=DL3006
|
||||||
|
|||||||
@@ -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:v2025.12.2
|
# $ docker pull docker.io/vaultwarden/web-vault:v2026.1.1
|
||||||
# $ docker image inspect --format "{{.RepoDigests}}" docker.io/vaultwarden/web-vault:v2025.12.2
|
# $ docker image inspect --format "{{.RepoDigests}}" docker.io/vaultwarden/web-vault:v2026.1.1
|
||||||
# [docker.io/vaultwarden/web-vault@sha256:3c9aec4924c4f529af5e48888cfddd559e553ee62ce3e81372b50103bbaf20f7]
|
# [docker.io/vaultwarden/web-vault@sha256:062fcf0d5dc37247dae61b0ee1ba5d20f9296e290d7ad1f6114ea5888f5738a7]
|
||||||
#
|
#
|
||||||
# - 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:3c9aec4924c4f529af5e48888cfddd559e553ee62ce3e81372b50103bbaf20f7
|
# $ docker image inspect --format "{{.RepoTags}}" docker.io/vaultwarden/web-vault@sha256:062fcf0d5dc37247dae61b0ee1ba5d20f9296e290d7ad1f6114ea5888f5738a7
|
||||||
# [docker.io/vaultwarden/web-vault:v2025.12.2]
|
# [docker.io/vaultwarden/web-vault:v2026.1.1]
|
||||||
#
|
#
|
||||||
FROM --platform=linux/amd64 docker.io/vaultwarden/web-vault@sha256:3c9aec4924c4f529af5e48888cfddd559e553ee62ce3e81372b50103bbaf20f7 AS vault
|
FROM --platform=linux/amd64 docker.io/vaultwarden/web-vault@sha256:062fcf0d5dc37247dae61b0ee1ba5d20f9296e290d7ad1f6114ea5888f5738a7 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
|
||||||
@@ -36,7 +36,7 @@ FROM --platform=linux/amd64 docker.io/tonistiigi/xx@sha256:c64defb9ed5a91eacb37f
|
|||||||
|
|
||||||
########################## BUILD IMAGE ##########################
|
########################## BUILD IMAGE ##########################
|
||||||
# hadolint ignore=DL3006
|
# hadolint ignore=DL3006
|
||||||
FROM --platform=$BUILDPLATFORM docker.io/library/rust:1.92.0-slim-trixie AS build
|
FROM --platform=$BUILDPLATFORM docker.io/library/rust:1.93.1-slim-trixie AS build
|
||||||
COPY --from=xx / /
|
COPY --from=xx / /
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ARG TARGETVARIANT
|
ARG TARGETVARIANT
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ path = "src/lib.rs"
|
|||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
quote = "1.0.43"
|
quote = "1.0.44"
|
||||||
syn = "2.0.114"
|
syn = "2.0.114"
|
||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.92.0"
|
channel = "1.93.1"
|
||||||
components = [ "rustfmt", "clippy" ]
|
components = [ "rustfmt", "clippy" ]
|
||||||
profile = "minimal"
|
profile = "minimal"
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ use rocket::{
|
|||||||
|
|
||||||
pub fn routes() -> Vec<rocket::Route> {
|
pub fn routes() -> Vec<rocket::Route> {
|
||||||
routes![
|
routes![
|
||||||
register,
|
|
||||||
profile,
|
profile,
|
||||||
put_profile,
|
put_profile,
|
||||||
post_profile,
|
post_profile,
|
||||||
@@ -168,11 +167,6 @@ async fn is_email_2fa_required(member_id: Option<MembershipId>, conn: &DbConn) -
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
#[post("/accounts/register", data = "<data>")]
|
|
||||||
async fn register(data: Json<RegisterData>, conn: DbConn) -> JsonResult {
|
|
||||||
_register(data, false, conn).await
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn _register(data: Json<RegisterData>, email_verification: bool, conn: DbConn) -> JsonResult {
|
pub async fn _register(data: Json<RegisterData>, email_verification: bool, conn: DbConn) -> JsonResult {
|
||||||
let mut data: RegisterData = data.into_inner();
|
let mut data: RegisterData = data.into_inner();
|
||||||
let email = data.email.to_lowercase();
|
let email = data.email.to_lowercase();
|
||||||
@@ -1199,10 +1193,9 @@ async fn password_hint(data: Json<PasswordHintData>, conn: DbConn) -> EmptyResul
|
|||||||
// There is still a timing side channel here in that the code
|
// There is still a timing side channel here in that the code
|
||||||
// paths that send mail take noticeably longer than ones that
|
// paths that send mail take noticeably longer than ones that
|
||||||
// don't. Add a randomized sleep to mitigate this somewhat.
|
// don't. Add a randomized sleep to mitigate this somewhat.
|
||||||
use rand::{rngs::SmallRng, Rng, SeedableRng};
|
use rand::{rngs::SmallRng, RngExt};
|
||||||
let mut rng = SmallRng::from_os_rng();
|
let mut rng: SmallRng = rand::make_rng();
|
||||||
let delta: i32 = 100;
|
let sleep_ms = rng.random_range(900..=1100) as u64;
|
||||||
let sleep_ms = (1_000 + rng.random_range(-delta..=delta)) as u64;
|
|
||||||
tokio::time::sleep(tokio::time::Duration::from_millis(sleep_ms)).await;
|
tokio::time::sleep(tokio::time::Duration::from_millis(sleep_ms)).await;
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -715,9 +715,13 @@ async fn put_cipher_partial(
|
|||||||
let data: PartialCipherData = data.into_inner();
|
let data: PartialCipherData = data.into_inner();
|
||||||
|
|
||||||
let Some(cipher) = Cipher::find_by_uuid(&cipher_id, &conn).await else {
|
let Some(cipher) = Cipher::find_by_uuid(&cipher_id, &conn).await else {
|
||||||
err!("Cipher doesn't exist")
|
err!("Cipher does not exist")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if !cipher.is_accessible_to_user(&headers.user.uuid, &conn).await {
|
||||||
|
err!("Cipher does not exist", "Cipher is not accessible for the current user")
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(ref folder_id) = data.folder_id {
|
if let Some(ref folder_id) = data.folder_id {
|
||||||
if Folder::find_by_uuid_and_user(folder_id, &headers.user.uuid, &conn).await.is_none() {
|
if Folder::find_by_uuid_and_user(folder_id, &headers.user.uuid, &conn).await.is_none() {
|
||||||
err!("Invalid folder", "Folder does not exist or belongs to another user");
|
err!("Invalid folder", "Folder does not exist or belongs to another user");
|
||||||
|
|||||||
+36
-397
@@ -36,12 +36,9 @@ pub fn routes() -> Vec<Route> {
|
|||||||
get_org_collections_details,
|
get_org_collections_details,
|
||||||
get_org_collection_detail,
|
get_org_collection_detail,
|
||||||
get_collection_users,
|
get_collection_users,
|
||||||
put_collection_users,
|
|
||||||
put_organization,
|
put_organization,
|
||||||
post_organization,
|
post_organization,
|
||||||
post_organization_collections,
|
post_organization_collections,
|
||||||
delete_organization_collection_member,
|
|
||||||
post_organization_collection_delete_member,
|
|
||||||
post_bulk_access_collections,
|
post_bulk_access_collections,
|
||||||
post_organization_collection_update,
|
post_organization_collection_update,
|
||||||
put_organization_collection_update,
|
put_organization_collection_update,
|
||||||
@@ -64,28 +61,20 @@ pub fn routes() -> Vec<Route> {
|
|||||||
put_member,
|
put_member,
|
||||||
delete_member,
|
delete_member,
|
||||||
bulk_delete_member,
|
bulk_delete_member,
|
||||||
post_delete_member,
|
|
||||||
post_org_import,
|
post_org_import,
|
||||||
list_policies,
|
list_policies,
|
||||||
list_policies_token,
|
list_policies_token,
|
||||||
get_master_password_policy,
|
get_master_password_policy,
|
||||||
get_policy,
|
get_policy,
|
||||||
put_policy,
|
put_policy,
|
||||||
get_organization_tax,
|
put_policy_vnext,
|
||||||
get_plans,
|
get_plans,
|
||||||
get_plans_all,
|
|
||||||
get_plans_tax_rates,
|
|
||||||
import,
|
|
||||||
post_org_keys,
|
post_org_keys,
|
||||||
get_organization_keys,
|
get_organization_keys,
|
||||||
get_organization_public_key,
|
get_organization_public_key,
|
||||||
bulk_public_keys,
|
bulk_public_keys,
|
||||||
deactivate_member,
|
|
||||||
bulk_deactivate_members,
|
|
||||||
revoke_member,
|
revoke_member,
|
||||||
bulk_revoke_members,
|
bulk_revoke_members,
|
||||||
activate_member,
|
|
||||||
bulk_activate_members,
|
|
||||||
restore_member,
|
restore_member,
|
||||||
bulk_restore_members,
|
bulk_restore_members,
|
||||||
get_groups,
|
get_groups,
|
||||||
@@ -100,10 +89,6 @@ pub fn routes() -> Vec<Route> {
|
|||||||
bulk_delete_groups,
|
bulk_delete_groups,
|
||||||
get_group_members,
|
get_group_members,
|
||||||
put_group_members,
|
put_group_members,
|
||||||
get_user_groups,
|
|
||||||
post_user_groups,
|
|
||||||
put_user_groups,
|
|
||||||
delete_group_member,
|
|
||||||
post_delete_group_member,
|
post_delete_group_member,
|
||||||
put_reset_password_enrollment,
|
put_reset_password_enrollment,
|
||||||
get_reset_password_details,
|
get_reset_password_details,
|
||||||
@@ -380,6 +365,11 @@ async fn get_org_collections(org_id: OrganizationId, headers: ManagerHeadersLoos
|
|||||||
if org_id != headers.membership.org_uuid {
|
if org_id != headers.membership.org_uuid {
|
||||||
err!("Organization not found", "Organization id's do not match");
|
err!("Organization not found", "Organization id's do not match");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !headers.membership.has_full_access() {
|
||||||
|
err_code!("Resource not found.", "User does not have full access", rocket::http::Status::NotFound.code);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(Json(json!({
|
Ok(Json(json!({
|
||||||
"data": _get_org_collections(&org_id, &conn).await,
|
"data": _get_org_collections(&org_id, &conn).await,
|
||||||
"object": "list",
|
"object": "list",
|
||||||
@@ -392,7 +382,6 @@ async fn get_org_collections_details(org_id: OrganizationId, headers: ManagerHea
|
|||||||
if org_id != headers.membership.org_uuid {
|
if org_id != headers.membership.org_uuid {
|
||||||
err!("Organization not found", "Organization id's do not match");
|
err!("Organization not found", "Organization id's do not match");
|
||||||
}
|
}
|
||||||
let mut data = Vec::new();
|
|
||||||
|
|
||||||
let Some(member) = Membership::find_by_user_and_org(&headers.user.uuid, &org_id, &conn).await else {
|
let Some(member) = Membership::find_by_user_and_org(&headers.user.uuid, &org_id, &conn).await else {
|
||||||
err!("User is not part of organization")
|
err!("User is not part of organization")
|
||||||
@@ -424,6 +413,7 @@ async fn get_org_collections_details(org_id: OrganizationId, headers: ManagerHea
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
let mut data = Vec::new();
|
||||||
for col in Collection::find_by_organization(&org_id, &conn).await {
|
for col in Collection::find_by_organization(&org_id, &conn).await {
|
||||||
// check whether the current user has access to the given collection
|
// check whether the current user has access to the given collection
|
||||||
let assigned = has_full_access_to_org
|
let assigned = has_full_access_to_org
|
||||||
@@ -566,6 +556,10 @@ async fn post_bulk_access_collections(
|
|||||||
err!("Collection not found")
|
err!("Collection not found")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if !collection.is_manageable_by_user(&headers.membership.user_uuid, &conn).await {
|
||||||
|
err!("Collection not found", "The current user isn't a manager for this collection")
|
||||||
|
}
|
||||||
|
|
||||||
// update collection modification date
|
// update collection modification date
|
||||||
collection.save(&conn).await?;
|
collection.save(&conn).await?;
|
||||||
|
|
||||||
@@ -682,43 +676,6 @@ async fn post_organization_collection_update(
|
|||||||
Ok(Json(collection.to_json_details(&headers.user.uuid, None, &conn).await))
|
Ok(Json(collection.to_json_details(&headers.user.uuid, None, &conn).await))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[delete("/organizations/<org_id>/collections/<col_id>/user/<member_id>")]
|
|
||||||
async fn delete_organization_collection_member(
|
|
||||||
org_id: OrganizationId,
|
|
||||||
col_id: CollectionId,
|
|
||||||
member_id: MembershipId,
|
|
||||||
headers: AdminHeaders,
|
|
||||||
conn: DbConn,
|
|
||||||
) -> EmptyResult {
|
|
||||||
if org_id != headers.org_id {
|
|
||||||
err!("Organization not found", "Organization id's do not match");
|
|
||||||
}
|
|
||||||
let Some(collection) = Collection::find_by_uuid_and_org(&col_id, &org_id, &conn).await else {
|
|
||||||
err!("Collection not found", "Collection does not exist or does not belong to this organization")
|
|
||||||
};
|
|
||||||
|
|
||||||
match Membership::find_by_uuid_and_org(&member_id, &org_id, &conn).await {
|
|
||||||
None => err!("User not found in organization"),
|
|
||||||
Some(member) => {
|
|
||||||
match CollectionUser::find_by_collection_and_user(&collection.uuid, &member.user_uuid, &conn).await {
|
|
||||||
None => err!("User not assigned to collection"),
|
|
||||||
Some(col_user) => col_user.delete(&conn).await,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[post("/organizations/<org_id>/collections/<col_id>/delete-user/<member_id>")]
|
|
||||||
async fn post_organization_collection_delete_member(
|
|
||||||
org_id: OrganizationId,
|
|
||||||
col_id: CollectionId,
|
|
||||||
member_id: MembershipId,
|
|
||||||
headers: AdminHeaders,
|
|
||||||
conn: DbConn,
|
|
||||||
) -> EmptyResult {
|
|
||||||
delete_organization_collection_member(org_id, col_id, member_id, headers, conn).await
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn _delete_organization_collection(
|
async fn _delete_organization_collection(
|
||||||
org_id: &OrganizationId,
|
org_id: &OrganizationId,
|
||||||
col_id: &CollectionId,
|
col_id: &CollectionId,
|
||||||
@@ -887,41 +844,6 @@ async fn get_collection_users(
|
|||||||
Ok(Json(json!(member_list)))
|
Ok(Json(json!(member_list)))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[put("/organizations/<org_id>/collections/<col_id>/users", data = "<data>")]
|
|
||||||
async fn put_collection_users(
|
|
||||||
org_id: OrganizationId,
|
|
||||||
col_id: CollectionId,
|
|
||||||
data: Json<Vec<CollectionMembershipData>>,
|
|
||||||
headers: ManagerHeaders,
|
|
||||||
conn: DbConn,
|
|
||||||
) -> EmptyResult {
|
|
||||||
if org_id != headers.org_id {
|
|
||||||
err!("Organization not found", "Organization id's do not match");
|
|
||||||
}
|
|
||||||
// Get org and collection, check that collection is from org
|
|
||||||
if Collection::find_by_uuid_and_org(&col_id, &org_id, &conn).await.is_none() {
|
|
||||||
err!("Collection not found in Organization")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete all the user-collections
|
|
||||||
CollectionUser::delete_all_by_collection(&col_id, &conn).await?;
|
|
||||||
|
|
||||||
// And then add all the received ones (except if the user has access_all)
|
|
||||||
for d in data.iter() {
|
|
||||||
let Some(user) = Membership::find_by_uuid_and_org(&d.id, &org_id, &conn).await else {
|
|
||||||
err!("User is not part of organization")
|
|
||||||
};
|
|
||||||
|
|
||||||
if user.access_all {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
CollectionUser::save(&user.user_uuid, &col_id, d.read_only, d.hide_passwords, d.manage, &conn).await?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(FromForm)]
|
#[derive(FromForm)]
|
||||||
struct OrgIdData {
|
struct OrgIdData {
|
||||||
#[field(name = "organizationId")]
|
#[field(name = "organizationId")]
|
||||||
@@ -929,11 +851,15 @@ struct OrgIdData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[get("/ciphers/organization-details?<data..>")]
|
#[get("/ciphers/organization-details?<data..>")]
|
||||||
async fn get_org_details(data: OrgIdData, headers: OrgMemberHeaders, conn: DbConn) -> JsonResult {
|
async fn get_org_details(data: OrgIdData, headers: ManagerHeadersLoose, conn: DbConn) -> JsonResult {
|
||||||
if data.organization_id != headers.membership.org_uuid {
|
if data.organization_id != headers.membership.org_uuid {
|
||||||
err_code!("Resource not found.", "Organization id's do not match", rocket::http::Status::NotFound.code);
|
err_code!("Resource not found.", "Organization id's do not match", rocket::http::Status::NotFound.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !headers.membership.has_full_access() {
|
||||||
|
err_code!("Resource not found.", "User does not have full access", rocket::http::Status::NotFound.code);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(Json(json!({
|
Ok(Json(json!({
|
||||||
"data": _get_org_details(&data.organization_id, &headers.host, &headers.user.uuid, &conn).await?,
|
"data": _get_org_details(&data.organization_id, &headers.host, &headers.user.uuid, &conn).await?,
|
||||||
"object": "list",
|
"object": "list",
|
||||||
@@ -1715,17 +1641,6 @@ async fn delete_member(
|
|||||||
_delete_member(&org_id, &member_id, &headers, &conn, &nt).await
|
_delete_member(&org_id, &member_id, &headers, &conn, &nt).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[post("/organizations/<org_id>/users/<member_id>/delete")]
|
|
||||||
async fn post_delete_member(
|
|
||||||
org_id: OrganizationId,
|
|
||||||
member_id: MembershipId,
|
|
||||||
headers: AdminHeaders,
|
|
||||||
conn: DbConn,
|
|
||||||
nt: Notify<'_>,
|
|
||||||
) -> EmptyResult {
|
|
||||||
_delete_member(&org_id, &member_id, &headers, &conn, &nt).await
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn _delete_member(
|
async fn _delete_member(
|
||||||
org_id: &OrganizationId,
|
org_id: &OrganizationId,
|
||||||
member_id: &MembershipId,
|
member_id: &MembershipId,
|
||||||
@@ -2178,14 +2093,26 @@ async fn put_policy(
|
|||||||
Ok(Json(policy.to_json()))
|
Ok(Json(policy.to_json()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[derive(Deserialize)]
|
||||||
#[get("/organizations/<org_id>/tax")]
|
struct PolicyDataVnext {
|
||||||
fn get_organization_tax(org_id: OrganizationId, _headers: Headers) -> Json<Value> {
|
policy: PolicyData,
|
||||||
// Prevent a 404 error, which also causes Javascript errors.
|
// Ignore metadata for now as we do not yet support this
|
||||||
// Upstream sends "Only allowed when not self hosted." As an error message.
|
// "metadata": {
|
||||||
// If we do the same it will also output this to the log, which is overkill.
|
// "defaultUserCollectionName": "2.xx|xx==|xx="
|
||||||
// An empty list/data also works fine.
|
// }
|
||||||
Json(_empty_data_json())
|
}
|
||||||
|
|
||||||
|
#[put("/organizations/<org_id>/policies/<pol_type>/vnext", data = "<data>")]
|
||||||
|
async fn put_policy_vnext(
|
||||||
|
org_id: OrganizationId,
|
||||||
|
pol_type: i32,
|
||||||
|
data: Json<PolicyDataVnext>,
|
||||||
|
headers: AdminHeaders,
|
||||||
|
conn: DbConn,
|
||||||
|
) -> JsonResult {
|
||||||
|
let data: PolicyDataVnext = data.into_inner();
|
||||||
|
let policy: PolicyData = data.policy;
|
||||||
|
put_policy(org_id, pol_type, Json(policy), headers, conn).await
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/plans")]
|
#[get("/plans")]
|
||||||
@@ -2216,17 +2143,6 @@ fn get_plans() -> Json<Value> {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/plans/all")]
|
|
||||||
fn get_plans_all() -> Json<Value> {
|
|
||||||
get_plans()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[get("/plans/sales-tax-rates")]
|
|
||||||
fn get_plans_tax_rates(_headers: Headers) -> Json<Value> {
|
|
||||||
// Prevent a 404 error, which also causes Javascript errors.
|
|
||||||
Json(_empty_data_json())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[get("/organizations/<_org_id>/billing/metadata")]
|
#[get("/organizations/<_org_id>/billing/metadata")]
|
||||||
fn get_billing_metadata(_org_id: OrganizationId, _headers: Headers) -> Json<Value> {
|
fn get_billing_metadata(_org_id: OrganizationId, _headers: Headers) -> Json<Value> {
|
||||||
// Prevent a 404 error, which also causes Javascript errors.
|
// Prevent a 404 error, which also causes Javascript errors.
|
||||||
@@ -2251,174 +2167,12 @@ fn _empty_data_json() -> Value {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
struct OrgImportGroupData {
|
|
||||||
#[allow(dead_code)]
|
|
||||||
name: String, // "GroupName"
|
|
||||||
#[allow(dead_code)]
|
|
||||||
external_id: String, // "cn=GroupName,ou=Groups,dc=example,dc=com"
|
|
||||||
#[allow(dead_code)]
|
|
||||||
users: Vec<String>, // ["uid=user,ou=People,dc=example,dc=com"]
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
struct OrgImportUserData {
|
|
||||||
email: String, // "user@maildomain.net"
|
|
||||||
#[allow(dead_code)]
|
|
||||||
external_id: String, // "uid=user,ou=People,dc=example,dc=com"
|
|
||||||
deleted: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
struct OrgImportData {
|
|
||||||
#[allow(dead_code)]
|
|
||||||
groups: Vec<OrgImportGroupData>,
|
|
||||||
overwrite_existing: bool,
|
|
||||||
users: Vec<OrgImportUserData>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// This function seems to be deprecated
|
|
||||||
/// It is only used with older directory connectors
|
|
||||||
/// TODO: Cleanup Tech debt
|
|
||||||
#[post("/organizations/<org_id>/import", data = "<data>")]
|
|
||||||
async fn import(org_id: OrganizationId, data: Json<OrgImportData>, headers: Headers, conn: DbConn) -> EmptyResult {
|
|
||||||
let data = data.into_inner();
|
|
||||||
|
|
||||||
// TODO: Currently we aren't storing the externalId's anywhere, so we also don't have a way
|
|
||||||
// to differentiate between auto-imported users and manually added ones.
|
|
||||||
// This means that this endpoint can end up removing users that were added manually by an admin,
|
|
||||||
// as opposed to upstream which only removes auto-imported users.
|
|
||||||
|
|
||||||
// User needs to be admin or owner to use the Directory Connector
|
|
||||||
match Membership::find_by_user_and_org(&headers.user.uuid, &org_id, &conn).await {
|
|
||||||
Some(member) if member.atype >= MembershipType::Admin => { /* Okay, nothing to do */ }
|
|
||||||
Some(_) => err!("User has insufficient permissions to use Directory Connector"),
|
|
||||||
None => err!("User not part of organization"),
|
|
||||||
};
|
|
||||||
|
|
||||||
for user_data in &data.users {
|
|
||||||
if user_data.deleted {
|
|
||||||
// If user is marked for deletion and it exists, delete it
|
|
||||||
if let Some(member) = Membership::find_by_email_and_org(&user_data.email, &org_id, &conn).await {
|
|
||||||
log_event(
|
|
||||||
EventType::OrganizationUserRemoved as i32,
|
|
||||||
&member.uuid,
|
|
||||||
&org_id,
|
|
||||||
&headers.user.uuid,
|
|
||||||
headers.device.atype,
|
|
||||||
&headers.ip.ip,
|
|
||||||
&conn,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
member.delete(&conn).await?;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If user is not part of the organization, but it exists
|
|
||||||
} else if Membership::find_by_email_and_org(&user_data.email, &org_id, &conn).await.is_none() {
|
|
||||||
if let Some(user) = User::find_by_mail(&user_data.email, &conn).await {
|
|
||||||
let member_status = if CONFIG.mail_enabled() {
|
|
||||||
MembershipStatus::Invited as i32
|
|
||||||
} else {
|
|
||||||
MembershipStatus::Accepted as i32 // Automatically mark user as accepted if no email invites
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut new_member =
|
|
||||||
Membership::new(user.uuid.clone(), org_id.clone(), Some(headers.user.email.clone()));
|
|
||||||
new_member.access_all = false;
|
|
||||||
new_member.atype = MembershipType::User as i32;
|
|
||||||
new_member.status = member_status;
|
|
||||||
|
|
||||||
if CONFIG.mail_enabled() {
|
|
||||||
let org_name = match Organization::find_by_uuid(&org_id, &conn).await {
|
|
||||||
Some(org) => org.name,
|
|
||||||
None => err!("Error looking up organization"),
|
|
||||||
};
|
|
||||||
|
|
||||||
mail::send_invite(
|
|
||||||
&user,
|
|
||||||
org_id.clone(),
|
|
||||||
new_member.uuid.clone(),
|
|
||||||
&org_name,
|
|
||||||
Some(headers.user.email.clone()),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save the member after sending an email
|
|
||||||
// If sending fails the member will not be saved to the database, and will not result in the admin needing to reinvite the users manually
|
|
||||||
new_member.save(&conn).await?;
|
|
||||||
|
|
||||||
log_event(
|
|
||||||
EventType::OrganizationUserInvited as i32,
|
|
||||||
&new_member.uuid,
|
|
||||||
&org_id,
|
|
||||||
&headers.user.uuid,
|
|
||||||
headers.device.atype,
|
|
||||||
&headers.ip.ip,
|
|
||||||
&conn,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If this flag is enabled, any user that isn't provided in the Users list will be removed (by default they will be kept unless they have Deleted == true)
|
|
||||||
if data.overwrite_existing {
|
|
||||||
for member in Membership::find_by_org_and_type(&org_id, MembershipType::User, &conn).await {
|
|
||||||
if let Some(user_email) = User::find_by_uuid(&member.user_uuid, &conn).await.map(|u| u.email) {
|
|
||||||
if !data.users.iter().any(|u| u.email == user_email) {
|
|
||||||
log_event(
|
|
||||||
EventType::OrganizationUserRemoved as i32,
|
|
||||||
&member.uuid,
|
|
||||||
&org_id,
|
|
||||||
&headers.user.uuid,
|
|
||||||
headers.device.atype,
|
|
||||||
&headers.ip.ip,
|
|
||||||
&conn,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
member.delete(&conn).await?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pre web-vault v2022.9.x endpoint
|
|
||||||
#[put("/organizations/<org_id>/users/<member_id>/deactivate")]
|
|
||||||
async fn deactivate_member(
|
|
||||||
org_id: OrganizationId,
|
|
||||||
member_id: MembershipId,
|
|
||||||
headers: AdminHeaders,
|
|
||||||
conn: DbConn,
|
|
||||||
) -> EmptyResult {
|
|
||||||
_revoke_member(&org_id, &member_id, &headers, &conn).await
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
struct BulkRevokeMembershipIds {
|
struct BulkRevokeMembershipIds {
|
||||||
ids: Option<Vec<MembershipId>>,
|
ids: Option<Vec<MembershipId>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre web-vault v2022.9.x endpoint
|
|
||||||
#[put("/organizations/<org_id>/users/deactivate", data = "<data>")]
|
|
||||||
async fn bulk_deactivate_members(
|
|
||||||
org_id: OrganizationId,
|
|
||||||
data: Json<BulkRevokeMembershipIds>,
|
|
||||||
headers: AdminHeaders,
|
|
||||||
conn: DbConn,
|
|
||||||
) -> JsonResult {
|
|
||||||
bulk_revoke_members(org_id, data, headers, conn).await
|
|
||||||
}
|
|
||||||
|
|
||||||
#[put("/organizations/<org_id>/users/<member_id>/revoke")]
|
#[put("/organizations/<org_id>/users/<member_id>/revoke")]
|
||||||
async fn revoke_member(
|
async fn revoke_member(
|
||||||
org_id: OrganizationId,
|
org_id: OrganizationId,
|
||||||
@@ -2512,28 +2266,6 @@ async fn _revoke_member(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pre web-vault v2022.9.x endpoint
|
|
||||||
#[put("/organizations/<org_id>/users/<member_id>/activate")]
|
|
||||||
async fn activate_member(
|
|
||||||
org_id: OrganizationId,
|
|
||||||
member_id: MembershipId,
|
|
||||||
headers: AdminHeaders,
|
|
||||||
conn: DbConn,
|
|
||||||
) -> EmptyResult {
|
|
||||||
_restore_member(&org_id, &member_id, &headers, &conn).await
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pre web-vault v2022.9.x endpoint
|
|
||||||
#[put("/organizations/<org_id>/users/activate", data = "<data>")]
|
|
||||||
async fn bulk_activate_members(
|
|
||||||
org_id: OrganizationId,
|
|
||||||
data: Json<BulkMembershipIds>,
|
|
||||||
headers: AdminHeaders,
|
|
||||||
conn: DbConn,
|
|
||||||
) -> JsonResult {
|
|
||||||
bulk_restore_members(org_id, data, headers, conn).await
|
|
||||||
}
|
|
||||||
|
|
||||||
#[put("/organizations/<org_id>/users/<member_id>/restore")]
|
#[put("/organizations/<org_id>/users/<member_id>/restore")]
|
||||||
async fn restore_member(
|
async fn restore_member(
|
||||||
org_id: OrganizationId,
|
org_id: OrganizationId,
|
||||||
@@ -3002,88 +2734,6 @@ async fn put_group_members(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/organizations/<org_id>/users/<member_id>/groups")]
|
|
||||||
async fn get_user_groups(
|
|
||||||
org_id: OrganizationId,
|
|
||||||
member_id: MembershipId,
|
|
||||||
headers: AdminHeaders,
|
|
||||||
conn: DbConn,
|
|
||||||
) -> JsonResult {
|
|
||||||
if org_id != headers.org_id {
|
|
||||||
err!("Organization not found", "Organization id's do not match");
|
|
||||||
}
|
|
||||||
if !CONFIG.org_groups_enabled() {
|
|
||||||
err!("Group support is disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
if Membership::find_by_uuid_and_org(&member_id, &org_id, &conn).await.is_none() {
|
|
||||||
err!("User could not be found!")
|
|
||||||
};
|
|
||||||
|
|
||||||
let user_groups: Vec<GroupId> =
|
|
||||||
GroupUser::find_by_member(&member_id, &conn).await.iter().map(|entry| entry.groups_uuid.clone()).collect();
|
|
||||||
|
|
||||||
Ok(Json(json!(user_groups)))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
struct OrganizationUserUpdateGroupsRequest {
|
|
||||||
group_ids: Vec<GroupId>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[post("/organizations/<org_id>/users/<member_id>/groups", data = "<data>")]
|
|
||||||
async fn post_user_groups(
|
|
||||||
org_id: OrganizationId,
|
|
||||||
member_id: MembershipId,
|
|
||||||
data: Json<OrganizationUserUpdateGroupsRequest>,
|
|
||||||
headers: AdminHeaders,
|
|
||||||
conn: DbConn,
|
|
||||||
) -> EmptyResult {
|
|
||||||
put_user_groups(org_id, member_id, data, headers, conn).await
|
|
||||||
}
|
|
||||||
|
|
||||||
#[put("/organizations/<org_id>/users/<member_id>/groups", data = "<data>")]
|
|
||||||
async fn put_user_groups(
|
|
||||||
org_id: OrganizationId,
|
|
||||||
member_id: MembershipId,
|
|
||||||
data: Json<OrganizationUserUpdateGroupsRequest>,
|
|
||||||
headers: AdminHeaders,
|
|
||||||
conn: DbConn,
|
|
||||||
) -> EmptyResult {
|
|
||||||
if org_id != headers.org_id {
|
|
||||||
err!("Organization not found", "Organization id's do not match");
|
|
||||||
}
|
|
||||||
if !CONFIG.org_groups_enabled() {
|
|
||||||
err!("Group support is disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
if Membership::find_by_uuid_and_org(&member_id, &org_id, &conn).await.is_none() {
|
|
||||||
err!("User could not be found or does not belong to the organization.");
|
|
||||||
}
|
|
||||||
|
|
||||||
GroupUser::delete_all_by_member(&member_id, &conn).await?;
|
|
||||||
|
|
||||||
let assigned_group_ids = data.into_inner();
|
|
||||||
for assigned_group_id in assigned_group_ids.group_ids {
|
|
||||||
let mut group_user = GroupUser::new(assigned_group_id.clone(), member_id.clone());
|
|
||||||
group_user.save(&conn).await?;
|
|
||||||
}
|
|
||||||
|
|
||||||
log_event(
|
|
||||||
EventType::OrganizationUserUpdatedGroups as i32,
|
|
||||||
&member_id,
|
|
||||||
&org_id,
|
|
||||||
&headers.user.uuid,
|
|
||||||
headers.device.atype,
|
|
||||||
&headers.ip.ip,
|
|
||||||
&conn,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[post("/organizations/<org_id>/groups/<group_id>/delete-user/<member_id>")]
|
#[post("/organizations/<org_id>/groups/<group_id>/delete-user/<member_id>")]
|
||||||
async fn post_delete_group_member(
|
async fn post_delete_group_member(
|
||||||
org_id: OrganizationId,
|
org_id: OrganizationId,
|
||||||
@@ -3091,17 +2741,6 @@ async fn post_delete_group_member(
|
|||||||
member_id: MembershipId,
|
member_id: MembershipId,
|
||||||
headers: AdminHeaders,
|
headers: AdminHeaders,
|
||||||
conn: DbConn,
|
conn: DbConn,
|
||||||
) -> EmptyResult {
|
|
||||||
delete_group_member(org_id, group_id, member_id, headers, conn).await
|
|
||||||
}
|
|
||||||
|
|
||||||
#[delete("/organizations/<org_id>/groups/<group_id>/users/<member_id>")]
|
|
||||||
async fn delete_group_member(
|
|
||||||
org_id: OrganizationId,
|
|
||||||
group_id: GroupId,
|
|
||||||
member_id: MembershipId,
|
|
||||||
headers: AdminHeaders,
|
|
||||||
conn: DbConn,
|
|
||||||
) -> EmptyResult {
|
) -> EmptyResult {
|
||||||
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");
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ async fn send_email_login(data: Json<SendEmailLoginData>, client_headers: Client
|
|||||||
err!("Email 2FA is disabled")
|
err!("Email 2FA is disabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ratelimit the login
|
||||||
|
crate::ratelimit::check_limit_login(&client_headers.ip.ip)?;
|
||||||
|
|
||||||
// Get the user
|
// Get the user
|
||||||
let email = match &data.email {
|
let email = match &data.email {
|
||||||
Some(email) if !email.is_empty() => Some(email),
|
Some(email) if !email.is_empty() => Some(email),
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use crate::{
|
|||||||
core::{log_event, log_user_event},
|
core::{log_event, log_user_event},
|
||||||
EmptyResult, JsonResult, PasswordOrOtpData,
|
EmptyResult, JsonResult, PasswordOrOtpData,
|
||||||
},
|
},
|
||||||
auth::{ClientHeaders, Headers},
|
auth::Headers,
|
||||||
crypto,
|
crypto,
|
||||||
db::{
|
db::{
|
||||||
models::{
|
models::{
|
||||||
@@ -35,7 +35,6 @@ pub fn routes() -> Vec<Route> {
|
|||||||
let mut routes = routes![
|
let mut routes = routes![
|
||||||
get_twofactor,
|
get_twofactor,
|
||||||
get_recover,
|
get_recover,
|
||||||
recover,
|
|
||||||
disable_twofactor,
|
disable_twofactor,
|
||||||
disable_twofactor_put,
|
disable_twofactor_put,
|
||||||
get_device_verification_settings,
|
get_device_verification_settings,
|
||||||
@@ -76,54 +75,6 @@ async fn get_recover(data: Json<PasswordOrOtpData>, headers: Headers, conn: DbCo
|
|||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
struct RecoverTwoFactor {
|
|
||||||
master_password_hash: String,
|
|
||||||
email: String,
|
|
||||||
recovery_code: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[post("/two-factor/recover", data = "<data>")]
|
|
||||||
async fn recover(data: Json<RecoverTwoFactor>, client_headers: ClientHeaders, conn: DbConn) -> JsonResult {
|
|
||||||
let data: RecoverTwoFactor = data.into_inner();
|
|
||||||
|
|
||||||
use crate::db::models::User;
|
|
||||||
|
|
||||||
// Get the user
|
|
||||||
let Some(mut user) = User::find_by_mail(&data.email, &conn).await else {
|
|
||||||
err!("Username or password is incorrect. Try again.")
|
|
||||||
};
|
|
||||||
|
|
||||||
// Check password
|
|
||||||
if !user.check_valid_password(&data.master_password_hash) {
|
|
||||||
err!("Username or password is incorrect. Try again.")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if recovery code is correct
|
|
||||||
if !user.check_valid_recovery_code(&data.recovery_code) {
|
|
||||||
err!("Recovery code is incorrect. Try again.")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove all twofactors from the user
|
|
||||||
TwoFactor::delete_all_by_user(&user.uuid, &conn).await?;
|
|
||||||
enforce_2fa_policy(&user, &user.uuid, client_headers.device_type, &client_headers.ip.ip, &conn).await?;
|
|
||||||
|
|
||||||
log_user_event(
|
|
||||||
EventType::UserRecovered2fa as i32,
|
|
||||||
&user.uuid,
|
|
||||||
client_headers.device_type,
|
|
||||||
&client_headers.ip.ip,
|
|
||||||
&conn,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
|
|
||||||
// Remove the recovery code, not needed without twofactors
|
|
||||||
user.totp_recover = None;
|
|
||||||
user.save(&conn).await?;
|
|
||||||
Ok(Json(Value::Object(serde_json::Map::new())))
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn _generate_recover_code(user: &mut User, conn: &DbConn) {
|
async fn _generate_recover_code(user: &mut User, conn: &DbConn) {
|
||||||
if user.totp_recover.is_none() {
|
if user.totp_recover.is_none() {
|
||||||
let totp_recover = crypto::encode_random_bytes::<20>(&BASE32);
|
let totp_recover = crypto::encode_random_bytes::<20>(&BASE32);
|
||||||
|
|||||||
+5
-6
@@ -975,12 +975,11 @@ async fn register_verification_email(
|
|||||||
let user = User::find_by_mail(&data.email, &conn).await;
|
let user = User::find_by_mail(&data.email, &conn).await;
|
||||||
if user.filter(|u| u.private_key.is_some()).is_some() {
|
if user.filter(|u| u.private_key.is_some()).is_some() {
|
||||||
// There is still a timing side channel here in that the code
|
// There is still a timing side channel here in that the code
|
||||||
// paths that send mail take noticeably longer than ones that
|
// paths that send mail take noticeably longer than ones that don't.
|
||||||
// don't. Add a randomized sleep to mitigate this somewhat.
|
// Add a randomized sleep to mitigate this somewhat.
|
||||||
use rand::{rngs::SmallRng, Rng, SeedableRng};
|
use rand::{rngs::SmallRng, RngExt};
|
||||||
let mut rng = SmallRng::from_os_rng();
|
let mut rng: SmallRng = rand::make_rng();
|
||||||
let delta: i32 = 100;
|
let sleep_ms = rng.random_range(900..=1100) as u64;
|
||||||
let sleep_ms = (1_000 + rng.random_range(-delta..=delta)) as u64;
|
|
||||||
tokio::time::sleep(tokio::time::Duration::from_millis(sleep_ms)).await;
|
tokio::time::sleep(tokio::time::Duration::from_millis(sleep_ms)).await;
|
||||||
} else {
|
} else {
|
||||||
mail::send_register_verify_email(&data.email, &token).await?;
|
mail::send_register_verify_email(&data.email, &token).await?;
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ fn vaultwarden_css() -> Cached<Css<String>> {
|
|||||||
"mail_2fa_enabled": CONFIG._enable_email_2fa(),
|
"mail_2fa_enabled": CONFIG._enable_email_2fa(),
|
||||||
"mail_enabled": CONFIG.mail_enabled(),
|
"mail_enabled": CONFIG.mail_enabled(),
|
||||||
"sends_allowed": CONFIG.sends_allowed(),
|
"sends_allowed": CONFIG.sends_allowed(),
|
||||||
|
"remember_2fa_disabled": CONFIG.disable_2fa_remember(),
|
||||||
"password_hints_allowed": CONFIG.password_hints_allowed(),
|
"password_hints_allowed": CONFIG.password_hints_allowed(),
|
||||||
"signup_disabled": CONFIG.is_signup_disabled(),
|
"signup_disabled": CONFIG.is_signup_disabled(),
|
||||||
"sso_enabled": CONFIG.sso_enabled(),
|
"sso_enabled": CONFIG.sso_enabled(),
|
||||||
|
|||||||
+3
-3
@@ -826,7 +826,7 @@ impl<'r> FromRequest<'r> for ManagerHeaders {
|
|||||||
_ => err_handler!("Error getting DB"),
|
_ => err_handler!("Error getting DB"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if !Collection::can_access_collection(&headers.membership, &col_id, &conn).await {
|
if !Collection::is_coll_manageable_by_user(&col_id, &headers.membership.user_uuid, &conn).await {
|
||||||
err_handler!("The current user isn't a manager for this collection")
|
err_handler!("The current user isn't a manager for this collection")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -908,8 +908,8 @@ impl ManagerHeaders {
|
|||||||
if uuid::Uuid::parse_str(col_id.as_ref()).is_err() {
|
if uuid::Uuid::parse_str(col_id.as_ref()).is_err() {
|
||||||
err!("Collection Id is malformed!");
|
err!("Collection Id is malformed!");
|
||||||
}
|
}
|
||||||
if !Collection::can_access_collection(&h.membership, col_id, conn).await {
|
if !Collection::is_coll_manageable_by_user(col_id, &h.membership.user_uuid, conn).await {
|
||||||
err!("You don't have access to all collections!");
|
err!("Collection not found", "The current user isn't a manager for this collection")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -55,13 +55,13 @@ pub fn encode_random_bytes<const N: usize>(e: &Encoding) -> String {
|
|||||||
/// Generates a random string over a specified alphabet.
|
/// Generates a random string over a specified alphabet.
|
||||||
pub fn get_random_string(alphabet: &[u8], num_chars: usize) -> String {
|
pub fn get_random_string(alphabet: &[u8], num_chars: usize) -> String {
|
||||||
// Ref: https://rust-lang-nursery.github.io/rust-cookbook/algorithms/randomness.html
|
// Ref: https://rust-lang-nursery.github.io/rust-cookbook/algorithms/randomness.html
|
||||||
use rand::Rng;
|
use rand::RngExt;
|
||||||
let mut rng = rand::rng();
|
let mut rng = rand::rng();
|
||||||
|
|
||||||
(0..num_chars)
|
(0..num_chars)
|
||||||
.map(|_| {
|
.map(|_| {
|
||||||
let i = rng.random_range(0..alphabet.len());
|
let i = rng.random_range(0..alphabet.len());
|
||||||
alphabet[i] as char
|
char::from(alphabet[i])
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -513,7 +513,8 @@ impl Collection {
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn is_manageable_by_user(&self, user_uuid: &UserId, conn: &DbConn) -> bool {
|
pub async fn is_coll_manageable_by_user(uuid: &CollectionId, user_uuid: &UserId, conn: &DbConn) -> bool {
|
||||||
|
let uuid = uuid.to_string();
|
||||||
let user_uuid = user_uuid.to_string();
|
let user_uuid = user_uuid.to_string();
|
||||||
db_run! { conn: {
|
db_run! { conn: {
|
||||||
collections::table
|
collections::table
|
||||||
@@ -538,9 +539,9 @@ impl Collection {
|
|||||||
collections_groups::collections_uuid.eq(collections::uuid)
|
collections_groups::collections_uuid.eq(collections::uuid)
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
.filter(collections::uuid.eq(&self.uuid))
|
.filter(collections::uuid.eq(&uuid))
|
||||||
.filter(
|
.filter(
|
||||||
users_collections::collection_uuid.eq(&self.uuid).and(users_collections::manage.eq(true)).or(// Directly accessed collection
|
users_collections::collection_uuid.eq(&uuid).and(users_collections::manage.eq(true)).or(// Directly accessed collection
|
||||||
users_organizations::access_all.eq(true).or( // access_all in Organization
|
users_organizations::access_all.eq(true).or( // access_all in Organization
|
||||||
users_organizations::atype.le(MembershipType::Admin as i32) // Org admin or owner
|
users_organizations::atype.le(MembershipType::Admin as i32) // Org admin or owner
|
||||||
)).or(
|
)).or(
|
||||||
@@ -558,6 +559,10 @@ impl Collection {
|
|||||||
.unwrap_or(0) != 0
|
.unwrap_or(0) != 0
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn is_manageable_by_user(&self, user_uuid: &UserId, conn: &DbConn) -> bool {
|
||||||
|
Self::is_coll_manageable_by_user(&self.uuid, user_uuid, conn).await
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Database methods
|
/// Database methods
|
||||||
|
|||||||
+3
-3
@@ -302,10 +302,10 @@ pub async fn send_invite(
|
|||||||
.append_pair("organizationUserId", &member_id)
|
.append_pair("organizationUserId", &member_id)
|
||||||
.append_pair("token", &invite_token);
|
.append_pair("token", &invite_token);
|
||||||
|
|
||||||
if CONFIG.sso_enabled() {
|
if CONFIG.sso_enabled() && CONFIG.sso_only() {
|
||||||
query_params.append_pair("orgUserHasExistingUser", "false");
|
|
||||||
query_params.append_pair("orgSsoIdentifier", &org_id);
|
query_params.append_pair("orgSsoIdentifier", &org_id);
|
||||||
} else if user.private_key.is_some() {
|
}
|
||||||
|
if user.private_key.is_some() {
|
||||||
query_params.append_pair("orgUserHasExistingUser", "true");
|
query_params.append_pair("orgUserHasExistingUser", "true");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -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-2.3.6
|
* https://datatables.net/download/#bs5/dt-2.3.7
|
||||||
*
|
*
|
||||||
* Included libraries:
|
* Included libraries:
|
||||||
* DataTables 2.3.6
|
* DataTables 2.3.7
|
||||||
*/
|
*/
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
|
|||||||
Vendored
+10
-6
@@ -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-2.3.6
|
* https://datatables.net/download/#bs5/dt-2.3.7
|
||||||
*
|
*
|
||||||
* Included libraries:
|
* Included libraries:
|
||||||
* DataTables 2.3.6
|
* DataTables 2.3.7
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! DataTables 2.3.6
|
/*! DataTables 2.3.7
|
||||||
* © SpryMedia Ltd - datatables.net/license
|
* © SpryMedia Ltd - datatables.net/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -460,7 +460,7 @@
|
|||||||
if ( tfoot.length === 0 ) {
|
if ( tfoot.length === 0 ) {
|
||||||
// If we are a scrolling table, and no footer has been given, then we need to create
|
// If we are a scrolling table, and no footer has been given, then we need to create
|
||||||
// a tfoot element for the caption element to be appended to
|
// a tfoot element for the caption element to be appended to
|
||||||
tfoot = $('<tfoot/>').insertAfter(thead);
|
tfoot = $('<tfoot/>').appendTo($this);
|
||||||
}
|
}
|
||||||
oSettings.nTFoot = tfoot[0];
|
oSettings.nTFoot = tfoot[0];
|
||||||
|
|
||||||
@@ -525,7 +525,7 @@
|
|||||||
*
|
*
|
||||||
* @type string
|
* @type string
|
||||||
*/
|
*/
|
||||||
builder: "bs5/dt-2.3.6",
|
builder: "bs5/dt-2.3.7",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Buttons. For use with the Buttons extension for DataTables. This is
|
* Buttons. For use with the Buttons extension for DataTables. This is
|
||||||
@@ -8896,6 +8896,10 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (col.responsiveVisible === false) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Selector
|
// Selector
|
||||||
if (match[1]) {
|
if (match[1]) {
|
||||||
return $(nodes[idx]).filter(match[1]).length > 0 ? idx : null;
|
return $(nodes[idx]).filter(match[1]).length > 0 ? idx : null;
|
||||||
@@ -10300,7 +10304,7 @@
|
|||||||
* @type string
|
* @type string
|
||||||
* @default Version number
|
* @default Version number
|
||||||
*/
|
*/
|
||||||
DataTable.version = "2.3.6";
|
DataTable.version = "2.3.7";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data store, containing all of the settings objects that are
|
* Private data store, containing all of the settings objects that are
|
||||||
|
|||||||
@@ -158,6 +158,13 @@ app-root a[routerlink="/signup"] {
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if remember_2fa_disabled}}
|
||||||
|
/* Hide checkbox to remember 2FA token for 30 days */
|
||||||
|
app-two-factor-auth > form > bit-form-control {
|
||||||
|
@extend %vw-hide;
|
||||||
|
}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#unless mail_2fa_enabled}}
|
{{#unless mail_2fa_enabled}}
|
||||||
/* Hide `Email` 2FA if mail is not enabled */
|
/* Hide `Email` 2FA if mail is not enabled */
|
||||||
.providers-2fa-1 {
|
.providers-2fa-1 {
|
||||||
|
|||||||
Reference in New Issue
Block a user