Skip to content

Commit f75c15d

Browse files
fix(proxy_server.py): security fix - fix sql injection attack on global spend logs
1 parent 1ec2ba1 commit f75c15d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

litellm/proxy/proxy_server.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -8693,17 +8693,13 @@ async def global_spend_logs(
86938693

86948694
return response
86958695
else:
8696-
sql_query = (
8697-
"""
8696+
sql_query = """
86988697
SELECT * FROM "MonthlyGlobalSpendPerKey"
8699-
WHERE "api_key" = '"""
8700-
+ api_key
8701-
+ """'
8698+
WHERE "api_key" = $1
87028699
ORDER BY "date";
8703-
"""
8704-
)
8700+
"""
87058701

8706-
response = await prisma_client.db.query_raw(query=sql_query)
8702+
response = await prisma_client.db.query_raw(sql_query, api_key)
87078703

87088704
return response
87098705
return

0 commit comments

Comments
 (0)