Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Prevent Uncontrolled data used in path expression

Blue Mousec8969633e30f
diff --git a/backend/apps/cloud/src/data-import/data-import.controller.ts b/backend/apps/cloud/src/data-import/data-import.controller.ts
index b1179d52b..a68569add 100644
--- a/backend/apps/cloud/src/data-import/data-import.controller.ts
+++ b/backend/apps/cloud/src/data-import/data-import.controller.ts
@@ -1,6 +1,7 @@
import * as fs from 'fs'
import * as os from 'os'
import * as path from 'path'
+import { randomUUID } from 'crypto'
import {
Controller,
Post,
@@ -93,7 +94,7 @@ export class DataImportController {
if (!fs.existsSync(tempDir)) {
fs.mkdirSync(tempDir, { recursive: true })
}
- const tempFile = path.join(tempDir, `${projectId}-${Date.now()}${ext}`)
+ const tempFile = path.join(tempDir, `${Date.now()}-${randomUUID()}${ext}`)
fs.writeFileSync(tempFile, file.buffer)
const dataImport = await this.dataImportService.create(
diff --git a/backend/apps/community/src/data-import/data-import.controller.ts b/backend/apps/community/src/data-import/data-import.controller.ts
index 952f434f9..e8ce62670 100644
--- a/backend/apps/community/src/data-import/data-import.controller.ts
+++ b/backend/apps/community/src/data-import/data-import.controller.ts
@@ -1,6 +1,7 @@
import * as fs from 'fs'
import * as os from 'os'
import * as path from 'path'
+import { randomUUID } from 'crypto'
import {
Controller,
Post,
@@ -89,7 +90,7 @@ export class DataImportController {
if (!fs.existsSync(tempDir)) {
fs.mkdirSync(tempDir, { recursive: true })
}
- const tempFile = path.join(tempDir, `${projectId}-${Date.now()}${ext}`)
+ const tempFile = path.join(tempDir, `${Date.now()}-${randomUUID()}${ext}`)
fs.writeFileSync(tempFile, file.buffer)
const dataImport = await this.dataImportService.create(