Browse Source

implement server side default URI matching

pull/3748/head
Matlink 2 years ago
parent
commit
eedfc4c7a1
  1. 11
      .env.template
  2. 4
      src/api/core/ciphers.rs
  3. 10
      src/config.rs

11
.env.template

@ -97,6 +97,17 @@
## If unset (the default), events are kept indefinitely and the scheduled job is disabled!
# EVENTS_DAYS_RETAIN=
## Override the default URI matching when for all ciphers
## When users leave the default URI matching for a cipher, replace it by the given value.
## -1: user default,
## 0: base domain,
## 1: host,
## 2: begins with,
## 3: regular expression,
## 4: exact match,
## 5: never match.
# OVERRIDE_DEFAULT_URI_MATCHING=-1
## BETA FEATURE: Groups
## Controls whether group support is enabled for organizations
## This setting applies to organizations.

4
src/api/core/ciphers.rs

@ -456,6 +456,10 @@ pub async fn update_cipher_from_data(
if json_data.is_array() {
json_data.as_array_mut().unwrap().iter_mut().for_each(|ref mut f| {
f.as_object_mut().unwrap().remove("Response");
// When user leaves the default "URI matching" and admin has it overridden
if CONFIG.override_default_uri_matching() >= 0 && f["Match"].is_null() {
f.as_object_mut().unwrap()["Match"] = Value::Number(CONFIG.override_default_uri_matching().into());
}
});
};
json_data

10
src/config.rs

@ -494,6 +494,16 @@ make_config! {
/// Events days retain |> Number of days to retain events stored in the database. If unset, events are kept indefently.
events_days_retain: i64, false, option;
/// Override default URI matching for all ciphers |> When users leave the default URI matching for a cipher, replace it by the given value.
/// -1: user default,
/// 0: base domain,
/// 1: host,
/// 2: begins with,
/// 3: regular expression,
/// 4: exact match,
/// 5: never match.
override_default_uri_matching: i8, true, def, -1;
},
/// Advanced settings

Loading…
Cancel
Save