Agentforce Security Checklist: How to Build Secure AI Agents

Key Takeaways:

  • Building an Agentforce agent starts with defining its role, identity, permissions, and the data it can access, laying the foundation for security.

  • As the agent gains actions, integrations, and knowledge sources, each needs to be reviewed, restricted, and tested against potential security risks.

  • Before and after deployment, security testing, activity monitoring, and regular reviews help catch vulnerabilities and keep the agent secure as it evolves.

Businesses are moving beyond AI assistants that simply answer questions. With Agentforce, they're building agents that perform tasks, access enterprise data, interact with other systems, and automate entire workflows. 

As adoption grows and these agents take on more responsibility, the importance of securing them grows too. Salesforce provides Einstein Trust Layer as the security foundation, but how each agent is built, what permissions it receives, and which actions it can run still decide how well it is protected. 

This guide covers the security best practices that matter most, plus a checklist to run before go-live.

Understand How Agentforce Security Works

Before securing an Agentforce agent, it's important to understand how its security works. Salesforce provides several built-in protection layers. Each layer protects something different, and a gap in one can weaken the others.

  • Salesforce platform security: the identity, access, and data protection foundation your org already relies on.

  • Einstein Trust Layer: built-in protections around prompts and responses, such as secure data retrieval, zero data retention with model providers, and toxicity filtering.

  • Agent-level instructions and guardrails: the topics, rules, and boundaries you define for how the agent behaves.

  • User permissions and access controls: what the agent, and the person using it, can see and change.

  • Actions, integrations, and data sources: the Flows, Apex, prompt templates, and connected systems the agent can reach.

The first two layers come built in. The last three are shaped largely by the people building the agent, which is where the rest of this guide focuses.

What Makes Agentforce Security Different from Traditional Apps

Traditional automation does exactly what it was programmed to do. An agent interprets language, chooses a topic, picks an action, and responds. That flexibility creates three risks that classic apps rarely face:

  • Over-exposure: the agent can see or say more than the person talking to it should know. For example, an employee asks for a customer's details and the agent also returns fields they were never meant to see.

  • Over-action: the agent can do more than it should because its actions or permissions are too broad. A broad "update record" action can turn a read-only request into a change nobody intended.

  • Manipulation: a user, or even content the agent reads, like an email or case comment, can steer it off course. This is called prompt injection, and it works because an agent can't always tell data from instructions. Text hidden in an email can act like a command.

Agents are also less predictable. The same request can produce different responses, so one passing test doesn't prove an agent is safe. And because an agent acts with whatever access it runs with, one mistake can repeat across many conversations before anyone notices.

10 Agentforce Security Checks Every Builder Should Perform

With the security layers in mind, let's look at the practical steps you can take to protect your Agentforce agents. These practical security checklist cover everything from data access and permissions to action execution, testing, and monitoring.

1. Establish Agent Identity and Review Permissions

Before anything else, know whose access the agent uses. Every permission check, sharing rule, and field restriction applies to that identity, so a mistake here carries into everything the agent does. Here is how to do this.

  • Know the running user: Employee agents typically act as the logged-in user and inherit that person's access. Service agents typically run as a dedicated agent user. Confirm which applies to each agent you build.

  • Give each agent its own identity: Avoid sharing one agent user across several agents, so access stays scoped and your logs show which agent did what.

  • Apply least privilege: New agents start with minimal access. Add only the objects, fields, and records its actions need, through permission sets, and avoid broad permissions like View All Data or Modify All Data.

  • Review how access can widen: Check field-level security, sharing rules, role hierarchy, and org-wide defaults. Remember that a flow running in system context can reach more than the agent user could directly.

Organizations with complex permission structures must hire a Salesforce consultant to audit them before launch.

2. Restrict Access to Sensitive Data

An agent is only as safe as the data it can access. Even when permissions are set correctly, sensitive data can still leak through what the agent reads and what it says back. Make these checks part of your security review:

  • Know what it can read: List every object, field, knowledge source, and Data Cloud source the agent touches, and what each could reveal in a response.

  • Classify your data: Public, confidential, and restricted data should never end up in the same agent by accident.

  • Use sharing and restriction rules: Check that they limit which records the agent's user can see, especially for sensitive customer information such as personal, financial, or health data.

  • Review connected sources: Data pulled in from Data Cloud, knowledge, and external systems may follow different access rules than your Salesforce records, so review each source separately.

  • Minimize: Skip the "nice to have" data sources. If the agent doesn't need financial records to answer support questions, it should not be able to reach them.

3. Secure Knowledge Sources and Data Grounding

Knowledge sources play a major role in how an agent responds. Outdated information, incorrect records, or malicious instructions hidden in content can lead to inaccurate answers or unintended behavior.

  • Salesforce Knowledge: Check article visibility so the agent only uses content its audience is allowed to see. It also helps to limit who can create or edit articles, because anyone who can write to a source can influence what the agent says.

  • Data Cloud (Data 360): Review what data the agent's grounding can reach, and confirm that access rules are still enforced when content is retrieved.

  • External sources: Content from outside systems is best treated as untrusted until it has been reviewed, and it helps to connect only what the agent genuinely needs.

  • Data quality: Stale or duplicate records can lead to confident but wrong answers, so give each source an owner and review it on a regular schedule.

4. Define a Tight Role for the Agent

Security starts before you build a single action. So you must write down what the agent is for, who will talk to it, and where it will live. Here’s how it is done

  • Scope: A support agent that answers order questions should not also be able to discuss pricing negotiations. Narrow topics mean fewer ways for things to go wrong.

  • Audience: A public website visitor, a logged-in customer, and an internal employee deserve very different levels of trust.

  • Deployment: A public website, a mobile app, Slack, and an internal console each carry different exposure.

A vague agent is a risky agent. If you cannot describe its job in two sentences, the scope is probably too wide.

5. Secure Agent Actions and Automation

Actions are where an agent stops talking and starts doing. They can be built with Flow, Apex, or prompt templates, and they deserve the most scrutiny in your build.

  • Separate public and private actions: Something like "share store hours" is safe for anyone. Updating an account or reading personal records is not.

  • Verify identity before private actions: Use the Customer Verification topic and restrict sensitive topics and actions until the user has been verified.

  • Keep actions narrow: One action should do one clear job. A single "update any record" action is an open door.

  • Respect sharing and field-level security in Apex and Flow: Check whether each flow runs in user or system context, and don't assume the agent's guardrails will catch what your code allows.

  • Treat generated output as untrusted: Salesforce's own partner requirements say content generated by prompt templates or the Models API in your Apex or flows should be treated as untrusted. Validate it before it drives a record update, a callout, or a query.

  • Validate inputs and handle errors safely: Check the type, format, and allowed values of anything passed into a Flow or Apex action, and make sure error messages don't reveal internal details.

  • Require human approval for sensitive operations: For high-impact steps like refunds, deletions, or bulk updates, have a person approve the action before it runs.

6. Secure Integrations and External Services

Agents often reach beyond Salesforce through connected apps, APIs, and external systems. Each connection is another place where access can become too broad or data can slip out, so integrations deserve the same care as the agent itself.

  • Review what is connected: Keep an inventory of the connected apps, external client apps, APIs, and external systems your agent's actions touch, and retire any that are no longer needed.

  • Protect credentials: Store secrets in Named Credentials or other managed settings rather than in code, flows, or instructions, and prefer short-lived tokens that are rotated regularly.

  • Limit integration permissions: Give each integration only the scopes and permissions it needs, ideally through a dedicated integration user.

  • Check how data moves: Confirm what leaves Salesforce and what comes back, and validate responses from external systems before the agent acts on them.

7. Use the Einstein Trust Layer, Then Add Your Own Guardrails

No single control is enough. The Einstein Trust Layer does a lot of work for you, but you still need to know what it covers and what it leaves to you. Its main protections are:

  • Secure data retrieval and grounding: Your data is inserted into prompts while standard permissions and field-level security are preserved. This protects you only as far as your own permissions are set correctly.

  • Zero data retention: An arrangement with model providers so prompts and responses are not stored or used for training outside Salesforce.

  • Prompt defense and toxicity detection: System policies that help limit harmful outputs and manipulation attempts, plus scoring for toxic content. Neither catches everything, so don't treat them as your only defense against prompt injection.

  • Audit trail: A record of prompts, responses, and Trust Layer decisions that you can review.

  • Check what applies to agents: Not every Trust Layer feature works the same way for every agent. For example, Salesforce's Trailhead notes that data masking for LLMs is currently disabled for agents, so confirm what is active for yours.

Beyond the Trust Layer, combine these controls:

  • Supervisory checks: Runtime monitoring that scans prompts, responses, and context for noncompliant behavior.

  • Clear agent instructions: Specific natural-language rules about what the agent should and should not do.

One caution: Instructions are guidance, not enforcement. An instruction saying "never reveal customer emails" is not a substitute for simply not giving the agent access to customer emails. Use instructions to shape behavior, and permissions to enforce limits.

8. Protect Agents Against Prompt Injection

Prompt injection is when someone hides instructions in content an agent reads, hoping it will treat them as commands. Assume some attempts will get through, so narrow actions and least privilege matter most.

  • Malicious user inputs: Expect anyone on a public channel to try overriding the agent's rules. Permissions and action limits hold; instructions alone don't.

  • Indirect injection: Hidden instructions can sit in cases, emails, web forms, or knowledge articles. In the 2025 ForcedLeak case, text planted in a Web-to-Lead form led an agent to send CRM data to an attacker's domain.

  • Instruction manipulation: Attackers may try to rewrite or extract the agent's rules. Keep secrets out of instructions, and keep sensitive actions behind verification.

  • Testing: Run malicious prompts and poisoned content before launch and after every change.

9. Test Agent Behavior Before Deployment

Most teams test whether an agent works. Fewer test whether it can be tricked. Before launch, it helps to try the following, ideally in a sandbox so test actions don't change real records:

  • Unauthorized access attempts: Ask for data or records the user should not see, and check that the agent holds back what it should.

  • Sensitive data requests: Ask directly for personal or financial details, and try indirect routes too, such as asking the agent to summarize or list records.

  • Unexpected inputs and prompt injection: Ask the agent to ignore or reveal its instructions, and plant instructions inside content it will read, such as a case description.

  • Different user profiles: Run the same requests as verified and unverified users, and as users with different permission sets, then compare the results.

  • Out-of-scope requests: Confirm the agent politely declines topics and actions outside its role.

Keep these test cases and rerun them whenever you change topics, actions, or instructions. Salesforce's Testing Center can help automate this.

Teams short on time or experience can also bring in a Salesforce consultant to design and run these tests.

10. Monitor Agent Activity After Deployment

Security does not end at go-live. Agents tend to grow in scope over time, and permissions often grow with them, so it helps to keep watching how an agent behaves once real users start relying on it.

  • Review activity regularly: Look through conversations, actions, and errors on a set schedule. Unusual patterns, such as a sudden rise in one action or repeated attempts to extract data or override instructions, can be early signs that something is wrong.

  • Use the available logs: The Einstein audit trail records prompts, responses, and Trust Layer decisions, which makes it easier to understand what happened when something looks off.

  • Have an incident process: Decide ahead of time who reviews alerts and how an agent can be paused or have its access reduced, so a problem can be contained quickly.

  • Recheck permissions as scope grows: Whenever the agent gains a new topic, action, or data source, it is worth reviewing its access again.

Many organizations rely on Salesforce managed services to handle this ongoing work, including log reviews, permission checks, and incident response.

Building for AgentExchange? Plan for the Security Review

If you are a partner building an agent to list on AgentExchange, everything above also matter when your solution goes through Salesforce's security review. 

Apps and agents must pass Salesforce's security review before they can be listed on AgentExchange.

According to Salesforce's security review guidelines, partners must:

  1. Scan managed packages with Salesforce Code Analyzer and include the results in your submission.

  2. Scanners only give a first pass, so test manually too, and either fix each flagged issue or document why it is a false positive.

  3. Prepare a complete submission: an end-to-end test environment, credentials to all connected systems, scan reports, false positive explanations, and user documentation.

  4. If you fail, the report explains each vulnerability type with an example and reproduction steps, and a fix limited to those issues can go through a follow-up review.

  5. Passing is not forever. Solutions can be called back for periodic re-review.

Building with the practices in this guide from day one makes the review far less painful than trying to retrofit security at the end.

Agentforce Security Checklist

An Agentforce agent may work as expected and still have security gaps. Before taking it live, use this checklist as a final security review

Identity and permissions

  • Each agent has its own agent user, or its running user is documented

  • The running user has least-privilege permission sets

  • Object permissions, field-level security, and sharing are verified

  • Flows and Apex actions respect the running user's access

Data

  • Every data source and object the agent can read is listed

  • Data is classified, and sensitive data is kept out of agents that don't need it

  • Sharing rules and restriction rules are reviewed for sensitive customer information

  • Unneeded data sources are removed

Knowledge and grounding sources

  • Knowledge article visibility and edit access are reviewed

  • Data Cloud and external sources are limited to what the agent needs

  • Each source has an owner and a review schedule

Role

  • The agent's purpose is defined in one or two clear sentences

  • Topics are limited to that purpose

  • The audience (public, customer, employee) and channel are documented

Actions

  • Public and private actions are separated

  • Private actions require identity verification

  • Each action does one narrow job

  • Apex and Flow respect sharing and field-level security

  • Generated output is validated before it triggers changes

  • Inputs are validated, and error messages don't reveal internal details

  • Sensitive operations require human approval

Integrations and external services

  • Connected apps and external systems are inventoried, and unused ones are removed

  • Credentials are stored securely and rotated

  • Integrations have only the permissions they need

  • Data moving in and out of Salesforce is reviewed, and external responses are validated

Guardrails

  • Trust Layer protections are understood, including which ones apply to agents

  • Instructions are specific, and no limit depends on instructions alone

Prompt injection

  • Content from outside sources (cases, emails, web forms) is treated as untrusted

  • The Trusted URLs list is reviewed and kept minimal

  • Content alone can't trigger sensitive actions without verification or approval

Channel

  • Endpoints use authentication and encryption

  • Public-facing risks (abuse, adversarial prompts) are addressed

  • Application security basics are in place

Testing and monitoring

  • Adversarial and prompt injection tests are written and passing

  • Logs are reviewed on a schedule

  • Permissions are re-checked when the agent's scope changes

  • A process exists for responding to security incidents, including pausing an agent

Partners only

  • Salesforce Code Analyzer scan is complete, and the report is attached (for managed packages).

  • Source Code Scanner (Checkmarx) report is included, where applicable.

  • Dynamic Application Security Testing (DAST) is complete for external endpoints, where applicable.

  • Security vulnerabilities are fixed, and false positives are documented with explanations.

  • Manual security testing is completed alongside automated scans.

  • An end-to-end test environment is available, with valid credentials for connected systems.

  • Solution architecture, data flows, API callouts, and technical documentation are prepared.

  • User and administrator documentation is ready.

  • The Agentforce security questionnaire is completed for solutions containing Agentforce elements.

  • All required submission details and supporting documents are uploaded through the AgentExchange Security Review Wizard.

Conclusion

A safe agent is not the result of one setting. It comes from small, deliberate choices: tight permissions, protected data, scoped actions, layered guardrails, and steady monitoring. Salesforce provides the foundation, but the final security posture is yours.

If you would rather not carry that alone, an experienced Salesforce consultant can help. As a Salesforce implementation company, our team can review your agents, close security gaps, and keep them protected after launch. Contact us today to build agents you can trust.

Frequently Asked Questions

Related Readings

Let's Talk

Drop us a note, we’re happy to take the conversation forward 👇🏻

Bhanujeet Singh Rajawat

Bhanujeet Singh Rajawat is a technical content writer at Concretio, a Salesforce consulting partner. By collaborating with Salesforce consultants and solution architects, he simplifies the technical Salesforce landscape into clear, practical content that helps readers make informed decisions.

Previous
Previous

MCP Just Went Stateless: What the Latest MCP Spec Changes for Enterprise Servers

Next
Next

How to Choose a Salesforce AgentExchange Partner