File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
lib/semmle/python/frameworks
test/library-tests/frameworks/stdlib Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -4842,6 +4842,23 @@ module StdlibPrivate {
4842
4842
override predicate isShellInterpreted ( DataFlow:: Node arg ) { arg = this .getCommand ( ) }
4843
4843
}
4844
4844
}
4845
+
4846
+ // ---------------------------------------------------------------------------
4847
+ // html
4848
+ // ---------------------------------------------------------------------------
4849
+ /**
4850
+ * A call to 'html.escape'.
4851
+ * See https://docs.python.org/3/library/html.html#html.escape
4852
+ */
4853
+ private class HtmlEscapeCall extends Escaping:: Range , API:: CallNode {
4854
+ HtmlEscapeCall ( ) { this = API:: moduleImport ( "html" ) .getMember ( "escape" ) .getACall ( ) }
4855
+
4856
+ override DataFlow:: Node getAnInput ( ) { result = this .getParameter ( 0 , "s" ) .asSink ( ) }
4857
+
4858
+ override DataFlow:: Node getOutput ( ) { result = this }
4859
+
4860
+ override string getKind ( ) { result = Escaping:: getHtmlKind ( ) }
4861
+ }
4845
4862
}
4846
4863
4847
4864
// ---------------------------------------------------------------------------
Original file line number Diff line number Diff line change
1
+ import html
2
+
3
+ s = "tainted"
4
+
5
+ html .escape (s ) # $ escapeInput=s escapeKind=html escapeOutput=html.escape(..)
6
+ html .escape (s , True ) # $ escapeInput=s escapeKind=html escapeOutput=html.escape(..)
7
+ html .escape (s , False ) # $ escapeInput=s escapeKind=html escapeOutput=html.escape(..)
8
+ html .escape (s , quote = False ) # $ escapeInput=s escapeKind=html escapeOutput=html.escape(..)
You can’t perform that action at this time.
0 commit comments