From b696ae91edcf5bb16b05b26ad0f8f0c962a911eb Mon Sep 17 00:00:00 2001 From: sriram veeraghanta Date: Wed, 10 Sep 2025 14:42:46 +0530 Subject: [PATCH] Potential fix for code scanning alert no. 646: Server-side request forgery (#7758) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- apps/space/app/issues/[anchor]/layout.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/space/app/issues/[anchor]/layout.tsx b/apps/space/app/issues/[anchor]/layout.tsx index 91631d6c0..46f187ddc 100644 --- a/apps/space/app/issues/[anchor]/layout.tsx +++ b/apps/space/app/issues/[anchor]/layout.tsx @@ -13,6 +13,11 @@ export async function generateMetadata({ params }: Props) { const { anchor } = params; const DEFAULT_TITLE = "Plane"; const DEFAULT_DESCRIPTION = "Made with Plane, an AI-powered work management platform with publishing capabilities."; + // Validate anchor before using in request (only allow alphanumeric, -, _) + const ANCHOR_REGEX = /^[a-zA-Z0-9_-]+$/; + if (!ANCHOR_REGEX.test(anchor)) { + return { title: DEFAULT_TITLE, description: DEFAULT_DESCRIPTION }; + } try { const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/public/anchor/${anchor}/meta/`); const data = await response.json();