The in-app assistant that answered to the wrong author
A B2B app added an AI assistant that answers questions over the customer's own data. The Deep scan's assistant check showed its answers could be steered by text inside the content it read. Separating instructions from data and limiting what the assistant could call fixed it.
Composite case study: built from real Scanwright findings, with names, hosts and figures changed.
- Team
- Three developers
- Feature
- Chat assistant over tickets and documents
- Scan
- Deep, with the assistant endpoint in Setup
- Time to fix
- One day
- Result
- Re-scan clean; assistant scope documented
The app
A ticketing tool for small support teams. The assistant summarises tickets, drafts replies and can look up account details through a few internal tools.
What the report said
- High: text inside a ticket could change what the assistant did, including revealing its own instructions and calling a lookup tool for an account the current user had no business seeing.
- Medium: the assistant's replies were rendered as HTML without escaping, so a crafted reply could run script in the agent's browser.
Why it had not been caught
Everything worked in testing because nobody on the team wrote tickets designed to confuse the assistant. The model cannot tell instructions from data unless the app keeps them apart.
Keep instructions and content in separate roles, give the assistant only the tools it needs with the current user's permissions, and render its output as text.
- Pass ticket content as user-role messages, never inside the system prompt.
- Run every tool call through the same permission check as the UI, as the current user.
- Render assistant output as text; escape anything shown as HTML.
- Re-run the Deep scan with the assistant endpoint set.
const messages = [
{ role: 'system', content: SYSTEM_INSTRUCTIONS }, // fixed, never includes user content
{ role: 'user', content: `Ticket:\n${ticket.body}` }, // data, clearly labelled
];
// tools: lookupAccount(id) checks can(user, 'read', id) before returning anything
- The re-scan reported the assistant holding to its instructions and refusing lookups outside the user's account.
- The team added the assistant's scope to the Business logic section in Setup, so every future scan tests the same boundary.