fix(security-guidance): normalize backslashes in path checks for Windows#29092
Open
4RH1T3CT0R7 wants to merge 1 commit intoanthropics:mainfrom
Open
fix(security-guidance): normalize backslashes in path checks for Windows#290924RH1T3CT0R7 wants to merge 1 commit intoanthropics:mainfrom
4RH1T3CT0R7 wants to merge 1 commit intoanthropics:mainfrom
Conversation
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 anthropics#18508
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.github\workflows\ci.yml)path_checklambda checks for.github/workflows/with forward slashes\→/incheck_patterns()alongside existing leading-slash normalizationChanges
plugins/security-guidance/hooks/security_reminder_hook.pyline 186: added.replace("\\", "/")to path normalizationThe
replace()is a no-op on Linux/macOS where paths already use forward slashes.Test plan
file_path: ".github\workflows\ci.yml"— should trigger GitHub Actions security warningfile_path: ".github/workflows/ci.yml"— should still trigger (no regression)file_path: "C:\project\.github\workflows\deploy.yaml"— should triggerfile_path: "src/main.py"— should NOT trigger path-based ruleFixes #18508