File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
src/semmle/python/frameworks
test/experimental/library-tests/frameworks/stdlib Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -90,23 +90,31 @@ module cursor {
9090}
9191
9292/**
93- * Gets a reference to the `execute` method on a cursor.
93+ * Gets a reference to the `execute` method on a cursor (or on a connection).
94+ *
95+ * Note: while `execute` method on a connection is not part of PEP249, if it is used, we
96+ * recognize it as an alias for constructing a cursor and calling `execute` on it.
97+ *
9498 * See https://www.python.org/dev/peps/pep-0249/#id15.
9599 */
96100private DataFlow:: Node execute ( DataFlow:: TypeTracker t ) {
97101 t .startInAttr ( "execute" ) and
98- result = cursor:: methodResult ( )
102+ result in [ cursor:: methodResult ( ) , Connection :: instance ( ) ]
99103 or
100104 exists ( DataFlow:: TypeTracker t2 | result = execute ( t2 ) .track ( t2 , t ) )
101105}
102106
103107/**
104- * Gets a reference to the `execute` method on a cursor.
108+ * Gets a reference to the `execute` method on a cursor (or on a connection).
109+ *
110+ * Note: while `execute` method on a connection is not part of PEP249, if it is used, we
111+ * recognize it as an alias for constructing a cursor and calling `execute` on it.
112+ *
105113 * See https://www.python.org/dev/peps/pep-0249/#id15.
106114 */
107115DataFlow:: Node execute ( ) { result = execute ( DataFlow:: TypeTracker:: end ( ) ) }
108116
109- /** A call to the `execute` method on a cursor. */
117+ /** A call to the `execute` method on a cursor (or on a connection) . */
110118private class ExecuteCall extends SqlExecution:: Range , DataFlow:: CfgNode {
111119 override CallNode node ;
112120
Original file line number Diff line number Diff line change 22db = sqlite3 .connect ("example.db" )
33
44# non standard
5- db .execute ("some sql" , (42 ,)) # $ MISSING: getSql="some sql"
5+ db .execute ("some sql" , (42 ,)) # $ getSql="some sql"
66
77cursor = db .cursor ()
88cursor .execute ("some sql" , (42 ,)) # $ getSql="some sql"
You can’t perform that action at this time.
0 commit comments