Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
feat(media): rate-limit upload endpoint to 10 req/min/IP
Paulo Castellano7fac3aaf0fe7
diff --git a/routes/api.php b/routes/api.phpindex c6f5a67fc..fe3c48f18 100644--- a/routes/api.php+++ b/routes/api.php@@ -13,7 +13,7 @@ use App\Http\Controllers\Api\WorkspaceController;use Illuminate\Support\Facades\Route;Route::post('/uploads/{token}', [UploadController::class, 'store'])- ->middleware('signed')+ ->middleware(['signed', 'throttle:10,1'])->where('token', '[0-9a-f-]{36}')->name('api.uploads.store');diff --git a/tests/Feature/Api/UploadControllerTest.php b/tests/Feature/Api/UploadControllerTest.phpindex 2d79584ae..ac69900e9 100644--- a/tests/Feature/Api/UploadControllerTest.php+++ b/tests/Feature/Api/UploadControllerTest.php@@ -121,3 +121,19 @@ test('rejects disallowed mime type', function () {$response->assertStatus(422);expect(Media::where('upload_token', $token)->exists())->toBeFalse();});++test('rate limits floods from the same IP', function () {+ for ($i = 0; $i < 10; $i++) {+ $this->postJson(+ signedUploadUrl($this->workspace, (string) Str::uuid()),+ ['media' => UploadedFile::fake()->image("f{$i}.png", 16, 16)],+ );+ }++ $response = $this->postJson(+ signedUploadUrl($this->workspace, (string) Str::uuid()),+ ['media' => UploadedFile::fake()->image('over.png', 16, 16)],+ );++ $response->assertStatus(429);+});