Commit Graph

2936 Commits

Author SHA1 Message Date
kalvinparker
03eb5a2ab0 ci(audit): trigger dependency audit workflow 2025-11-10 21:50:42 +00:00
kalvinparker
3acda59afd chore(audit): temporarily allow MPL-2.0 and CDLA-Permissive-2.0 to unblock CI; timebox and track remediation 2025-11-10 21:48:04 +00:00
kalvinparker
b0ee507743 chore(experiment): try reqwest with native-tls to avoid webpki-roots 2025-11-10 21:18:18 +00:00
kalvinparker
fe4f9ce212 docs(audit): record webauthn upgrade experiment results 2025-11-10 21:13:15 +00:00
kalvinparker
64f402b6af chore(audit): add Dockerfile and scripts for cargo audit and deny integration 2025-11-09 17:57:34 +00:00
kalvinparker
d9db30e4b9 docs(audit): add feasibility report for webauthn-rs and webpki-roots remediation 2025-11-09 17:53:16 +00:00
kalvinparker
6ed3d31cc0 chore(audit): add temporary license allowlist for common OSI-approved licenses; document in tracking issue 2025-11-09 08:38:54 +00:00
kalvinparker
c97fc90f40 chore(audit): ignore RUSTSEC-2023-0071 and RUSTSEC-2024-0436 in deny.toml (temporary) 2025-11-09 08:00:37 +00:00
kalvinparker
a305cf3d6d chore(audit): add advisory exceptions for RUSTSEC-2023-0071 and RUSTSEC-2024-0436 under [advisories] (timeboxed) 2025-11-09 07:59:10 +00:00
kalvinparker
a64bf18935 chore(audit): format deny.toml license exceptions as [[licenses.exceptions]] (cargo-deny compatible) 2025-11-09 07:57:46 +00:00
kalvinparker
f16723c8d8 chore(audit): add temporary deny exceptions for rsa and paste; add tracking issue and document in audit note 2025-11-09 07:52:27 +00:00
kalvinparker
22ff36919c chore(deps): allow caret ranges for rmpv and openidconnect to permit safe published bumps 2025-11-09 00:30:26 +00:00
kalvinparker
eb077610b8 chore(deps): revert attempted openidconnect/rmpv bumps (incompatible with crates.io) 2025-11-09 00:25:52 +00:00
kalvinparker
f84d861746 chore(audit): make deny.toml parseable by cargo-deny 2025-11-09 00:24:15 +00:00
kalvinparker
5818cbfff9 chore(audit): fix deny.toml to valid cargo-deny format 2025-11-09 00:23:35 +00:00
kalvinparker
e3d25181b5 chore(deps): attempt bump openidconnect and rmpv to avoid transitive rsa/paste 2025-11-09 00:22:52 +00:00
kalvinparker
1f2cadc8b2 chore(audit): add cargo-deny policy, CI audit workflow and security note (2025-11-09) 2025-11-09 00:16:11 +00:00
kalvinparker
54053f7e28 Add audit and deny command error messages to respective files 2025-11-08 23:20:51 +00:00
kalvinparker
0951c8d220 Add supply chain audit workflow with cargo-audit and cargo-deny steps 2025-11-08 23:20:44 +00:00
Mathijs van Veluw
9017ca265a
Optimizations and build speedup (#6339)
Some checks failed
Build / Build and Test ${{ matrix.channel }} (msrv) (push) Has been cancelled
Build / Build and Test ${{ matrix.channel }} (rust-toolchain) (push) Has been cancelled
Check templates / Validate docker templates (push) Has been cancelled
Hadolint / Validate Dockerfile syntax (push) Has been cancelled
Release / Build Vaultwarden containers (alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (debian) (push) Has been cancelled
Trivy / Trivy Scan (push) Has been cancelled
Code Spell Checking / Run typos spell checking (push) Has been cancelled
Security Analysis with zizmor / Run zizmor (push) Has been cancelled
* Optimizations and build speedup

With this commit I have changed several components to be more efficient.
This can be less llvm-lines generated or less `clone()` calls.

 ### Config
- Re-ordered the `make_config` macro to be more efficient
- Created a custom Deserializer for `ConfigBuilder` less code and more efficient
- Use struct's for the `prepare_json` function instead of generating a custom JSON object.
  This generates less code and is more efficient.
- Updated the `get_support_string` function to handle the masking differently.
  This generates less code and also was able to remove some sub-macro-calls

 ### Error
- Added an extra new call to prevent duplicate Strings in generated macro code.
  This generated less llvm-lines and seems to be more efficient.
- Created a custom Serializer for `ApiError` and `CompactApiError`
  This makes that struct smaller in size, so better for memory, but also less llvm-lines.

 ### General
- Removed `once_lock` and replace it all with Rust's std LazyLock
- Added and fixed some Clippy lints which reduced `clone()` calls for example.
- Updated build profiles for more efficiency
  Also added a new profile specifically for CI, which should decrease the build check
- Updated several GitHub Workflows for better security and use the new `ci` build profile
- Updated to Rust v1.90.0 which uses a new linker `rust-lld` which should help in faster building
- Updated the Cargo.toml for all crates to better use the `workspace` variables
- Added a `typos` Workflow and Pre-Commit, which should help in detecting spell error's.
  Also fixed a few found by it.

Signed-off-by: BlackDex <black.dex@gmail.com>

* Fix release profile

Signed-off-by: BlackDex <black.dex@gmail.com>

* Update typos and remove mimalloc check from pre-commit checks

Signed-off-by: BlackDex <black.dex@gmail.com>

* Misc fixes and updated typos

Signed-off-by: BlackDex <black.dex@gmail.com>

* Update crates and workflows

Signed-off-by: BlackDex <black.dex@gmail.com>

* Fix formating and pre-commit

Signed-off-by: BlackDex <black.dex@gmail.com>

* Update to Rust v1.91 and update crates

Signed-off-by: BlackDex <black.dex@gmail.com>

* Update web-vault to v2025.10.1 and xx to v1.8.0

Signed-off-by: BlackDex <black.dex@gmail.com>

---------

Signed-off-by: BlackDex <black.dex@gmail.com>
2025-11-01 22:21:04 +01:00
Mathijs van Veluw
8d30285160
Fix issue with key-rotation and emergency-access (#6421)
When a user has an unconfirmed emergency-access user, and tries to do a key-rotation, the validation fails.
The reason is that Bitwarden only returns new keys for confirmed users, not for invited or accepted.

This commit fixes this by only requesting confirmed or higher status emergency-access users.

Signed-off-by: BlackDex <black.dex@gmail.com>
2025-11-01 22:20:38 +01:00
Daniel García
3cd3d33d00
Improve protected actions (#6411)
Some checks failed
Build / Build and Test ${{ matrix.channel }} (msrv) (push) Has been cancelled
Build / Build and Test ${{ matrix.channel }} (rust-toolchain) (push) Has been cancelled
Check templates / Validate docker templates (push) Has been cancelled
Hadolint / Validate Dockerfile syntax (push) Has been cancelled
Release / Build Vaultwarden containers (alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (debian) (push) Has been cancelled
Trivy / Trivy Scan (push) Has been cancelled
Security Analysis with zizmor / Run zizmor (push) Has been cancelled
* Improve protected actions

* Match usage on two factor

* Use saturating add

* Don't delete token when tracking attempts
2025-10-29 21:41:34 +01:00
Mathijs van Veluw
2ee5819b56
Use Diesels MultiConnections Derive (#6279)
* Use Diesels MultiConnections Derive

With this PR we remove almost all custom macro's to create the multiple database type code. This is now handled by Diesel it self.

This removed the need of the following functions/macro's:
 - `db_object!`
 - `::to_db`
 - `.from_db()`

It is also possible to just use one schema instead of multiple per type.

Also done:
 - Refactored the SQLite backup function
 - Some formatting of queries so every call is one a separate line, this looks a bit better
 - Declare `conn` as mut inside each `db_run!` instead of having to declare it as `mut` in functions or calls
 - Added an `ACTIVE_DB_TYPE` static which holds the currently active database type
 - Removed `diesel_logger` crate and use Diesel's `set_default_instrumentation()`
   If you want debug queries you can now simply change the log level of `vaultwarden::db::query_logger`
 - Use PostgreSQL v17 in the Alpine images to match the Debian Trixie version
 - Optimized the Workflows since `diesel_logger` isn't needed anymore

And on the extra plus-side, this lowers the compile-time and binary size too.

Signed-off-by: BlackDex <black.dex@gmail.com>

* Adjust query_logger and some other small items

Signed-off-by: BlackDex <black.dex@gmail.com>

* Remove  macro, replaced with an  function

Signed-off-by: BlackDex <black.dex@gmail.com>

* Implement custom connection manager

Signed-off-by: BlackDex <black.dex@gmail.com>

* Updated some crates to keep up2date

Signed-off-by: BlackDex <black.dex@gmail.com>

* Small adjustment

Signed-off-by: BlackDex <black.dex@gmail.com>

* crate updates

Signed-off-by: BlackDex <black.dex@gmail.com>

* Update crates

Signed-off-by: BlackDex <black.dex@gmail.com>

---------

Signed-off-by: BlackDex <black.dex@gmail.com>
2025-10-29 21:04:30 +01:00
Timshel
7c597e88f9
[Playwright] Improvements around node (#6321)
* Playwright node improvements

* Upgrade Keycloak compose to trixie
2025-10-29 20:50:54 +01:00
Stefan Melmuk
a85b48512c
add seat limit for the invite dialog (#6371)
Some checks failed
Build / Build and Test ${{ matrix.channel }} (msrv) (push) Has been cancelled
Build / Build and Test ${{ matrix.channel }} (rust-toolchain) (push) Has been cancelled
Check templates / Validate docker templates (push) Has been cancelled
Hadolint / Validate Dockerfile syntax (push) Has been cancelled
Release / Build Vaultwarden containers (alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (debian) (push) Has been cancelled
Trivy / Trivy Scan (push) Has been cancelled
Security Analysis with zizmor / Run zizmor (push) Has been cancelled
2025-10-21 20:23:46 +02:00
Stefan Melmuk
fe1a8f7738
add missing media-src directive (#6381) 2025-10-21 19:22:37 +02:00
Stefan Melmuk
d43edb8f17
add mail address change warning for invited accounts (#6377)
add a new mail template to differentiate between existing accounts and
only invited accounts, so that they can easier delete the
existing placeholder account
2025-10-21 19:21:47 +02:00
Timshel
8043f7eca7
Fix Org identifier (#6364)
* Fix Org identifier

* Org invitation default to SSO when SSO_ENABLED
2025-10-21 19:20:18 +02:00
Timshel
e659a61581
Add auth_request pending endpoint (#6368) 2025-10-21 19:17:52 +02:00
Stefan Melmuk
2d54cc61df
add new billing warnings endpoint (#6369) 2025-10-21 19:16:27 +02:00
Timshel
3f010a50af
Change OIDC dummy identifier (#6263)
Some checks failed
Build / Build and Test ${{ matrix.channel }} (msrv) (push) Has been cancelled
Build / Build and Test ${{ matrix.channel }} (rust-toolchain) (push) Has been cancelled
Check templates / Validate docker templates (push) Has been cancelled
Hadolint / Validate Dockerfile syntax (push) Has been cancelled
Release / Build Vaultwarden containers (alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (debian) (push) Has been cancelled
Trivy / Trivy Scan (push) Has been cancelled
Security Analysis with zizmor / Run zizmor (push) Has been cancelled
* Change OIDC dummy identifier

* Update src/sso.rs

Co-authored-by: Helmut K. C. Tessarek <tessarek@evermeet.cx>

* Use Org uuid as identifier

---------

Co-authored-by: Helmut K. C. Tessarek <tessarek@evermeet.cx>
Co-authored-by: Mathijs van Veluw <black.dex@gmail.com>
2025-10-13 21:28:37 +02:00
Timshel
e83faad8d2
Fix sso_user dropped on User::save (#6262)
* Admin delete SSO association prompt

* User.save don't use replace_into

* User.save use upsert with sqlite

* User.save use upsert with mysql
2025-10-13 21:25:53 +02:00
Stefan Melmuk
a79cd40ea9
improve permission check for collections (#6278) 2025-10-13 21:14:53 +02:00
Stefan Melmuk
b1d84298cc
update web vault to v2025.9.1 and allow new policy (#6340)
* update web-vault to v2025.9.1

* allow new card removal policy
2025-10-13 20:54:24 +02:00
Stefan Melmuk
a2ad1dc7c3
update trivy-action to v0.33.0 (#6248)
Some checks failed
Check templates / Validate docker templates (push) Has been cancelled
Hadolint / Validate Dockerfile syntax (push) Has been cancelled
Release / Build Vaultwarden containers (alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (debian) (push) Has been cancelled
Trivy / Trivy Scan (push) Has been cancelled
Security Analysis with zizmor / Run zizmor (push) Has been cancelled
* update trivy-action to v0.33.0

* update trivy-action again with fix for setup-trivy
2025-08-29 13:14:39 +02:00
Mathijs van Veluw
7cc4dfabbf
Fix 2fa recovery endpoint (#6240)
Some checks failed
Build / Build and Test ${{ matrix.channel }} (msrv) (push) Has been cancelled
Build / Build and Test ${{ matrix.channel }} (rust-toolchain) (push) Has been cancelled
Check templates / Validate docker templates (push) Has been cancelled
Hadolint / Validate Dockerfile syntax (push) Has been cancelled
Release / Build Vaultwarden containers (alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (debian) (push) Has been cancelled
Trivy / Trivy Scan (push) Has been cancelled
Security Analysis with zizmor / Run zizmor (push) Has been cancelled
The newer web-vaults handle the 2fa recovery code differently.
This commit fixes this by adding this new flow.

Fixes #6200
Fixes #6203

Signed-off-by: BlackDex <black.dex@gmail.com>
2025-08-27 20:53:56 +02:00
Stefan Melmuk
5a8736e116
make webauthn more optional (#6160)
Some checks are pending
Build / Build and Test ${{ matrix.channel }} (msrv) (push) Waiting to run
Build / Build and Test ${{ matrix.channel }} (rust-toolchain) (push) Waiting to run
Check templates / Validate docker templates (push) Waiting to run
Hadolint / Validate Dockerfile syntax (push) Waiting to run
Release / Build Vaultwarden containers (alpine) (push) Waiting to run
Release / Build Vaultwarden containers (debian) (push) Waiting to run
Trivy / Trivy Scan (push) Waiting to run
Security Analysis with zizmor / Run zizmor (push) Waiting to run
* make webauthn optional

* hide passkey if domain is not set
2025-08-26 22:07:20 +02:00
Timshel
f76362ff89
Fix panic around sso_master_password_policy (#6233) 2025-08-26 21:18:25 +02:00
Mathijs van Veluw
6db5b7115d
Update crates, gha and web-vault (#6234)
- Update crates to the latest version (Some are yanked and downgraded)
- Update GHA's
- Update web-vault to v2025.8.0

Signed-off-by: BlackDex <black.dex@gmail.com>
2025-08-26 21:16:50 +02:00
Timshel
3510351f4d
Show SSO_ALLOW_UNKNOWN_EMAIL_VERIFICATION in admin (#6235) 2025-08-26 21:08:43 +02:00
Helmut K. C. Tessarek
7161f612a1
refactor(config): update template, add validation (#6229)
Some checks are pending
Build / Build and Test ${{ matrix.channel }} (msrv) (push) Waiting to run
Build / Build and Test ${{ matrix.channel }} (rust-toolchain) (push) Waiting to run
Check templates / Validate docker templates (push) Waiting to run
Hadolint / Validate Dockerfile syntax (push) Waiting to run
Release / Build Vaultwarden containers (alpine) (push) Waiting to run
Release / Build Vaultwarden containers (debian) (push) Waiting to run
Trivy / Trivy Scan (push) Waiting to run
Security Analysis with zizmor / Run zizmor (push) Waiting to run
This change is a follow up to #6166

- add new options to `.env.template`
- add validation for new config option values
2025-08-26 00:11:36 +02:00
Mathijs van Veluw
5ee908517f
Fix Webauthn/Passkey 2FA migration/validation issues (#6190)
Some checks are pending
Build / Build and Test ${{ matrix.channel }} (msrv) (push) Waiting to run
Build / Build and Test ${{ matrix.channel }} (rust-toolchain) (push) Waiting to run
Check templates / Validate docker templates (push) Waiting to run
Hadolint / Validate Dockerfile syntax (push) Waiting to run
Release / Build Vaultwarden containers (alpine) (push) Waiting to run
Release / Build Vaultwarden containers (debian) (push) Waiting to run
Trivy / Trivy Scan (push) Waiting to run
Security Analysis with zizmor / Run zizmor (push) Waiting to run
* Apply Passkey fixes from zUnixorn

Applied SecurityKey to Passkey fixes from @zUnixorn

Co-authored-by: zUnixorn <77864446+zUnixorn@users.noreply.github.com>

Signed-off-by: BlackDex <black.dex@gmail.com>

* Fix Webauthn/Passkey 2FA migration issues

Because the webauthn-rs v0.3 crate did not know or store new flags currently used in v0.5, some verifications failed.
This mainly failed because of a check if a key was backuped or not, and if it was allowed to do so.

Most hardware keys like YubiKey's do not have this flag enabled and can't be duplicated or faked via software.
Since the rise of Passkey's, like Bitwarden's own implementation, and other platforms like Android, and Apple use Software keys which are shared between devices, they set these backup flags to true. This broke the login attempts, because the default during the migration was `false`, and cause an error during validation.

This PR checks for the flags during the response/verification step, and if these flags are `true`, then search for the stored key, adjust it's value, and also update the current challenge state to match, to prevent the first login attempt to fail.

This should not cause any issue, since the credential-id is checked and matched, and only updated when needed.

Fixes #6154

Signed-off-by: BlackDex <black.dex@gmail.com>

* Fix comments

Signed-off-by: BlackDex <black.dex@gmail.com>

---------

Signed-off-by: BlackDex <black.dex@gmail.com>
2025-08-25 20:49:39 +02:00
Daniel
55577fa4eb
Re-add if check to release workflow (#6227)
- prevents container builds from running on forks
2025-08-25 20:44:31 +02:00
Thomas Violent
843c063649
Make database connection pool dynamic (#6166)
* Add min_idle and idle_timeout to database pool

* Update src/config.rs

Co-authored-by: Daniel García <dani-garcia@users.noreply.github.com>

---------

Co-authored-by: Daniel García <dani-garcia@users.noreply.github.com>
2025-08-25 18:32:05 +02:00
Daniel
550b670dba
Switch to GHA's concurrency control (#6164)
- removes the need to use a 3rd party action
2025-08-25 18:00:10 +02:00
Timshel
de808c5ad9
Fix Playwright docker (#6206) 2025-08-25 17:59:55 +02:00
Justus Dicker
1f73630136
fix typo in description of helo_name (#6194)
Some checks failed
Build / Build and Test ${{ matrix.channel }} (msrv) (push) Has been cancelled
Build / Build and Test ${{ matrix.channel }} (rust-toolchain) (push) Has been cancelled
Check templates / Validate docker templates (push) Has been cancelled
Hadolint / Validate Dockerfile syntax (push) Has been cancelled
Release / Cancel older jobs when running (push) Has been cancelled
Trivy / Trivy Scan (push) Has been cancelled
Security Analysis with zizmor / Run zizmor (push) Has been cancelled
Release / Build Vaultwarden containers (alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (debian) (push) Has been cancelled
fix(config): also correct typo in config.rs
2025-08-20 23:50:52 +02:00
Mathijs van Veluw
77008a91e9
Misc updates (#6185)
Some checks failed
Build / Build and Test ${{ matrix.channel }} (msrv) (push) Has been cancelled
Build / Build and Test ${{ matrix.channel }} (rust-toolchain) (push) Has been cancelled
Check templates / Validate docker templates (push) Has been cancelled
Hadolint / Validate Dockerfile syntax (push) Has been cancelled
Release / Cancel older jobs when running (push) Has been cancelled
Trivy / Trivy Scan (push) Has been cancelled
Security Analysis with zizmor / Run zizmor (push) Has been cancelled
Release / Build Vaultwarden containers (alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (debian) (push) Has been cancelled
- Updated web-vault to v2025.7.2
- Updated Debian to v13 a.k.a. Trixie
- Adjusted Debian build where needed
- Updated several crates
- Updated workflows
- Updated pre-commit

Signed-off-by: BlackDex <black.dex@gmail.com>
2025-08-14 18:05:54 +02:00
Timshel
7f386d38ae
Fix Playwright test conf and update deps (#6176) 2025-08-14 18:04:14 +02:00
Mathijs van Veluw
8e7eeab293
Fix WebauthN issue with Software Keys (#6168)
Some checks failed
Build / Build and Test ${{ matrix.channel }} (msrv) (push) Has been cancelled
Build / Build and Test ${{ matrix.channel }} (rust-toolchain) (push) Has been cancelled
Check templates / Validate docker templates (push) Has been cancelled
Hadolint / Validate Dockerfile syntax (push) Has been cancelled
Release / Cancel older jobs when running (push) Has been cancelled
Trivy / Trivy Scan (push) Has been cancelled
Security Analysis with zizmor / Run zizmor (push) Has been cancelled
Release / Build Vaultwarden containers (alpine) (push) Has been cancelled
Release / Build Vaultwarden containers (debian) (push) Has been cancelled
The check if the token used was a known valid token also checked if it needed to be updated.
This check caused always caused an issue with tokens which do not need or want to be updated.

Since the cred_ids are already checked and deemed valid we only need to check if there is an updated needed.
Their already is a function for this `update_credential`, which returns `Some(true)` if this was the case.
So, only update the records if that is the case, else do not update anything.

Also, used constant time compare to check and validate the cred_id's.

Fixes #6154

Signed-off-by: BlackDex <black.dex@gmail.com>
2025-08-10 19:07:05 +02:00