🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Add validation for R2 key
Edward Cui7d3d76954c16
diff --git a/server/src/services/storage/r2StorageService.ts b/server/src/services/storage/r2StorageService.tsindex 3ba724c0e..eaaf35628 100644--- a/server/src/services/storage/r2StorageService.ts+++ b/server/src/services/storage/r2StorageService.ts@@ -211,6 +211,14 @@ class R2StorageService {throw new Error("R2 storage is not enabled");}+ if (key.trim().length === 0) {+ throw new Error("Invalid storage key: key cannot be empty");+ }++ if (key.includes("..")) {+ throw new Error("Invalid storage key: path traversal not allowed");+ }+try {const upload = new Upload({client: this.client,