Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
AI Safety and Ethics  ›  Lesson

Security and Privacy

Security and Privacy Concerns 12 minAn AI app should send the model only the data a task needs, keep secrets out of prompts, scope every lookup to the current user, and handle logs and provider data with care.

Security and Privacy

A security review of the Pedal Point assistant finds three things in an afternoon: the full customer record, phone number and address included, goes to the model with every question; every prompt is logged in plain text forever; and the payment provider's API key sits in the system prompt "so the model can check payments". None of this was malicious. It was just convenient.

The rule

Send only what the task needs; never send what must not leak.

Every piece of data you put in a prompt can travel: to the model provider, into your logs, and, with a clever enough request, back out in an answer. So design as if it might.

Keep secrets out. API keys, passwords and internal URLs never belong in a prompt. Tools that need credentials hold them in your server code, where the model cannot see them.

Minimise personal data. "Where is my order?" needs one order's status and date, not the customer's address, phone and payment details. Less data sent means less that can leak.

Scope every lookup to the user. When the assistant retrieves orders or documents, your code filters by the logged-in customer's ID. Never rely on the model to decide whose data it may see.

Mask where you can. Replace names, emails and card numbers with placeholders before logging or before sending when they are not needed.

Handle logs as sensitive data. Prompts and replies are full of personal details. Limit who can read them, and delete them after a set period.

Know your provider's terms. Check how a hosted model provider stores the data you send and whether it may be used for training, and choose settings that match what you promise your customers.

Tag requests with a user ID. Attaching an anonymous, stable ID for each end user (a hash, not their email) to requests and logs helps you trace abuse to one account. Some providers let you pass such an ID with each call.

The shortcut

Three words for every field in a prompt: minimise, mask, scope. Is it needed? Can it be masked? Is it limited to this user?

Cleaning up the order questionStep 1 of 4
  1. Minimise

    Keep: order number, status, delivery date. Drop: address, phone, card digits, past orders.

The trap is "the model will keep it private". A model has no concept of confidentiality; anything in its context can come out.

Drills

Answer fast — trust the rule.

quick drill

Where should the payment provider's API key live?

quick drill

"Where is my order 4417?" Which data does the model actually need?

quick drill

How should the assistant be stopped from reading another customer's orders?

quick drill

What is the safest kind of end-user ID to attach to requests?

Remember

  • Send only what the task needs; never send what must not leak.
  • Minimise, mask, scope — for every field.
  • Logs are sensitive data too; the model keeps no secrets.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainA privacy review of the assistant

Review the Pedal Point assistant's data flow for privacy and security. It sends the customer's question, their full customer record (name, address, phone, payment card's last four digits, all past orders) and retrieved help pages to a hosted model, and logs every prompt in full. Name three problems and the fix for each.