Skip to content

Commit b563681

Browse files
committed
JS: Remove special treatment of strings in AngularJS code
String literals are already SourceNodes. But we need to add template literals as well
1 parent 0d0eaa2 commit b563681

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

javascript/ql/lib/semmle/javascript/dataflow/Sources.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ module SourceNode {
334334
astNode instanceof Templating::PipeRefExpr or
335335
astNode instanceof Templating::TemplateVarRefExpr or
336336
astNode instanceof StringLiteral or
337+
astNode instanceof TemplateLiteral or
337338
astNode instanceof TypeAssertion or
338339
astNode instanceof SatisfiesExpr
339340
)

javascript/ql/lib/semmle/javascript/frameworks/AngularJS/AngularJSCore.qll

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,6 @@ private predicate isAngularTopLevel(TopLevel tl) {
4141
)
4242
}
4343

44-
/**
45-
* Holds if `s` is a string in a top-level using the AngularJS library.
46-
*
47-
* Should not depend on the `SourceNode` class.
48-
*/
49-
pragma[nomagic]
50-
private predicate isAngularString(Expr s) {
51-
isAngularTopLevel(s.getTopLevel()) and
52-
(
53-
s instanceof StringLiteral or
54-
s instanceof TemplateLiteral
55-
)
56-
}
57-
58-
/**
59-
* String literals in Angular code are often used as identifiers or references, so we
60-
* want to track them.
61-
*/
62-
private class TrackStringsInAngularCode extends DataFlow::SourceNode::Range, DataFlow::ValueNode {
63-
TrackStringsInAngularCode() { isAngularString(astNode) }
64-
}
65-
6644
/**
6745
* Holds if `m` is of the form `angular.module("name", ...)`.
6846
*/

0 commit comments

Comments
 (0)