Skip to content

Commit 4c5e48f

Browse files
author
Esben Sparre Andreasen
committed
JS: introduce DataFlow::HtmlAttributeNode
1 parent da1ffcf commit 4c5e48f

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

javascript/ql/src/semmle/javascript/dataflow/DataFlow.qll

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ module DataFlow {
4040
} or
4141
TDestructuredModuleImportNode(ImportDeclaration decl) {
4242
exists(decl.getASpecifier().getImportedName())
43-
}
43+
} or
44+
THtmlAttributeNode(HTML::Attribute attr)
4445

4546
/**
4647
* A node in the data flow graph.
@@ -738,6 +739,27 @@ module DataFlow {
738739
}
739740
}
740741

742+
/**
743+
* A data flow node representing an HTML attribute.
744+
*/
745+
private class HtmlAttributeNode extends DataFlow::Node, THtmlAttributeNode {
746+
HTML::Attribute attr;
747+
748+
HtmlAttributeNode() { this = THtmlAttributeNode(attr) }
749+
750+
override string toString() { result = attr.toString() }
751+
752+
override ASTNode getAstNode() { none() }
753+
754+
override BasicBlock getBasicBlock() { none() }
755+
756+
override predicate hasLocationInfo(
757+
string filepath, int startline, int startcolumn, int endline, int endcolumn
758+
) {
759+
attr.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
760+
}
761+
}
762+
741763
/**
742764
* Provides classes representing various kinds of calls.
743765
*

0 commit comments

Comments
 (0)