Cargo.toml 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. [workspace]
  2. members = ["macros"]
  3. [package]
  4. name = "vaultwarden"
  5. version = "1.0.0"
  6. authors = ["Daniel García <[email protected]>"]
  7. edition = "2021"
  8. rust-version = "1.87.0"
  9. resolver = "2"
  10. repository = "https://github.com/dani-garcia/vaultwarden"
  11. readme = "README.md"
  12. license = "AGPL-3.0-only"
  13. publish = false
  14. build = "build.rs"
  15. [features]
  16. # default = ["sqlite"]
  17. # Empty to keep compatibility, prefer to set USE_SYSLOG=true
  18. enable_syslog = []
  19. mysql = ["diesel/mysql", "diesel_migrations/mysql"]
  20. postgresql = ["diesel/postgres", "diesel_migrations/postgres"]
  21. sqlite = ["diesel/sqlite", "diesel_migrations/sqlite", "dep:libsqlite3-sys"]
  22. # Enable to use a vendored and statically linked openssl
  23. vendored_openssl = ["openssl/vendored"]
  24. # Enable MiMalloc memory allocator to replace the default malloc
  25. # This can improve performance for Alpine builds
  26. enable_mimalloc = ["dep:mimalloc"]
  27. # This is a development dependency, and should only be used during development!
  28. # It enables the usage of the diesel_logger crate, which is able to output the generated queries.
  29. # You also need to set an env variable `QUERY_LOGGER=1` to fully activate this so you do not have to re-compile
  30. # if you want to turn off the logging for a specific run.
  31. query_logger = ["dep:diesel_logger"]
  32. s3 = ["opendal/services-s3", "dep:aws-config", "dep:aws-credential-types", "dep:aws-smithy-runtime-api", "dep:anyhow", "dep:http", "dep:reqsign"]
  33. # OIDC specific features
  34. oidc-accept-rfc3339-timestamps = ["openidconnect/accept-rfc3339-timestamps"]
  35. oidc-accept-string-booleans = ["openidconnect/accept-string-booleans"]
  36. # Enable unstable features, requires nightly
  37. # Currently only used to enable rusts official ip support
  38. unstable = []
  39. [target."cfg(unix)".dependencies]
  40. # Logging
  41. syslog = "7.0.0"
  42. [dependencies]
  43. macros = { path = "./macros" }
  44. # Logging
  45. log = "0.4.27"
  46. fern = { version = "0.7.1", features = ["syslog-7", "reopen-1"] }
  47. tracing = { version = "0.1.41", features = ["log"] } # Needed to have lettre and webauthn-rs trace logging to work
  48. # A `dotenv` implementation for Rust
  49. dotenvy = { version = "0.15.7", default-features = false }
  50. # Lazy initialization
  51. once_cell = "1.21.3"
  52. # Numerical libraries
  53. num-traits = "0.2.19"
  54. num-derive = "0.4.2"
  55. bigdecimal = "0.4.8"
  56. # Web framework
  57. rocket = { version = "0.5.1", features = ["tls", "json"], default-features = false }
  58. rocket_ws = { version ="0.1.1" }
  59. # WebSockets libraries
  60. rmpv = "1.3.0" # MessagePack library
  61. # Concurrent HashMap used for WebSocket messaging and favicons
  62. dashmap = "6.1.0"
  63. # Async futures
  64. futures = "0.3.31"
  65. tokio = { version = "1.47.1", features = ["rt-multi-thread", "fs", "io-util", "parking_lot", "time", "signal", "net"] }
  66. tokio-util = { version = "0.7.16", features = ["compat"]}
  67. # A generic serialization/deserialization framework
  68. serde = { version = "1.0.219", features = ["derive"] }
  69. serde_json = "1.0.143"
  70. # A safe, extensible ORM and Query builder
  71. diesel = { version = "2.2.12", features = ["chrono", "r2d2", "numeric"] }
  72. diesel_migrations = "2.2.0"
  73. diesel_logger = { version = "0.4.0", optional = true }
  74. derive_more = { version = "2.0.1", features = ["from", "into", "as_ref", "deref", "display"] }
  75. diesel-derive-newtype = "2.1.2"
  76. # Bundled/Static SQLite
  77. libsqlite3-sys = { version = "0.35.0", features = ["bundled"], optional = true }
  78. # Crypto-related libraries
  79. rand = "0.9.2"
  80. ring = "0.17.14"
  81. subtle = "2.6.1"
  82. # UUID generation
  83. uuid = { version = "1.18.0", features = ["v4"] }
  84. # Date and time libraries
  85. chrono = { version = "0.4.41", features = ["clock", "serde"], default-features = false }
  86. chrono-tz = "0.10.4"
  87. time = "0.3.41"
  88. # Job scheduler
  89. job_scheduler_ng = "2.3.0"
  90. # Data encoding library Hex/Base32/Base64
  91. data-encoding = "2.9.0"
  92. # JWT library
  93. jsonwebtoken = "9.3.1"
  94. # TOTP library
  95. totp-lite = "2.0.1"
  96. # Yubico Library
  97. yubico = { package = "yubico_ng", version = "0.14.1", features = ["online-tokio"], default-features = false }
  98. # WebAuthn libraries
  99. # danger-allow-state-serialisation is needed to save the state in the db
  100. # danger-credential-internals is needed to support U2F to Webauthn migration
  101. webauthn-rs = { version = "0.5.2", features = ["danger-allow-state-serialisation", "danger-credential-internals"] }
  102. webauthn-rs-proto = "0.5.2"
  103. webauthn-rs-core = "0.5.2"
  104. # Handling of URL's for WebAuthn and favicons
  105. url = "2.5.7"
  106. # Email libraries
  107. lettre = { version = "0.11.18", features = ["smtp-transport", "sendmail-transport", "builder", "serde", "hostname", "tracing", "tokio1-rustls", "ring", "rustls-native-certs"], default-features = false }
  108. percent-encoding = "2.3.2" # URL encoding library used for URL's in the emails
  109. email_address = "0.2.9"
  110. # HTML Template library
  111. handlebars = { version = "6.3.2", features = ["dir_source"] }
  112. # HTTP client (Used for favicons, version check, DUO and HIBP API)
  113. reqwest = { version = "0.12.23", features = ["rustls-tls", "rustls-tls-native-roots", "stream", "json", "deflate", "gzip", "brotli", "zstd", "socks", "cookies", "charset", "http2", "system-proxy"], default-features = false}
  114. hickory-resolver = "0.25.2"
  115. # Favicon extraction libraries
  116. html5gum = "0.8.0"
  117. regex = { version = "1.11.2", features = ["std", "perf", "unicode-perl"], default-features = false }
  118. data-url = "0.3.2"
  119. bytes = "1.10.1"
  120. svg-hush = "0.9.5"
  121. # Cache function results (Used for version check and favicon fetching)
  122. cached = { version = "0.56.0", features = ["async"] }
  123. # Used for custom short lived cookie jar during favicon extraction
  124. cookie = "0.18.1"
  125. cookie_store = "0.21.1"
  126. # Used by U2F, JWT and PostgreSQL
  127. openssl = "0.10.73"
  128. # CLI argument parsing
  129. pico-args = "0.5.0"
  130. # Macro ident concatenation
  131. pastey = "0.1.1"
  132. governor = "0.10.1"
  133. # OIDC for SSO
  134. openidconnect = { version = "4.0.1", features = ["reqwest", "native-tls"] }
  135. mini-moka = "0.10.3"
  136. # Check client versions for specific features.
  137. semver = "1.0.26"
  138. # Allow overriding the default memory allocator
  139. # Mainly used for the musl builds, since the default musl malloc is very slow
  140. mimalloc = { version = "0.1.48", features = ["secure"], default-features = false, optional = true }
  141. which = "8.0.0"
  142. # Argon2 library with support for the PHC format
  143. argon2 = "0.5.3"
  144. # Reading a password from the cli for generating the Argon2id ADMIN_TOKEN
  145. rpassword = "7.4.0"
  146. # Loading a dynamic CSS Stylesheet
  147. grass_compiler = { version = "0.13.4", default-features = false }
  148. # File are accessed through Apache OpenDAL
  149. opendal = { version = "0.54.0", features = ["services-fs"], default-features = false }
  150. # For retrieving AWS credentials, including temporary SSO credentials
  151. anyhow = { version = "1.0.99", optional = true }
  152. aws-config = { version = "1.8.5", features = ["behavior-version-latest", "rt-tokio", "credentials-process", "sso"], default-features = false, optional = true }
  153. aws-credential-types = { version = "1.2.5", optional = true }
  154. aws-smithy-runtime-api = { version = "1.9.0", optional = true }
  155. http = { version = "1.3.1", optional = true }
  156. reqsign = { version = "0.16.5", optional = true }
  157. # Strip debuginfo from the release builds
  158. # The debug symbols are to provide better panic traces
  159. # Also enable fat LTO and use 1 codegen unit for optimizations
  160. [profile.release]
  161. strip = "debuginfo"
  162. lto = "fat"
  163. codegen-units = 1
  164. # A little bit of a speedup
  165. [profile.dev]
  166. split-debuginfo = "unpacked"
  167. # Always build argon2 using opt-level 3
  168. # This is a huge speed improvement during testing
  169. [profile.dev.package.argon2]
  170. opt-level = 3
  171. # Optimize for size
  172. [profile.release-micro]
  173. inherits = "release"
  174. opt-level = "z"
  175. strip = "symbols"
  176. lto = "fat"
  177. codegen-units = 1
  178. panic = "abort"
  179. # Profile for systems with low resources
  180. # It will use less resources during build
  181. [profile.release-low]
  182. inherits = "release"
  183. strip = "symbols"
  184. lto = "thin"
  185. codegen-units = 16
  186. # Linting config
  187. # https://doc.rust-lang.org/rustc/lints/groups.html
  188. [workspace.lints.rust]
  189. # Forbid
  190. unsafe_code = "forbid"
  191. non_ascii_idents = "forbid"
  192. # Deny
  193. deprecated_in_future = "deny"
  194. future_incompatible = { level = "deny", priority = -1 }
  195. keyword_idents = { level = "deny", priority = -1 }
  196. let_underscore = { level = "deny", priority = -1 }
  197. noop_method_call = "deny"
  198. refining_impl_trait = { level = "deny", priority = -1 }
  199. rust_2018_idioms = { level = "deny", priority = -1 }
  200. rust_2021_compatibility = { level = "deny", priority = -1 }
  201. rust_2024_compatibility = { level = "deny", priority = -1 }
  202. edition_2024_expr_fragment_specifier = "allow" # Once changed to Rust 2024 this should be removed and macro's should be validated again
  203. single_use_lifetimes = "deny"
  204. trivial_casts = "deny"
  205. trivial_numeric_casts = "deny"
  206. unused = { level = "deny", priority = -1 }
  207. unused_import_braces = "deny"
  208. unused_lifetimes = "deny"
  209. unused_qualifications = "deny"
  210. variant_size_differences = "deny"
  211. # Allow the following lints since these cause issues with Rust v1.84.0 or newer
  212. # Building Vaultwarden with Rust v1.85.0 and edition 2024 also works without issues
  213. if_let_rescope = "allow"
  214. tail_expr_drop_order = "allow"
  215. # https://rust-lang.github.io/rust-clippy/stable/index.html
  216. [workspace.lints.clippy]
  217. # Warn
  218. dbg_macro = "warn"
  219. todo = "warn"
  220. # Ignore/Allow
  221. result_large_err = "allow"
  222. # Deny
  223. case_sensitive_file_extension_comparisons = "deny"
  224. cast_lossless = "deny"
  225. clone_on_ref_ptr = "deny"
  226. equatable_if_let = "deny"
  227. filter_map_next = "deny"
  228. float_cmp_const = "deny"
  229. implicit_clone = "deny"
  230. inefficient_to_string = "deny"
  231. iter_on_empty_collections = "deny"
  232. iter_on_single_items = "deny"
  233. linkedlist = "deny"
  234. macro_use_imports = "deny"
  235. manual_assert = "deny"
  236. manual_instant_elapsed = "deny"
  237. manual_string_new = "deny"
  238. match_wildcard_for_single_variants = "deny"
  239. mem_forget = "deny"
  240. needless_continue = "deny"
  241. needless_lifetimes = "deny"
  242. option_option = "deny"
  243. string_add_assign = "deny"
  244. unnecessary_join = "deny"
  245. unnecessary_self_imports = "deny"
  246. unnested_or_patterns = "deny"
  247. unused_async = "deny"
  248. unused_self = "deny"
  249. verbose_file_reads = "deny"
  250. zero_sized_map_values = "deny"
  251. [lints]
  252. workspace = true