Browse Source

add a config experimental_client_feature_flags_skip_validation, that, when set, passes through all feature flags verbatim without validation. Useful for testing and eaerly adopters

pull/6855/head
phoeagon 2 months ago
parent
commit
acb2069fe6
  1. 5
      .env.template
  2. 8
      src/config.rs

5
.env.template

@ -383,6 +383,11 @@
## - "mutual-tls": Enable the use of mutual TLS on Android (Client >= 2025.2.0) ## - "mutual-tls": Enable the use of mutual TLS on Android (Client >= 2025.2.0)
# EXPERIMENTAL_CLIENT_FEATURE_FLAGS=fido2-vault-credentials # EXPERIMENTAL_CLIENT_FEATURE_FLAGS=fido2-vault-credentials
## Skip validation of experimental client feature flags.
## If set to true, Vaultwarden will not check if the flags in EXPERIMENTAL_CLIENT_FEATURE_FLAGS are known.
## Use this at your own risk!
# EXPERIMENTAL_CLIENT_FEATURE_FLAGS_SKIP_VALIDATION=false
## Require new device emails. When a user logs in an email is required to be sent. ## Require new device emails. When a user logs in an email is required to be sent.
## If sending the email fails the login attempt will fail!! ## If sending the email fails the login attempt will fail!!
# REQUIRE_DEVICE_EMAIL=false # REQUIRE_DEVICE_EMAIL=false

8
src/config.rs

@ -712,6 +712,9 @@ make_config! {
/// Customize the enabled feature flags on the clients |> This is a comma separated list of feature flags to enable. /// Customize the enabled feature flags on the clients |> This is a comma separated list of feature flags to enable.
experimental_client_feature_flags: String, false, def, String::new(); experimental_client_feature_flags: String, false, def, String::new();
/// Skip validation of experimental client feature flags |> If this is set to true, the experimental client feature flags will not be validated. This is useful for testing.
/// Use this at your own risk!
experimental_client_feature_flags_skip_validation: bool, false, def, false;
/// Require new device emails |> When a user logs in an email is required to be sent. /// Require new device emails |> When a user logs in an email is required to be sent.
/// If sending the email fails the login attempt will fail. /// If sending the email fails the login attempt will fail.
@ -1047,13 +1050,16 @@ fn validate_config(cfg: &ConfigItems) -> Result<(), Error> {
"simple-login-self-host-alias", "simple-login-self-host-alias",
"mutual-tls", "mutual-tls",
]; ];
if !cfg.experimental_client_feature_flags_skip_validation {
let configured_flags = parse_experimental_client_feature_flags(&cfg.experimental_client_feature_flags); let configured_flags = parse_experimental_client_feature_flags(&cfg.experimental_client_feature_flags);
let invalid_flags: Vec<_> = configured_flags.keys().filter(|flag| !KNOWN_FLAGS.contains(&flag.as_str())).collect(); let invalid_flags: Vec<_> =
configured_flags.keys().filter(|flag| !KNOWN_FLAGS.contains(&flag.as_str())).collect();
if !invalid_flags.is_empty() { if !invalid_flags.is_empty() {
err!(format!("Unrecognized experimental client feature flags: {invalid_flags:?}.\n\n\ err!(format!("Unrecognized experimental client feature flags: {invalid_flags:?}.\n\n\
Please ensure all feature flags are spelled correctly and that they are supported in this version.\n\ Please ensure all feature flags are spelled correctly and that they are supported in this version.\n\
Supported flags: {KNOWN_FLAGS:?}")); Supported flags: {KNOWN_FLAGS:?}"));
} }
}
const MAX_FILESIZE_KB: i64 = i64::MAX >> 10; const MAX_FILESIZE_KB: i64 = i64::MAX >> 10;

Loading…
Cancel
Save