Uh oh!
There was an error while loading. Please reload this page.
fix(security): resolve ReDoS vulnerability in function execute tag pattern - #4149
Conversation
…ttern Simplified regex to eliminate overlapping quantifiers that caused exponential backtracking on malformed input without closing delimiter.
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview This removes the previous potentially backtracking-heavy pattern and centralizes tag parsing behavior to the common reference-validation utility, mitigating ReDoS risk from malformed/untrusted code inputs. Reviewed by Cursor Bugbot for commit 4e21a08. Configure here. |
Uh oh!
There was an error while loading. Please reload this page.
Greptile SummaryThis PR fixes a ReDoS vulnerability in Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["resolveTagVariables(code, ...)"] --> B["resolvedCode.match(TAG_PATTERN)"]
B --> C{"matches found?"}
C -- "no" --> Z["return resolvedCode"]
C -- "yes" --> D["for each match"]
D --> E["slice <...> to get tagName"]
E --> F["resolveBlockReference(blockName, fieldPath)"]
F --> G{"result found?"}
G -- "no" --> D
G -- "yes" --> H{"tagValue === undefined?"}
H -- "yes" --> I["replace match with 'undefined'/'None'"]
H -- "no" --> J["build safeVarName\n__tag_..."]
J --> K["contextVariables[safeVarName] = tagValue"]
K --> L["replace match with safeVarName in code"]
I --> D
L --> D
D --> Z
style B fill:#d4edda,stroke:#28a745
note1["TAG_PATTERN = createReferencePattern()\n= /<([^<>]+)>/g\n(no ReDoS risk)"]
Reviews (3): Last reviewed commit: "refactor(security): use createReferenceP..." | Re-trigger Greptile |
Uh oh!
There was an error while loading. Please reload this page.
Matches createReferencePattern() from reference-validation.ts used by the core executor. Invalid refs handled gracefully by resolveBlockReference.
waleedlatif1
commented
Apr 14, 2026
waleedlatif1
commented
Apr 14, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Apr 14, 2026
waleedlatif1
commented
Apr 14, 2026
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 4e21a08. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
Summary
resolveTagVariablesto eliminate overlapping quantifiers ([a-zA-Z0-9_.]*[a-zA-Z0-9_]) that caused exponential backtracking on malformed input (e.g.,<aaaa...without closing>)Type of Change
Testing
bun run lintpassesbun run test— all 5031 tests pass (5 pre-existing import failures unrelated)Checklist