Skip to content

Commit 1ba4a7c

Browse files
committed
fix: Unauthenticated Arbitrary File Upload in SQLBot uploadExcel Endpoint
1 parent 71e9f1f commit 1ba4a7c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

backend/common/utils/whitelist.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"/system/assistant/info/*",
3434
"/system/assistant/app/*",
3535
"/system/assistant/picture/*",
36-
"/datasource/uploadExcel",
3736
"/system/authentication/platform/status",
3837
"/system/authentication/login/*",
3938
"/system/authentication/sso/*",

frontend/src/views/ds/DatasourceForm.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { setSize } from '@/utils/utils'
1616
import EmptyBackground from '@/views/dashboard/common/EmptyBackground.vue'
1717
import icon_fileExcel_colorful from '@/assets/datasource/icon_excel.png'
1818
import IconOpeDelete from '@/assets/svg/icon_delete.svg'
19+
import { useCache } from '@/utils/useCache'
1920
2021
const props = withDefaults(
2122
defineProps<{
@@ -128,6 +129,10 @@ const close = () => {
128129
saveLoading.value = false
129130
}
130131
132+
const { wsCache } = useCache()
133+
const token = wsCache.get('user.token')
134+
const headers = ref<any>({ 'X-SQLBOT-TOKEN': `Bearer ${token}` })
135+
131136
const initForm = (item: any, editTable: boolean = false) => {
132137
isEditTable.value = false
133138
keywords.value = ''
@@ -539,6 +544,7 @@ defineExpose({
539544
v-if="form.filename && !form.id"
540545
class="upload-user"
541546
accept=".xlsx,.xls,.csv"
547+
:headers="headers"
542548
:action="getUploadURL"
543549
:before-upload="beforeUpload"
544550
:on-error="onError"
@@ -554,6 +560,7 @@ defineExpose({
554560
v-else-if="!form.id"
555561
class="upload-user"
556562
accept=".xlsx,.xls,.csv"
563+
:headers="headers"
557564
:action="getUploadURL"
558565
:before-upload="beforeUpload"
559566
:on-success="onSuccess"

0 commit comments

Comments
 (0)