Skip to content

Commit 5beb6bc

Browse files
committed
fix: restrict BinaryExpression evaluation in computed access to import.meta only
1 parent 6c5c3dc commit 5beb6bc

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎lib/javascript/JavascriptParser.js‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5220,6 +5220,16 @@ class JavascriptParser extends Parser {
52205220
const memberRanges = [];
52215221
while (expr.type === "MemberExpression") {
52225222
if (expr.computed) {
5223+
if (
5224+
expr.property.type !== "Literal" &&
5225+
expr.property.type !== "TemplateLiteral" &&
5226+
!(
5227+
expr.property.type === "BinaryExpression" &&
5228+
expr.object.type === "MetaProperty"
5229+
)
5230+
) {
5231+
break;
5232+
}
52235233
const member = this.evaluateExpression(expr.property).asString();
52245234
if (typeof member !== "string") break;
52255235
members.push(member);

0 commit comments

Comments
 (0)