aboutsummaryrefslogtreecommitdiff
path: root/src/db
AgeCommit message (Collapse)Author
12 daysSome refactoring and optimizations (#5291)Mathijs van Veluw
- Refactored several code to use more modern syntax - Made some checks a bit more strict - Updated crates Signed-off-by: BlackDex <[email protected]>
2024-12-08Fix another sync issue with native clients (#5259)Mathijs van Veluw
The `reprompt` value somehow sometimes has a value of `4`. This isn't a valid value, and doesn't cause issues with other clients, but the native clients are more strict. This commit fixes this by validating the value before storing and returning. Signed-off-by: BlackDex <[email protected]>
2024-12-05Update Rust and crates (#5248)Mathijs van Veluw
* Update Rust and crates - Updated Rust to v1.83.0 - Updated MSRV to v1.82.0 (Needed for html5gum crate) - Updated icon fetching code to match new html5gum version - Updated workflows - Enabled edition 2024 clippy lints Nightly reports some clippy hints, but that would be too much to change in this PR i think. Signed-off-by: BlackDex <[email protected]> * Some additional updates - Patch fern to allow syslog-7 feature - Fixed diesel logger which was broken because of the sqlite backup feature Refactored the sqlite backup because of this - Added a build workflow test to include the query_logger feature Signed-off-by: BlackDex <[email protected]> * Also patch yubico-rs and latest updates Signed-off-by: BlackDex <[email protected]> --------- Signed-off-by: BlackDex <[email protected]>
2024-11-20Fix editing members which have access-all rights (#5213)Mathijs van Veluw
With web-vault v2024.6.2 and lower, if a user has access-all rights either as an org-member or via a group it shouldn't return individual collections. This probably needs to be changed with newer versions which do not support the `access-all` feature anymore and work with manage. But with the current version this should solve access right issues. Fixes #5212 Signed-off-by: BlackDex <[email protected]>
2024-11-15Support SSH keys on desktop 2024.12 (#5187)Daniel García
* Support SSH keys on desktop 2024.12 * Document flags in .env.template * Validate key rotation contents
2024-11-13don't infer manage permission for groups (#5190)Stefan Melmuk
the web-vault v2024.6.2 currently cannot deal with manage permission so instead of relying on the org user type this should just default to false
2024-11-10Update crates and fix several issuesBlackDex
Signed-off-by: BlackDex <[email protected]>
2024-10-19Hide user name on invite status (#5110)Mathijs van Veluw
A possible user disclosure when you invite an user into an organization which already has an account on the same instance. This was because we always returned the user's name. To prevent this, this PR only returns the user's name if the status is accepted or higher, else we will return null. This is the same as Bitwarden does. Resolves a reported issue. Also resolved a new `nightly` reported clippy regarding a regex within a loop.
2024-10-18Fix collection management and match some json output (#5095)Mathijs van Veluw
- Fixed collection management to be usable from the Password Manager UI - Checked and brought in-to-sync with upstream several json responses - Fixed a small issue with the `fields` response when it was empty Signed-off-by: BlackDex <[email protected]>
2024-10-13Fix field type to actually be hidden (#5082)Mathijs van Veluw
In an oversight i forgot to set the type to a hidden type if converting the int was not possible. This fixes that. Signed-off-by: BlackDex <[email protected]>
2024-10-13Fix iOS sync by converting field types to int (#5081)Mathijs van Veluw
It seems the iOS clients are not able to handle the `type` key within the `fields` array when they are of the type string. All other clients seem to handle this just fine though. This PR fixes this by validating it is a number, if this is not the case, try to convert the string to a number, or return the default of `1`. `1` is used as this is the type `hidden` and should prevent accidental data disclosure. Fixes #5069 Possibly Fixes #5016 Possibly Fixes #5002 Signed-off-by: BlackDex <[email protected]>
2024-10-11Fix `--version` from failing without config (#5055)1.32.2Mathijs van Veluw
* Fix `--version` from failing without config Since we added the option to show the web-vault version also when running `--version` this causes the config to always be validated. While this is not very bad in general, it could cause the command to quit during the config validation, and not show the version, but also errors. This is probably not very useful for this specific command, unlike the `--backup` for example. To fix this, and preventing the config from being validated, i added an AtomicBool to check if we need to validate the config on first load. This prevents errors, and will just show the Vaultwarden version, and if possible the web-vault version too. Fixes #5046 Signed-off-by: BlackDex <[email protected]> * Adjusted the code bsaed upon review Signed-off-by: BlackDex <[email protected]> --------- Signed-off-by: BlackDex <[email protected]>
2024-10-11Updates and collection management fixes (#5072)Mathijs van Veluw
* Fix collections not editable by managers Since a newer version of the web-vault we use manager were not able to create sub collections anymore. This was because of some missing details in the response of some json objects. This commit fixes this by using the `to_json_details` instead of the `to_json` Fixes #5066 Fixes #5044 * Update crates and GitHub Actions - Updated all the crates - Updated all the GHA dependencies - Configured the trivy workflow to only run on the main repo and not on forks Also selected a random new scheduled date so it will not run at the same time as all other forks. The two changes should help running this scan every day without failing, and also prevent the same for new or updated forks.
2024-09-23Add extra linting (#4977)1.32.1Mathijs van Veluw
* Add extra linting Added extra linting for some code styles. Also added the Rust Edition 2024 lints. Closes #4974 Signed-off-by: BlackDex <[email protected]> * Adjusted according to comments Signed-off-by: BlackDex <[email protected]> --------- Signed-off-by: BlackDex <[email protected]>
2024-09-20Fix encrypted lastUsedDate (#4972)Mathijs van Veluw
It appears that some password histories have an encrypted value on the `lastUsedDate` Instead of only checking if it is a string, also check if it is a valid RFC Date/Time String. If not, set it also to epoch 0. Signed-off-by: BlackDex <[email protected]>
2024-09-18Actually use Device Type for mails (#4916)Daniel
- match Bitwarden behaviour - add a different segment in mails for Device Name
2024-09-18fix 2fa policy check on registration (#4956)Stefan Melmuk
2024-09-18Fix Pw History null dates (#4966)Mathijs van Veluw
It seemed to have been possible to have `null` date values. This PR fixes this by setting the epoch start date if either the date does not exists or is not a string. This should solve sync issues with the new native mobile clients. Fixes https://github.com/dani-garcia/vaultwarden/pull/4932#issuecomment-2357581292 Signed-off-by: BlackDex <[email protected]>
2024-09-09Fix sync with new native clients (#4932)Mathijs van Veluw
2024-09-01Add a CLI feature to backup the SQLite DB (#4906)Mathijs van Veluw
* Add a CLI feature to backup the SQLite DB Many users request to add the sqlite3 binary to the container image. This isn't really ideal as that might bring in other dependencies and will only bloat the image. There main reason is to create a backup of the database. While there already was a feature within the admin interface to do so (or by using the admin API call), this might not be easy. This PR adds several ways to generate a backup. 1. By calling the Vaultwarden binary with the `backup` command like: - `/vaultwarden backup` - `docker exec -it vaultwarden /vaultwarden backup` 2. By sending the USR1 signal to the running process like: - `kill -s USR1 $(pidof vaultwarden) - `killall -s USR1 vaultwarden) This should help users to more easily create backups of there SQLite database. Also added the Web-Vault version number when using `-v/--version` to the output. Signed-off-by: BlackDex <[email protected]> * Spelling and small adjustments Signed-off-by: BlackDex <[email protected]> --------- Signed-off-by: BlackDex <[email protected]>
2024-08-21Fix Login with device (#4878)Mathijs van Veluw
Fixed an issue with login with device for the new Bitwrden Beta clients. They seem to not support ISO8601 milli date/time, only micro. Also updated the device display names to match Upstream and added the CLI devices which were missing. Signed-off-by: BlackDex <[email protected]>
2024-08-15Fix manager in web-vault v2024.6.2 for collections (#4860)Mathijs van Veluw
The web-vault v2024.6.2 we use needs some extra information to allow managers to actually be able to manage collections. The v2024.6.2 web-vault has somewhat of a mixture of the newer roles and older manager roles. To at least fix this for the web-vault we bundle these changes will make the manager able to manage. For future web-vaults we would need a lot more changes to be done to fix this in a better way though. Fixes #4844
2024-08-11Fix data disclosure on organization endpoints (#4837)1.32.0Mathijs van Veluw
- All users were able to request organizational details from any org, even if they were not a member (anymore). Now it will check if that user is a member of the org or not. - The `/organization/<uuid>/keys` endpoint returned also the private keys. This should not be the case. Also, according to the upstream server code the endpoint changed, but the clients do not seem to use it. I added it anyway just in case they will in the future. - Also require a valid login before being able to retreve those org keys. Upstream does not do this, but i see no reason why not. Fixes: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-39925
2024-08-07Update crates, web-vault and fixes (#4823)Mathijs van Veluw
* Update crates, web-vault and fixes - Updated crates - Updated web-vault to v2024.6.2 This version is currently the latest version compatible with our API implementation. For newer versions we need more code updates to make it compatible. Thanks to @stefan0xC this version fixes #4628 - Added a small fix to prevent errors in the Vaultwarden and Client logs. The v2024.6.2 web-vault calls an endpoint with invalid arguments. If this happens we ignore the call and just return an Ok. - Added the bulk-collection endpoint (Though not yet available in v2024.6.2) Fixes #4628 * Prevent bulk remove collections to work
2024-07-24Allow to increase the note size to 100_000 (#4772)Mathijs van Veluw
This PR adds a config option to allow the note size to increase to 100_000, instead of the default 10_000. Since this might cause issues with the clients (in the future), and will cause issues with importing into a Bitwarden server, i added warnings regarding this. Closes #3168
2024-07-24Add support for MFA with Duo's Universal Prompt (#4637)0x0fbc
* Add initial working Duo Universal Prompt support. * Add db schema and models for Duo 2FA state storage * store duo states in the database and validate during authentication * cleanup & comments * bump state/nonce length * replace stray use of TimeDelta * more cleanup * bind Duo oauth flow to device id, drop redundant device type handling * drop redundant alphanum string generation code * error handling cleanup * directly use JWT_VALIDITY_SECS constant instead of copying it to DuoClient instances * remove redundant explicit returns, rustfmt * rearrange constants, update comments, error message * override charset on duo state column to ascii for mysql * Reduce twofactor_duo_ctx state/nonce column size in postgres and maria * Add fixes suggested by clippy * rustfmt * Update to use the make_http_request * Don't handle OrganizationDuo * move Duo API endpoint fmt strings out of macros and into format! calls * Add missing indentation Co-authored-by: Daniel García <[email protected]> * remove redundant expiry check when purging Duo contexts --------- Co-authored-by: BlackDex <[email protected]> Co-authored-by: Daniel García <[email protected]>
2024-07-10Fix bug where secureNotes is empty (#4730)Coby Geralnik
2024-07-10use a custom plan of enterprise tier to fix limits (#4726)Stefan Melmuk
* use a custom plan of enterprise tier to fix limits * set maxStorageGb limit to max signed int value
2024-07-08Some fixes for emergency access (#4715)1.31.0Mathijs van Veluw
- Add missing `Headers` parameter for some functions This allowed any request from allowing these endpoints by not validating the user correctly. - Changed the functions to retreive the emergency access record by using the user uuid which calls the endpoint, instead of validating afterwards. This is more secure and prevents the need of an if check.
2024-07-04add group support for Cipher::get_collections() (#4592)Stefan Melmuk
* add group support for Cipher::get_collections() join group infos assigned to a collection to check whether user has been given access to all collections via any group or they have access to a specific collection via any group membership * fix Collection::is_writable_by_user() prevent side effects if groups are disabled * differentiate the /collection endpoints * return cipherDetails on post_collections_update() * add collections_v2 endpoint
2024-07-03Fix collections and native app issue (#4685)Mathijs van Veluw
Collections were not visible in the organization view. This was because the `flexibleCollections` was set to `true` Found an issue with loading some old created Secure Notes which had `{}` or `{"type":null}` as there `data` value. This isn't allowed. When detected, replace it with `{"type":0}` Fixes #4682 Fixes #4590
2024-06-23Change API and structs to camelCase (#4386)Daniel García
* Change API inputs/outputs and structs to camelCase * Fix fields and password history * Use convert_json_key_lcase_first * Make sends lowercase * Update admin and templates * Update org revoke * Fix sends expecting size to be a string on mobile * Convert two-factor providers to string
2024-06-20Fix some more nightly errors and remove lint that will become an error by ↵Daniel García
default (#4661)
2024-06-20Fix some nightly build errors (#4657)Daniel García
2024-06-19Update crates, web-vault and GHA (#4648)Mathijs van Veluw
- Updated all crates including Diesel and the new mysqlclient-sys - Updated the MSRV to v1.78 as that is what Diesel mandates - Added the mimalloc crate as a patch for now to fix armv6 static builds This probably makes #4606 possible - Updated web-vault to v2024.5.1 - Updated GitHub Actions Fixed an issue with the localhost images for extracting the musl binaries.
2024-05-25differentiate external groups by organization id (#4586)Stefan Melmuk
2024-05-19also delete organization_api_key (#4557)Stefan Melmuk
2024-04-27Some fixes for the new mobile apps (#4526)Daniel García
2024-04-27fix emergency access invites (#4337)Stefan Melmuk
* fix emergency access invites with no mail when mail is disabled instead of accepting emergency access for all invited users automatically, we only accept if the user already exists on registration of a new account any open emergency access invitations will be accepted, if mail is disabled also prevent invited emergency access contacts to register if emergency access is disabled (this is only relevant for when mail is enabled, if mail is disabled they should have an Invitation entry) * delete emergency access invitations if an invited user is deleted in the /admin panel their emergency access invitation will remain in the database which causes the to_json_grantee_details fn to panic * improve missing emergency access grantees instead of returning an empty emergency access contact the entry should not be added to the list. also the error handling can be improved a bit.
2024-04-27improve access to collections via groups (#4441)Stefan Melmuk
* refactor get_org_collections_details * improve access to collection check * fix get_org_collection_detail too
2024-04-06Update crates and some Clippy fixes (#4475)Mathijs van Veluw
- Updated all crates including reqwest - Fixed some clippy lints reported by nightly Rust
2024-03-19Update chrono and sqlite (#4436)Mathijs van Veluw
- Updated sqlite crate - Updated chrono crate The latter needed a lot of changes done, mostly `Duration` to `TimeDelta`. And some changes on how to use Naive.
2024-03-17automatically use email address as 2fa provider (#4317)Stefan Melmuk
2024-03-17Fix #3624: fix manager permission within groups (#3754)Matlink
* Fix #3624: fix manager permission within groups * Query returns UUID only * Fix issue when user is manager and in a group having access to all collections * optimize condition check * fix(groups): renaming and optimizations * fix: wrong organization group membership detection * Simplify group membership check Co-authored-by: Stefan Melmuk <[email protected]> * Remove unused statement * improve check if the user has access via groups instead of returning the two lists of member ids and later checking if they contain the uuid of the current user, we really only care if the current user has full access via a group or if they have access to a given collection via a group * improve comments for get_org_collections_details * small refactor to make it easier to review * fix(groups): query full access via group only when necessary Co-authored-by: Mathijs van Veluw <[email protected]> * chore(fmt): apply rustfmt --------- Co-authored-by: Stefan Melmuk <[email protected]> Co-authored-by: Stefan Melmuk <[email protected]> Co-authored-by: Mathijs van Veluw <[email protected]>
2024-03-17Change timestamp data type. (#4355)gzfrozen
Co-authored-by: Daniel García <[email protected]>
2024-03-17Improve JWT key initialization and avoid saving public key (#4085)Daniel García
2024-01-30register missing push devices at login (#3792)Stefan Melmuk
save the push token of new device even if push notifications are not enabled and provide a way to register the push device at login unregister device if there already is a push token saved unless the new token has already been registered. also the `unregister_push_device` function used the wrong argument cf. https://github.com/bitwarden/server/blob/08d380900b540f8d1a734c7abccaf80e59a91ced/src/Core/Services/Implementations/RelayPushRegistrationService.cs#L43
2024-01-27Improve file limit handling (#4242)Daniel García
* Improve file limit handling * Oops * Update PostgreSQL migration * Review comments --------- Co-authored-by: BlackDex <[email protected]>
2024-01-25prevent side effects if groups are disabled (#4265)Stefan Melmuk
2024-01-01enforce 2FA policy on removal of second factor and login (#3803)Stefan Melmuk
* enforce 2fa policy on removal of second factor users should be revoked when their second factors are removed. we want to revoke users so they don't have to be invited again and organization admins and owners are aware that they no longer have access. we make an exception for non-confirmed users to speed up the invitation process as they would have to be restored before they can accept their invitation or be confirmed. if email is enabled, invited users have to add a second factor before they can accept the invitation to an organization with 2fa policy. and if it is not enabled that check is done when confirming the user. * use &str instead of String in log_event() * enforce the 2fa policy on login if a user doesn't have a second factor check if they are in an organization that has the 2fa policy enabled to revoke their access