Back to insights

Agentforce, Authorization & Action Security

An Agentforce topic is not an authorization model

JSBC Labs8 min read

Routing is not authorization

A service agent has separate topics for order questions, returns and refunds. The refund topic says that only verified customers may receive account-specific help, so the team assumes the sensitive path is protected. A user phrases the request differently, the reasoning engine selects another available action and the underlying Flow runs with broad access. The instructions were followed imperfectly, but the deeper failure is architectural: natural-language routing was treated as the enforcing control.

The JSBC Labs position is that an Agentforce topic is not an authorization model. Topics, subagents and instructions organise reasoning and scope. Filters can conditionally remove assets from consideration. Actual authority comes from the identity under which the agent runs, the platform permissions applied to that identity, verified business context and checks inside the action. Secure agents align all of those layers instead of expecting prose to carry security policy.

Choose the runtime identity before the conversation design

Salesforce documents different execution contexts for employee and service scenarios. Agents in authenticated employee channels can operate in the logged-in user's context, while service agents on unauthenticated messaging channels commonly use a dedicated agent user. The profile, permission sets, field-level security and sharing applied to the effective user determine which Salesforce resources and records are reachable.

Write an identity matrix before building topics. For every channel, record whether the caller is authenticated, which Salesforce user executes the action, how the customer is identified, which audit identity appears and what changes after verification. Do not confuse a Contact ID stored in a conversation variable with a security principal. Salesforce explicitly notes that context variables can identify a person without controlling data access. Identity and context must be connected deliberately.

Separate availability from permission

An agent can consider only the topics and actions included in its configuration and available under its filters. That is a valuable reduction of attack surface: a product-information agent should not carry record-update or email actions it never needs. But inclusion in the action set does not itself grant the referenced Flow, Apex class, prompt template, object or record access.

Maintain two inventories. The capability inventory says which assets the agent may select and under which conditions. The permission inventory says which licences, permission sets, Flow access, Apex class access, object permissions, field access and sharing each execution identity requires. Review both when an action is added, a channel changes or an agent is connected to a subagent. A tidy topic list cannot compensate for an over-permissioned agent user.

Use filters for deterministic eligibility

Agentforce filters use variables to control whether a topic, subagent or action is available in a conversation. Salesforce recommends them for cases such as requiring verification before private customer actions or restricting an operation to an eligible order state. This is stronger than asking the reasoning engine to interpret a sentence such as 'only refund recent purchases' on every turn.

Define eligibility as explicit data: isVerified, verifiedCustomerId, orderAgeDays, caseStatus, channel or entitlement. Establish where each value originates, when it expires and whether the user can influence it. Apply the narrowest filter to the sensitive action as well as any higher-level topic when appropriate. Then test the false, missing, stale and contradictory states. A filter is only as trustworthy as the variable pipeline feeding it.

Bind verification to the resource being changed

Salesforce's customer-verification patterns produce a verified customer or Contact identifier that can be stored in a variable, used by filters and passed into secure actions. The important architectural step is not merely completing an OTP exchange; it is ensuring that the action operates on resources belonging to the verified identity rather than on an arbitrary identifier supplied elsewhere in the conversation.

Make sensitive actions accept the verified identifier through a controlled input and derive the permitted records from it. Reject mismatches between the verified customer, requested order, case or account. Decide how verification state is cleared when a session changes user, channel or authentication status. Treat verification as short-lived evidence bound to purpose and scope—not a global Boolean that turns every private capability on for the rest of the conversation.

Enforce the rule again inside the action

Custom actions inherit the security behaviour of their implementation. Salesforce's guidance for Agentforce Apex actions recommends using sharing-aware classes and user-mode data access so object and field permissions are enforced. Flow access, Apex class access and prompt-template permissions also need explicit assignment. An action implemented in elevated or system context can widen the blast radius beyond what its topic description suggests.

Treat every action as a public API reached through an intelligent caller. Validate identifiers, allowed state transitions, field values and output shape at the implementation boundary. Return only the fields required for the conversation. Document any deliberate system-context operation and add a separate business authorization check. Instructions may reduce accidental selection; action code must prevent unauthorized execution even when selection, variables or upstream reasoning are wrong.

Map privilege across the complete agent chain

Agent orchestration can cross subagents, Flows, Apex, prompt templates and external services. Salesforce Well-Architected guidance warns against reviewing each component in isolation when a limited orchestrator can invoke a specialist with broader privileges. Effective capability is the union of reachable actions constrained by the identities and permissions actually used along the path.

Draw a permission chain for every material outcome: caller to agent, agent to subagent, subagent to action, action to Salesforce data or external system. Mark identity changes, system-context steps, named credentials and write operations. Remove unnecessary tools and split high-risk capabilities behind narrower identities where practical. The review question is not 'Can this topic refund an order?' but 'Can any reachable path cause a refund, and which control proves the caller is allowed to request it?'

Test denial as a first-class outcome

Happy-path agent tests prove that an eligible request can reach the expected action. Authorization needs adversarial scenarios: unverified users, verified users requesting another customer's record, missing variables, stale sessions, prompt injection in retrieved content, direct action invocation, altered identifiers and users whose Salesforce access differs from the designer's. Assert both the conversational response and the absence of unauthorized data changes.

Release evidence should include persona-based permission tests, filter tests, action-level negative tests and audit attribution. Monitor denied actions, verification failures, unexpected topic selection and privileged agent-user activity after launch. Re-run the suite when instructions, filters, permissions, actions, channels or subagent links change. A trustworthy Agentforce design does not rely on the model always choosing correctly; it remains safe when the model, user or context takes an unexpected route.

Official references

Continue reading