Skip to content

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

Draft
admin-it-jupiterone wants to merge 1 commit into
masterfrom
alert-autofix-8
Draft

Potential fix for code scanning alert no. 8: Inefficient regular expression#23
admin-it-jupiterone wants to merge 1 commit into
masterfrom
alert-autofix-8

Conversation

@admin-it-jupiterone
Copy link
Copy Markdown

Potential fix for https://github.com/JupiterOne/tinkerpop/security/code-scanning/8

General fix approach: remove ambiguity inside the repeated alternation by ensuring generic branches cannot consume prefixes of specific multi-character branches. Practically, exclude < from the fallback character class so <<0>> is matched only by its dedicated alternative.

Best minimal functional fix in docs/site/home/js/prism.js:

  • Update line 2072 pattern from:
    /(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/
  • To:
    /(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{<]|<(?!<0>>))*"/

Why this preserves behavior:

  • Previously < was consumed by [^\\"{].
  • Now < is consumed either as part of <<0>> or as a single < when it is not the start of <<0>> (<(?!<0>>)).
  • This removes the key overlap causing excessive backtracking while keeping accepted strings equivalent.

No imports, helper methods, or dependency changes are required.

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

…ession

Testing GitHub code scanning using their AI to generate fixes, this may be old, stale, or not applicable. Please review and let me know.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.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.

1 participant