Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(security): harden thread channel validation in discord-pr-sync
psychosomat2a4ab80abd8c
diff --git a/.github/scripts/discord-pr-sync.mjs b/.github/scripts/discord-pr-sync.mjsindex 0867f8dd6..177ccecb7 100644--- a/.github/scripts/discord-pr-sync.mjs+++ b/.github/scripts/discord-pr-sync.mjs@@ -51,8 +51,13 @@ function extractThreadId(body) {return match ? match[1] : null;}-async function validateThreadChannel(threadId) {- if (!botToken || !forumChannelId) return true;+async function validateThreadChannel(threadId, prNumber) {+ if (!botToken) {+ warning(+ "DISCORD_BOT_TOKEN not set; cannot validate thread channel ownership. Rejecting marker.",+ );+ return false;+ }try {const res = await fetch(`https://discord.com/api/v10/channels/${threadId}`, {headers: { Authorization: `Bot ${botToken}` },@@ -62,12 +67,19 @@ async function validateThreadChannel(threadId) {return false;}const channel = await res.json();- if (channel.parent_id !== forumChannelId) {+ if (forumChannelId && channel.parent_id !== forumChannelId) {warning(`Thread ${threadId} parent_id=${channel.parent_id} does not match expected forum ${forumChannelId}; treating marker as untrusted.`,);return false;}+ const expectedPrefix = `PR #${prNumber} -`;+ if (!channel.name || !channel.name.startsWith(expectedPrefix)) {+ warning(+ `Thread ${threadId} name "${channel.name}" does not match expected prefix "${expectedPrefix}"; treating marker as untrusted.`,+ );+ return false;+ }return true;} catch (err) {warning(`Thread validation threw: ${err && err.message ? err.message : err}`);@@ -292,7 +304,7 @@ async function main() {return;}- if (!(await validateThreadChannel(threadId))) {+ if (!(await validateThreadChannel(threadId, number))) {info("Thread ID in PR body failed channel validation; ignoring marker.");return;}