Welcome to the talk and the title for our talk today is Threat Modeling Based Application Security Pipeline. A legal disclaimer before we get started. All opinions in this talk belong to the speakers and do not represent that of the organization or the community itself. So, let's get started. A little bit about us. I'm Nilad Demelo. I'm a security engineer at Datadog. I work on the security design and guidance team that works on engineering new products securely. Previously, I worked at Intel and McAfee and I'm very passionate about writing. And I mentor grad school students at San Jose State. Larkins, over to you. Hey folks, I'm Larkins. I'm product security engineer at Plaid. Previously, I was application security engineer at AWS and I worked at Intel as well. I worked on software engineer technologies at Intel and then transitioned to security researcher. I'm an outdoor enthusiast. I love camping, hiking, and I have a golden retriever who goes along with me wherever I go. Pretty, pretty cool. So, as two AppSec professionals who work in a fast-paced engineering-heavy organization where security needs to be comprehensive, it needs to be effective. We trade a lot of nodes. And we thought we should first lay the foundation for what a fast-paced engineering-heavy organization looks like. What are the traits of such organizations? So, first and foremost, these organizations ship very fast and they ship frequently. Just the volume is insane. And new services and prototypes are being spawned, like anything. Inherently cloud-native, that's the biggest trait there. And then the ratio of engineering to security engineering is disproportionate. When you look at security, when you look at InfoSec, privacy, risk, these are fairly lean teams as compared to the engineering teams. So, that brings us to the question, what does security do in such places? First and foremost, security places calculated bets. It places calculated bets where the impact, the return on investment, and the value is the highest. That being said, what are we going to cover in our talk today? Since the title of our talk is Threat Modeling-Based Application Security Pipeline, we are first going to get a background on application security reviews. Once we cover what these application security reviews are, we are going to get into secure SDLC. We all know what a software development lifecycle is. So, when we integrate security events or security activities in there, what does a secure SDLC look like? Next, the most favorite part here is in order to make this comprehensive and effective, the AppSec trio of success. That's what we'll focus on. Then, we'll go into the AppSec pipeline and we'll take an example after that for illustration purposes to see what that looks like. And finally, there is no good end to a talk without discussing how we measure progress. So, that's a bird's eye view of what we are going to cover today. So, at a high level, what are application security reviews or assessment? So, it all starts with secure design reviews. Not all organizations will be doing all of these activities or they will be doing a subset of these activities. So, what are secure design reviews? In secure design reviews, we look at a product requirement and then come up with security requirements based on the security controls we think will be most beneficial. Once we have that nailed down, we look at threat modeling. Threat modeling is a holistic exercise where we understand, we work and collaborate with the engineering teams to figure out what can go wrong with a system. How can attackers or bad users can abuse a system and then create havoc, right? So then, once we have that defined, we start looking into the implementation guidance. And this is where we collaborate closely with developers. Like, we have a bunch of requirements in place, but they don't know how to action on them. And then, for the implementation guidance, what we look at, like, what are some safe primitives? What are some frameworks? What are some crypto implementations which can go wrong and how we can do better? We also look at, like, what are some supply chain issues which can come along with those? And then we start looking at, once we have that implementation guidance in place, and then developers come to us, that, hey, this was the set of requirements which we agreed upon, and we have implemented them. Can we get a code review? So, here we utilize SAS tooling, a great way of us leveraging and exercising on, like, what we have, the implementation guidance that is supposed to be put in place, but not all can be caught as part of, like, a SAS tooling. And at that point, we need to do some form of manual code reviews. And at the end, we have some form of dynamic testing. There can be API security testing, there can be first testing, and then it can be IAST, the tooling we have. But there is also another aspect to it. Dynamic security testing can be achieved with penetration testings as well. Not all will be doing the penetration testing, but, like, we would like to emphasize our efforts where we think these will be critical aspects of our systems. So, why invest in building culture of application security reviews? So, as part of security design reviews, we closely work with our engineers to understand, like, what are some of the implications. So, like, proactively, we work to understand what are the requirements from the security point of view and how we can address these or fix these design issues right from the start. We know, like, fixing design issues can be a lot more complicated than fixing just code issues. So, tools are great. Like, they help us scale in so many different ways. But we also know sometimes tools create a lot of security problems for security teams. And, like, how can we leverage tools in this manner without having issues with our development teams? And then, we also need to think that design issues and the architecture issues cannot be found with tools we use. This is my personal favorite. Like, collaboration, right? Like, when we work with our developers and our engineers right from the get-go, they know that we are on their side. They know that we are working on a shared common goal to build a system securely. And now, as part of all this exercise which we are going and collaboration which we are doing with our developers, we now know what are some of the critical systems. And based on that, we can emphasize like, efforts on some... pinpointing some of the critical systems and then have close eyes on them. So, now Nilet will be talking about and walking us through, like, what is software development lifecycle and how secure development lifecycle fits in. So, regardless of the paradigm that you follow in your software development lifecycle, be it waterfall, agile, iterative, spiral, whatever, we can agree that they all come down to these blocks. There is requirement. There is design. There is code. There is test. And there is release. Now, how do we inject security in these phases? At the top, what you are saying is, again, when a new service or a new feature or a new product is getting started, right? When we talk about design or requirements phase, that's, no, I'm going to go back. When we talk about the requirements phase, there is a bunch of exploration and there's a bunch of folks involved in it, product management, engineering, security. That's the time when we should be talking about the security requirements. During planning, that's when we'll be talking about how do we want to allocate the security resources for this. When it's time to do an RFC or a design doc, that's when it's appropriate to have an architecture review. Also, threat modeling. What can go wrong? What can we do about it? Also, how are we going to test what we are saying can go wrong and what we are going to do about it? The security test plan is also going to be part of the design document itself. There is implementation, after which we can add secure code review and security testing as well. Optionally, wherever it's critical, you include your external pen test or even some form of internal pen tests as well. That's the flow for when a new service or a new product is being spawned. You keep adding on top of it. Towards the bottom, you start now doing feature-based assessments. Every time you add something new, there is a chance that you are adding more risks as well. So, you want to also add some detective controls in place to maybe identify what are some anomalies or behavioral anti-patterns that you are seeing with respect to your services. So, that's the time when you also inject some security monitoring and incident response-related activities as well. But as you can see, that's a lot. And the call-out here is, it is challenging to adopt and execute on it all. And really what happens when all of this secure SDLC activities, the threat modeling, or your dynamic testing, or your code reviews, all of that is happening in isolation. There is engineering is doing something, security teams that are focusing on different aspects are doing something. Security best practices don't get followed in the ideal way. That introduces security bugs and vulnerabilities. Dumpster fire keeps amplifying. Mounts tech debt. And there is inconsistent outcomes, really. And eventually leading into internal security events and breaches. And finally, the doom day scenario, which nobody really wants. Loss of reputation and precious customer trust. At the end, customer trust is everything. We can sit there and say, yeah, this is fine. Every security professional's mood. But no, we can do something about it, right? And that's where the AppSec trio of success really comes into play. You know, the secret formula there to make this scale well and in a successful manner is to have all three things that we're going to talk about. We start with tools. These are essential. We need them to automate our security activities, to do code analysis for us, to tell us what are the security vulnerabilities that are in place. Important. But then on top of that, there is processes. How do you keep your security best practices in place? When do you do them? Who do you involve? You take tools, you layer processes on top of it. But none of this is going to be successful if you don't have the most important aspect here, the people. Your different folks in security who have different skill sets and domain expertise and your development teams, you know, who have real good understanding of why this is important. Why do I need to do a certain thing from a security standpoint? Combine it all together. That's your AppSec trio of success. So Neelit, can you talk a little bit about who are people and who are involved in this? That's a good question. Let's start with the developers. What's in it for them? Well, they need clear information about what is it that I need to implement and how do I test the expected behaviors? The product owner or the business decision maker. They're going to be like, okay, you're telling me there is a risk. What's the necessary action I need to take for that risk? And the third, the security engineer who's really concerned about what is the security posture of this overall application and is this new feature or this new service introducing some sort of vulnerabilities or risks that I need to be aware of? Also, does it satisfy the compliance requirements? So now let's talk about the application security pipeline. So if now we look at the application security pipeline in a very vanilla way, in a very serialized way, it's a security design review that you can do at the start, exploration, planning, design phase. Then you have your security code review which is essentially doing your tooling for your code analysis as well as your manual code review for things that your tool really cannot catch and your dynamic testing. But keep in mind that this serial activity is not going to scale when you really, really, really, really have thousands of services, microservices that connect to each other here and there. You have thousands of infrastructure components. Did I tell you about the commandment here when you work in a high-speed environment? Thou shall not block. You do anything for security, but you will not block me. So how do you do that then? So today we are going to focus on security design review and we are going to talk about how we can implement different measures as part of a security design review and how we can scale our review processes. And to reiterate, fixing a design issue is a lot more complicated than fixing a code issue. So now let's take a look. So this is the vanilla pipeline. Like a security design review followed by security code review and dynamic testing. So in a security design review, as a security engineer, when we start looking at our reviews, don't do it in isolation. There are different... On the left, what we see is just a pipeline and in the middle, these are parallel activities which need to happen. We have experts which are focused on privacy aspects. We have experts who are focused for risk. We have security operations and supply chain as well. So when you are doing reviews, talk to them. Talk to them and understand different implications of what we are introducing. We are having different design aspects from a privacy point of view. Data handling. So they are the experts who can help us understand. So when we have that understanding, we come up with security and privacy requirements. As we are doing this process, we are collaborating with the engineers, we come up with threat model as well. Based on the threat model and based on the mitigations we have in place, we have implementation guidance. And to have implementation guidance, what do we need? We need some kind of a test plan. We need some kind of security findings and events which will be coming out of security code review pipeline as well. So let's focus on security design review where we will be doing RFC's fake review. Here we will be engaging with our different teams and come up with the security requirements. We have to make sure these align with what our product team is developing. We need to make sure that this is not actually making these features less attractive to the customers they are providing. Nillet will be talking now about security design review process. She will be talking about how we have to design the intake process and how we can have different phases altogether. So as you saw in the pipeline where there was the security design review, that is the injection point for even bringing in your experts who do supply chain or privacy or risk, everything that you can inject in there. The starting point is a security design review. So when should you be doing it? You can do it whenever you are launching a new service or anytime there is a major update to an existing service. Any service that has a security sensitive context, you need to have a security design review as well. And periodical evaluation of your services. So this is part of the process. At an organization level, we define, even at Datadog, we define when should you have a design review? Because folks need to have a clear understanding of the expectations here. So security review calibration. So now we saw there are different processes which are in place. I see one of my engineers, past engineer, Nick. I know you. So security review calibration, which was a very heavily focused process in AWS, a US successful process because we work on so many different services and there are different risks coming out, there are different guidance coming out and we need a centralized place where engineers who are working on different services can look at different insecure patterns and they can develop a shared context on how we are doing and processing these services. Some of the activities as part of that exercise were about how do we assign different risks? How do we assign different severities? Not all severities will be the same and having that context helps us to scale differently. So why do we need security review calibration? We need it to be consistent. Our process needs to be consistent in how we find different vulnerabilities, how we assign different severities and if we have some gaps, what can we do about it? We need to have a knowledge base. We need to expand on it. By chance, if there was no knowledge base, if there were no processes in place, we have good opportunities to set up new processes. We have good opportunities to innovate. So now I will dive a little into partnership because if you want to set a good pipeline, you need to have some foundational elements in place. You need to try and test and evolve accordingly. So you can pick some of your products or services that are really critical and aim for that to be your partner. So where your security engineer is partnering with that organization or that product and that's when, say, you define how the security reviews get done, how you bring in the different domain experts in as well, how you streamline the secure code reviews for that particular organization, as well as how the pen test scoping is done for that particular organization. So you can try to do it in different contexts but if you pick a few feature services or products that you can partner with, that is going to be the best bang for buck. Because then you can really measure your progress properly. So Nilit, we have this partnership program, then what is the role of security champions? That's a good question. So with partnership, it's a security engineer going to the product teams. But you also need to scale the guidance, right? You need to scale what needs to be done. You need eyes and ears where the real action is. So security champions are folks who are in the product teams. These are folks who are extremely security-minded. They have the right direction, the right support, as well as they know what needs to be done. So training few folks within the organization to take care of security-sensitive tasks is where the security champions really shine in. Now let's take an illustration of pipeline. So before going in there, we covered a lot about what are the different activities. Security design review, code reviews, dynamic testing. Let's take an example to see how we can do that in practice. Now, you have your intake process as a security team and the development team comes in through that intake process and saying, hey, we are doing this exciting feature. It's a code playground. We all are pretty familiar with what a code playground is, right? So, they come in saying they want to do a code playground. We ask them to go through a security review intake. Then that security review intake should be hooked up to a good project tracking software. Now what does the intake involve? If we have heard talks or we have seen different tools, context is super important, right? We need to collect as much information or context of what is being built. Otherwise, anything that you say is not going to be actionable. So, you collect different details like what data stores you have, what's the internet exposure, what kind of untrusted inputs are you handling, what are the service interfaces in terms of how is your server looking like, what's your client looking like, what is your authentication and access control model, what's your cryptographic usage, do you have any customer data that you are handling, tell me about your APIs. You collect all of that information as part of the intake so that you know what is being done. Based on that review intake, it tells us that hey, this feature that allows the customer to bring in or allows the user to bring in arbitrary code, it's a high risk critical feature. So, it needs a security design review. It needs an assessment. So, the security team goes like, this is a critical feature, let's work together to do a security assessment. So, now they have a lot of questions. We talked about different requirements, we talked about the criticality of the service, and now they are confused like, hey, how are we going to do this, and how are we going to ship? So, one of the things we do is collaborate with them, not only just give the requirements, but exactly what they need to do. There are different activities that can go wrong with the code playground. And we first need to understand, what can we do about it? The first thing that comes to our mind is sandbox. Like, we can give them like, okay, create a sandbox environment. But what does sandbox environment mean to them? I have seen in the past, a sandbox environment means to them is like, just scanning what customers are uploading with the virus scanning software, and just call it done. That is not a sandbox, what it's supposed to be. A sandbox has to be carefully designed, that even in case of a compromise, we are limiting the blast radius. So, this we have to be collaborative and prescriptive in how we want to see this environment to play out. So, if you go back a slide, you can see that there are so many different aspects. You know, if you were going to do a pen test later in the game, you have still established a very good scope here. Look at the different high risk areas that we are highlighting right at the design phase. Yeah, that's an interesting point. Because all this we are doing, and by the end when the feature is going to be shipped, we will be looking at different pen tests. And to have a good pen test scope, we need to define these as part of our requirement gathering and threat modeling. So, our pen test team will be very happy to see the scope is already defined for them, and they know where exactly to focus on. So, the implementation is done. When you say that here are my security requirements, you are going to check for, like, they are implementing what was promised, right? Yes. So, then you need to call for an implementation review as well. So, what do we do in an implementation review? So, in implementation review, we will first look at, like, what were the security requirements, and we will start evaluating different frameworks. One of the frameworks can be, like, insecure. Like, some of the libraries will be, they will have secure usage and insecure usage as well. We need to help developers understand what will go wrong if we use insecure patterns, because libraries, the documentation, is difficult to understand sometimes, and details are very hidden. So, helping them understand, if we don't have guidance, we can help them understand how to do and build it securely. So, ultimately, the goal of the pipeline is you start with the design review, you have your pen test, you've also identified that maybe I need some audit logs for certain high-risk activities. I need some detective controls. You combine it all together, ultimately you're driving down the residual risk. The risk is never going to go away, but your residual risk is much lower than the actual risk that could have been in place. And that also helps with prioritizing remediation, because I got a thousand things to do, why should I do this thing that you're asking me to do, right? So, it really helps to be precise with prioritizing remediations. And then, Larkins, you were talking about calibrating reviews. How can we calibrate this particular review? Yes, so now when we look at what were all the different requirements, and then we understood there were some gaps in our knowledge bases. So, now this is a good opportunity for us to go ahead and build some kind of knowledge base. Think about the sandbox. Sandbox implementation was missing. So, now we have a sandbox environment, which we need to publicize, which we need to tell our different engineers that, hey, we have this already in place, and we should be using and suggesting moving forward. Then, fine-tuned rules. As part of these, we also came to know that there was some insecure implementation of code while doing secure code reviews, which were not caught previously. But now we have opportunities to expand our rule set and develop new rules. Write new monitoring test cases. We all know that there were so many different attack vectors. One of the attack vectors is SSRF. Now we can write different alerting rules. We can write different rules for malicious behavior as part of it. And then extend our dynamic testing. Some of the test cases were missing. Like, some of the test cases which should have been in place, they were missing, and we will have an opportunity to expand on them. But now, as we talked about our security champions program, when our champions look at different security requirements, they look at the checklist sometimes. Not everything can be as part of a checklist, but if they can look at some of the insecure patterns, they can understand this is critical service. This is something that needs careful attention of our security teams, and they can highlight us, like, hey, these are anti-patterns in our system, and can you help us design some secure mechanisms? So as we saw, calibration is super important when there is so many moving parts in here. Also, how do you measure progress with so much dynamic pipelines in place, so much parallel activities happening? How many bugs are you shipping pre-GA? How many vulnerabilities were covered as part of the design review itself? And also retrospectives, really quantitatively, qualitatively doing retrospectives, bringing everyone in the room together to see, like, did we do a good job here? And most importantly, did getting started early on help your pen test? That is probably the most... pen tests are expensive. If you don't scope them right, you're not really going to cover the real high-risk areas. So did it help your pen test as well? There was a lot that we covered, and now let's summarize towards the end. Key takeaways. First and foremost, decentralize your security functions. Decentralize them in a way where the key folks really know what needs to be done. Set your expectations right. Build as much security context as possible. That's your intake. Design your intake very crisply. Leverage tools, processes and people effectively. Go back and see if something's not working right. Go back and see, is it a tooling problem? Is it a process problem? Or is it a people problem? You can effectively debug from there. And most importantly, none of this happens in a day. This is very iterative. Take an iterative approach and be patient and keep building on it. So what is the endgame? Earlier our engineers come to us with what they have built and ask, hey, is this secure? And then we do a bunch of work and then let them know, hey, assure them that this is secure. But that's not what we want to do. We want to be in a state where our software developers come to us and tell us, these were the requirements which were promised. These were the requirements which we agreed upon. And now we have developed and we are ready to ship secure software. That's the endgame we are aiming for. That's it, folks. I hope we covered a bunch of things of how we can do this in a pipelined approach. Time for some questions, if you have any.