Skip to content

Potential fix for code scanning alert no. 8: Inefficient regular expression#43

Merged
jmaxdev merged 3 commits intomainfrom
alert-autofix-8
Apr 19, 2026
Merged

Potential fix for code scanning alert no. 8: Inefficient regular expression#43
jmaxdev merged 3 commits intomainfrom
alert-autofix-8

Conversation

@jmaxdev
Copy link
Copy Markdown
Collaborator

@jmaxdev jmaxdev commented Apr 19, 2026

Potential fix for https://github.com/TrixtyAI/ide/security/code-scanning/8

The best fix is to remove the ambiguous alternation under * by replacing (?:[^\]\\]|@escapes)* with a deterministic equivalent that consumes either:

  • runs of safe characters ([^\\\]\[]+), or
  • a backslash-escape pair (\\.), or
  • lone [ characters (which were previously allowed by [^\]\\]).

This preserves behavior (content between [ and ], allowing escaped chars and unescaped [), while avoiding catastrophic backtracking paths.

Change only the line 93 regex in apps/desktop/src/addons/builtin.language.markdown/index.ts. No imports, helper methods, or dependencies are needed.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…ession

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Comment thread apps/desktop/src/addons/builtin.language.markdown/index.ts Fixed
…expression'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@jmaxdev jmaxdev marked this pull request as ready for review April 19, 2026 06:02
@jmaxdev jmaxdev merged commit 49d75fb into main Apr 19, 2026
7 checks passed
@jmaxdev jmaxdev deleted the alert-autofix-8 branch April 19, 2026 06:44
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.

2 participants