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. 18
      src/config.rs

5
.env.template

@ -383,6 +383,11 @@
## - "mutual-tls": Enable the use of mutual TLS on Android (Client >= 2025.2.0)
# 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.
## If sending the email fails the login attempt will fail!!
# REQUIRE_DEVICE_EMAIL=false

18
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.
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.
/// If sending the email fails the login attempt will fail.
@ -1047,12 +1050,15 @@ fn validate_config(cfg: &ConfigItems) -> Result<(), Error> {
"simple-login-self-host-alias",
"mutual-tls",
];
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();
if !invalid_flags.is_empty() {
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\
Supported flags: {KNOWN_FLAGS:?}"));
if !cfg.experimental_client_feature_flags_skip_validation {
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();
if !invalid_flags.is_empty() {
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\
Supported flags: {KNOWN_FLAGS:?}"));
}
}
const MAX_FILESIZE_KB: i64 = i64::MAX >> 10;

Loading…
Cancel
Save