From cadacd13673390744146b9a94af08b674f3e25ca Mon Sep 17 00:00:00 2001 From: 4RH1T3CT0R7 Date: Thu, 26 Feb 2026 21:39:21 +0300 Subject: [PATCH] fix(security-guidance): normalize backslashes in path checks for Windows On Windows, file paths use backslashes (.github\workflows\ci.yml) which caused the forward-slash path_check lambda to never match. The security reminder for GitHub Actions workflow editing was silently skipped for all Windows users. Normalize backslashes to forward slashes in check_patterns() alongside the existing leading-slash normalization. The replace() is a no-op on Linux/macOS where paths already use forward slashes. Fixes #18508 --- plugins/security-guidance/hooks/security_reminder_hook.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/security-guidance/hooks/security_reminder_hook.py b/plugins/security-guidance/hooks/security_reminder_hook.py index 37a8b5789b..ac0ad44956 100755 --- a/plugins/security-guidance/hooks/security_reminder_hook.py +++ b/plugins/security-guidance/hooks/security_reminder_hook.py @@ -182,8 +182,9 @@ def save_state(session_id, shown_warnings): def check_patterns(file_path, content): """Check if file path or content matches any security patterns.""" - # Normalize path by removing leading slashes - normalized_path = file_path.lstrip("/") + # Normalize path: remove leading slashes and convert backslashes to forward slashes + # (Windows paths use backslashes, but path_check lambdas use forward slashes) + normalized_path = file_path.lstrip("/").replace("\\", "/") for pattern in SECURITY_PATTERNS: # Check path-based patterns