A. B. Khan

Threat-modelling a meshed .NET API

The Mesh Series · Article 23

Threat modellingAuthorizationPolicyCompliance evidenceJWT validationCERT-In & DPDPEgress controlmTLS.NET & C#

Cover: Threat-modelling a meshed .NET API

You've spent the last dozen articles building controls. A gateway that validates tokens. A service that re-validates them across five gates. mTLS between every workload. Default-deny authorization. An egress door that only opens to named hosts. Each one earns its place.

Now an auditor sits across the table and asks a question none of those controls answer: "What's your threat model?"

Not "is it secure." Not "did you run a scan." Where are the boundaries, what can cross them, and what happens when one fails. That's the question STRIDE exists to answer, and it's the one most teams skip — because it produces a document, not a green checkmark, and nobody budgets for the document.

This is the demo-to-audit gap in its purest form. Your stack demos beautifully. The threat model is the artifact that proves you understood why it's safe, not just that it happened to pass on the day.

One concept: point STRIDE at the boundaries you built

STRIDE is six failure modes, one per letter: Spoofing, Tampering, Repudiation, Information disclosure, Denial of service, Elevation of privilege. Microsoft's Loren Kohnfelder and Praerit Garg named them in 1999, and they've outlived every framework that tried to replace them, because the six map cleanly onto the questions an attacker actually asks.

The mistake is running STRIDE as a checklist once, the week before go-live, against a tidy architecture diagram. A checklist run against a diagram tells you the diagram is safe. It says nothing about the system.

The move that works: draw the trust boundaries — the lines where data crosses from one level of trust to another — and point all six letters at each line. Every boundary you built in this series is a place where a request changes hands, and every hand-off is a place a control can be present but silent.

Diagram: stride

The picture above is the system you've been assembling, redrawn as trust boundaries. The internet-to-ingress line. The ingress-to-service line. The service-to-downstream line. The workload-to-external line at egress. Pin S-T-R-I-D-E to each and you stop threat-modeling the diagram and start threat-modeling the seams.

Why it matters for regulated institutions

For a financial institution, a threat model isn't hygiene. It's a named expectation.

SAMA's Cyber Security Framework assesses you on a maturity model — you don't pass by owning a firewall, you pass by demonstrating that risk is identified, documented, and continuously managed. "Show me your threat model for the payments API" is a fair question under that framework, and "we don't have one written down" is a finding. RBI's IT framework for NBFCs pushes board-level accountability for exactly this kind of risk identification. The DPDP Act and the CERT-In six-hour clock assume you already know what a breach would look like — you can't report in six hours what you never modeled.

Here's the part teams miss. The regulator isn't asking whether you have controls. They can see the controls. They're asking whether you understood the system well enough to know which threats those controls address and which they don't. A threat model is the evidence that the security was designed, not accreted.

And a good one narrows the audit. When you can hand an assessor a STRIDE table that says "Spoofing at the edge is handled by Entra JWT validation plus mesh RequestAuthentication; here's the config; here's the log stream that proves it fires" — you've turned a week of interrogation into a document review. That compression is the whole return on the exercise.

How the components come together

Threat modeling is the first time in this series where you look at the whole thing instead of one feature. That's the point of it. Each control you built mitigates specific STRIDE categories, and only the full map shows you the gaps between them.

Walk the six against what you already have:

Spoofing — someone pretends to be a user or a workload. Mitigated on the user plane by Entra JWT validation (Article 12) and at the edge by RequestAuthentication (Article 11); on the workload plane by mTLS with SPIFFE identities (Article 14). The identity of both the caller and the callee is cryptographic, not asserted.

Tampering — someone alters data in flight or at rest. Mesh mTLS makes in-flight tampering between workloads a non-event. At-rest is your storage's job, not the mesh's — and the boundary between "the mesh protects it" and "the database protects it" is exactly the kind of seam a threat model exists to make explicit.

Repudiation — someone does a thing and there's no proof they did it. This is the one the mesh alone doesn't solve, and it's the reason Articles 24 through 28 exist. Access logs, identity-annotated traces, signed evidence — repudiation is a whole layer, not a checkbox.

Information disclosure — data leaks to someone who shouldn't see it. Default-deny authorization (Article 16) shrinks the blast radius; egress control (Article 22) is what stops the leak from leaving. You can't localize data you can't stop from exfiltrating.

Denial of service — someone exhausts the system. The mesh gives you the levers — timeouts, retries, circuit breakers, connection limits in the Envoy layer — but levers aren't a mitigation until you've set them. Default Istio will happily retry a request storm into a downstream outage.

Elevation of privilege — someone does more than they're allowed. This is where most real breaches live, and it's the one the mesh handles least completely. Which brings us to the uncomfortable part.

Show the gap: the mesh authorizes the call, not the object

Here's the threat the whole stack is quietly weakest against. Your AuthorizationPolicy decides whether this service may call that endpoint. It does not decide whether this user may see that record. Those are different questions, and the mesh only answers the first.

This is OWASP's number-one API risk — Broken Object Level Authorization, still API1 in the 2023 list and still the most-exploited class in production. A perfectly valid token, a call the mesh happily authorizes, an object ID the caller was never entitled to:

Code: bola probe

The mesh sees a valid principal calling a permitted route. It votes yes. Nothing in RequestAuthentication, nothing in PeerAuthentication, nothing in a namespace AuthorizationPolicy knows that account 999812 belongs to a different customer. The mesh authorizes the call. It does not authorize the object. Object-level authorization is application logic, and it has to live in the service:

Code: object authz

Read that against your threat model and the point lands: a control being present at one boundary tells you nothing about a threat that lives at a different boundary. STRIDE is what forces you to check each boundary on its own terms instead of assuming the strong control at the front door covers the whole house.

I've watched the front-door assumption fail in the most boring way possible. Early on, a gateway went out with RequestAuthentication validating tokens and no AuthorizationPolicy behind it. The tokens were checked. Nothing rejected the requests that carried no token at all. Infosec flagged it for open access. There was no attacker, no clever exploit — just a control that looked present on the diagram and voted for nothing in production. That's the exact failure a STRIDE pass over the ingress boundary catches on paper, months before infosec catches it live: validation is not enforcement, and "the token is checked" is not "the request is authorized."

The failure path is where the threats hide

One more, because it's current and it's instructive. In March 2026, Istio disclosed CVE-2026-31837 (CVSS 8.7) — JWKS Resolver Failure May Allow Authentication Bypass Using Known Default Keys. When istiod's fetch of the JWKS signing keys failed, older versions fell back to a set of publicly known default keys. An attacker who could force that fetch to fail could then forge tokens the mesh would accept. It's fixed in the 1.30 line (run 1.30.3; 1.28 left support in July 2026, 1.29 by end of August).

Sit with what that is. The vulnerability wasn't in the happy path — signature validation worked fine when the keys loaded. It was in the failure path: what the control does when its dependency is unavailable. That's the same shape as the key-rotation failure this series has flagged before, where a JWKS fetch died and surfaced as a generic network exception with no tidy IDX code to name it. The nastiest threats don't live in what your control does. They live in what it does when it breaks. STRIDE forces the question a checklist never asks: for each mitigation, what is the behavior when it fails — fail closed, or fail open to a known key?

And your threat model has to include the actor who isn't an attacker at all. A dev environment that could still reach production, dev workloads writing corrupt data into the prod store, no breach and no alarm — because the one trust boundary everyone assumed existed was never actually enforced. No STRIDE letter has a villain in it by necessity. Tampering doesn't care whether the hand on the keyboard was malicious. Model the boundary, not the bad guy.

Security · Audit · Integration

Security property gained: systematic coverage. Not "we added controls" but "we can name, per trust boundary, which of the six threat classes is mitigated, by what, and what the residual risk is." The gaps become explicit instead of assumed.

Audit evidence it produces: the threat model itself is the evidence — a versioned STRIDE table or data-flow diagram, mapped to controls, mapped to the log streams that prove each control fires. Under SAMA's maturity model, that document is a chunk of your assessment. Under RBI and DPDP, it's proof the risk was identified before the incident, not after.

How it integrates: threat modeling is the connective tissue — the one artifact that references the gateway, the JWT pipeline, mTLS, default-deny, egress, and the audit layer all at once, and shows how they compose into a defensible whole rather than a pile of individually-correct features.

Alternatives and trade-offs

STRIDE is not the only frame, and it's fair to say when another fits better.

PASTA (Process for Attack Simulation and Threat Analysis) is risk-centric and heavier — seven stages, business-impact-driven. Pick it instead when you need to tie threats to dollar risk for a board, and you have the time to run it properly. For a per-service engineering artifact, it's overkill.

Attack trees model a single attacker goal in depth. Pick them instead when you're reasoning about one high-value target — the signing key, the payments path — and want to enumerate every route to it. They complement STRIDE; they don't replace the breadth.

LINDDUN is STRIDE's shape aimed at privacy threats. Pick it alongside STRIDE when DPDP or PDPL data-subject harms are the thing you most need to demonstrate you considered.

On tooling: the Microsoft Threat Modeling Tool still exists and still auto-suggests STRIDE threats from a data-flow diagram; OWASP Threat Dragon is the open-source, threat-model-as-code alternative that stores the model as JSON you can diff in git. Pick Threat Dragon if you want the model to live in the repo and change under review like everything else. And you can start with neither — a whiteboard photo and a spreadsheet is a real threat model, and it beats a beautiful tool you never open. The artifact is the thinking, not the file format.

From simple to standard, and what's next

The toy version is a one-page STRIDE table for one API: six rows, the boundary each applies to, the control that mitigates it, the residual risk. You can build that this afternoon, and it will immediately surface at least one boundary you'd been trusting on faith.

The industry-grade version has three properties the toy version lacks. It's per-service and composed — each service carries its own model, and the platform model shows how they connect. It's versioned as code — the model lives beside the service, changes under pull request, and a new data flow that isn't in the model fails review. And it's wired to evidence — every "mitigated by" cell links to the control config and the log stream that proves the control runs, so the threat model and the audit trail are the same story told twice.

That last property is the whole back third of this series. A threat model claims a control exists. The next articles are about proving it fired — because if you can't prove it, it didn't happen. Article 24: audit logging in the mesh — turning every one of these boundaries into a log line an auditor can read.

Key skills & topics in this article

Threat modellingAuthorizationPolicyCompliance evidenceJWT validationCERT-In & DPDPEgress controlmTLS.NET & C#

  • #ServiceMesh
  • #Istio
  • #Azure
  • #dotnet
  • #ZeroTrust
  • #Kubernetes

Also on LinkedIn.