Omer Levi Hevroni has a very interesting post exploring ways to represent threat models as code.
The closer threat modeling practices are to engineering practices already in place, the more it will be impactful, and the more it will be a standard part of delivery.
There’s interesting work in both transforming threat modeling thinking into code, and using code to reduce the amount of thinking required for a project. These are importantly different. Going from analysis to code is work, and selecting the right code to represent your project is work. Both, like writing tests, are an investment of effort now to increase productivity later.
It’s absolutely worth exploring ways to reduce the unique thinking that a project requires, and I’m glad to see this work being done.