Add StreamlitConnection model

Co-authored-by: yoff <lerchedahl@gmail.com>
This commit is contained in:
Sylwia Budzynska
2024-07-30 12:58:49 +02:00
committed by GitHub
parent a05266c236
commit bfd2e4350b
2 changed files with 15 additions and 0 deletions

View File

@@ -44,4 +44,14 @@ module Streamlit {
override DataFlow::Node getSql() { result in [this.getArg(0), this.getArgByName("sql")] }
}
private class StreamlitConnection extends SqlAlchemy::Connection::InstanceSource {
StreamlitConnection() {
this =
API::moduleImport("streamlit")
.getMember("connection")
.getReturn()
.getMember("connect")
.getACall()
}
}
}

View File

@@ -10,3 +10,8 @@ conn = st.connection("postgresql", type="sql")
# SQL injection sink
q = conn.query("some sql") # $ getSql="some sql"
# SQLAlchemy connection
c = conn.connect()
c.execute("other sql") # $ getSql="other sql"