fix: Slack token is readable by g/error_handler (#2454)

* fix: Slack token is readable by g/error_handler

* remove is_some
This commit is contained in:
Guillaume Bouvignies
2023-10-16 05:53:12 -07:00
committed by GitHub
parent 13725d7576
commit 31c923aab8
13 changed files with 5 additions and 12 deletions

View File

@@ -37,7 +37,6 @@
"bash",
"postgresql",
"nativets",
"Nativets",
"bun",
"mysql",
"bigquery",

View File

@@ -67,7 +67,6 @@
"bash",
"postgresql",
"nativets",
"Nativets",
"bun",
"mysql",
"bigquery",

View File

@@ -28,7 +28,6 @@
"bash",
"postgresql",
"nativets",
"Nativets",
"bun",
"mysql",
"bigquery",

View File

@@ -42,7 +42,6 @@
"bash",
"postgresql",
"nativets",
"Nativets",
"bun",
"mysql",
"bigquery",

View File

@@ -42,7 +42,6 @@
"bash",
"postgresql",
"nativets",
"Nativets",
"bun",
"mysql",
"bigquery",

View File

@@ -46,7 +46,6 @@
"bash",
"postgresql",
"nativets",
"Nativets",
"bun",
"mysql",
"bigquery",

View File

@@ -40,7 +40,6 @@
"bash",
"postgresql",
"nativets",
"Nativets",
"bun",
"mysql",
"bigquery",

View File

@@ -60,7 +60,6 @@
"bash",
"postgresql",
"nativets",
"Nativets",
"bun",
"mysql",
"bigquery",

View File

@@ -42,7 +42,6 @@
"bash",
"postgresql",
"nativets",
"Nativets",
"bun",
"mysql",
"bigquery",

View File

@@ -0,0 +1 @@
-- Add down migration script here

View File

@@ -0,0 +1,2 @@
-- Add up migration script here
UPDATE folder SET extra_perms = JSONB_SET(extra_perms, '{g/error_handler}', 'false', true) WHERE name = 'slack_bot';

View File

@@ -753,7 +753,7 @@ async fn connect_slack_callback(
"slack_bot",
"Slack bot",
&["g/slack".to_string()],
serde_json::json!({"g/slack": true})
serde_json::json!({"g/slack": true, "g/error_handler": false})
)
.execute(&mut *tx)
.await?;

View File

@@ -810,8 +810,7 @@ async fn edit_error_handler(
require_admin(is_admin, &username)?;
#[cfg(not(feature = "enterprise"))]
if ee.error_handler.is_some()
&& ee.error_handler.as_ref().unwrap() == "script/hub/2431/slack/schedule-error-handler-slack"
if ee.error_handler.as_ref().is_some_and(|val| val == "script/hub/2431/slack/schedule-error-handler-slack")
{
return Err(Error::BadRequest(
"Slack error handler is only available in enterprise version".to_string(),