Skip to content

Commit bfd2e43

Browse files
Add StreamlitConnection model
Co-authored-by: yoff <[email protected]>
1 parent a05266c commit bfd2e43

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

python/ql/lib/semmle/python/frameworks/Streamlit.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,14 @@ module Streamlit {
4444

4545
override DataFlow::Node getSql() { result in [this.getArg(0), this.getArgByName("sql")] }
4646
}
47+
private class StreamlitConnection extends SqlAlchemy::Connection::InstanceSource {
48+
StreamlitConnection() {
49+
this =
50+
API::moduleImport("streamlit")
51+
.getMember("connection")
52+
.getReturn()
53+
.getMember("connect")
54+
.getACall()
55+
}
56+
}
4757
}

python/ql/test/library-tests/frameworks/streamlit/test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@
1010

1111
# SQL injection sink
1212
q = conn.query("some sql") # $ getSql="some sql"
13+
14+
# SQLAlchemy connection
15+
c = conn.connect()
16+
17+
c.execute("other sql") # $ getSql="other sql"

0 commit comments

Comments
 (0)