That is_user_logged_in() check on your CRM AJAX handler is the one I'd retest first, because it lets any subscriber edit client records, not just an admin. The check I'd add is to call that handler directly as a subscriber on staging, bypassing the UI, and to grep your other AJAX handlers for the same is_user_logged_in() pattern, since that shortcut usually repeats. Any handler that updates records needs a current_user_can() check for that specific CRM capability, not just a login check.
You're welcome — and testing it directly as a subscriber is exactly the test that catches it. If that call succeeds for a subscriber with no capability check, the handler is trusting login alone. Worth also trying it logged out, to see whether it fails closed the same way.
Everything that AI created, are sandboxed on the staging. I don't really care even if the production was build by my own hand. I only let the agent scanning the production site, not building it. This flow also makes me better knowing what works what didn't by not guessing everything that live on the production.
That boundary is healthy: AI can accelerate implementation, but it should not be the authority for product trade-offs, security posture, or the meaning of a client requirement. I would add an explicit decision log for the choices kept human-owned; it makes review and future maintenance much less dependent on memory.
That loop—'AI writes the ability, and AI calls the ability'—is the exact security boundary most teams haven't fully internalized yet.
Whenever you expose domain logic over MCP or an Abilities API, the permission_callback stops being a boring boilerplate check and becomes your primary firewall. Agents are notoriously eager to satisfy the user's prompt; if a capability check defaults to is_user_logged_in() instead of granular object-level ownership, an agent will happily execute a destructive state change because 'it worked in the happy path.'
Also love the rule 'New Abilities start read-only.' Treating write access like a privilege that has to be explicitly opted into—and audited via raw diff, never the agent's summary—is spot on.
It's a simple rule, but it changes the whole trust model. If the agent can freely modify the same permissions and boundaries that are supposed to constrain it, those safeguards don't mean much. Keeping the authority to change those rules outside the agent is what makes the firewall meaningful.
That is_user_logged_in() check on your CRM AJAX handler is the one I'd retest first, because it lets any subscriber edit client records, not just an admin. The check I'd add is to call that handler directly as a subscriber on staging, bypassing the UI, and to grep your other AJAX handlers for the same is_user_logged_in() pattern, since that shortcut usually repeats. Any handler that updates records needs a current_user_can() check for that specific CRM capability, not just a login check.
Super useful, thank you! Testing the handler directly as a subscriber is going on my checklist.
You're welcome — and testing it directly as a subscriber is exactly the test that catches it. If that call succeeds for a subscriber with no capability check, the handler is trusting login alone. Worth also trying it logged out, to see whether it fails closed the same way.
Everything that AI created, are sandboxed on the staging. I don't really care even if the production was build by my own hand. I only let the agent scanning the production site, not building it. This flow also makes me better knowing what works what didn't by not guessing everything that live on the production.
Love that flow! Letting the agent scan but never build on production is smart. Thanks for sharing!
That boundary is healthy: AI can accelerate implementation, but it should not be the authority for product trade-offs, security posture, or the meaning of a client requirement. I would add an explicit decision log for the choices kept human-owned; it makes review and future maintenance much less dependent on memory.
A decision log is a great idea. Most of those calls live in my head right now 😅 Adding it to my process!
That loop—'AI writes the ability, and AI calls the ability'—is the exact security boundary most teams haven't fully internalized yet.
Whenever you expose domain logic over MCP or an Abilities API, the permission_callback stops being a boring boilerplate check and becomes your primary firewall. Agents are notoriously eager to satisfy the user's prompt; if a capability check defaults to is_user_logged_in() instead of granular object-level ownership, an agent will happily execute a destructive state change because 'it worked in the happy path.'
Also love the rule 'New Abilities start read-only.' Treating write access like a privilege that has to be explicitly opted into—and audited via raw diff, never the agent's summary—is spot on.
"Primary firewall" is exactly it. Glad the read-only rule clicked with you!
It's a simple rule, but it changes the whole trust model. If the agent can freely modify the same permissions and boundaries that are supposed to constrain it, those safeguards don't mean much. Keeping the authority to change those rules outside the agent is what makes the firewall meaningful.
the is_user_logged_in() example says it all. any subscriber could have edited client records, and the code looked correct.
Exactly, it looked totally fine. That's what made it scary 😬