Skip to content

Fix regex special character escaping in seatbelt rules for paths with brackets#134

Open
ddworken wants to merge 1 commit intomainfrom
dworken/fix-regex-escaping-seatbelt
Open

Fix regex special character escaping in seatbelt rules for paths with brackets#134
ddworken wants to merge 1 commit intomainfrom
dworken/fix-regex-escaping-seatbelt

Conversation

@ddworken
Copy link
Copy Markdown
Collaborator

Paths containing regex-special characters like [ and ] (e.g., /Users/jbo/Projects/He[ll]o) were not properly escaped when generating macOS Seatbelt regex rules. This caused [ll] to be interpreted as a regex character class (matching a single l) instead of the literal string [ll], so deny rules would not match the actual path.

Fix:

  • Escape [ and ] in globToRegex() alongside other regex special characters
  • Remove [ and ] from containsGlobChars() so literal paths with brackets use (subpath ...) rules instead of being misrouted through regex
  • Fix static prefix extraction in normalizePathForSandbox(), expandGlobPattern(), and generateMoveBlockingRules() to not split on [ and ]
  • Drop unused [abc] glob character class support (not used anywhere in this codebase)
  • Bump version to 0.0.38

@ddworken ddworken marked this pull request as ready for review February 13, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant