Salesforce Decode
Salesforcedecode
Back to questions
AgentforceExpertactionssoqlinjectionsecurity

Review agent action exposing unrestricted SOQL to end user prompts

Real World Scenario

Developer created Agent action running dynamic SOQL built from user utterance; security review before production flags data exfiltration risk.

Expected Answer

• Reject dynamic SOQL from LLM output — use parameterized queries with allowlisted objects and fields • Agent actions return fixed query templates with bound variables only • Enforce withSharing and CRUD/FLS in all Apex invoked by agents • Rate limit action invocations per session and user • Audit log every query executed via agent with user Id • Pen test prompt injection attempting cross-object joins • Principle of least privilege on integration user for agent actions

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Main difference: use case and scale. Reject dynamic SOQL from LLM output — use parameterized queries with allowlisted objects and fields. Agent actions return fixed query templates with bound variables only. Pick based on your integration pattern and team capability. Agent actions are APIs exposed to adversarial prompts — same rigor as public REST endpoints. Validate against production-scale constraints and long-term platform evolution.

Architect Perspective

Agent actions are APIs exposed to adversarial prompts — same rigor as public REST endpoints.