From 3641a342befc2c7a29cf5addfb7b2551ab762437 Mon Sep 17 00:00:00 2001 From: Xin Jin <39755499+EugeneJinXin@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:30:26 -0700 Subject: [PATCH] Potential fix for code scanning alert no. 47: Bad HTML filtering regexp Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- docs/_scripts/copy_page_hooks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_scripts/copy_page_hooks.py b/docs/_scripts/copy_page_hooks.py index de7b985ed..e8d9faea5 100644 --- a/docs/_scripts/copy_page_hooks.py +++ b/docs/_scripts/copy_page_hooks.py @@ -45,8 +45,8 @@ def _clean_markdown(content: str) -> str: # Remove frontmatter content = re.sub(r'^---\n.*?\n---\n', '', content, flags=re.DOTALL) - # Remove script tags (handle spaces in closing tags) - content = re.sub(r']*>.*?', '', content, flags=re.DOTALL | re.IGNORECASE) + # Remove script tags (handle malformed closing tags) + content = re.sub(r']*>.*?]*>', '', content, flags=re.DOTALL | re.IGNORECASE) # Remove style tags (handle spaces in closing tags) content = re.sub(r']*>.*?', '', content, flags=re.DOTALL | re.IGNORECASE)