Skip to content

fix: guard ContentTypeMatchesPlatform against non-uuid social_account_id - #260

Merged
paulocastellano merged 1 commit into
mainfrom
fix/content-type-matches-platform-uuid-guard
Aug 9, 2026
Merged

fix: guard ContentTypeMatchesPlatform against non-uuid social_account_id#260
paulocastellano merged 1 commit into
mainfrom
fix/content-type-matches-platform-uuid-guard

Conversation

@paulocastellano

Copy link
Copy Markdown
Contributor

Summary

  • App\Rules\ContentTypeMatchesPlatform fetched the sibling social_account_id and passed it straight to SocialAccount::find() without checking it was a valid UUID.
  • On Postgres, an invalid uuid literal (e.g. "threads-account", sent by an MCP client) throws QueryException: 22P02 invalid input syntax for type uuid instead of failing validation normally — reported via Nightwatch from POST /mcp/trypost.
  • Now guards with Str::isUuid() before querying; a non-uuid value is left for the sibling uuid rule on platforms.*.social_account_id to report.

Test plan

  • php artisan test --compact --filter=ContentTypeMatchesPlatformTest (6 passed, new regression test reproduces the crash against local Postgres without the fix)
  • php artisan test --compact --filter=PostToolTest (32 passed)
  • vendor/bin/pint --dirty --format agent

An MCP client sending a non-uuid social_account_id (e.g. a placeholder
string) reached SocialAccount::find() directly, which threw a Postgres
QueryException (22P02) instead of failing validation gracefully.
@paulocastellano
paulocastellano merged commit 9293d0c into main Aug 9, 2026
5 checks passed
@paulocastellano
paulocastellano deleted the fix/content-type-matches-platform-uuid-guard branch August 9, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant