Skip to content

fix: escape regex metacharacters in frontmatter field names#52416

Open
sakal-s wants to merge 1 commit intoanthropics:mainfrom
sakal-s:fix/regex-escaping-frontmatter-parser
Open

fix: escape regex metacharacters in frontmatter field names#52416
sakal-s wants to merge 1 commit intoanthropics:mainfrom
sakal-s:fix/regex-escaping-frontmatter-parser

Conversation

@sakal-s
Copy link
Copy Markdown

@sakal-s sakal-s commented Apr 23, 2026

Summary

  • Escape regex metacharacters in field names before using them in sed patterns in parse-frontmatter.sh and validate-settings.sh
  • Without escaping, a field like my.setting would match myXsetting since . is a regex wildcard

Test plan

  • Test with normal field names (enabled, strict_mode) still works
  • Test with a field name containing . (e.g. my.setting) matches only the exact field

Fixes #52406

🤖 Generated with Claude Code

Field names are interpolated directly into sed regex patterns without
escaping. If a field name contains regex metacharacters (., *, ?, [,
etc.), the sed command matches incorrectly. For example, a field named
'my.setting' would match 'myXsetting' since '.' matches any character.

Escape special characters in field names before using them in sed
patterns in both parse-frontmatter.sh and validate-settings.sh.

Fixes anthropics#52406

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Bug: Unescaped regex metacharacters in frontmatter parser sed command

2 participants