mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
security: fix RCE via terminology poisoning and restrict upload access
This commit is contained in:
@@ -670,7 +670,7 @@ def check_sql_read(sql: str, ds: CoreDatasource | AssistantOutDsSchema):
|
||||
write_types = (
|
||||
exp.Insert, exp.Update, exp.Delete,
|
||||
exp.Create, exp.Drop, exp.Alter,
|
||||
exp.Merge, exp.Command
|
||||
exp.Merge, exp.Command, exp.Copy
|
||||
)
|
||||
|
||||
for stmt in statements:
|
||||
|
||||
@@ -164,6 +164,7 @@ session_maker = scoped_session(sessionmaker(bind=engine, class_=Session))
|
||||
|
||||
|
||||
@router.post("/uploadExcel", summary=f"{PLACEHOLDER_PREFIX}upload_term")
|
||||
@require_permissions(permission=SqlbotPermission(role=['ws_admin']))
|
||||
@system_log(LogConfig(operation_type=OperationType.IMPORT, module=OperationModules.TERMINOLOGY))
|
||||
async def upload_excel(trans: Trans, current_user: CurrentUser, file: UploadFile = File(...)):
|
||||
ALLOWED_EXTENSIONS = {"xlsx", "xls"}
|
||||
|
||||
Reference in New Issue
Block a user