Scrivio Interview library
LeadershipAdvanced6 min read · updated 12 November 2026

How would you build an AI security programme that covers prompt injection, data leakage, model supply chain and abuse across all AI features in the company?

I would build the programme on a shared threat framework such as the OWASP Top 10 for LLM Applications, threat-model every AI feature at design review with a focus on tools, data access and how output is used, and give teams shared guardrail components: input and output filters, PII redaction, tool authorization patterns and logging. The model supply chain gets its own controls: approved models and providers, checksums for downloaded weights, licence review and safe model file formats. Finally, red teaming before launch, continuous monitoring and incident response playbooks for AI misuse.

Why this question is asked

Once a company has a dozen AI features built by different teams, security cannot be handled feature by feature through heroics. Each team meets prompt injection, data leakage and abuse for the first time, solves it differently, and some do not solve it at all. Interviewers ask this leadership question to see whether we can build a programme, a repeatable system of standards, shared components and checks, that scales across the company without blocking delivery. In this answer, we will set up a common threat framework, put threat modelling into design reviews, build shared guardrails, secure the model supply chain, and run red teaming, monitoring and incident response, explaining why each part is there.

1A Shared Framework for Threats

Teams need a common vocabulary before they can share solutions. The OWASP Top 10 for LLM Applications is a good starting point: it lists the main risk categories, such as prompt injection, sensitive information disclosure, supply chain risks, data and model poisoning, improper output handling, excessive agency (giving the model more power than it needs), system prompt leakage, weaknesses in vectors and embeddings, misinformation and unbounded consumption, with typical controls for each. The list is updated periodically, so we use the current edition.

We map that framework onto our own context: which categories apply to our features, which controls we require for each, and who owns them. The result is a short internal standard, a few pages, that design reviews, guardrail libraries and audits all refer to.

From threat to control (selected categories)
ThreatTypical causeRequired control
Prompt injectionUntrusted text in the contextLeast-privilege tools, confirmation, delimiting
Sensitive data disclosureUnfiltered retrieval, logs with PIIACL-filtered retrieval, redaction
Improper output handlingOutput used as HTML, SQL or commandsEncoding, validation, no direct execution
Excessive agencyBroad tools, service accountsUser-scoped authorization, caps
Supply chainUnvetted models, unsafe weight filesApproved list, checksums, safe formats
Unbounded consumptionNo quotas, abusive usersRate limits, budgets, monitoring
Based on the OWASP Top 10 for LLM Applications; use its current edition.

2Threat Modelling Every Feature at Design Review

The cheapest time to fix an AI security problem is before it is built. Every new AI feature goes through a design review with a short threat model, focused on three questions. What tools and actions can the model trigger, and with whose permissions? What data can reach the model's context, from where, and who may see it? How is the model's output used: shown to a user, stored, rendered as HTML, executed as a query, passed to another system?

Those three questions find most serious problems. A summariser that also has an email tool, a RAG bot indexing HR documents without permissions, a feature that runs generated SQL with a powerful database user: each is obvious once someone asks the question. A security champion in each team, trained by the central security group, runs these reviews so the central team is not a bottleneck.

Step throughSecurity path of a new AI feature
  1. Design review with threat modeltools, data access, output use
  2. Use shared guardrailsfilters, redaction, tool authorization, logging
  3. Check models against the approved list
  4. Red team before launchinjection, leakage, abuse
  5. Critical findings fixed?
    YesLaunch with monitoringNoFix and re-test
  6. Monitor and respondalerts, playbooks, regression tests

6 steps in order. Play them, or step through them one at a time.

3Shared Guardrail Components

Asking every team to build its own defences leads to uneven quality. The platform and security teams provide shared components, usually as part of the company's AI starter and gateway. Input filters detect obvious injection patterns and secrets before content reaches the model. Output filters check for leaked secrets, personal data and disallowed content before the answer reaches a user. PII redaction removes or masks personal data in prompts where the use case does not need it, and in logs. Tool authorization patterns, such as passing the user identity through a tool context and requiring confirmation for side effects, come as tested library code and examples. And standard logging records model, prompt version, tools called and outcomes for every request.

These components do not make a feature secure on their own, but they make the secure path the easy one, and a fix to a shared filter reaches every feature at once.

Java
// What a team writes when the shared guardrails are in the starter
ChatClient chat = builder
.defaultAdvisors(
guardrails.inputFilter(), // injection patterns, secrets -> blocked or flagged
guardrails.piiRedaction(), // emails, IBANs, phone numbers masked before the call
guardrails.outputFilter(), // secrets and PII checked before the answer is returned
guardrails.auditLog("claims-assistant"))
.build();
// audit: feature=claims-assistant model=chat-standard tools=[] input_flags=0 output_flags=0

Spring AI's advisors, interceptors around each ChatClient call, are a natural place to plug these in; the names above are our own components, not framework classes.

4Securing the Model Supply Chain

Models and the tools around them are dependencies, and they can be compromised or simply unsuitable. We keep an approved list of providers and models, each reviewed for terms, data handling and region. For open-weight models we download, we pin exact versions from trusted sources, verify checksums, and scan them like other artefacts. We prefer safe file formats such as safetensors, which only contain tensors, over formats based on Python pickle, which can execute code when loaded.

Licences are reviewed too, since open-weight model licences vary and some impose conditions on use. The same applies to agent tools, plugins and MCP servers that give models access to systems: each one is an integration with its own permissions and must be approved like any other.

5Red Teaming, Monitoring and Incident Response

Before a significant AI feature launches, a red team tries to break it: direct and indirect prompt injection, attempts to extract other users' data, abuse of tools, jailbreaks to produce harmful content, and attempts to run up costs. Findings are fixed before launch and each becomes a regression test in the feature's evaluation suite, so the attack stays fixed.

After launch, monitoring watches for signals of misuse: spikes in filter flags, unusual tool call patterns, authorization failures, retrieval of sensitive sources by unexpected users, and sudden cost increases. And when something happens, teams need a playbook: how to switch a feature to read-only or off quickly, how to preserve logs, how to assess which data was exposed, who must be told (including data protection officers where personal data is involved), and how to deploy a fix. We rehearse it once a year like any other incident.

6Follow-up questions

How do you avoid the programme slowing teams down?

By making most of it self-service: a short standard, a threat model template that takes an hour, shared guardrails in the starter, and trained champions in the teams. Central security reviews only the high-risk features, such as those with financial tools or sensitive data.

Who owns AI security: the security team or the platform team?

Both, with clear lines. Security owns the standard, threat modelling training, red teaming and incident response; the platform team owns the gateway, starter and guardrail components; feature teams own their threat models and fixes.

How do you measure whether the programme works?

Coverage measures, such as the share of AI features with a threat model and using shared guardrails, plus outcome measures: red team findings per launch over time, incidents and their severity, and time to fix. A falling number of critical findings at launch shows the design reviews are working.

7Conclusion

In this answer, we built an AI security programme around the OWASP Top 10 for LLM Applications as a shared framework. Every AI feature gets a threat model at design review focused on tools, data access and output use; teams use shared guardrails for input and output filtering, PII redaction, tool authorization and logging; the model supply chain is controlled with approved models, checksums, licence review and safe file formats; and red teaming before launch, continuous monitoring and incident response playbooks cover misuse after launch.

What to say in the interviewAbout 80 seconds aloud

Open with

I would build it in five parts. First a shared framework, the OWASP Top 10 for LLM Applications, mapped onto our features in a short internal standard, so teams share the vocabulary for prompt injection, data disclosure, excessive agency, output handling, supply chain and unbounded consumption.

Then, if they want more

Second, threat modelling in every AI design review, asking three questions: which tools can the model trigger and with whose permissions, what data can reach the context and who may see it, and how the output is used. Security champions in the teams run these, with central security reviewing high-risk features.

Third, shared guardrail components in the AI starter and gateway: input filters for injection patterns and secrets, output filters, PII redaction in prompts and logs, tested patterns for tool authorization with the user's identity and confirmation of side effects, and standard audit logging.

Fourth, supply chain controls: an approved list of models and providers, pinned versions and checksums for downloaded weights, safe formats like safetensors instead of pickle, and licence review, plus approval for agent tools and plugins.

Fifth, red teaming before launch with every finding turned into a regression test, monitoring for flags, unusual tool use and cost spikes, and incident playbooks for switching features off, assessing exposure and notifying, rehearsed regularly.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Spring AI reference
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "How would you build an AI security programme that covers prompt injection, data leakage...": https://scrivio-interview-library.netlify.app/spring-boot/llm-fundamentals/425304fcc6/