Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: root team able to download backups

Andras Bacsai64f85839751c
diff --git a/routes/web.php b/routes/web.php
index feb2dd0eb3..75ba96e2ff 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -254,14 +254,16 @@ Route::middleware(['auth'])->group(function () {
$exeuctionId = request()->route('executionId');
$execution = ScheduledDatabaseBackupExecution::where('id', $exeuctionId)->firstOrFail();
$execution_team_id = $execution->scheduledDatabaseBackup->database->team()?->id;
- if (is_null($execution_team_id)) {
- return response()->json(['message' => 'Team not found.'], 404);
- }
- if ($team->id !== $execution_team_id) {
- return response()->json(['message' => 'Permission denied.'], 403);
- }
- if (is_null($execution)) {
- return response()->json(['message' => 'Backup not found.'], 404);
+ if ($team->id !== 0) {
+ if (is_null($execution_team_id)) {
+ return response()->json(['message' => 'Team not found.'], 404);
+ }
+ if ($team->id !== $execution_team_id) {
+ return response()->json(['message' => 'Permission denied.'], 403);
+ }
+ if (is_null($execution)) {
+ return response()->json(['message' => 'Backup not found.'], 404);
+ }
}
$filename = data_get($execution, 'filename');
if ($execution->scheduledDatabaseBackup->database->getMorphClass() === 'App\Models\ServiceDatabase') {