Case studies / AI features
highNext.js · OpenAI API · Supabase · Vercel

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

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.

The fix

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.

  1. Pass ticket content as user-role messages, never inside the system prompt.
  2. Run every tool call through the same permission check as the UI, as the current user.
  3. Render assistant output as text; escape anything shown as HTML.
  4. 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 result
  • 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.