Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(mattermost): harden webhook configuration

Tin0890c8deee71
diff --git a/apps/api/src/mattermost-integration/index.ts b/apps/api/src/mattermost-integration/index.ts
index 92f6347ae..b659197ad 100644
--- a/apps/api/src/mattermost-integration/index.ts
+++ b/apps/api/src/mattermost-integration/index.ts
@@ -255,7 +255,10 @@ mattermostIntegration
JSON.parse(existing.config) as MattermostConfig,
);
const nextConfig = normalizeMattermostConfig({
- webhookUrl: body.webhookUrl?.trim() || currentConfig.webhookUrl,
+ webhookUrl:
+ body.webhookUrl === undefined
+ ? currentConfig.webhookUrl
+ : body.webhookUrl.trim(),
channelName:
body.channelName === undefined
? currentConfig.channelName
diff --git a/apps/api/src/plugins/mattermost/client.ts b/apps/api/src/plugins/mattermost/client.ts
index 23d1b0bdc..d08aad1c2 100644
--- a/apps/api/src/plugins/mattermost/client.ts
+++ b/apps/api/src/plugins/mattermost/client.ts
@@ -17,6 +17,8 @@ export async function postToMattermost(
webhookUrl: string,
message: MattermostMessage,
): Promise<void> {
+ await assertPublicWebhookDestination(webhookUrl);
+
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), MATTERMOST_TIMEOUT_MS);
@@ -27,6 +29,7 @@ export async function postToMattermost(
"Content-Type": "application/json",
},
body: JSON.stringify(message),
+ redirect: "error",
signal: controller.signal,
});
@@ -48,3 +51,5 @@ export async function postToMattermost(
clearTimeout(timeoutId);
}
}
+
+import { assertPublicWebhookDestination } from "../generic-webhook/config";
diff --git a/apps/api/src/plugins/mattermost/config.ts b/apps/api/src/plugins/mattermost/config.ts
index b8e352913..3ace092c9 100644
--- a/apps/api/src/plugins/mattermost/config.ts
+++ b/apps/api/src/plugins/mattermost/config.ts
@@ -1,4 +1,5 @@
import * as v from "valibot";
+import { assertPublicWebhookDestination } from "../generic-webhook/config";
const mattermostWebhookUrlPattern = /^https:\/\/[^\s]+$/;
@@ -68,7 +69,8 @@ export async function validateMattermostConfig(
config: unknown,
): Promise<{ valid: boolean; errors?: string[] }> {
try {
- v.parse(mattermostConfigSchema, config);
+ const parsed = v.parse(mattermostConfigSchema, config);
+ await assertPublicWebhookDestination(parsed.webhookUrl);
return { valid: true };
} catch (error) {
if (error instanceof v.ValiError) {
diff --git a/apps/web/src/components/project/mattermost-integration-settings.tsx b/apps/web/src/components/project/mattermost-integration-settings.tsx
index d1d1fe706..325611682 100644
--- a/apps/web/src/components/project/mattermost-integration-settings.tsx
+++ b/apps/web/src/components/project/mattermost-integration-settings.tsx
@@ -200,7 +200,7 @@ export function MattermostIntegrationSettings({
projectId,
json: {
webhookUrl: trimmedWebhookUrl || undefined,
- channelName: values.channelName || undefined,
+ channelName: values.channelName.trim() || null,
events,
},
});
diff --git a/i18n/de-DE.json b/i18n/de-DE.json
index cc38ef192..f01bc96ae 100644
--- a/i18n/de-DE.json
+++ b/i18n/de-DE.json
@@ -601,9 +601,7 @@
"slackSectionTitle": "Slack-Integration",
"slackSectionSubtitle": "Sende Projektaktualisierungen per Incoming Webhook in einen Slack-Kanal.",
"telegramSectionTitle": "Telegram-Integration",
- "telegramSectionSubtitle": "Sende Projektaktualisierungen mit einem Bot in einen Telegram-Chat oder ein Thema.",
- "mattermostSectionTitle": "Mattermost Integration",
- "mattermostSectionSubtitle": "Send project task updates into a Mattermost channel with an incoming webhook."
+ "telegramSectionSubtitle": "Sende Projektaktualisierungen mit einem Bot in einen Telegram-Chat oder ein Thema."
},
"projectVisibility": {
"pageTitle": "Projektsichtbarkeit",
@@ -1013,44 +1011,6 @@
"merged": "Zusammengeführt",
"draft": "Entwurf",
"open": "Offen"
- },
- "mattermostIntegration": {
- "validation": {
- "webhookInvalid": "Enter a valid Mattermost webhook URL"
- },
- "toast": {
- "saved": "Mattermost integration saved successfully",
- "saveError": "Failed to save Mattermost integration",
- "enabled": "Mattermost notifications enabled",
- "disabled": "Mattermost notifications paused",
- "updateError": "Failed to update Mattermost integration",
- "removed": "Mattermost integration removed successfully",
- "removeError": "Failed to remove Mattermost integration"
- },
- "connectionTitle": "Mattermost webhook connection",
- "connectionHint": "Paste a Mattermost incoming webhook URL and choose which task events should be posted.",
- "connected": "Connected",
- "paused": "Paused",
- "webhookLabel": "Incoming webhook URL",
- "webhookPlaceholder": "https://your-mattermost-server.com/hooks/...",
- "webhookHint": "Create an Incoming Webhook in Mattermost and paste the generated URL here.",
- "channelLabel": "Channel name",
- "channelPlaceholder": "town-square",
- "channelHint": "Optional label for your reference. Mattermost controls the actual destination channel from the webhook setup.",
- "eventsTitle": "Event notifications",
- "eventsHint": "Choose which project changes should post to Mattermost.",
- "events": {
- "taskCreated": "New tasks",
- "taskStatusChanged": "Status changes",
- "taskPriorityChanged": "Priority changes",
- "taskTitleChanged": "Title changes",
- "taskDescriptionChanged": "Description changes",
- "taskCommentCreated": "New comments"
- },
- "connect": "Connect Mattermost",
- "saveChanges": "Save changes",
- "update": "Update Mattermost",
- "disconnect": "Disconnect"
}
},
"navigation": {
diff --git a/i18n/el-GR.json b/i18n/el-GR.json
index 06e791e0a..4414f830b 100644
--- a/i18n/el-GR.json
+++ b/i18n/el-GR.json
@@ -601,9 +601,7 @@
"genericWebhookSectionTitle": "Γενικά Webhooks",
"genericWebhookSectionSubtitle": "Στείλτε γεγονότα εργασιών έργου σε οποιοδήποτε HTTP endpoint ως JSON.",
"slackSectionTitle": "Ενσωμάτωση Slack",
- "slackSectionSubtitle": "Στείλτε ενημερώσεις εργασιών έργου σε κανάλι Slack μέσω εισερχόμενου webhook.",
- "mattermostSectionTitle": "Mattermost Integration",
- "mattermostSectionSubtitle": "Send project task updates into a Mattermost channel with an incoming webhook."
+ "slackSectionSubtitle": "Στείλτε ενημερώσεις εργασιών έργου σε κανάλι Slack μέσω εισερχόμενου webhook."
},
"projectVisibility": {
"pageTitle": "Ορατότητα έργου",
@@ -1011,44 +1009,6 @@
"merged": "Συγχωνευμένο",
"draft": "Πρόχειρο",
"open": "Ανοιχτό"
- },
- "mattermostIntegration": {
- "validation": {
- "webhookInvalid": "Enter a valid Mattermost webhook URL"
- },
- "toast": {
- "saved": "Mattermost integration saved successfully",
- "saveError": "Failed to save Mattermost integration",
- "enabled": "Mattermost notifications enabled",
- "disabled": "Mattermost notifications paused",
- "updateError": "Failed to update Mattermost integration",
- "removed": "Mattermost integration removed successfully",
- "removeError": "Failed to remove Mattermost integration"
- },
- "connectionTitle": "Mattermost webhook connection",
- "connectionHint": "Paste a Mattermost incoming webhook URL and choose which task events should be posted.",
- "connected": "Connected",
- "paused": "Paused",
- "webhookLabel": "Incoming webhook URL",
- "webhookPlaceholder": "https://your-mattermost-server.com/hooks/...",
- "webhookHint": "Create an Incoming Webhook in Mattermost and paste the generated URL here.",
- "channelLabel": "Channel name",
- "channelPlaceholder": "town-square",
- "channelHint": "Optional label for your reference. Mattermost controls the actual destination channel from the webhook setup.",
- "eventsTitle": "Event notifications",
- "eventsHint": "Choose which project changes should post to Mattermost.",
- "events": {
- "taskCreated": "New tasks",
- "taskStatusChanged": "Status changes",
- "taskPriorityChanged": "Priority changes",
- "taskTitleChanged": "Title changes",
- "taskDescriptionChanged": "Description changes",
- "taskCommentCreated": "New comments"
- },
- "connect": "Connect Mattermost",
- "saveChanges": "Save changes",
- "update": "Update Mattermost",
- "disconnect": "Disconnect"
}
},
"navigation": {
diff --git a/i18n/es-ES.json b/i18n/es-ES.json
index 5b59289b9..2ba76de06 100644
--- a/i18n/es-ES.json
+++ b/i18n/es-ES.json
@@ -507,9 +507,7 @@
"genericWebhookSectionTitle": "Webhooks generales",
"genericWebhookSectionSubtitle": "Envía los eventos de las tareas a cualquier endpoint HTTP como JSON.",
"slackSectionTitle": "Integración con Slack",
- "slackSectionSubtitle": "Envía los eventos de las tareas a un canal de Slack con un webhook.",
- "mattermostSectionTitle": "Mattermost Integration",
- "mattermostSectionSubtitle": "Send project task updates into a Mattermost channel with an incoming webhook."
+ "slackSectionSubtitle": "Envía los eventos de las tareas a un canal de Slack con un webhook."
},
"projectVisibility": {
"pageTitle": "Visibilidad del Proyecto",
@@ -797,44 +795,6 @@
"merged": "Merged",
"draft": "Borrador",
"open": "Abierta"
- },
- "mattermostIntegration": {
- "validation": {
- "webhookInvalid": "Enter a valid Mattermost webhook URL"
- },
- "toast": {
- "saved": "Mattermost integration saved successfully",
- "saveError": "Failed to save Mattermost integration",
- "enabled": "Mattermost notifications enabled",
- "disabled": "Mattermost notifications paused",
- "updateError": "Failed to update Mattermost integration",
- "removed": "Mattermost integration removed successfully",
- "removeError": "Failed to remove Mattermost integration"
- },
- "connectionTitle": "Mattermost webhook connection",
- "connectionHint": "Paste a Mattermost incoming webhook URL and choose which task events should be posted.",
- "connected": "Connected",
- "paused": "Paused",
- "webhookLabel": "Incoming webhook URL",
- "webhookPlaceholder": "https://your-mattermost-server.com/hooks/...",
- "webhookHint": "Create an Incoming Webhook in Mattermost and paste the generated URL here.",
- "channelLabel": "Channel name",
- "channelPlaceholder": "town-square",
- "channelHint": "Optional label for your reference. Mattermost controls the actual destination channel from the webhook setup.",
- "eventsTitle": "Event notifications",
- "eventsHint": "Choose which project changes should post to Mattermost.",
- "events": {
- "taskCreated": "New tasks",
- "taskStatusChanged": "Status changes",
- "taskPriorityChanged": "Priority changes",
- "taskTitleChanged": "Title changes",
- "taskDescriptionChanged": "Description changes",
- "taskCommentCreated": "New comments"
- },
- "connect": "Connect Mattermost",
- "saveChanges": "Save changes",
- "update": "Update Mattermost",
- "disconnect": "Disconnect"
}
},
"navigation": {
diff --git a/i18n/fr-FR.json b/i18n/fr-FR.json
index 2c5654d26..827808cf7 100644
--- a/i18n/fr-FR.json
+++ b/i18n/fr-FR.json
@@ -601,9 +601,7 @@
"genericWebhookSectionTitle": "Webhooks génériques",
"genericWebhookSectionSubtitle": "Envoyez les événements des tâches du projet vers n'importe quel point de terminaison HTTP au format JSON.",
"slackSectionTitle": "Intégration Slack",
- "slackSectionSubtitle": "Envoyez les mises à jour des tâches du projet dans un canal Slack via un webhook entrant.",
- "mattermostSectionTitle": "Mattermost Integration",
- "mattermostSectionSubtitle": "Send project task updates into a Mattermost channel with an incoming webhook."
+ "slackSectionSubtitle": "Envoyez les mises à jour des tâches du projet dans un canal Slack via un webhook entrant."
},
"projectVisibility": {
"pageTitle": "Visibilité du projet",
@@ -1011,44 +1009,6 @@
"merged": "Fusionné",
"draft": "Brouillon",
"open": "Ouvert"
- },
- "mattermostIntegration": {
- "validation": {
- "webhookInvalid": "Enter a valid Mattermost webhook URL"
- },
- "toast": {
- "saved": "Mattermost integration saved successfully",
- "saveError": "Failed to save Mattermost integration",
- "enabled": "Mattermost notifications enabled",
- "disabled": "Mattermost notifications paused",
- "updateError": "Failed to update Mattermost integration",
- "removed": "Mattermost integration removed successfully",
- "removeError": "Failed to remove Mattermost integration"
- },
- "connectionTitle": "Mattermost webhook connection",
- "connectionHint": "Paste a Mattermost incoming webhook URL and choose which task events should be posted.",
- "connected": "Connected",
- "paused": "Paused",
- "webhookLabel": "Incoming webhook URL",
- "webhookPlaceholder": "https://your-mattermost-server.com/hooks/...",
- "webhookHint": "Create an Incoming Webhook in Mattermost and paste the generated URL here.",
- "channelLabel": "Channel name",
- "channelPlaceholder": "town-square",
- "channelHint": "Optional label for your reference. Mattermost controls the actual destination channel from the webhook setup.",
- "eventsTitle": "Event notifications",
- "eventsHint": "Choose which project changes should post to Mattermost.",
- "events": {
- "taskCreated": "New tasks",
- "taskStatusChanged": "Status changes",
- "taskPriorityChanged": "Priority changes",
- "taskTitleChanged": "Title changes",
- "taskDescriptionChanged": "Description changes",
- "taskCommentCreated": "New comments"
- },
- "connect": "Connect Mattermost",
- "saveChanges": "Save changes",
- "update": "Update Mattermost",
- "disconnect": "Disconnect"
}
},
"navigation": {
diff --git a/i18n/ko-KR.json b/i18n/ko-KR.json
index 658a8a62b..5b115405a 100644
--- a/i18n/ko-KR.json
+++ b/i18n/ko-KR.json
@@ -601,9 +601,7 @@
"slackSectionTitle": "Slack 연동",
"slackSectionSubtitle": "수신 웹훅을 사용하여 프로젝트 작업 업데이트를 Slack 채널로 전송합니다.",
"telegramSectionTitle": "Telegram 연동",
- "telegramSectionSubtitle": "봇을 사용하여 프로젝트 작업 업데이트를 Telegram 채팅 또는 토픽으로 전송합니다.",
- "mattermostSectionTitle": "Mattermost Integration",
- "mattermostSectionSubtitle": "Send project task updates into a Mattermost channel with an incoming webhook."
+ "telegramSectionSubtitle": "봇을 사용하여 프로젝트 작업 업데이트를 Telegram 채팅 또는 토픽으로 전송합니다."
},
"projectVisibility": {
"pageTitle": "프로젝트 공개 설정",
@@ -1013,44 +1011,6 @@
"merged": "병합됨",
"draft": "초안",
"open": "열림"
- },
- "mattermostIntegration": {
- "validation": {
- "webhookInvalid": "Enter a valid Mattermost webhook URL"
- },
- "toast": {
- "saved": "Mattermost integration saved successfully",
- "saveError": "Failed to save Mattermost integration",
- "enabled": "Mattermost notifications enabled",
- "disabled": "Mattermost notifications paused",
- "updateError": "Failed to update Mattermost integration",
- "removed": "Mattermost integration removed successfully",
- "removeError": "Failed to remove Mattermost integration"
- },
- "connectionTitle": "Mattermost webhook connection",
- "connectionHint": "Paste a Mattermost incoming webhook URL and choose which task events should be posted.",
- "connected": "Connected",
- "paused": "Paused",
- "webhookLabel": "Incoming webhook URL",
- "webhookPlaceholder": "https://your-mattermost-server.com/hooks/...",
- "webhookHint": "Create an Incoming Webhook in Mattermost and paste the generated URL here.",
- "channelLabel": "Channel name",
- "channelPlaceholder": "town-square",
- "channelHint": "Optional label for your reference. Mattermost controls the actual destination channel from the webhook setup.",
- "eventsTitle": "Event notifications",
- "eventsHint": "Choose which project changes should post to Mattermost.",
- "events": {
- "taskCreated": "New tasks",
- "taskStatusChanged": "Status changes",
- "taskPriorityChanged": "Priority changes",
- "taskTitleChanged": "Title changes",
- "taskDescriptionChanged": "Description changes",
- "taskCommentCreated": "New comments"
- },
- "connect": "Connect Mattermost",
- "saveChanges": "Save changes",
- "update": "Update Mattermost",
- "disconnect": "Disconnect"
}
},
"navigation": {
diff --git a/i18n/mk-MK.json b/i18n/mk-MK.json
index 1978b6e5b..161a8dbde 100644
--- a/i18n/mk-MK.json
+++ b/i18n/mk-MK.json
@@ -601,9 +601,7 @@
"genericWebhookSectionTitle": "Општи webhooks",
"genericWebhookSectionSubtitle": "Испрати настани за задачи на проектот до кој било HTTP endpoint како JSON.",
"slackSectionTitle": "Slack интеграција",
- "slackSectionSubtitle": "Испрати ажурирања за задачи на проектот во Slack канал преку дојдовен webhook.",
- "mattermostSectionTitle": "Mattermost Integration",
- "mattermostSectionSubtitle": "Send project task updates into a Mattermost channel with an incoming webhook."
+ "slackSectionSubtitle": "Испрати ажурирања за задачи на проектот во Slack канал преку дојдовен webhook."
},
"projectVisibility": {
"pageTitle": "Видливост на проект",
@@ -1011,44 +1009,6 @@
"merged": "Споен",
"draft": "Нацрт",
"open": "Отворен"
- },
- "mattermostIntegration": {
- "validation": {
- "webhookInvalid": "Enter a valid Mattermost webhook URL"
- },
- "toast": {
- "saved": "Mattermost integration saved successfully",
- "saveError": "Failed to save Mattermost integration",
- "enabled": "Mattermost notifications enabled",
- "disabled": "Mattermost notifications paused",
- "updateError": "Failed to update Mattermost integration",
- "removed": "Mattermost integration removed successfully",
- "removeError": "Failed to remove Mattermost integration"
- },
- "connectionTitle": "Mattermost webhook connection",
- "connectionHint": "Paste a Mattermost incoming webhook URL and choose which task events should be posted.",
- "connected": "Connected",
- "paused": "Paused",
- "webhookLabel": "Incoming webhook URL",
- "webhookPlaceholder": "https://your-mattermost-server.com/hooks/...",
- "webhookHint": "Create an Incoming Webhook in Mattermost and paste the generated URL here.",
- "channelLabel": "Channel name",
- "channelPlaceholder": "town-square",
- "channelHint": "Optional label for your reference. Mattermost controls the actual destination channel from the webhook setup.",
- "eventsTitle": "Event notifications",
- "eventsHint": "Choose which project changes should post to Mattermost.",
- "events": {
- "taskCreated": "New tasks",
- "taskStatusChanged": "Status changes",
- "taskPriorityChanged": "Priority changes",
- "taskTitleChanged": "Title changes",
- "taskDescriptionChanged": "Description changes",
- "taskCommentCreated": "New comments"
- },
- "connect": "Connect Mattermost",
- "saveChanges": "Save changes",
- "update": "Update Mattermost",
- "disconnect": "Disconnect"
}
},
"navigation": {
diff --git a/i18n/nl-NL.json b/i18n/nl-NL.json
index 099973d50..ab4265761 100644
--- a/i18n/nl-NL.json
+++ b/i18n/nl-NL.json
@@ -507,9 +507,7 @@
"genericWebhookSectionTitle": "Generieke Webhooks",
"genericWebhookSectionSubtitle": "Verstuur updates van projecttaken als JSON naar elk gewenst HTTP-eindpunt.",
"slackSectionTitle": "Slack Integratie",
- "slackSectionSubtitle": "Verstuur updates van projecttaken naar een Slack-kanaal met een binnenkomende webhook.",
- "mattermostSectionTitle": "Mattermost Integration",
- "mattermostSectionSubtitle": "Send project task updates into a Mattermost channel with an incoming webhook."
+ "slackSectionSubtitle": "Verstuur updates van projecttaken naar een Slack-kanaal met een binnenkomende webhook."
},
"projectVisibility": {
"pageTitle": "Projectzichtbaarheid",
@@ -797,44 +795,6 @@
"merged": "Samengevoegd",
"draft": "Concept",
"open": "Open"
- },
- "mattermostIntegration": {
- "validation": {
- "webhookInvalid": "Enter a valid Mattermost webhook URL"
- },
- "toast": {
- "saved": "Mattermost integration saved successfully",
- "saveError": "Failed to save Mattermost integration",
- "enabled": "Mattermost notifications enabled",
- "disabled": "Mattermost notifications paused",
- "updateError": "Failed to update Mattermost integration",
- "removed": "Mattermost integration removed successfully",
- "removeError": "Failed to remove Mattermost integration"
- },
- "connectionTitle": "Mattermost webhook connection",
- "connectionHint": "Paste a Mattermost incoming webhook URL and choose which task events should be posted.",
- "connected": "Connected",
- "paused": "Paused",
- "webhookLabel": "Incoming webhook URL",
- "webhookPlaceholder": "https://your-mattermost-server.com/hooks/...",
- "webhookHint": "Create an Incoming Webhook in Mattermost and paste the generated URL here.",
- "channelLabel": "Channel name",
- "channelPlaceholder": "town-square",
- "channelHint": "Optional label for your reference. Mattermost controls the actual destination channel from the webhook setup.",
- "eventsTitle": "Event notifications",
- "eventsHint": "Choose which project changes should post to Mattermost.",
- "events": {
- "taskCreated": "New tasks",
- "taskStatusChanged": "Status changes",
- "taskPriorityChanged": "Priority changes",
- "taskTitleChanged": "Title changes",
- "taskDescriptionChanged": "Description changes",
- "taskCommentCreated": "New comments"
- },
- "connect": "Connect Mattermost",
- "saveChanges": "Save changes",
- "update": "Update Mattermost",
- "disconnect": "Disconnect"
}
},
"navigation": {
diff --git a/i18n/ru-RU.json b/i18n/ru-RU.json
index b82f50ed4..d1bb88179 100644
--- a/i18n/ru-RU.json
+++ b/i18n/ru-RU.json
@@ -599,9 +599,7 @@
"slackSectionTitle": "Интеграция со Slack",
"slackSectionSubtitle": "Отправка обновлений по задачам проекта в канал Slack через входящий вебхук.",
"telegramSectionTitle": "Интеграция с Telegram",
- "telegramSectionSubtitle": "Отправка обновлений по задачам проекта в чат или тему Telegram через бота.",
- "mattermostSectionTitle": "Mattermost Integration",
- "mattermostSectionSubtitle": "Send project task updates into a Mattermost channel with an incoming webhook."
+ "telegramSectionSubtitle": "Отправка обновлений по задачам проекта в чат или тему Telegram через бота."
},
"projectVisibility": {
"pageTitle": "Видимость проекта",
@@ -1017,44 +1015,6 @@
"merged": "Влит",
"draft": "Черновик",
"open": "Открыт"
- },
- "mattermostIntegration": {
- "validation": {
- "webhookInvalid": "Enter a valid Mattermost webhook URL"
- },
- "toast": {
- "saved": "Mattermost integration saved successfully",
- "saveError": "Failed to save Mattermost integration",
- "enabled": "Mattermost notifications enabled",
- "disabled": "Mattermost notifications paused",
- "updateError": "Failed to update Mattermost integration",
- "removed": "Mattermost integration removed successfully",
- "removeError": "Failed to remove Mattermost integration"
- },
- "connectionTitle": "Mattermost webhook connection",
- "connectionHint": "Paste a Mattermost incoming webhook URL and choose which task events should be posted.",
- "connected": "Connected",
- "paused": "Paused",
- "webhookLabel": "Incoming webhook URL",
- "webhookPlaceholder": "https://your-mattermost-server.com/hooks/...",
- "webhookHint": "Create an Incoming Webhook in Mattermost and paste the generated URL here.",
- "channelLabel": "Channel name",
- "channelPlaceholder": "town-square",
- "channelHint": "Optional label for your reference. Mattermost controls the actual destination channel from the webhook setup.",
- "eventsTitle": "Event notifications",
- "eventsHint": "Choose which project changes should post to Mattermost.",
- "events": {
- "taskCreated": "New tasks",
- "taskStatusChanged": "Status changes",
- "taskPriorityChanged": "Priority changes",
- "taskTitleChanged": "Title changes",
- "taskDescriptionChanged": "Description changes",
- "taskCommentCreated": "New comments"
- },
- "connect": "Connect Mattermost",
- "saveChanges": "Save changes",
- "update": "Update Mattermost",
- "disconnect": "Disconnect"
}
},
"navigation": {
diff --git a/i18n/uk-UA.json b/i18n/uk-UA.json
index f9db6787d..efb2a827c 100644
--- a/i18n/uk-UA.json
+++ b/i18n/uk-UA.json
@@ -599,9 +599,7 @@
"slackSectionTitle": "Інтеґрація зі Slack",
"slackSectionSubtitle": "Надсилайте оновлення завдань проєкту до каналу Slack за допомогою вхідного вебхука.",
"telegramSectionTitle": "Інтеґрація з Telegram",
- "telegramSectionSubtitle": "Надсилайте оновлення завдань проєкту до чату або теми Telegram за допомогою бота.",
- "mattermostSectionTitle": "Mattermost Integration",
- "mattermostSectionSubtitle": "Send project task updates into a Mattermost channel with an incoming webhook."
+ "telegramSectionSubtitle": "Надсилайте оновлення завдань проєкту до чату або теми Telegram за допомогою бота."
},
"projectVisibility": {
"pageTitle": "Видимість проєкту",
@@ -1011,44 +1009,6 @@
"merged": "Змерджено",
"draft": "Чернетка",
"open": "Відкрито"
- },
- "mattermostIntegration": {
- "validation": {
- "webhookInvalid": "Enter a valid Mattermost webhook URL"
- },
- "toast": {
- "saved": "Mattermost integration saved successfully",
- "saveError": "Failed to save Mattermost integration",
- "enabled": "Mattermost notifications enabled",
- "disabled": "Mattermost notifications paused",
- "updateError": "Failed to update Mattermost integration",
- "removed": "Mattermost integration removed successfully",
- "removeError": "Failed to remove Mattermost integration"
- },
- "connectionTitle": "Mattermost webhook connection",
- "connectionHint": "Paste a Mattermost incoming webhook URL and choose which task events should be posted.",
- "connected": "Connected",
- "paused": "Paused",
- "webhookLabel": "Incoming webhook URL",
- "webhookPlaceholder": "https://your-mattermost-server.com/hooks/...",
- "webhookHint": "Create an Incoming Webhook in Mattermost and paste the generated URL here.",
- "channelLabel": "Channel name",
- "channelPlaceholder": "town-square",
- "channelHint": "Optional label for your reference. Mattermost controls the actual destination channel from the webhook setup.",
- "eventsTitle": "Event notifications",
- "eventsHint": "Choose which project changes should post to Mattermost.",
- "events": {
- "taskCreated": "New tasks",
- "taskStatusChanged": "Status changes",
- "taskPriorityChanged": "Priority changes",
- "taskTitleChanged": "Title changes",
- "taskDescriptionChanged": "Description changes",
- "taskCommentCreated": "New comments"
- },
- "connect": "Connect Mattermost",
- "saveChanges": "Save changes",
- "update": "Update Mattermost",
- "disconnect": "Disconnect"
}
},
"navigation": {
diff --git a/tests/api/plugins/mattermost-config.test.ts b/tests/api/plugins/mattermost-config.test.ts
new file mode 100644
index 000000000..3c3ba6d23
--- /dev/null
+++ b/tests/api/plugins/mattermost-config.test.ts
@@ -0,0 +1,43 @@
+import { afterEach, describe, expect, it } from "vitest";
+import { validateMattermostConfig } from "../../../apps/api/src/plugins/mattermost/config";
+
+const originalAllowPrivateDestinations =
+ process.env.KANEO_ALLOW_PRIVATE_WEBHOOK_DESTINATIONS;
+
+afterEach(() => {
+ if (originalAllowPrivateDestinations === undefined) {
+ delete process.env.KANEO_ALLOW_PRIVATE_WEBHOOK_DESTINATIONS;
+ } else {
+ process.env.KANEO_ALLOW_PRIVATE_WEBHOOK_DESTINATIONS =
+ originalAllowPrivateDestinations;
+ }
+});
+
+describe("validateMattermostConfig", () => {
+ it("rejects private webhook destinations by default", async () => {
+ delete process.env.KANEO_ALLOW_PRIVATE_WEBHOOK_DESTINATIONS;
+
+ const result = await validateMattermostConfig({
+ webhookUrl: "https://127.0.0.1/hooks/example",
+ });
+
+ expect(result.valid).toBe(false);
+ expect(result.errors?.join(" ")).toContain("non-routable address");
+ });
+
+ it("allows private destinations when the self-hosting override is enabled", async () => {
+ process.env.KANEO_ALLOW_PRIVATE_WEBHOOK_DESTINATIONS = "true";
+
+ const result = await validateMattermostConfig({
+ webhookUrl: "https://127.0.0.1/hooks/example",
+ });
+
+ expect(result).toEqual({ valid: true });
+ });
+
+ it("rejects an explicitly empty webhook URL", async () => {
+ const result = await validateMattermostConfig({ webhookUrl: "" });
+
+ expect(result.valid).toBe(false);
+ });
+});