Skip to content

fix(sections-editor): tighten Mustache template regex sanitization - #7428

Merged
pedrofrxncx merged 1 commit into
mainfrom
fix/array-item-display-sanitization-w4
Sep 22, 2026
Merged

pedrofrxncx merged 1 commit into
mainfrom
fix/array-item-display-sanitization-w4

Conversation

@pedrofrxncx

@pedrofrxncx pedrofrxncx commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Addresses code-scanning alert #11 (incomplete multi-character sanitization) in the sections-editor array-item-display component. Replaced [^}]+ with .+? (non-greedy any character) for proper multi-character handling in Mustache triple/double brace delimiters.

Why

The previous regex pattern [^}]+ had edge case issues with multi-character closing brace sequences. Non-greedy matching (.+?) is the correct approach for Mustache template parsing and is more robust against boundary cases.

Test plan

  • bun run fmt passes
  • bunx oxlint apps/web/src/components/sections-editor/array-item-display.ts passes with no errors
  • Regex correctly matches {{{key}}} (triple braces) and {{key}} (double braces) templates
  • Non-greedy matching stops at first closing sequence, handling edge cases

Diff

-1 / +1 (1 line changed)

The change is behavior-preserving: both patterns match the same content between delimiters, but .+? correctly handles edge cases with multi-character sequences by using non-greedy matching.


Summary by cubic

Replaces the regex pattern sanitizing Mustache templates in the sections-editor array-item display, addressing a code-scanning alert about incomplete multi-character sanitization.

The change swaps [^}]+ for non-greedy .+? so matches stop at the first closing brace sequence, improving robustness on edge cases while keeping the behavior identical for normal {{{key}}} and {{key}} templates.

Written for commit 1722150. Summary will update on new commits.

Review in cubic

Replace [^}]+ with .+? (non-greedy any character) for proper multi-character
handling in triple/double brace delimiters. Addresses code-scanning alert #11
(incomplete multi-character sanitization) by using the correct non-greedy
matching pattern for Mustache templates, improving robustness on edge cases.
@pedrofrxncx
pedrofrxncx merged commit d0c93b9 into main Sep 22, 2026
34 checks passed
@pedrofrxncx
pedrofrxncx deleted the fix/array-item-display-sanitization-w4 branch September 22, 2026 15:12
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