fix(security): authorize all Livewire write methods (33 forms)#61
Merged
fix(security): authorize all Livewire write methods (33 forms)#61
Conversation
Adds Gate::authorize('edit-content') or Gate::authorize('manage-team')
at the top of every public write method on Livewire components that
previously executed without role enforcement. Cloud's role-based gates
checked the user's team role canEdit()/canManageTeam(); without
authorize(), a viewer-role member could submit form POST and mutate
team-owned domain entities.
Scope:
- Domain content forms (edit-content): Telegram bots, Chatbots,
Skills, Email themes/templates, Toolsets, Websites, Credentials,
Crews, Tools, Triggers, Agents, Projects, Workflows, Integrations,
Git repositories, Signal connector setup.
- Team config forms (manage-team): outbound connectors, webhook
endpoints, signal connector secrets.
Base community gate returns true (single-team mode), so this is a
no-op there. Cloud gate enforces real role checks.
Methods covered: save, delete, toggleStatus, activate, pause, resume,
archive, restart, triggerRun, addPage, deletePage, publishPage,
unpublishPage, publishWebsite, unpublishWebsite, deleteWebsite,
deployWebsite, saveContent, saveSettings, saveCredentials, saveGraph,
saveProxyCredential, saveMemberPolicy, saveTelegramChannel, saveEdit,
publishPage, generateToken, revokeToken, approveCredential,
rejectCredential, rotateSecret, savePastedSecret, setAsDefault,
generateFromPrompt, testConnection, testTrigger, disconnect,
connect, connectOAuth, syncNow, deleteSkill, deleteTheme,
deleteTemplate, deleteCrew, deleteTool, deleteTelegramChannel,
toggleTelegramChannel, toggleActive (webhook).
UI-only methods (cancelEdit, removeRow, toggleWorker pre-save,
updatedSearch) intentionally not gated — no DB writes.
Tests: 3065 pass, 6 pre-existing SocialLoginTest failures unchanged
(unrelated to this sprint). Pint clean. PHPStan clean (no baseline
regenerated).
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the remaining 33 Livewire forms that had
save()/write methods withoutGate::authorize. Companion to yesterday'sfix(security)commit which fixed 2 forms (EditProjectForm + GitRepositoryDetailPage); this commit closes the rest.Why
In community edition all gates return true (single-team mode). In cloud,
CloudServiceProvideroverrides:edit-content→\$user->teamRole(\$team)->canEdit()manage-team→\$user->teamRole(\$team)->canManageTeam()Without
Gate::authorizeon Livewire write methods, a cloud team's viewer-role member could submit form POST and mutate team-owned data. Routes are auth-protected but role differentiation was never checked.Scope
35 Livewire write methods across 33 forms gated:
edit-content (domain content): Agents, Chatbots, Credentials, Crews, Email themes/templates, Git repos, Integrations, Projects, Signal connector setup (rotate/save secret), Skills, Telegram bots, Tools, Toolsets, Triggers, Websites, Workflows.
manage-team (team config): Outbound connectors (SMTP, webhook, notifications, WhatsApp), connector setup secrets.
Tests
Test plan
🤖 Generated with Claude Code