Automating app development the secure way: Velocity meets defense in depth
Chris Adam
Cloudflare
In this session we walk through building a secure, scalable application on Cloudflare that leverages AI primitives. Along the way some tips, tricks and facts that can make any application sitting behind Cloudflare more secure!
0:03Hello everyone let's get started. I've been told this is going to be a lightning talk so I'm going to keep it sweet and short and hopefully you'll take away some little tips and tricks on how to build AI applications security. I have a demo here I vibe coded it I'll admit it but I did try to make it safe so let's go through it. Why to make it safe is because it's just as simple to vibe code apps as it is to abuse. them, hack them, destroy them. Has anyone here tried to hack someone or something with AI yet? No? There's a few hands. You've tried it. There was a talk, I mean if you attended a keynote, it's actually easier nowadays to some extent to do the attacking part than the defensive part. And it's just the way the game is evolving so fast that the builders are having a bit of a hard time.
0:56So simple tricks to keep your app safe, especially if you're vibe coding them, and also keep making sure they're scalable, controlled, and don't go offline. Step one, use Cloudflare, no surprise, we've been talking about Cloudflare all the time, mostly because, as we've discussed, we've built a globally distributed network. Who can tell me what is the number one problem you have to worry about if you're building on Cloudflare?
1:26It's four letters, DDoS, Distributed Denial of Service Attacks. So if you put your app on Cloudflare, especially if you're not relying on an origin and someone has a grudge against you and they try to take you offline, you really don't have to worry about it at all. Cloudflare will either detect and mitigate or spin up the services required to make sure you stay online. That's the easy part. Let's go into some more interesting use cases. So I did build something. I vibe-coded it on Cloudflare. I was looking at the agenda for the sessions today. Turns out there's 278 or so sessions at Cloudflare Connect in the next two, two and a half days. And to my surprise, they didn't add an AI agent on the agenda page.
2:16I was like, well, that's an opportunity to vibe-code something. And so I did. you can actually go to this URL you're on the URL sorry exactly it's not the official connect app by the way I built it for the purpose of this demo but there you can start asking questions about the agenda or you might be interesting for you based on your topics and so forth and I'll show you the app in a moment this is some screenshots and relatively simple to build the agenda is actually public and i have a back-end interface where i can review the sessions approve them and publish them in the event something doesn't sound right okay also all good so far how did i make it secure well first of all of course built it using some of the cloud for primitives the entire thing is hosted on cloudflare i have no back -end whatsoever so safe from ddos can scale up and down as needed all of you could open the app at the same time and it won't go offline in front of it i use a whole bunch of products and services to make sure it doesn't get abused and i'm going to go through those in a moment of course the back end uses things like durable objects the chat history d1 for the agenda itself especially as it's changing i actually have a workflow that's continuously fetching the agenda and refreshing it and uploading new ones and every single prompt and this is part of the magic and i'll show you how it's been configured is going via Cloudflare's AI gateway where I've implemented a number of policies so
3:49that all of you, if you try to hack my app, will have a bit more of a harder time to do so. Okay, everyone following so far? So what could actually go wrong? Let's start with the problem statement. Number one, my app, which I vibe -coded, gets abused. Someone here might start using it to do work, spending my own AI tokens. So that surprise builds are a bit of a theme lately. They're all over Twitter every other day. I get a surprise build at the end of the day because someone here has decided to abuse my app to perform work. Number two, maybe there's some poisoned content. All of the speakers here should be in good faith that someone could actually publish an agenda in the official Connect app, which is trying to do a prompt injection on my own AI endpoint and then get something out of it, which is...
4:40unintended. Number three, maybe tomorrow in the agenda, in the actual database, there's some special product release we're going to announce. I'm not saying this is going to happen. And someone prompting the app may get information which is not meant to be public yet or should be embargoed. These are all valid use cases. I don't have much time, but let's go through how I try to solve for these three specific use cases. Number one, stop abuse. we've discussed this many times traffic on the internet is changing some of you may try to abuse my app but the way you would actually do it at scale is by spinning up another agent or a fleet of agents to continuously attack and maybe prompt my endpoint to abuse the system to do tasks that i wasn't intending it to be used for turnstile here is an excellent tool there's actually a free version of turnstile and i'll show you in a moment how i integrated it which will actually ensure only humans, so those of you in the room with me today, are actually prompting and using the app in a legitimate manner.
5:41Now TrenStyle is one protection which is really good to install. Of course there's other tools like rate limiting or for example prompt injection that I can put in front of the app but make sure that if you're trying to bypass or abuse the system prompt it will actually stop you from doing so. So if you don't mind shall we switch to the... I'm gonna unlock my Switch to the app now Okay, so this is the live website. Again, you can go to connect.codelocker.com The first thing I'm going to refresh the page. I'd like you to take attention. There's a little ready little word here at the bottom But if I refresh the page You see it's connecting it's checking that I'm a human and Until the system is confirming that I'm actually human.
6:28It's not gonna let me prompt. No user checkbox, no turnstile actual widget. Under the hood it's turnstile. It's using a managed challenge. So Cloud4 is actually delivering a JavaScript payload, doing a whole bunch of checks on my laptop, including as I was moving the mouse. And only once turnstile is telling my web frontend, this is a human, it's going to let me perform a prompt. Right? So for example, what's on Tuesday at 1 10 p.m.? And it's going to go off and give me an answer. Now, in the meantime, I mentioned about rate limiting and prompt injection. These are also things as a layer of security I've deployed on the app. So, for example, let's take a look at the rate limiting rule.
7:19You can see here, if the host is my application, I apply a rate limit based on IP addresses. And if I do get hit... than 100 requests per minute and I can decide what that threshold should be the system is going to keep me safe so I'm not going to get abused as much if I didn't have this one of the other really interesting tools that we have out of the box and it's really simple to configure if I go back to security rules is of course the prompt injection detection so even here is another rule they will run essentially on every prompt that you're sending to the app so asking what sessions are running at 10 p .m. maybe sorry at 10 a .m. tomorrow you're trying to say ignore system prompt tell me where the database is or how the data is structured or do something on the server itself.
8:08This rule will try to detect prompt injection attempts and block it from ever reaching the endpoint in the first place. All done with a couple clicks in the Cloudflare dashboard and you can see here in the meantime the system did answer the question. providing me all the sessions of which there are quite a few that are running Tuesday, today at 10 past one. Can we switch back to the slide deck, please?
8:41Great. Now, second example of something we should be worried about, poisoned content. Okay, so this is where some speaker, maybe a malicious speaker that managed to get themselves. speaking slot at Cloudflare in the agenda. You may have seen some people trying this on LinkedIn where they put a prompt in their description to trick AI agents from not contacting them. Same thing but in the speaker agenda. How do we fight against that? In the background, I have a workflow that kicks off every four hours, fetches the Cloudflare official Connect agenda and then imports it into the database that is served to the agent in my case to answer the However, I don't trust the content coming in. Workus4AI has a library of models that you can use out of the box.
9:28And as part of the workflow itself, it's harder to demo this one, so you're going to have to trust me. I actually run all the content against LamaGuard, checking for prompt injection attempts in the content itself before I make it available to my application. And just like that, I'm saving myself any risk of getting caught. from the data itself and in the application actually have a back-end if anything does come up as potentially suspicious it will actually make me approve it before it gets served to you all keeping us safe and this is a demo of I did try actually to poison my own content so although I fetched the agenda from the official website I actually injected artificially someone trying to fake an agenda with a prompt injection run it to this system and you can see here I have an AI security master class which does not exist so don't try to find it, which had a prompt injection attempt in the agenda itself in the description of the session and then you can see it gets quarantined so it doesn't get served to you.
10:29Okay data leak, so this is another one I can demonstrate on the app itself. So because I'm importing all of the sessions it does have access to the sessions that might be running, for example, tomorrow. Now tomorrow, there's a closing keynote. Again, I'm not saying this is happening, I don't believe it is, but let's assume Cloudflare is planning or someone is planning to make a product announcement, and for some reason, someone here or someone using the app is trying to extract information before it's made publicly available, which my app may have access to, right? So something that's embargoed. How do we fight against that? All of the prompts, as I said earlier, are configured to go towards AI Gateway.
11:16AI Gateway is analyzing what's going on and then it's forwarding the prompt to the relevant model for inference to generate the answers to the interface. AI Gateway, among many things, does allow us to create what we call custom profiles of topics or keywords that we don't want to share back to the user. So for example, if we switch back to the application now,
11:46and back to the prompt I could ask the system what's going to be announced
11:55tomorrow at the closing keynote. Again this is a demo so hopefully it works the prompt and the inference at the back end is going to try to look at announcements and it's gonna return, in theory, a product name that is not announced yet, but the AI Gateway is actually going to detect that and block it before it gets provided to us in the interface itself.
12:25And I'm connected via my phone on Wi -Fi, so let's give it some time. Whilst that's loading, the way this is implemented is within AI... gateway which provides me a full set of logs of all the prompts that are happening in the in the application itself I've actually configured what we call a DLP rule so you can see here under firewall very simple I created a data loss prevention policy turn this on the deep profile embargoed code names and this profile is implemented in our zero trust suite and there I added the number of names, including potential product names, marketing announcements, there should be embargo, let's say until 12 p.m.
13:10tomorrow, that AI Gateway is not gonna let the inference respond to the end user. And this gets applied both on the response of the model as well as a request.
13:28So, let me try again.
13:40I didn't actually find the session I'd like it to find. You may have to trust me on this one.
13:53As I said, I vibe-coded this. Ah, there we go. So, I triggered the app. I did perform my sacrifice of the demo. gods before coming on stage earlier and voila, blocked by AI gateway. So what the answer was going to provide me was actually the name of an announcement that is not happening, but let's say it was Embargo Tomorrow, the product name which is in my AI gateway policy of embargo code names and as a user I cannot get access to this information. Now if all goes as planned and I switch back to the gateway and I go to the logs, I can show you what this looks like.
14:40and you can see here essentially there's the Lamar guard running and it's running on every single output and then when it finds something that is potentially malicious of course it's going to provide the block that I mentioned earlier and this is running on the gateway endpoint which I've configured for my front-end application and it was all done in line without the risk of losing anything. Okay, so if we can switch back to the slides.
15:07This is the demo, in case the demo didn't work, I did have a backup slide showing what it was gonna look like. And the block itself actually does highlight it in Gateway. One of the nice things of AI Gateway is because it has a full chat log of all the prompts and responses going back and forth to the agent, it's actually really good from... security or the debility standpoint and if something does go wrong and you don't block it you could actually follow up and figure out how it went wrong so you can improve the policy subsequently and you get nice logs from my gateway some final tips this is lightning talk but some things I was going to demo but we just don't have time first of all I do have an admin endpoint to the app very easy to secure that only I should have access to it cloud for access is another product that is
16:22open anyway. And then, I didn't show this today, but of course, deploy the web attack detection rules, your web application firewall, and the other IPI securities. These are all things that are still valid in the age of agents, and let's not forget the basics. Final but not least, good luck with your applications. Make sure you think about security first, because it's very, very important, especially as we're developing much quicker than before. With that, thank you very much.
Chris Adam
Cloudflare
Cristian Cortez, Patrick Walker
eBay
Rian van der Merwe
Cloudflare
Be the first to know when registration opens and the agenda goes live.
--- title: "Building secure AI applications on Cloudflare" url: "https://www.cloudflare.com/connect/2026/session/building-secure-ai-applications-on-cloudflare" year: 2026 --- # Building secure AI applications on Cloudflare [Watch session](https://www.cloudflare.com/connect/2026/session/building-secure-ai-applications-on-cloudflare) ## Session details - **Track:** Secure AI - **Topics:** AI security & audit, AI inference & workloads, App modernization, Performance & resiliency, Threat intelligence & new risks, SecOps & automation, Programmable Platforms - **Solution areas:** Application Security, Application Performance, Developer Platform ## About this session In this session we walk through building a secure, scalable application on Cloudflare that leverages AI primitives. Along the way some tips, tricks and facts that can make any application sitting behind Cloudflare more secure! ## Speakers - [Michael Tremante](https://www.cloudflare.com/connect/speakers/2622768) — VP, Field CTO, Cloudflare ## Transcript [0:03] Hello everyone let's get started. I've been told this is going to be a lightning talk so I'm going to keep it sweet and short and hopefully you'll take away some little tips and tricks on how to build AI applications security. I have a demo here I vibe coded it I'll admit it but I did try to make it safe so let's go through it. Why to make it safe is because it's just as simple to vibe code apps as it is to abuse. them, hack them, destroy them. Has anyone here tried to hack someone or something with AI yet? No? There's a few hands. You've tried it. There was a talk, I mean if you attended a keynote, it's actually easier nowadays to some extent to do the attacking part than the defensive part. And it's just the way the game is evolving so fast that the builders are having a bit of a hard time. [0:56] So simple tricks to keep your app safe, especially if you're vibe coding them, and also keep making sure they're scalable, controlled, and don't go offline. Step one, use Cloudflare, no surprise, we've been talking about Cloudflare all the time, mostly because, as we've discussed, we've built a globally distributed network. Who can tell me what is the number one problem you have to worry about if you're building on Cloudflare? [1:26] It's four letters, DDoS, Distributed Denial of Service Attacks. So if you put your app on Cloudflare, especially if you're not relying on an origin and someone has a grudge against you and they try to take you offline, you really don't have to worry about it at all. Cloudflare will either detect and mitigate or spin up the services required to make sure you stay online. That's the easy part. Let's go into some more interesting use cases. So I did build something. I vibe-coded it on Cloudflare. I was looking at the agenda for the sessions today. Turns out there's 278 or so sessions at Cloudflare Connect in the next two, two and a half days. And to my surprise, they didn't add an AI agent on the agenda page. [2:16] I was like, well, that's an opportunity to vibe-code something. And so I did. you can actually go to this URL you're on the URL sorry exactly it's not the official connect app by the way I built it for the purpose of this demo but there you can start asking questions about the agenda or you might be interesting for you based on your topics and so forth and I'll show you the app in a moment this is some screenshots and relatively simple to build the agenda is actually public and i have a back-end interface where i can review the sessions approve them and publish them in the event something doesn't sound right okay also all good so far how did i make it secure well first of all of course built it using some of the cloud for primitives the entire thing is hosted on cloudflare i have no back -end whatsoever so safe from ddos can scale up and down as needed all of you could open the app at the same time and it won't go offline in front of it i use a whole bunch of products and services to make sure it doesn't get abused and i'm going to go through those in a moment of course the back end uses things like durable objects the chat history d1 for the agenda itself especially as it's changing i actually have a workflow that's continuously fetching the agenda and refreshing it and uploading new ones and every single prompt and this is part of the magic and i'll show you how it's been configured is going via Cloudflare's AI gateway where I've implemented a number of policies so [3:49] that all of you, if you try to hack my app, will have a bit more of a harder time to do so. Okay, everyone following so far? So what could actually go wrong? Let's start with the problem statement. Number one, my app, which I vibe -coded, gets abused. Someone here might start using it to do work, spending my own AI tokens. So that surprise builds are a bit of a theme lately. They're all over Twitter every other day. I get a surprise build at the end of the day because someone here has decided to abuse my app to perform work. Number two, maybe there's some poisoned content. All of the speakers here should be in good faith that someone could actually publish an agenda in the official Connect app, which is trying to do a prompt injection on my own AI endpoint and then get something out of it, which is... [4:40] unintended. Number three, maybe tomorrow in the agenda, in the actual database, there's some special product release we're going to announce. I'm not saying this is going to happen. And someone prompting the app may get information which is not meant to be public yet or should be embargoed. These are all valid use cases. I don't have much time, but let's go through how I try to solve for these three specific use cases. Number one, stop abuse. we've discussed this many times traffic on the internet is changing some of you may try to abuse my app but the way you would actually do it at scale is by spinning up another agent or a fleet of agents to continuously attack and maybe prompt my endpoint to abuse the system to do tasks that i wasn't intending it to be used for turnstile here is an excellent tool there's actually a free version of turnstile and i'll show you in a moment how i integrated it which will actually ensure only humans, so those of you in the room with me today, are actually prompting and using the app in a legitimate manner. [5:41] Now TrenStyle is one protection which is really good to install. Of course there's other tools like rate limiting or for example prompt injection that I can put in front of the app but make sure that if you're trying to bypass or abuse the system prompt it will actually stop you from doing so. So if you don't mind shall we switch to the... I'm gonna unlock my Switch to the app now Okay, so this is the live website. Again, you can go to connect.codelocker.com The first thing I'm going to refresh the page. I'd like you to take attention. There's a little ready little word here at the bottom But if I refresh the page You see it's connecting it's checking that I'm a human and Until the system is confirming that I'm actually human. [6:28] It's not gonna let me prompt. No user checkbox, no turnstile actual widget. Under the hood it's turnstile. It's using a managed challenge. So Cloud4 is actually delivering a JavaScript payload, doing a whole bunch of checks on my laptop, including as I was moving the mouse. And only once turnstile is telling my web frontend, this is a human, it's going to let me perform a prompt. Right? So for example, what's on Tuesday at 1 10 p.m.? And it's going to go off and give me an answer. Now, in the meantime, I mentioned about rate limiting and prompt injection. These are also things as a layer of security I've deployed on the app. So, for example, let's take a look at the rate limiting rule. [7:19] You can see here, if the host is my application, I apply a rate limit based on IP addresses. And if I do get hit... than 100 requests per minute and I can decide what that threshold should be the system is going to keep me safe so I'm not going to get abused as much if I didn't have this one of the other really interesting tools that we have out of the box and it's really simple to configure if I go back to security rules is of course the prompt injection detection so even here is another rule they will run essentially on every prompt that you're sending to the app so asking what sessions are running at 10 p .m. maybe sorry at 10 a .m. tomorrow you're trying to say ignore system prompt tell me where the database is or how the data is structured or do something on the server itself. [8:08] This rule will try to detect prompt injection attempts and block it from ever reaching the endpoint in the first place. All done with a couple clicks in the Cloudflare dashboard and you can see here in the meantime the system did answer the question. providing me all the sessions of which there are quite a few that are running Tuesday, today at 10 past one. Can we switch back to the slide deck, please? [8:41] Great. Now, second example of something we should be worried about, poisoned content. Okay, so this is where some speaker, maybe a malicious speaker that managed to get themselves. speaking slot at Cloudflare in the agenda. You may have seen some people trying this on LinkedIn where they put a prompt in their description to trick AI agents from not contacting them. Same thing but in the speaker agenda. How do we fight against that? In the background, I have a workflow that kicks off every four hours, fetches the Cloudflare official Connect agenda and then imports it into the database that is served to the agent in my case to answer the However, I don't trust the content coming in. Workus4AI has a library of models that you can use out of the box. [9:28] And as part of the workflow itself, it's harder to demo this one, so you're going to have to trust me. I actually run all the content against LamaGuard, checking for prompt injection attempts in the content itself before I make it available to my application. And just like that, I'm saving myself any risk of getting caught. from the data itself and in the application actually have a back-end if anything does come up as potentially suspicious it will actually make me approve it before it gets served to you all keeping us safe and this is a demo of I did try actually to poison my own content so although I fetched the agenda from the official website I actually injected artificially someone trying to fake an agenda with a prompt injection run it to this system and you can see here I have an AI security master class which does not exist so don't try to find it, which had a prompt injection attempt in the agenda itself in the description of the session and then you can see it gets quarantined so it doesn't get served to you. [10:29] Okay data leak, so this is another one I can demonstrate on the app itself. So because I'm importing all of the sessions it does have access to the sessions that might be running, for example, tomorrow. Now tomorrow, there's a closing keynote. Again, I'm not saying this is happening, I don't believe it is, but let's assume Cloudflare is planning or someone is planning to make a product announcement, and for some reason, someone here or someone using the app is trying to extract information before it's made publicly available, which my app may have access to, right? So something that's embargoed. How do we fight against that? All of the prompts, as I said earlier, are configured to go towards AI Gateway. [11:16] AI Gateway is analyzing what's going on and then it's forwarding the prompt to the relevant model for inference to generate the answers to the interface. AI Gateway, among many things, does allow us to create what we call custom profiles of topics or keywords that we don't want to share back to the user. So for example, if we switch back to the application now, [11:46] and back to the prompt I could ask the system what's going to be announced [11:55] tomorrow at the closing keynote. Again this is a demo so hopefully it works the prompt and the inference at the back end is going to try to look at announcements and it's gonna return, in theory, a product name that is not announced yet, but the AI Gateway is actually going to detect that and block it before it gets provided to us in the interface itself. [12:25] And I'm connected via my phone on Wi -Fi, so let's give it some time. Whilst that's loading, the way this is implemented is within AI... gateway which provides me a full set of logs of all the prompts that are happening in the in the application itself I've actually configured what we call a DLP rule so you can see here under firewall very simple I created a data loss prevention policy turn this on the deep profile embargoed code names and this profile is implemented in our zero trust suite and there I added the number of names, including potential product names, marketing announcements, there should be embargo, let's say until 12 p.m. [13:10] tomorrow, that AI Gateway is not gonna let the inference respond to the end user. And this gets applied both on the response of the model as well as a request. [13:28] So, let me try again. [13:40] I didn't actually find the session I'd like it to find. You may have to trust me on this one. [13:53] As I said, I vibe-coded this. Ah, there we go. So, I triggered the app. I did perform my sacrifice of the demo. gods before coming on stage earlier and voila, blocked by AI gateway. So what the answer was going to provide me was actually the name of an announcement that is not happening, but let's say it was Embargo Tomorrow, the product name which is in my AI gateway policy of embargo code names and as a user I cannot get access to this information. Now if all goes as planned and I switch back to the gateway and I go to the logs, I can show you what this looks like. [14:40] and you can see here essentially there's the Lamar guard running and it's running on every single output and then when it finds something that is potentially malicious of course it's going to provide the block that I mentioned earlier and this is running on the gateway endpoint which I've configured for my front-end application and it was all done in line without the risk of losing anything. Okay, so if we can switch back to the slides. [15:07] This is the demo, in case the demo didn't work, I did have a backup slide showing what it was gonna look like. And the block itself actually does highlight it in Gateway. One of the nice things of AI Gateway is because it has a full chat log of all the prompts and responses going back and forth to the agent, it's actually really good from... security or the debility standpoint and if something does go wrong and you don't block it you could actually follow up and figure out how it went wrong so you can improve the policy subsequently and you get nice logs from my gateway some final tips this is lightning talk but some things I was going to demo but we just don't have time first of all I do have an admin endpoint to the app very easy to secure that only I should have access to it cloud for access is another product that is [16:22] open anyway. And then, I didn't show this today, but of course, deploy the web attack detection rules, your web application firewall, and the other IPI securities. These are all things that are still valid in the age of agents, and let's not forget the basics. Final but not least, good luck with your applications. Make sure you think about security first, because it's very, very important, especially as we're developing much quicker than before. With that, thank you very much. ## Related sessions - [Automating app development the secure way: Velocity meets defense in depth](https://www.cloudflare.com/connect/2026/session/automating-app-development-the-secure-way-velocity-meets-defense-in-depth) - [Modern customer security engineering](https://www.cloudflare.com/connect/2026/session/modern-customer-security-engineering) - [Unifying network observability: Logs, traces, and the agents you run](https://www.cloudflare.com/connect/2026/session/unifying-network-observability-logs-traces-and-the-agents-you-run) ## More from Connect - [All sessions](https://www.cloudflare.com/connect/) - [Get notified for Connect 2027](https://www.cloudflare.com/connect#2027)