Security Controls for Self-Hosted AI
Access, isolation, approvals, logging and the attacks that target AI systems specifically.
Hello. In this lesson I will take you through 3 ideas, one at a time.
Why it matters: Access, isolation, approvals, logging and the attacks that target AI systems specifically. After each idea I will ask you one quick question.
In this lessonFollows you as you read
Access and isolation
The short version: Start with the basics that apply to any sensitive system.
Start with the basics that apply to any sensitive system. Users reach the AI application through single sign-on with roles. The model server is not reachable from the internet or from every internal machine, only from the applications that need it. Administrators use separate accounts with strong authentication, and every admin action is logged.
Treat the document index as sensitive. If retrieval ignores permissions, the AI will happily summarise a file the user was never allowed to open. Test this directly: sign in as a low-privilege user and ask about restricted content.
What happens if retrieval ignores document permissions?
Agents need approvals
The short version: An agent that can send, delete, pay or publish needs a human approval step before those actions, at least until it has a long, clean record.
An agent that can send, delete, pay or publish needs a human approval step before those actions, at least until it has a long, clean record. Give each tool the least access it needs: a tool that reads invoices should not be able to change bank details. Set limits on how many actions an agent may take in a period.
These controls also limit the damage from mistakes, not only attacks. A model that misreads an instruction can do as much harm as an attacker if nothing stops it.
Which agent action most clearly needs human approval?
Attacks specific to AI
The short version: Prompt injection hides instructions in content the model reads, such as a web page, an email or a document, hoping the model follows them.
Prompt injection hides instructions in content the model reads, such as a web page, an email or a document, hoping the model follows them. Data leakage happens when outputs reveal information from other users, the index or the system prompt. Neither is solved by hosting privately; both need design and testing.
The voluntary NIST AI Risk Management Framework, released on 26 January 2023, is a useful structure for deciding which controls you need and checking that they work. Use it alongside your existing security standards rather than as a separate programme.
- Never let content the model reads change its permissions or tools
- Show sources with answers so users can check them
- Filter outputs for secrets and personal data before display
- Re-test after every model, prompt or tool change
Does hosting a model privately prevent prompt injection?
- Single sign-on, roles and network isolation come first
- Retrieval must enforce document permissions, and you should test it
- Agents need least-privilege tools and human approval for risky actions
- Prompt injection and leakage need design and testing, even when self-hosted
Write five test cases for your planned use: one permission test, one prompt injection hidden in a document, one attempt to reveal the system prompt, one request for another user's data and one risky agent action. Record the expected safe behaviour for each.
Mark it complete to track your progress on this device.