From Bruno BELANYI to ~sircmpwn/aerc
Hello, On Mon, 12 Apr 2021 19:08:32 +0200 Reto <reto@labrat.space> wrote: > Why do you need this in the first place? > Your user has read access, why do other users need to read the config? There have been multiple issues relating to this check: [1] and [2]. > I don't think this is the right approach, this is way to brittle. > The code that actually adds new auth schemes doesn't life in this > function and chances are this gets missed once a new scheme is > introduced. Meaning we now have a security problem waiting to happen.
From Bruno BELANYI to ~alarsyo/patches
--- src/bot.rs | 10 +++++++++- src/config.rs | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/bot.rs b/src/bot.rs index aa97d32..eb833db 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -100,11 +100,19 @@ impl BadNewsBot { const KEY_MESSAGE: &str = "MESSAGE"; if let Some(unit) = record.get(KEY_UNIT) { if !self.config.units.iter().map(|u| &u.name).any(|name| name == unit) {[message trimmed]
From Bruno BELANYI to ~alarsyo/patches
--- Cargo.lock | 24 ++++++++++++++++++++++++ Cargo.toml | 2 ++ src/config.rs | 14 ++++++++++++-- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e2fbccb..a615ff6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -66,6 +66,15 @@ dependencies = [ "opaque-debug", ] [message trimmed]
From Bruno BELANYI to ~alarsyo/patches
This allows the user to write: ```yaml units: - foo.service - bar.service - name: baz.service filter: "^Error: .*$" ``` So a unit can be provided as a string, or as a map which contains both `name` and `filter`. --- Cargo.lock | 7 +++++ [message trimmed]
From Bruno BELANYI to ~alarsyo/patches
--- src/config.rs | 23 +++++++++++++++++++++++ src/main.rs | 24 ++---------------------- 2 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 src/config.rs diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..9d99a37 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,23 @@ use matrix_sdk::identifiers::RoomId; use serde::Deserialize;[message trimmed]
From Bruno BELANYI to ~alarsyo/patches
So turns out my previous patchset did an infinite recursion when trying to deserialize the configuration file. The fix was quiet simple, as usual in CS it was simply to add another level of indirection. -- 2.31.1
From Bruno BELANYI to ~alarsyo/patches
--- src/bot.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/bot.rs b/src/bot.rs index aa97d32..eb833db 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -100,11 +100,19 @@ impl BadNewsBot { const KEY_MESSAGE: &str = "MESSAGE"; if let Some(unit) = record.get(KEY_UNIT) { if !self.config.units.iter().map(|u| &u.name).any(|name| name == unit) { let unit_config = self.config.units.iter().find(|u| &u.name == unit);[message trimmed]
From Bruno BELANYI to ~alarsyo/patches
--- Cargo.lock | 24 ++++++++++++++++++++++++ Cargo.toml | 2 ++ src/config.rs | 14 ++++++++++++-- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e2fbccb..a615ff6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -66,6 +66,15 @@ dependencies = [ "opaque-debug", ] [message trimmed]
From Bruno BELANYI to ~alarsyo/patches
This allows the user to write: ```yaml units: - foo.service - bar.service - name: baz.service filter: "^Error: .*$" ``` So a unit can be provided as a string, or as a map which contains both `name` and `filter`. --- Cargo.lock | 7 +++++ [message trimmed]
From Bruno BELANYI to ~alarsyo/patches
--- src/config.rs | 23 +++++++++++++++++++++++ src/main.rs | 24 ++---------------------- 2 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 src/config.rs diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..9d99a37 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,23 @@ use matrix_sdk::identifiers::RoomId; use serde::Deserialize;[message trimmed]