An app can be created using AI in one afternoon. Even then, IT must consider issues around data location and access, together with autonomous agent behaviour.
Gartner estimate that 25% of enterprise generative AI apps will suffer 5+ low-level security events per year. This is compared to 9% in 2025.
For app creation, there are three areas to secure. That includes the app’s code and data, the model’s input and output and also the behaviour of the AI agent.
Whether apps are hosted in the cloud or on-premises affects data and control ownership, but this is not exclusive. Agent controls are only effective if they are enforced by the infrastructure. Model prompts can be disregarded.
In this blog post, we’ll explore factors about AI security for app building.
AI App Development: Unique Security Issues
Why does AI security for app building need different guardrails? Standard apps execute code. But AI apps will enact what they understand from text.
As a result, there are specific additional security concerns. By 2034, this market will reach USD 221.9 billion, growing at an 18.60% CAGR.
Model Understanding Influenced by Text
Anyone can submit text to an AI application. For example, a user, file, website or email. If this text includes directions, then these can be enacted by the model.
Although models are susceptible to prompt injection (being influenced by text), there is no universal defence against this.
Agents Add Risk through Physical Action
Along with interpreting text, agents can also execute code, access APIs, communicate, and amend data. These extra functionalities mean agents can cause greater harm than chatbots.
In December 2025, the OWASP GenAI Security Project released the first Top 10 for Agentic Applications, having consulted over 100 professionals. Risks identified include agent redirection, incorrect tool usage, impersonation, and over-privilege. It also included unauthorised code execution and malicious agents.
Quick Development = Basic Security Oversights
With AI, applications can frequently be developed within days. Often those doing the development are not security engineers.
Common basic errors include exposing API keys in front-end code, failing to apply access controls to database tables, and omitting authentication for endpoints.
Cloud-based Hosting Presents Unique Risks
Cloud-based hosting offers quick and easily scalable deployment. However, that also means that neither your data, prompts, nor agent access rights are under your complete control.
Indeed, statistics highlight this issue. SailPoint reports that 82% of organisations currently use AI agents. However, just 44% have established security policies for them.
Typically, teams are working and adopting new technology at a quicker rate than their security processes can keep up with.
Common Cloud-Related Security Issues
Common cloud-related issues with AI security for app building include:
- Divided accountability: Although cloud service providers secure their platform, you remain accountable for categorising and controlling access to your data.
- Over-privileged access: Commonly, during development, agents are provided with wide access to APIs, despite the principle of least privilege.
- External elements: Frequently, cloud-based application development tools will integrate third-party plug-ins and links which you have not personally evaluated.
User-friendly platforms such as Base44 and Lovable allow non-developers to design and develop entire apps within a browser. Therefore, good governance must be embedded from the outset.
How Does an AI App Handle a Request?
In order to understand how AI security for app building works, it is useful to consider how a request is processed.
- Data is sent to your application by an individual or system.
- Combines this with application logic and submits it to an AI model.
- This can generate text or initiate a tool call (such as executing code, accessing a database and/or communication).
- The application executes tool calls and relays their outputs back to the model.
This process is then repeated until the model can provide a conclusive response.
Below is an overview of the request flow within one trust boundary (could be your cloud account or computer). The initial data (on the left) is untrusted and may contain commands which the model will enact (typically where the majority of AI-targeted attacks originate).
All items within a trust boundary are under your control. Whilst the service provider looks after the security of the data centre, you also have responsibility for securing your cloud account and physical devices.
Cloud-Hosted vs On-Premise AI Apps: What Changes?
| Cloud hosted | Locally hosted | |
|---|---|---|
| Infrastructure control | Shared. The provider secures the data centre and platform. You secure configuration, identities, and data. | You secure everything: hardware, operating system, network, model runtime and model files. |
| Where your data goes | To the cloud region you choose and, if you call a model API, to the model provider. | It stays inside your network, which suits strict data residency rules. |
| Failure points | Misconfigured database and storage rules, leaked API keys, service accounts with too much access. | Model servers reachable on the network without authentication, unpatched software, agents running on a staff laptop with access to its files. |
| Patching | The provider patches the platform. You patch your code and dependencies. | You patch all of it, on your own schedule. |
| Recommended for | Teams that want managed security controls and fast scaling. | Teams with sensitive data and the in-house skills to run and patch servers. |
Is Local Hosting Really More Secure?
Local hosting eliminates both the ‘third party’ and an organisation’s security function. But the correct option should be based on data regulation and who will be administering in year two.
Despite decreasing the attack surface, local hosting does not guarantee security. Maintenance, segmentation, and oversight must then be handled internally.
Spending on securing the cloud is booming, adding to the cloud’s associated risk. Cloud security is currently the area of cybersecurity experiencing the highest rate of growth, sitting at 28.8% in 2026.
This is a clear demonstration of just how hard organisations continue to work in order to mitigate their risk. Executing AI agents on on-site or specialised equipment can further help to limit risk.
In our article analysing the benefits and limitations of employing a Mac Mini vs a Virtual Machine for AI agents, we explored two popular local hosting solutions and the areas in which they lack segmentation.
- Network segmentation: Just as with a cloud-hosted agent, a locally hosted agent which accesses outside APIs must have appropriate egress settings.
- Update frequency: Only by having a named person/department who regularly applies updates can on-site equipment continue to remain securely updated.
- Physical access: In addition to the physical security that is already provided for you by cloud hosts, local hosting introduces another element of physical security.
How to Secure Cloud and Locally Hosted AI Apps?
The location where you host affects who is in charge of AI security for app building.
For cloud-hosted services, the provider will take care of their platform, and you will then add security to the AI applications which you create. For self-hosting, you manage the security yourself.
Cloud-Hosted AI Security
- Secure sensitive information: Never hard-code or commit to version control systems API keys and tokens – instead store these in a secrets management system. Search your version control system to identify and remove any erroneously committed keys.
- Secure database tables: Enable row-level security on all database tables so individuals can’t view data which belongs to others.
- Provide individual agent identities: Create a dedicated service identity for each agent. This should contain just the right level of authorisation and utilise temporary credentials.
- Understand data flow: Investigate where prompts and data are being analysed and stored. Find out how long a model provider stores data, and if this is used for re-training.
- Imposing limits: Enforce limits on both the number of requests and cost incurred via model API keys. This prevents uncontrolled costs if a key is compromised or if agents enter infinite loops.
- Audit agent behaviour: Log all prompts, tool invocations and results. This will allow you to trace and understand an agent’s activity.
Self-Hosted AI Security
- Secure access to the model service: Whilst many self-hosted model services automatically do not require users to authenticate, add a login stage and link this to either the local device or internal network.
- Update all components: Continually update the operating system, model execution environment, and supporting libraries. You will be responsible for carrying out these updates.
- Ensure model files are reliable: Only download models from reputable sources. Ideally, also download models in non-executable file types like safetensors.
- Separate agent functionality: Agents should be executed within a virtual machine or on a specialised server. Avoid running agents on employees’ laptops, as this will expose them to the employee’s data, web browsing history and password information.
- Secure physical devices: Ensure data on devices is encrypted. Regularly back up information and manage who has physical access to devices.
How Does an AI Agent Work?
McKinsey reports that 40% of large organisations will scale workflows using agentic AI. That’s why it’s important to understand how they work.
Like a chatbot (which can both respond and then cease), an agent will continually perform a process.
- Develops a new action based on its objective and environment.
- Uses a tool and analyses the outcome.
- Continues around this cycle until it determines that it has completed a task.
This is where agents are so powerful, but equally, can be so dangerous, as each cycle can result in physical world action. Various ‘guardrails’ are integrated within the cycle to control the transition between an agent’s plans and reality.
- An authorisation gate checks if an agent is permitted to execute specific tools.
- A policy gate prevents permanent actions from being undertaken without human approval.
- The sandbox gate ensures that file, internet and login restrictions are respected, meaning that the model cannot use language to bypass these.
- An audit log is created so that all tool usage can be reviewed.
- A maximum number of steps is set to avoid an erroneous cycle.
Again, these are all independent of the model’s behaviour and are applicable regardless of what it does.
Ready to build systems that scale with your team?
Book a complimentary 30-minute audit with a Fruition consultant. We will map your workflows, spot the automation wins and show you what the build looks like.
What Is an Agent Escape?
An agent escape is when an AI ‘breaks out’ of its defined space. This is the most common issue when it comes to AI security for app building.
Agents can access information, connect to networks, use login details, and modify systems. These are all beyond what they should be allowed to do.
As well as being the most serious form of hosting risk, this can occur both within the cloud and on one's own infrastructure.
How Do Agent Escapes Occur?
An initial method is for an attacker to embed malicious prompts within information that is analysed by the agent. For example, documents, emails, and websites.
Secondly, there does not even need to be an attacker, as agents can also ‘self-exploit’ and identify alternative methods to achieve their goal. The threat is increasing rapidly.
Within NIST’s Centre for AI Standards and Innovation laboratories, novel methods of attack have been shown to boost the percentage of successful agent takeovers from 11% to 81%. People are swiftly gaining knowledge of how to exploit previously thought-secure agents.
Three factors increase the risk of an agent breakout:
- Prompt injection: Agents can be duped by unreliable information so that they interpret it as a prompt.
- Too much agency: Agents which have greater access to tools than is required for their function are more susceptible to exploitation.
- Unrestricted behaviour: Where there are no authorisation procedures for an agent to undertake certain activities, it may carry them out without detection.
Is this already happening? Anthropic has acknowledged that their models have ‘broken out’ of a sandbox to fulfil a requirement. There have also been a number of 2026 examples where agents were solely restricted by a textual prompt.
All these situations highlight the same issue. Should the only barrier between an agent and your live database be a line of text within a prompt, then there effectively is no boundary in place.
Advanced Attack Techniques (& How They Work)
It’s possible for an attack to focus on and disrupt an AI model’s mathematics. Yet the most significant attacks against AI applications involve using the application correctly and inputting suitable prompts.
Below are the key attack methods that jeopardise AI security for app building.
Prompt Injection: Direct or Indirect
IBM defines prompt injection as a cyberattack against LLMs where hackers disguise malicious inputs as legitimate prompts. It also involves embedding a set of instructions into an input and persuading the model that these should be carried out.
Prompt injection can be both overt and covert. Here’s how that works:
- An attacker can type in instructions directly (overt injection). The far more insidious covert injection does not even require an attacker to have access to your application.
- Instructions are embedded in an item of information that will subsequently be analysed by your agent. This may include web pages, group documents, support requests and emails.
- A ‘good’ user then engages the agent in a standard way, and the agent analyses the infected information as part of this interaction. It performs the covert instruction, again, without detection.
Countering this involves recognising all incoming information as data and never as instructions. An agent should also be issued with the minimum level of privileges so that even if injection occurs, nothing important can be accessed.
Furthermore, agents should not be permitted to make permanent changes. By default, they should not be able to connect to external networks to prevent injected information from transmitting results.
Agent Data Exfiltration
Many attackers will seek to inject information in order to exfiltrate data. An agent is an ideal conduit for this.
Again, via a covert instruction, an agent is persuaded to gather data that it is authorised to access. For example, data, source code, and/or confidential information.
This data is then incorporated into a seemingly normal output such as a website address, image or API. It gets transmitted by the agent to a site controlled by the attacker. In isolation, each element of this process appears to be appropriate behaviour by the agent.
Preventing this requires disruption to one or more of these elements.
- Recognise all information as data so that the initial element of the process cannot occur.
- Ensure that an agent is not authorised to access a wide-ranging set of items and so cannot effectively gather information.
- Prevent an agent from connecting to external sites by default.
Only permit connections to specific sites. Therefore, even if all previous elements are completed, there is no outlet for exfiltrated data.
3 Other Attack Types
Other attack types to hamper AI security for app development include:
- Improper tool or privilege use arises when an agent is persuaded to utilise authorised tools in an inappropriate manner (to delete or to make payments). Permanent tools must be situated behind authorisation.
- Knowledge corruption is where incorrect information is added to an agent’s long-term memory or knowledge store and then used in subsequent sessions. Thus, the scope of what an agent can enter into its memory should be restricted, and this should be periodically checked.
- Sequential breakout occurs when an agent joins together a sequence of seemingly appropriate individual actions to effect a breakout from its sandbox environment. Again, this shows the importance of the sandbox being policed by the infrastructure, not simply by a rule within a prompt.
How to Prevent Prompt Injection and Agent Breakout?
Infrastructure protection should be used to control behaviour, not prompts. A system prompt can influence behaviour. However, it does not constitute protection.
Protection can also be provided by controlling tools and having a human confirm certain actions. Assume all model responses are untrusted and must be verified.
The 7 protections listed below implement this.
- Infrastructure, not prompts, should be used for protection. Operating systems, networking and identities should all be controlled regardless of model choice. Prompts can influence behaviour but are not protective in themselves.
- Run agents in a micro or full virtual machine to execute code. Single-kernel containers still share the host’s operating system kernel and thus can be used to break out.
- Control file system access. Permit reading and writing within an agent’s working directory. However, prohibit writing to configuration and launch files, as these are both auto-executed and are well-known breakout points.
- By default, prevent agents from accessing external networks. Only permit connections to the precise set of relevant domains. This prevents exfiltration of data.
- Don’t expose secrets to agents. Secrets will not be exfiltrated if they are never present in an agent’s environment. An API broker can manage secrets and provide agents with finely targeted and time-limited tokens.
- Control and human confirmation. Agents should only be provided with relevant tools. Critical functions, including payments, deletion, external email and production modification, need to be confirmed by a human.
- Maintain a full audit trail and have a kill switch. Log all tool usage and results. Also define a maximum number of actions and expenditure per agent session. Finally, ensure there is the ability to instantly halt an agent.
If you're formalising this across an organisation rather than for one app, our AI agent governance checklist walks through what a practical policy looks like, based on recent industry frameworks.
Pre-Launch AI Security for App Development Checklist
- No secrets in front-end code or the repository.
- Access rules on every database table, tested with two separate user accounts.
- Each agent has its own identity and the minimum permissions for its job.
- Agents that run code do so in an isolated environment with restricted files and network.
- Irreversible actions require human approval.
- Prompts, tool calls and outputs are logged and retained.
- Spend caps and step limits are set.
- The app has been scanned with a web security scanner, and the agent has been red-teamed with prompt injection and jailbreak tests.
- Someone is named as the owner of patching and incident response.
To End With
Cloud, on-site and agent controls are different options. Even so, they all relate to the level of control that you wish to have over your risk.
Good teams begin by defining and seeking authorisation for activities. They then decide which hosting option is appropriate for their data and their tolerance for administration. Deployment of an AI application has never been difficult.
If you are developing or expanding an AI-enabled application, then please undertake a security assessment. Book a free advisory session with Fruition.
We work on a ‘process first’ basis. When developing AI apps and agents, we define what can and cannot be done by the AI, what needs authorisation and also consider where data should be stored.





























