The threat model is the source of truth

Coding agents made the prototype cheap, but deploying, integrating and operating an app is as hard as it ever was. The code shows what an app does and the config shows how it’s deployed, but only the threat model says what it’s supposed to be.
The prototype was never the hard part
If you build with coding agents, you already know how fast the code comes now. This piece is about everything after it, and the clearest example I have comes from a friend of mine in the Swedish public sector.
His organization has budget to buy software, but specifying and procuring a project takes forever. So he built what he needed at home, with Claude. Then he asked me two questions. How do I deploy it, so I can show it to my colleagues? And how do I make it secure?
Those questions were hard long before anyone had a coding agent, and they’re just as hard now, because the prototype was never what made them hard. Claude had already suggested a domestic hosting provider. I leaned towards a Swedish region in a large cloud like Azure, since in many cases it gives better containment and operations for an organization like his. But neither Claude nor I should make that call. It depends on the organization’s policies and the data the app processes, and it’s for his IT department to approve.
Where the data is stored is only half of it. For an organization like his, the next question is who can legally access it, for example whether a US-owned provider can be compelled to hand over data even when it’s stored in Sweden. Sweden’s new national cloud policy asks public-sector organizations to take that exposure into account when they procure, and to plan in advance how to leave if needed.
It’s great that he thought about security at all, and building the app himself is exactly what AI coding makes possible. But he shouldn’t need a friend to answer any of this. Who owns the app now? Where does the data go? And how would IT ever say yes to it, or know what happens to it if he changes jobs?
I see the same pattern in large tech companies. Every app has to be built, operated and secured, and each of those disciplines holds a different piece. The builder knows what the app is for, operations knows the infrastructure and access, and security knows the risks but rarely has the capacity to review every app and every change by hand. In separate departments, an app reaches production before IT knows it exists. In a DevOps team the gap moves into one head instead, and the developer who ships the feature is also expected to get the mesh policy, the backups and the egress rules right.
The threat model is where intent lives
Most threat models start by asking what we are working on, and answering that means writing down what the app is supposed to be. The threat model records intent. Code shows what the app does; infrastructure config shows how it’s deployed. Neither tells you what it’s supposed to do, so without the threat model nothing can tell you when either one is wrong.
That’s why I think it should be the single source of truth, both for security requirements and for how an app is built, deployed, integrated and operated.
Threat model
What the app is supposed to be
- What it does
- Which data it handles
- Users and roles
- Who should reach it
- What it talks to
Secure
What can go wrong, and what to do about it
Build
Authorization in the code matches the roles
Deploy
Exposure and identity follow who should reach it
Integrate
Only approved services, in approved jurisdictions, get the data
Operate
Backups, logging and alerts sized to what’s at stake
How it should be architected and deployed
At a single customer, we now model close to 4000 repositories, including infrastructure as code, and thousands of pull requests every week. A lot of the security issues there aren’t in the code at all. They sit in the combination of architecture and deployment, like a service that’s only used internally but is exposed to the internet, or Istio authorization policies that allow far more than the service needs.
Often the pieces of a single app live in different repos, the service in one, the ingress in another and the mesh rules in a third, and each passes its own check.
Repo 1
The service
Code scanning
Repo 2
The ingress
IaC scan
Repo 3
The mesh rules
Cloud security tool
Threat model
The service only has internal callers
Reachable from the internet. Something is wrong.
Each tool sees one layer, and none of them knows the intent.
A cloud security tool that can see the endpoint is public, but not whether it should be, either flags everything and drowns teams in noise or flags nothing. The same gap goes well beyond exposure. Does logging and monitoring cover what it needs to? Are rate limits set where they’re needed? Could you actually recover from a disaster? None of it can be read from code or config alone, because the answer depends on what the app is supposed to do and what’s at stake if it fails.
Take identity. A deployed app should use the organization’s identities and single sign-on, but AI-built apps often come with their own login and user database, because that’s the quickest way to get something working. The threat model already defines who the users are and which roles they have, so it can say how the app should connect to the identity provider, which groups map to which roles, and whether the authorization in the code matches. When someone changes jobs or leaves, their access follows the identity and goes away with it.
Services work the same way. When the app talks to a database or another service, it should use an identity issued by the platform, like a managed identity in Azure, which leaves fewer secrets to manage and fewer that can leak.
What it should be allowed to connect to
What the app itself connects to matters just as much as who can reach it. Coding agents add analytics, error tracking, payment providers and, more and more often, AI services without much thought. Every one of those is a way for data to leave, through a careless integration, a compromised dependency calling home, or an AI feature tricked by prompt injection into contacting someone it shouldn’t.
Using a model in an agentic system might be perfectly fine. But who should tell whether the data it processes is safe to send outside the EU? The developer who added the API call, or the coding agent that suggested it? The threat model knows which data flows where and how sensitive it is, so it can tell when personal data is about to reach a model hosted outside the EU, and require a guardrail that actually prevents it, such as an EU-hosted model, redacting the data before the call, or an egress rule that blocks the connection.
Location alone isn’t enough either. The threat model can also hold who may legally access the data, so the guardrail depends on the provider’s jurisdiction and not only on where its servers are. For my friend’s app, the rule could be “citizen data only goes to approved services hosted in the EU”. In a service mesh, it could mean allowing only the egress each service needs and denying the rest. Across an organization, that adds up to something security and privacy teams have wanted for years, an up-to-date map of every external service, who uses it and what data goes there.
How it should be operated
Then there are backups, recovery, logging and monitoring, which many AI-built apps skip entirely because the AI focuses on the app and not on running it. What an app needs here depends on how critical it is and what data it holds, and the threat model already knows both. So it can derive how often to back up, how fast you need to recover, what deserves an alert, and what never to log, since logs and backups leak sensitive data more often than people think.
And operations never end. A few days after the first deploy, my friend asked me again:
“Claude says I should update Python, what do you think, Emil?”
He didn’t want to trust Claude blindly. He wanted to verify it, which is exactly the right instinct, but he had no way to do it himself. Is it a security fix, or just a new version? Will it break anything? And who verifies it next time, when I’m not around?
Patching, dependency updates and certificate renewals all raise the same two problems. Someone has to own them, and someone has to tell what actually matters for this particular app. The threat model helps with the second, because you can check the AI’s advice against what you know about the app, like whether the component is exposed or handles sensitive data. The first shouldn’t fall on each builder, and they probably don’t want it either. My friend wanted to show his app to his colleagues, and running servers was never the plan.
From one app to the whole organization
I think the right unit is one threat model per app, because that’s how people think about what they build. It covers the code, infrastructure and configuration across every repo the app spans, and it’s updated with every pull request that touches the app, generated from the change itself, so nobody has to keep it current by hand.
But apps rarely stay in their silo. Sooner or later they connect to other apps, data and services, so on top of the app models you need an organization level, composed from them rather than written as one giant model.
App model
App A
Code, infrastructure and configuration, across its repos
App model
App B
Code, infrastructure and configuration, across its repos
App model
App C
Code, infrastructure and configuration, across its repos
Organization model
What no single app model holds
- How services connect
- Shared infrastructure
- Where the crown jewels are
- “Internal services are never public”
- Developersees the app
- Platform teamsees the system
- CISOsees the organization
For my friend’s organization, the organization model would simply be every citizen-built app in IT’s cloud subscription, which is the view IT needs before it can say yes. It helps with regulation too. NIS2 is now in Swedish law through the new cybersecurity act, and managing risk starts with knowing what you have and how it’s protected. A model that’s updated with every change can answer that, where an inventory spreadsheet is outdated the day it’s finished.
Generate or verify
Once the threat model is the source of truth, it works in two directions. A new builder has intent but no infrastructure, and whether the app was built with Lovable or Claude, the threat model can generate its deployment from the organization’s policies, in a staging environment in the organization’s own cloud, while IT keeps control of the release to production. A mature organization has thousands of repos and nothing that checks whether they still match intent, so there the threat model verifies them, flags the drift and can propose the fix as a pull request.
Threat model and organization policies
One source, two directions
Generate
A new builder
Intent, but no infrastructure
Staging in the organization’s cloud
Exposure, connections, backups and logging from policy. Test data only
Release to production
Stays with IT
Verify
A mature organization
Thousands of repos and lots of infrastructure
Compared with intent
Drift is flagged, in observe mode first
The fix
Proposed as a pull request
Both leave a trail of what was intended, which requirements followed, how they were implemented, when that was verified and who approved the release.
A tip from experience: start in observe mode, and only enforce once teams trust it.
Separating prototype from production has another benefit. In staging, the builder and the coding agent work with test data and credentials that only reach staging, while production secrets and real data stay in the environment IT controls, so the agent never needs them. And the trail both modes leave, from intent to verified implementation to who approved the release, is exactly the evidence auditors ask for, whether it’s for ISO 27001, SOC 2 or a NIS2 supervisor.
The bottom line
Rather than yet another tool with its own view of the world, we need one shared description of what each app is supposed to be, that everyone building, operating and securing it can work from, whether they’re one DevOps team or three departments. The threat model is already that description. We just haven’t been using it that way.
That’s in a nutshell where we are taking Oplane. Threat models generated from code, kept up to date with every change, and used as the source of truth for how your apps are built, deployed, integrated and operated. Whether you have one citizen developer or thousands of repos.
See what your apps are supposed to be
Oplane generates the threat model from your code and keeps it current with every pull request, so you can check deployments against intent.