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
fix: guard ContentTypeMatchesPlatform against non-uuid social_account_id (#260)
Paulo Castellano9293d0cd8d72
diff --git a/app/Rules/ContentTypeMatchesPlatform.php b/app/Rules/ContentTypeMatchesPlatform.phpindex 56e945c24..fd0da853d 100644--- a/app/Rules/ContentTypeMatchesPlatform.php+++ b/app/Rules/ContentTypeMatchesPlatform.php@@ -40,7 +40,7 @@ class ContentTypeMatchesPlatform implements DataAwareRule, ValidationRule$parentKey = Str::beforeLast($attribute, '.');$accountId = data_get($this->data, $parentKey.'.social_account_id');- if (! $accountId) {+ if (! $accountId || ! Str::isUuid((string) $accountId)) {return;}diff --git a/tests/Unit/Rules/ContentTypeMatchesPlatformTest.php b/tests/Unit/Rules/ContentTypeMatchesPlatformTest.phpindex c3fe5352a..e5a6dedda 100644--- a/tests/Unit/Rules/ContentTypeMatchesPlatformTest.php+++ b/tests/Unit/Rules/ContentTypeMatchesPlatformTest.php@@ -67,6 +67,14 @@ test('skips validation when social_account_id is missing', function () {expect(runMatchesPlatformRule(ContentType::XPost->value, null))->toBe([]);});+test('skips validation without querying the database when social_account_id is not a uuid', function () {+ // Regression: a non-uuid social_account_id (e.g. an MCP client sending a+ // placeholder string) must not reach SocialAccount::find(), which throws+ // a QueryException on Postgres for invalid uuid input instead of+ // returning no rows.+ expect(runMatchesPlatformRule(ContentType::XPost->value, 'threads-account'))->toBe([]);+});+test('skips validation when content_type is not a known enum value', function () {$workspace = Workspace::factory()->create();$linkedin = SocialAccount::factory()->create([