Shipping LLM Features Without Shipping a Security Incident
A language model in your product is an untrusted-input processor with the credentials of whatever you connected it to. That framing removes most of the mystery from securing it: everything the model reads is data, never instructions, and everything the model can call needs an authorisation check of its own.
Treat retrieved content as hostile
Documents, web pages, emails and user uploads can contain text crafted to redirect the model. Never let retrieved content decide which tool runs or which record is written. Keep the decision to act inside your code, with the model supplying arguments that you validate.
Authorise every tool call server-side
If a tool can read a customer record, it must check that the current user is allowed to read that record — the same check you would apply to a REST endpoint. The model is not an authentication boundary and cannot be trusted to scope its own queries.
- Validate tool arguments with a schema before execution
- Scope database access to the requesting user, not to a service account
- Log every tool invocation with the user identity for audit
Constrain what leaves your network
Redact identifiers that the feature does not need before the request is sent to a provider. Under the DPDP Act, 2023, sending personal data to a processor does not transfer your obligations, so minimisation is both a security control and a compliance one.
Cap cost like you cap rate limits
Per-user and per-tenant token budgets, maximum context sizes and hard timeouts prevent a single loop or abusive script from producing a bill nobody approved. Alert on spend per hour, not only per month.
Keep an evaluation and rollback path
Pin model versions, keep the previous prompt available behind a flag, and run the regression set before every release. Silent provider updates are a real source of production regressions.
Key takeaway
Model output is a suggestion, not an instruction. Authorise, validate and budget everything it touches, and the feature becomes an ordinary piece of software to operate.
Want this applied to your business?
Makandaax Private Limited builds AI, software and SaaS systems for Indian and global teams, on-site and through hybrid delivery models.
Talk to our team