Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/apps/db/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions backend/apps/terminology/api/terminology.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def inner():


@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))
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decorator order means permission-denied requests won't be captured by @system_log. With the current order, require_permissions(...) runs before system_log(...), so if require_permissions raises (e.g., non-admin), the logging decorator never executes and the attempted import isn't audited. Consider swapping the decorators so @system_log(...) is above @require_permissions(...) (i.e., system_log(require_permissions(upload_excel))).

Suggested change
@require_permissions(permission=SqlbotPermission(role=['ws_admin']))
@system_log(LogConfig(operation_type=OperationType.IMPORT, module=OperationModules.TERMINOLOGY))
@system_log(LogConfig(operation_type=OperationType.IMPORT, module=OperationModules.TERMINOLOGY))
@require_permissions(permission=SqlbotPermission(role=['ws_admin']))

Copilot uses AI. Check for mistakes.
async def upload_excel(trans: Trans, current_user: CurrentUser, file: UploadFile = File(...)):
ALLOWED_EXTENSIONS = {"xlsx", "xls"}
Comment thread
jackieya marked this conversation as resolved.
Expand Down
Loading