Update javascript/ql/src/LanguageFeatures/TemplateSyntaxInStringLiteral.ql

Co-Authored-By: Asger F <316427+asgerf@users.noreply.github.com>
This commit is contained in:
Napalys Klicius
2025-06-12 14:25:00 +02:00
parent 75ee649362
commit da5cd251be

View File

@@ -76,9 +76,8 @@ class CandidateStringLiteral extends StringLiteral {
* ```
*/
predicate hasObjectProvidingTemplateVariables(CandidateStringLiteral lit) {
exists(DataFlow::CallNode call, DataFlow::ObjectLiteralNode obj, DataFlow::Node stringArg |
stringArg = [StringConcatenation::getRoot(lit.flow()), lit.flow()] and
stringArg = call.getAnArgument() and
exists(DataFlow::CallNode call, DataFlow::ObjectLiteralNode obj |
call.getAnArgument() = [lit.flow(), StringConcatenation::getRoot(lit.flow())] and
obj.flowsTo(call.getAnArgument()) and
forex(string name | name = lit.getAReferencedVariable() | exists(obj.getAPropertyWrite(name)))
)