Latest / Talk Python To Me / #545: OWASP Top 10 (2025 List) for Python Devs
Transcript
- 0:00The OWASP Top 10 just got a fresh update, and there are some big changes.
- 0:03Supply chain attacks, exceptional condition handling, and more.
- 0:07Tanya Janca is back on Talk Python to walk us through every single one of them.
- 0:12And we're not just talking theory here.
- 0:14We're going to turn Claude Code loose on a particularly crappy web project and see what it finds.
- 0:20Let's do this.
- 0:21It's Talk Python To Me, episode 545, recorded April 8th, 2026.
- 0:28Talk Python To Me.
- 0:30Yeah, we ready to roll.
- 0:31Upgrading the code.
- 0:32No fear of getting old.
- 0:34Async in the air.
- 0:35New frameworks in sight.
- 0:36Geeky rap on deck.
- 0:38Quart crew, it's time to unite.
- 0:39We started in Pyramid.
- 0:41Cruising old school lanes.
- 0:43Had that stable base, yeah, sir.
- 0:44Welcome to Talk Python To Me, the number one Python podcast for developers and data scientists.
- 0:49This is your host, Michael Kennedy.
- 0:51I'm a PSF fellow who's been coding for over 25 years.
- 0:55Let's connect on social media.
- 0:56You'll find me and Talk Python on Mastodon, Bluesky, and X.
- 1:00The social links are all in your show notes.
- 1:02You can find over 10 years of past episodes at talkpython.fm.
- 1:06And if you want to be part of the show, you can join our recording live streams.
- 1:10That's right.
- 1:10We live stream the raw uncut version of each episode on YouTube.
- 1:14Just visit talkpython.fm/youtube to see the schedule of upcoming events.
- 1:19Be sure to subscribe there and press the bell so you'll get notified anytime we're recording.
- 1:23This episode is brought to you by Temporal, durable workflows for Python.
- 1:27Write your workflows as normal Python code and Temporal ensures they run reliably, even across crashes and restarts.
- 1:34Get started at talkpython.fm/Temporal.
- 1:38Hello, Tanya Janca.
- 1:39Welcome back to Talk Python To Me.
- 1:40Awesome to have you here.
- 1:41Oh my gosh, Michael.
- 1:42It's so nice to see you.
- 1:43Yeah, it's really great to see you as well.
- 1:45I remember last time I was nervous you were on the show because you're going to make me feel concerned about all my software running on the internet that now all has all these issues I just realized.
- 1:55We're back for the 2025 edition.
- 1:57And I know the year is 2026.
- 1:59Please don't email me.
- 2:00I mean, email me, but not for that reason.
- 2:02But this is the 2025 OWASP top 10, which is pretty new, right?
- 2:07Yeah, so we released it December 31st, 2025 so that it could stay 2025 on it.
- 2:13Do you know how much branding has to change if we don't get it out this year?
- 2:17Let's just go.
- 2:18That's incredible.
- 2:19I didn't realize it was that close to the wire.
- 2:20We had released the release candidate.
- 2:23So every time it's released, we release a release candidate to say, this is what we're thinking.
- 2:29And then we ask the community for feedback.
- 2:32And I don't know if you remember in previous versions before I joined, there was some drama where sometimes the community is like, absolutely not.
- 2:39You are incorrect.
- 2:40Or there's vendor influence or whatever.
- 2:42And then they've had to rework it.
- 2:43But this time it was the smoothest it's literally ever been since the first time where all the links were or all the GitHub issues were great.
- 2:53Like, hey, you know, here's a great example of that attack.
- 2:57Do you want to use it?
- 2:59And we're like, yes.
- 2:59Or, you know, the grammar is wrong here or the, you know, the links are wrong.
- 3:03We had a couple of, well, this one should be number one because that's what my product solves.
- 3:08We're like, well, we'll hear that feedback.
- 3:11Exactly.
- 3:11You failed to mention our product.
- 3:13I'm like, oh, I do see how that happened.
- 3:15Yeah.
- 3:16But other than like the feedback was overall just overwhelmingly, yes, we agree, which was very validating.
- 3:22Yeah.
- 3:23I'm sure there was a lot of, boy, if I could get the OWAS top 10 to reference my solution.
- 3:28That's some good marketing right there.
- 3:30Incredible.
- 3:30So before we dive into that with a bit of a Python focus, let's just hear a little bit about you, who you are.
- 3:39You've started a podcast since you've been on the show.
- 3:42Tell us about you.
- 3:43So I'm Tanya and I was a software developer that switched into application security.
- 3:48I went to the dark side, Michael.
- 3:50I started speaking at conferences so I could get in free and writing and then ended up writing two books.
- 3:55And now I teach secure coding and like how to use AI securely and all of those things to large companies.
- 4:02And then speak at conferences.
- 4:04Serve as like a habit.
- 4:05I can't stop.
- 4:06You don't get paid to do that usually.
- 4:09And so recently I started a podcast called DevSec Station.
- 4:12And it's five to 10 minute lessons on secure coding and it's free.
- 4:19I used to have a podcast called We Hack Purple Podcast and I, like my company got bought and absorbed, et cetera.
- 4:26And eventually the podcast was retired.
- 4:28I've missed having a podcast, Michael.
- 4:30I'm sure as a podcast host, you can relate.
- 4:31It's really nice to be able to create a piece of art and release it.
- 4:35It's a very interesting medium and you get to just reach out to people or explore ideas that are just interesting to you.
- 4:43And long as there's a through thread, you can kind of do whatever you want to.
- 4:47It's great.
- 4:48Yeah, I love it.
- 4:48I wanted to teach some lessons and I wanted them to be just really short.
- 4:53And the first season I'm exploring the idea that the supply chain is changing.
- 4:58The supply chain security used to be just dependencies that people worried about.
- 5:02But now I'm like, what if that tech surface is actually very different than we realize?
- 5:08And so I'm talking about how developers can protect themselves, protect the organizations, protect their build pipelines, et cetera.
- 5:14And so, yeah, I'm excited to see what people think of it.
- 5:17Yeah, I encourage people to subscribe.
- 5:19That's really cool.
- 5:19Five to 10 minutes.
- 5:21Is it daily or weekly?
- 5:22So I released one two weeks ago and I was kind of thinking of releasing one tomorrow, but I need to just get the edits.
- 5:27It's, I hired some students and they're learning video editing and it's been very exciting.
- 5:33Yeah, that's the back end of all this type of work that people don't realize is it's an hour or 10 minutes or whatever, but then there's the whole production distribution, et cetera.
- 5:43I'm just a control freak.
- 5:44That's the problem, Michael.
- 5:46I just want to do it myself.
- 5:48Yes, exactly.
- 5:49There's a bit of a wind noise thing.
- 5:51Can we do that again?
- 5:52No, it is tough.
- 5:53It is really, really tough to kind of find that balance.
- 5:56But yeah, people check that out.
- 5:57That's awesome.
- 5:58Yeah.
- 5:59And is SheHacksPurple still your domain?
- 6:02Yeah.
- 6:02So if people go to SheHacksPurple.ca, you will find my website and my services and my blog.
- 6:08So lately I'm blogging a lot about how we can combine behavioral economic interventions, which is like the science of why people make decisions to the software development ecosystem
- 6:19so that we basically set up secure defaults and other things that just nudge developers to do the secure thing and make the secure thing always the easiest path.
- 6:30And so not how do we manipulate them and pressure them and make them feel bad, but more how can we remove cognitive load that's not necessary?
- 6:39How can we make it more obvious what we hope that they'll do?
- 6:42How can we make it so like it requires effort to do the bad thing?
- 6:46There's a phrase that I got, I think from Scott Guthrie was the one who spoke about it at Microsoft, but it doesn't really matter.
- 6:53The help people, help developers and security folks fall into the pit of success.
- 6:58Like you've got to climb out of the thing you're supposed to do and actively do it wrong.
- 7:02You know what I mean?
- 7:03Exactly.
- 7:04Exactly.
- 7:04So I'm writing a series on that based on a talk I did.
- 7:08So sometimes I'll do a talk and then I'm really excited about it.
- 7:10And I'm like, well, now I can nerd out as much as I want on my blog.
- 7:13I want to talk about what is the OWASP top 10?
- 7:17What is OWASP?
- 7:17What is the OWASP top 10 and all of that?
- 7:20But before we kind of get into that, I do want to set the stage just a little bit, because when people think about Python security or you pick your language, there's like every language and framework has a little security gotchas.
- 7:34Like in Python, there's a, I think it's a YAML parser, but it's too, it can run arbitrary code.
- 7:41So you got to do like the safe YAML parsing.
- 7:43And then there's, there's pickles, which is a serialization format that can run arbitrary code.
- 7:47So people say, these are the things to look out for.
- 7:50I actually think those are fairly useless.
- 7:52I think the real problem is things that developers do to write code and they either omit or add actions or steps that they should or shouldn't have done depending on the situation.
- 8:04And really that's what OWASP focuses on, right?
- 8:07Technically it is in a nonprofit organization, but in what I feel it is, is an international community of thousands and thousands and thousands of people who want there to be more secure software.
- 8:20And so we have chapters where people meet each month.
- 8:22There's over 300 worldwide, Michael.
- 8:25It's amazing.
- 8:27Wow.
- 8:27Yeah.
- 8:27Almost every big city in all of Canada has one.
- 8:30And like, we can't agree on a lot of things in Canada, but apparently we love OWASP.
- 8:34And like in India, oh my gosh, they have so many.
- 8:37And in the United States, like people love, oh, I love OWASP.
- 8:41And then we have over 100 active open source projects.
- 8:45So we have free books, free documents, free tools, free software, like everything you can think of.
- 8:51We're like, oh, I'll build one for you.
- 8:53And then, you know, there's a Slack channel with thousands of us on there being nerds together.
- 8:56And then twice a year, we have one in Europe and one in North America where we have a conference and we gather and there's talks and teachings and all the things, right?
- 9:08And I've been a part of OWASP since 2015 was the first thing I attended.
- 9:16And then 2016, I was a chapter leader because I don't know how to do small things.
- 9:19I only know how to do really big things because I was like, oh, I'm in.
- 9:23And I've just been, so I'm now a lifetime distinguished member because I've volunteered for over 10 years and I'm their biggest fan.
- 9:32I'm totally president of the non-existent fan club.
- 9:35And the thing, so the weird thing, Michael, so OWASP does so many amazing things.
- 9:40There's so many amazing people.
- 9:41But the thing that we're absolutely most famous for is called the OWASP top 10.
- 9:46And I volunteered in Norway at the OWASP booth at a conference because I gave a talk and then I had nothing else to do.
- 9:55And I don't mean to sound rude, but unless it's a security talk, I'm not going.
- 9:59And it was a developer talk.
- 10:00And so I went to the other two security talks and then I was like, what am I going to do?
- 10:03So I volunteered at the OWASP booth.
- 10:05And every person that walked by went top 10.
- 10:08That's awesome.
- 10:09And any of them that knew us, they only knew the top 10.
- 10:13They didn't know we had chapters.
- 10:14They didn't know we had any other things to help them.
- 10:16But literally person after person, top 10.
- 10:20That's pretty funny.
- 10:21Like a few weeks later, the top 10 team invited me to join.
- 10:24And I was like, me?
- 10:26And I was like, okay.
- 10:28I knew about the whole project because of the top 10 as well, honestly.
- 10:32Well, I mean, then we're doing a great job.
- 10:34And so we finally wrote a new one.
- 10:36And the team's like, okay, Tanya, you like talking the most.
- 10:39So you go tell them.
- 10:41You go tell them it's ready.
- 10:42Actually, if you go to the OWASP top 10, there's a GitHub link at the top.
- 10:47And you can see that there's, if you go there, you can actually see historically the 2003, 4, 7, 10, 2017, 2021, and the 2025.
- 10:55And you go and there's all the markdown files and presentations and et cetera.
- 10:59So you can kind of get the historical evolution as well.
- 11:02People file issues.
- 11:04And then I have to, me or, you know, we're twisting or that's what we do.
- 11:09We respond.
- 11:10Sometimes we respond and we're like, no.
- 11:13This is the third time you've asked.
- 11:14No.
- 11:15We talked about it twice.
- 11:16Yeah.
- 11:17We try really hard to always be open because the community, sometimes we don't have the data that supports the thing.
- 11:23But let me tell everyone what it is.
- 11:24So if you've been hiding under a rock, the OWASP top 10 is an awareness document of the top 10 things, according to the data we gathered and multiple community surveys of risks to web applications.
- 11:37Most of them relate to all software, but technically this one is about web applications.
- 11:43And you might not realize, but underneath the next steps, there's three more secret items because we couldn't decide, Michael.
- 11:52And Vibe coding needed to be on there.
- 11:54And then there was sort of a tie for the number 10.
- 11:58So we want to include the one that was the tie.
- 12:00And then we felt memory safety is still so unbelievably critical.
- 12:05We had to comment on that as well.
- 12:07So we had to talk about those as well.
- 12:10So that was good.
- 12:12So it's the top 10, but these are three other things for your consideration that are very important.
- 12:16I did not realize those.
- 12:17How interesting.
- 12:18I do think in whenever you release your next version in two, three, four years, whatever, there's going to be a strong AI bent and we're going to get into the AI angle of security in this conversation, which is going to be really fun.
- 12:32But yeah, I think we're just beginning this.
- 12:35Like you called it out with Vibe coding, but there's more to that even.
- 12:38Making the top 10 is complicated because we have to do it based on data.
- 12:43And the data I would like would be the postmortem from security incidents and would be, you know, the AppSec team telling us the things that are happening, not what we actually
- 12:54get, which is a bunch of SaaS vendors and Dask vendors telling us what their automated tools are capable of finding.
- 13:00And then a bunch of boutique pen tester companies who are so generous to give us their reports and to try to normalize that for us.
- 13:09And like we end up with millions and millions and millions of records and that's great.
- 13:13But if a SaaS tool is really good at finding X, that doesn't necessarily mean that X is the biggest problem in our industry.
- 13:22And so when we put supply chain security on there and expanded it from just being libraries, like, oh, you're using outdated or vulnerable components.
- 13:31Like, yeah, that's bad.
- 13:33But there's also malicious components.
- 13:35There's also you didn't lock down your CI and then the co-op term, like the co-op or you call them interns, put too many zeros on the Kubernetes deployment.
- 13:45And then you've got $30,000 bill you weren't expecting or like I've seen it, right?
- 13:50I feel like it's hard to get data that tells the full picture.
- 13:54And we're not allowed to just say, well, this is what the team thinks, right?
- 13:58So that's where the surveys come in.
- 13:59And we're like, this is what we see.
- 14:02This is what we think.
- 14:02Do you agree?
- 14:03And like across the board, everyone was like, supply chain must be on that list.
- 14:07You must expand it.
- 14:08We agree.
- 14:09I think it's the biggest issue of the year, at least of the last six months.
- 14:12If we look at reports like the Verizon breach report and the CrowdStrike and the like the big reports of many, many breaches, if we look at the big ones, the nation state ones,
- 14:24their supply chain, or in my opinion, if we really look at it, we think about it, they exploited the developer.
- 14:31They compromised a developer within an organization.
- 14:33It gave them access to multiple parts of the supply chain.
- 14:37And then they owned the entire organization.
- 14:40So if you get SQL injection in one app, you got into one database and maybe you could read sensitive data.
- 14:46Maybe you could delete sensitive data.
- 14:49If that database was completely unpatched in a total like terrible mess, then maybe you could take over that server.
- 14:56Then if your network's totally not secure and crappy, which is not exactly that common, like I'll look at, you know, network diagrams with clients and I'm like, oh, that line, is that a firewall?
- 15:06They're like, it's more aspirational.
- 15:07I've heard that many times, right?
- 15:09Then maybe they could pivot and get to a couple of places, but that's like, maybe, maybe, maybe, maybe, maybe you get a little bit, but you compromise a senior developer.
- 15:18Right.
- 15:18And so, yeah, I was really glad when the team agreed that we would do this and then the community supported it.
- 15:25So I was like, yes, win.
- 15:26Yeah.
- 15:27You compromise a developer, then you get.
- 15:29Especially a senior.
- 15:30Yeah, exactly.
- 15:31You get arbitrary code execution on potentially all the stuff that they send out to the world.
- 15:36It's, it's really bad.
- 15:37You know, an example of that would be the LastPass breach.
- 15:40Yeah.
- 15:40And the way that that all started from what I understand is one of the developers had an outdated version of Plex, the like streaming ripped video player on his home network that was open on the internet.
- 15:53That got taken over.
- 15:54Then they got into the dev machine and then they got everybody's password vaults.
- 15:57It's like, excuse me, because you had a movie player on your home automation network.
- 16:03That's crazy.
- 16:04There's been some recent hacks where the developers download like a plugin or something and it's malicious.
- 16:10And then not only is it trying to steal like secrets off their computer, but then it robs their crypto wallets.
- 16:17Because why don't you just kick someone when they're down like jerks?
- 16:21It's terrible.
- 16:22Well, we'll circle back to that.
- 16:23But I do think the vibe coding side is going to be a big deal in the future and you'll have a little bit of a challenge there.
- 16:29I think obviously professional developers love to bag on vibe coding.
- 16:34And I think that that's totally fair.
- 16:35But the problem is, I think a lot of that is kind of dark matter.
- 16:39Like you'll never see the people because the people do vibe coding.
- 16:43They don't know to go and fill out a survey for OWASP.
- 16:45They don't even know what a line of code looks like.
- 16:47They're just make me happy.
- 16:49You know, it's crazy.
- 16:50And now some companies are building dark factories, which is a term that was new for me, which is where they replace their entire software development team only with complete AI end to end solutions where there's no human in the loop whatsoever.
- 17:05And oh my gosh, Michael, imagine the security posture of what's being released there and the fact that they don't know what the posture is, right?
- 17:13But they're getting to market faster than someone else.
- 17:16Yes.
- 17:17And so consumers don't know that what they're buying has been put together with duct tape and glue.
- 17:23So I actually, we didn't talk about this beforehand, but I hope it's okay to mention.
- 17:27So I'm trying to push a secure coding law in Canada.
- 17:30So Canada is cute and quaint, just like all the stereotypes.
- 17:34And a citizen is allowed to create a petition if she could get a member of parliament to support her.
- 17:39And after three years of letter writing, one of them did.
- 17:42Wow.
- 17:42Congratulations.
- 17:43Thank you.
- 17:44In the house of commons and I have enough signatures, so it's going to go to vote.
- 17:47And so right now I'm lobbying all the public to try to get them to call their member of parliament and ask them to vote.
- 17:54Yes.
- 17:54Because what happens is my member of parliament will be like, Hey, seven one, one, five says this.
- 18:01We should create a secure coding law for all governmental organizations, have a standard and then, you know, assure the standard, make, make sure there's compliance.
- 18:09And I also like wrote the standard for them and sent it to them.
- 18:12Cause that's what I'm like, I'm like, you don't have to use it, but like, here it is in case you want one.
- 18:16I've been writing letters for years.
- 18:17I'm very annoying.
- 18:18Guess what?
- 18:19Members of parliament don't know what the word cyber means.
- 18:21Like they're very smart.
- 18:22I'm not trying to mock them.
- 18:23I'm not an expert in what they do either.
- 18:25Right.
- 18:26And so I need members.
- 18:28So Canadians, if you're listening, go like, look up petition E seven one, one five.
- 18:33You'll find me sign it and then call or write your member of parliament.
- 18:36So if enough of us call, if like 10 or 20, 30 people call the member of parliament or they receive emails, Michael, when the petition comes up, they're like, Oh yeah, my constituents care.
- 18:45Therefore I do.
- 18:46And they'll raise their hand and I get one chance.
- 18:49And I really want a lot of hands going up specifically at least half of 334 people.
- 18:54Good luck with that.
- 18:55I hope that that goes through.
- 18:56That's cool.
- 18:56We'll know by June.
- 18:58Yeah.
- 18:58That's the challenge with legislatures and government in general.
- 19:01So many of the people, especially elected officials, they're not elected because they're developers or security specialists or whatever.
- 19:08Right.
- 19:08But the difference is that you said it's fine because you don't know what they do.
- 19:13You're not an expert in law or whatever.
- 19:14That's that is true.
- 19:15But they have to choose how it's going to work for us through technology, whereas you don't have to choose how law works for them as a tech.
- 19:23You know what I mean?
- 19:23Like it's they decide.
- 19:25So it's I'm not saying that it's their fault or anything, but it is a very tricky thing to balance.
- 19:30It is.
- 19:30And this is why I, as like a influential person or whatever, are trying to use my influence for good.
- 19:37And I'm trying to protect Canada.
- 19:39And here's the thing, Michael, is that if Canada creates a law that does this, that is huge momentum for every other country.
- 19:46And Canada was one of the first countries to have privacy laws.
- 19:50Like we really led the way in that.
- 19:51We really have led the way in like laws for quantum as well.
- 19:56And like, we're not really used to being that we're just, you know, struggling along and we could lead the way in this.
- 20:04Right.
- 20:04And then that means other countries can say, well, they have one.
- 20:07Like, do we really want to be behind Canada?
- 20:09I mean, come on.
- 20:10We love Canada.
- 20:11Canada is awesome.
- 20:11Yeah, we're sweet and we're wonderful.
- 20:13And we mean well all the time.
- 20:16This portion of Talk Python To Me is sponsored by Temporal.
- 20:18Ever since I had Mason Egger on the podcast for episode 515, I've been fascinated with durable workflows in Python.
- 20:25That's why I'm thrilled that Temporal has decided to become a podcast sponsor since that episode.
- 20:30If you've built background jobs or multi-step workflows, you know how messy things get with retries, timeouts, partial failures, and keeping state consistent.
- 20:39I'm sure many of you have written brutal code to keep the workflow moving and to track when you run into problems.
- 20:45But it's trickier than that.
- 20:46What if you have a long-running workflow and you need to redeploy the app or restart the server while it's running?
- 20:52This is where Temporal's open source framework is a game changer.
- 20:56You write workflows as normal Python code and Temporal ensures that they execute reliably, even across crashes, restarts, or long-running processes while handling retries, states, and orchestrations for you so you don't have to build and maintain that logic yourself.
- 21:10You may be familiar with writing asynchronous code using the async and await keywords in Python.
- 21:16Temporal's brilliant programming model leverages the exact same programming model that you are familiar with but uses it for durability, not just concurrency.
- 21:25Imagine writing await workflow.sleep.
- 21:28timedelta, 30 days.
- 21:30Yes, seriously.
- 21:31Sleep for 30 days.
- 21:32Restart the server.
- 21:33Deploy new versions of the app.
- 21:34That's it.
- 21:35Temporal takes care of the rest.
- 21:36Temporal is used by teams at Netflix, Snap, and NVIDIA for critical production systems.
- 21:41Get started with the open source Python SDK today.
- 21:44Learn more at talkpython.fm/Temporal.
- 21:47The link is in your podcast player's show notes.
- 21:50Thank you to Temporal for supporting the show.
- 21:52Let's shift just a little bit to maybe people who don't necessarily mean well, the people who might exploit, you know, broken access control or other types of things.
- 22:03And to aid us here, going through the OWASP top 10, I've come up with a little example of, well, this is what some of the concrete examples might look like.
- 22:13Maybe I'll put a link to this and I'll reference them.
- 22:16And I don't know how often I'll totally use this.
- 22:18But let's start with this one.
- 22:20And if I understand it correctly, you all don't like suspense.
- 22:24It's the worst comes first, then the second worst, and then the third worst.
- 22:27Yeah, we go in order of this.
- 22:29So this is, it causes lots and lots of damage.
- 22:33It's not that hard to find or exploit.
- 22:35And it's everywhere.
- 22:37It's everywhere.
- 22:38When I talk to people that do pen testing, they're like, yeah, I find this basically every time.
- 22:43Like one of my friends, Katie Paxton Fear, she does API content and pen testing and bug bounty and stuff.
- 22:51And she said, I have never not once found broken access control in an API, like never once.
- 22:59And it's really hard to get right, Michael, because every single page, every single record, every single access, we should check that the role is allowed.
- 23:08And that they still are that role, right?
- 23:11So we continue to make sure the session's accurate and then grant access.
- 23:15And unfortunately, we just forget to ask a bot.
- 23:18Or we return the entire record set, and we'll just sort it out on the front end.
- 23:23And the malicious actor is like, thanks for the data set.
- 23:26That's so sweet of you to give that to me.
- 23:29And we just screwed up so much, so much.
- 23:32I would like to point out that these are not a single vulnerability.
- 23:35It's not like this is the number one issue.
- 23:38They're like categories, right?
- 23:39It's like violations of these could be you didn't use least privilege, or you bypass a control check, or you didn't put access control on the delete part of the API.
- 23:49You know, like there's a bunch of things that fall into each one of these, right?
- 23:52It's a category.
- 23:52They're all a bucket.
- 23:55And when we looked at the data, poor code quality was a bucket.
- 24:00I'm like, no, because all of the things go into that bucket, right?
- 24:03The OWASP top one.
- 24:04OWASP top one.
- 24:05And then also the mitigation advice is, what if you sucked less, right?
- 24:10Like there's no constructive feedback to poor code quality.
- 24:12It's not specific enough.
- 24:14So we didn't want buckets like that.
- 24:16Keep it actionable, right?
- 24:17Yeah, exactly.
- 24:18If it's not actionable, it's not worth raising awareness about, we felt.
- 24:21And broken access control, Michael, it's everywhere.
- 24:24And I wish there was like a product that you could buy that could just do this for you.
- 24:28So you can buy authentication products that manage session and identity like really, really, really well, right?
- 24:35And people buy the crap out of them because they work really well.
- 24:38I'd like to be able to buy an access control tool that was as easy to implement as, I'm going to try not to name brands, but you know the products, right?
- 24:48People pay a lot of money for Okta, you know, at like Active Directory, you know, Cognito because they work, right?
- 24:57And they work well.
- 24:58And the less painful they are to implement, the more likely, like they're willing to pay more for that, right?
- 25:04And so if we could solve this issue, like I think that could be pretty huge.
- 25:08Yeah.
- 25:09I got a couple of examples here that were, they're not obvious.
- 25:12Some are obvious, kind of like, here's a Django example.
- 25:15We might see this later.
- 25:16So you might have an admin endpoint and it has at login required, which is a decorator in Django that will do the validation before the function even runs.
- 25:25And so you look at it like, oh yeah, this is fine.
- 25:27It's using authentication here, but it's not using authorization.
- 25:30It's not checking that the person necessarily is an admin.
- 25:33It's just that they're logged in, right?
- 25:35Like that's a real simple example.
- 25:37Yep.
- 25:38And I see the problem.
- 25:39Another one would be if you say we're going to let people read and write files.
- 25:43Maybe it's like a WordPress type thing or something.
- 25:46But then if they can put dot, dot in their path and break out, let me read the file dot, dot, slash, dot, dot, slash, et cetera, dot password and read the passwords or whatever, or usernames.
- 25:57This is the type of stuff that falls in a broken access control or just no login checks at all.
- 26:01I literally did this yesterday, Michael, because someone was like, hey, go get this file from there.
- 26:05And then I go in the folder and it's not there.
- 26:07Like the link wasn't correct.
- 26:08So I just went through the web directory with that.
- 26:11Like, but they wanted to send me the file.
- 26:14So just to be clear, like, like they sent me and told me to go get it.
- 26:18I wasn't stealing anything.
- 26:19And I didn't end up eventually finding it either.
- 26:22So then they had to send me another link that was correct.
- 26:25But I was like, oh, I'll just like not waste their time.
- 26:27I'll just go look for myself because it's that easy.
- 26:30Incredible.
- 26:30It's like, I'm going to use their tools, but not in a way that they necessarily expected.
- 26:33Well, I mean, they could have just sent me the right link.
- 26:35Exactly.
- 26:36They should have just sent you the right link.
- 26:37Yeah, I've I have some I cannot recount them here, but my dad, he I've got to let you help take care of him and stuff now these days.
- 26:45And he can't do a lot of his own paperwork and things.
- 26:48And so I've had to do some crazy stuff to to get access to or to help him fill out something that, yeah, it's insane.
- 26:55OK, let's go on to number two.
- 26:57This is just setting the wrong configurations, not following the hardening guide, not doing patching.
- 27:02And this is so easy for a malicious actor to find because there's scanners.
- 27:06I joke whenever anyone's like, oh, like, you know, we don't want to do a pen test because it might break our thing.
- 27:12And I'm like, well, you're actually having a penetration test done all the time.
- 27:15If you're on the Internet, you just aren't receiving the report.
- 27:18That is absolutely so true and so disturbing.
- 27:21If if if you're out there listening and you have something on the Internet, API website, whatever, and you have not just tailed the log of it and just see slash WP slash admin slash this slash that just coming at it left and right.
- 27:34You're like, what is going on?
- 27:36Because it doesn't show up in your analytics.
- 27:37I actually had someone find something on my website that I was surprised about because I had a user from my blog from long ago and they could see my user and then it gave my
- 27:49email address and it was actually a personal email address that I because I had a backup admin account and I used my personal email and he is like, did you want that on there?
- 27:57I'm like, no, only my mom and my dad email me there because I'm bad.
- 28:01And if my parents write me, I should write back.
- 28:06Right.
- 28:07And so I'm like, oh, that's the personal email that I'm supposed to answer on time.
- 28:12He wrote me and helped me like turn off that setting that I had no idea about despite having multiple security plugins and having run an audit.
- 28:20I'd miss that.
- 28:20This one could evolve for like Python people like Django with debug equals true.
- 28:24Now this is the most, probably most used misconfiguration example for Django apps out there.
- 28:30You're like, well, of course, Michael, I know you don't set debug true in production.
- 28:34You do it all the time.
- 28:35People do it.
- 28:35You're right.
- 28:36And then two, there's like 10 other settings that are, should be in production that are not in production in Django.
- 28:42Like HSTS.
- 28:44Yes, please.
- 28:45And a bunch of other, you know, do not allow me to put it, be put into an iframe and all sorts of other things, content security policies and security headers.
- 28:53Yes, exactly.
- 28:54This is what happened with Claude Code.
- 28:56And this is how they, they essentially allowed debug and production, like by not suppressing their map file and then also not having it as part of their git ignore, which is essentially having debug mode in prod.
- 29:09And that's how they lost their source code.
- 29:11Just to be clear, I'm not shaming the developer that did that.
- 29:14They probably didn't have a checklist for that person.
- 29:17They probably didn't have anything that scanned to tell them that those settings were incorrect.
- 29:21Right.
- 29:22They probably don't even have a policy that clarifies.
- 29:25They're like, oh, they should just know not to do that.
- 29:27Right.
- 29:27And then they were rushed.
- 29:28Probably they're in a hurry.
- 29:30And then.
- 29:31Yeah.
- 29:31They're shipping three or four times a day, which I appreciate, but at the same time.
- 29:34Yeah.
- 29:34And then now very bad things are happening.
- 29:38It is going to be the most audited code that has ever happened.
- 29:41Michael.
- 29:41I've seen so many videos parsing that stuff apart.
- 29:45It's wild.
- 29:45Yeah.
- 29:46For people who don't know, I'm sure people heard Claude Code got leaked, but basically the map file in JavaScript says, here's the minified version.
- 29:54But if you want to show the full source version for helpful debugging, here it is.
- 29:59And there's how you get to it.
- 30:00And that apparently got shipped.
- 30:01And people were just like, you know what?
- 30:02Why don't we find out what those files are actually?
- 30:04And it was two security misconfigurations because one of them would have stopped it from going and the other one would have like not had it been in the package in the first place.
- 30:14Right.
- 30:14And it's number two.
- 30:16And it happens even to the really, really, really, really, really high profile, you know, high security assurance requiring places.
- 30:23I have a third one on this list that I think will really surprise people like for real.
- 30:29So imagine this.
- 30:30I've got a self-hosted app and I'm going to run it on a Docker in Docker.
- 30:35You know, it could be Kubernetes.
- 30:36It could be whatever.
- 30:37But I'm going to run it in Docker on my server.
- 30:40And it has both a web interface and a database.
- 30:44And the database is running on the default port and so on.
- 30:47So that's all fine.
- 30:48But it's in Docker and everything's locked down.
- 30:51And so what you could do is you can use this thing called UFW, uncomplicated firewall on Linux.
- 30:55Turn that on and say block or don't block.
- 30:58Only allow my web port.
- 31:00And in your Docker compose file, you often or even just Docker statements, you see map, say Postgres, port 5432 to 5432.
- 31:09Guess what?
- 31:09That's actually open on the Internet, probably with the default password on that database.
- 31:13Because if you look at the Docker docs and you go to the bottom, it says uncomplicated firewalls, a friend that ships with Debian and Ubuntu unless you manage firewall.
- 31:21Docker and UFW use firewall rules in ways that make them incompatible.
- 31:26When you publish the container ports on Docker traffic, it gets diverted before that.
- 31:30So guess what?
- 31:30That's open on the Internet.
- 31:32Holy smokes.
- 31:33Is that it's so common to just see this port on the container map to this port on the server.
- 31:39And if you're thinking that UFW on your firewall is going to save you, it's actually just open on the Internet.
- 31:45Like I didn't realize that.
- 31:46And so, for example, what do you do?
- 31:47Well, you say localhost colon my port on the server.
- 31:52So you're shipping, you're only listening locally.
- 31:54You don't have, or you just don't do that.
- 31:55But that's a really subtle and sneaky one that people should be aware of.
- 32:00The thing is no one can memorize all of this.
- 32:02And so what is the answer, Michael?
- 32:04Checklists?
- 32:05Checklists are good.
- 32:06Scanners?
- 32:06Scanners are good.
- 32:07Honestly, I think the modern top tier AI agentic tools are really good.
- 32:13They find a surprising amount of these things.
- 32:16They find them if you ask them to find them, or they make it part of the code that they give you when you just ask for it.
- 32:23Because people just say, I want the app.
- 32:24They don't say, I want a secure app necessarily.
- 32:26And well, it's more efficient to not worry about the security.
- 32:29We'll save you some tokens.
- 32:30Even if you just say, I want a secure app.
- 32:33So I gave a conference talk two weeks ago at RSA called Insecure Vibes.
- 32:37In the demo that I recorded in advance that was not part of the slides when I gave my live presentation, but it's on my YouTube.
- 32:44I just asked Claude, I'm like, can you make a login function that's for an insulin pump?
- 32:49So this is a medical device that needs to be really secure.
- 32:52And it does it.
- 32:53And then after I'm like, analyze it for vulnerabilities.
- 32:55And multiple AIs found critical vulnerabilities in it.
- 32:59So I asked for it to be secure.
- 33:00So you can't just say, I want to be secure.
- 33:02You have to say, and this is what secure means.
- 33:05I do think you can find a lot if you use the tools in the right way.
- 33:08But like you said, you've got to ask.
- 33:09And it's a proper step.
- 33:11Software supply chain failures.
- 33:13Number three.
- 33:14This is the expansion.
- 33:15So this used to be vulnerable and outdated components, which is part of your software supply chain.
- 33:20But Michael, I'm sure that I've told you this before, but for people that haven't heard me, blah, blah, blah, about it.
- 33:25Every single thing that you use to create and maintain your software is part of your supply chain.
- 33:31So that includes your browser, the plugins in the browser, the sandbox you created, your CI, all the settings in the CI, where you're getting your libraries and packages from, how you're getting them.
- 33:43So do they maintain integrity across the wire when you get them?
- 33:47Could it be that you got something else?
- 33:49Like every single thing that you're using to maintain and create is part of the supply chain.
- 33:56And so we need to protect the whole thing.
- 33:59And like we were saying earlier, developers themselves are becoming targets of malicious actors.
- 34:04We need to find ways to defend the developer themselves, protect them, make them safer doing their jobs, right?
- 34:12And help them find ways to secure the whole supply chain that's not too painful because they still need flexibility in order to be creative.
- 34:20So some Python things that you can do concretely here is pin your dependencies.
- 34:24You can use pip compile or you can use uv lock files.
- 34:28There's all sorts of things that are possible there.
- 34:31And then you can also, I think the other side that we haven't mentioned, Tanya, is like known vulnerabilities in packages.
- 34:38I think a lot of people, I would say over 95% of the people that install libraries from PyPI, they don't even check whether or not there's a vulnerability in that package before they install it.
- 34:50I would like to see.
- 34:51So in 2022, the first company announced this idea of reachability.
- 34:56So let's say you want to do math.
- 34:58So you install a math library.
- 34:59We don't actually want to do all of math, right?
- 35:02We probably just want to do calculus, but maybe the vulnerabilities in the statistics function, right?
- 35:07And so when your code calls all the calculus functions, you're like, woo, derivatives.
- 35:14You're not actually, there's no reachable path from your code to the vulnerability.
- 35:19Most of the time, that means it's not exploitable, except for if it's log4j, then you're just screwed.
- 35:24Just to be clear, you're just in trouble, right?
- 35:26But for most things, like 99.9% of the time, then you're fine if there's no reachability.
- 35:31And so software composition analysis tools, sometimes called supply chain security tools, when the marketing teams got a little out of hand.
- 35:39I feel like if you do one of the 19 attack surfaces within the supply chain that you don't get to call yourself a supply chain tool, but I digress.
- 35:47I have strong feels.
- 36:17That's so overwhelming.
- 36:18I'm just not even going to look at it.
- 36:20I have a known vulnerability in one of the packages that I am shipping to production.
- 36:25I think it's a PDF package or something like that.
- 36:28I can't remember.
- 36:29And I scan all my builds with pip audit and it will fail the build.
- 36:33So I have to ignore it because it is a vulnerability when you call a path that I don't call and you're running on Windows.
- 36:40And I'm trying to deploy it to Docker.
- 36:42And I'm not calling that path.
- 36:44I'm like, I understand it's a problem that could be an issue under some circumstances, but it doesn't apply here.
- 36:50And I just need to use it.
- 36:51And it's a Windows problem on my Docker Linux.
- 36:54I don't really care right now.
- 36:56I mean, it's fine.
- 36:56Until they fix it, I'll be okay.
- 36:58Well, and especially if you know what the problem is and you're not going to suddenly switch to Windows, why would you do that?
- 37:05So the tools are maturing, but they're not perfect.
- 37:09And lots of them are going at different speeds.
- 37:13We'll just say that.
- 37:13So I look forward to the day where there's reachability done on all of those things.
- 37:20This portion of Talk Python To Me is brought to you by us.
- 37:23I want to tell you about a course I put together that I'm really proud of, Agentic AI Programming for Python Developers.
- 37:31I know a lot of you have tried AI coding tools and come away thinking, well, this is more hassle than it's worth.
- 37:37And honestly, all the vibe coding hype isn't helping.
- 37:40It's a smokescreen that hides what these tools can actually do.
- 37:44This course is about agentic engineering, applying real software engineering practices with AI that understands your entire code base, runs your tests, and builds complete features under your direction.
- 37:57I've used these techniques to ship real production code across Talk Python, Python Bytes, and completely new projects.
- 38:04I migrated an entire CSS framework on a production site with thousands of lines of HTML in a few hours.
- 38:10Twice.
- 38:11I shipped a new search feature with caching and async in under an hour.
- 38:15I built a complete CLI tool for Talk Python from scratch, tested, documented, and published to PyPI in an afternoon.
- 38:24Real projects, real production code, both Greenfield and legacy.
- 38:29No toy demos, no fluff.
- 38:31I'll show you the guardrails, the planning techniques, and the workflows that turn AI into a genuine engineering partner.
- 38:37Check it out at talkpython.fm/agentic dash engineering.
- 38:41That's talkpython.fm/agentic dash engineering.
- 38:45The link is in your podcast player's show notes.
- 38:47One of the other things I wanted to mention is like, so you said pin dependencies.
- 38:52And so I teach this and then inevitably every time someone's like, well, if I pin dependencies forever, then I just have all these really old dependencies.
- 38:59That's not what Michael means.
- 39:01He means you do development, you update your dependencies to a version.
- 39:05Like ideally you're like LTE, you're like latest, you know, stable version of whatever the thing is.
- 39:10Because you're trying to keep like definitely as supported version, recent, you're not picking terrible things where, you know, it hasn't been updated in two years, or there's one maintainer and they happen to live in Russia and work for the Russian government, right?
- 39:23So you're picking like decent ones.
- 39:25You're updating it in dev.
- 39:26You're like, okay, this is the one.
- 39:27Then you pin it.
- 39:28So as it goes up to different environments, you don't get a surprise update and it changes.
- 39:33And then there's something different in prod than what you tested in UAT and approved with the security tools.
- 39:39That's what, that's what.
- 39:40And a hundred percent.
- 39:41Because it gets misinterpreted.
- 39:43Yeah.
- 39:43And another thing to do that you can do real simple is like with some of the tools, like with uv, you can say, I have pin dependencies, update them to the current ones
- 39:52with a very important caveat that you can say that are older than a week or older than a day or something.
- 39:58But because, you know, the really big example here is LLM, LiteLLM, just this, was that just this week or was that last week?
- 40:05I can't keep it.
- 40:06It was very recent.
- 40:07Yeah.
- 40:07This thing has a dependency that itself became, like you talked about, the developer got taken over, I believe, and a virus got put in and it was only out for like half an hour or something, but it took over, it's so popular.
- 40:20It got, took it, took it over like 50,000 machines because it gets downloaded millions of times a day.
- 40:26Automatically.
- 40:26If you say, give me the latest, he's like, obviously waiting a week is not hardcore security, but at the same time, so many of these popular issues that people take, they only last briefly, right?
- 40:36For a few moments.
- 40:37And then somebody's like, oh my gosh, why is this thing using 100% CPU?
- 40:41You know what I mean?
- 40:42And here's the thing, Michael, is that not all of those 50,000 got the memo that this happened and they're still vulnerable in prod and they could be from them.
- 40:49Yeah.
- 40:49It could be for a long time.
- 40:50Yes, I agree.
- 40:51Like update, but to, you know, one that's three days old or one week old, it's weird.
- 40:56So this advice has drastically changed over the past six months.
- 41:00The best practice used to be auto update to latest version, period.
- 41:03That used to be the advice and that's no longer the advice.
- 41:06And it's kind of heartbreaking, especially if you use npm.
- 41:09NPM is just like under siege.
- 41:11It is.
- 41:12Yeah.
- 41:12PyPI is as well, but it looks over at npm as thankful for its situation.
- 41:17Number four.
- 41:18Or I got to keep cruising here.
- 41:21For cryptographic failures.
- 41:22Cryptographic failures.
- 41:23Yeah.
- 41:24Not encrypting.
- 41:25Encrypting using something really old.
- 41:28You start off encrypted and then briefly you're not encrypted and then you're encrypted again.
- 41:32You don't encrypt it when you're supposed to.
- 41:34Also in this realm, one way hashing, not just reversible encryption, right?
- 41:41It would probably fall in here.
- 41:42Encrypting user passwords and storing them in the database along with the key.
- 41:47Ideally, we would hash and we would salt and then hash user passwords.
- 41:52That would be the best.
- 41:53If you really, really, really, really are intense, you could pepper it too.
- 41:56And no, I did not make that up.
- 41:58That is a mathematical nerd joke, not an app sec joke.
- 42:01But a salt is unique per user and the salt itself isn't really a secret.
- 42:06Where a pepper is unique per system or per organization.
- 42:09And it is a secret.
- 42:11Right.
- 42:11Like a secret key that you set and then it gets factored in there.
- 42:14That's cool.
- 42:15Yeah.
- 42:15Yeah.
- 42:15Also, maybe choose more modern hashing algorithms, right?
- 42:19Obviously not MD5, but maybe something memory hard like Argon maybe.
- 42:23I don't know.
- 42:23Yes.
- 42:23Argon 2.
- 42:24That would be better for sure.
- 42:27And this is something where if you're going to do it, it's very easy to look up what you're supposed to do on the internet.
- 42:33This is something where you can ask the AI, like, are you using a good algorithm?
- 42:38Are you doing this?
- 42:39Like, make sure it's secure.
- 42:40And then it's good as long as it does it.
- 42:43Because one suggestion, if you are going to VibeCode and not do the 400 other things we'll talk about later when we talk about my prompt library, but ask it to list its security assumptions.
- 42:54So whatever it is you prompt, you give it to make a thing.
- 42:56You're like, make this, then do that, blah, blah, blah.
- 42:59Please list all your security assumptions.
- 43:01And it'll be like, oh, yeah, but obviously like you wouldn't do like authentication like that because that's terrible.
- 43:06And like in production, you would do this other thing and you're like, oh, yeah, because it'll assume that you're going to change a bunch of things later that it doesn't tell you unless you ask it to tell you its assumptions.
- 43:18Yeah.
- 43:18We'll use no password here, but when you ship it, you're going to add that, right?
- 43:21Like, no, I wasn't going to, but now I will.
- 43:23All right.
- 43:24I think one of the best known ones has got to be little Bobby tables and friends.
- 43:29Number five, injection.
- 43:31Yes.
- 43:32So injection, tricking an application in, like you put your code, the malicious actor's code into a place where it should be data, but you've tricked it into thinking it's its code.
- 43:43And then either it executes it or it interprets it.
- 43:45Like if there's an interpreter, there's a compiler, there's the potential for injection.
- 43:49And it, yeah, we don't want to mix data in with commands.
- 43:54We don't want to mix data in with anything that's going to be executed or interpreted.
- 43:58And we do it a lot, Michael.
- 43:59I know we make bad choices, don't we?
- 44:01We make bad choices.
- 44:02So obviously SQL injection is the number one in this world for sure.
- 44:08And still it's popular.
- 44:10Still people don't know.
- 44:11It's still tricky.
- 44:12I mean, we have certainly parametrized queries and ORMs and stuff that should be helping us or does help us if we choose to use them with this.
- 44:19However, I think other ones should just give them a quick shout out.
- 44:23Like for example, if you're accepting JSON and converting it to a dictionary in Python, you can do MongoDB injection.
- 44:31Like your password, you know, the Bobby tables one is like quote, semicolon drop table that, you know, like that's what that looks like in T-SQL.
- 44:39But in MongoDB, you can do queries that are dictionaries.
- 44:43That's like kind of how you do your filtering.
- 44:44So if you take something that would be a password in a JSON document, the password could be curly brace greater than, you know, one equals one.
- 44:54Like a really complicated JSON dictionary that is actually the query that is equivalent.
- 44:58So you got to be super careful there as well.
- 44:59And that's really tricky to do that.
- 45:02And then also like the pickles and like serialization, deserialization.
- 45:06There's a lot to this, not just SQL injection.
- 45:09It's a lot about input validation.
- 45:11So using a parametrized query, so store procedures, prepared statements, whatever you want to call them.
- 45:17What that does is says this is data only treated as data.
- 45:21And then the database can do that.
- 45:24But if we, on top of that, do input validation.
- 45:27So like we're getting the thing that looks correct and we're rejecting, we're not trying to fix it.
- 45:33We're just rejecting everything that looks not correct.
- 45:36And then if we have to accept any special characters, we escape them or sanitize them out.
- 45:41I prefer escaping.
- 45:42I think it's weird to remove stuff.
- 45:43That's my data.
- 45:44I probably want it.
- 45:45So like if you have to accept single quotes because you know you're going to have users named O'Malley, let's say.
- 45:50Right.
- 45:50So we accept the letters.
- 45:52We accept the numbers.
- 45:53We accept a single quote and some dashes, even though those are dangerous.
- 45:56And then we escape those characters because we know they're potentially dangerous.
- 45:59And then we specify, by the way, that's definitely data and not code by making it a parameter.
- 46:06Right.
- 46:06And then we're locked down.
- 46:08We're in really good shape.
- 46:09If we olded input validation on everything and then we just rejected everything that looked weird, especially against like we always need to do like a yes list and allow like this is allowed list.
- 46:21Not like when I was a pen tester, Michael, I was not.
- 46:24I was a pen tester for a year and a half.
- 46:26I had basically zero training and I could get around those in two seconds.
- 46:31And like I was not particularly superbly talented.
- 46:34And I was just like, pew, pew, pew, ha, ha, ha, ha, ha, block list.
- 46:37You just try.
- 46:38If you just know to look, right?
- 46:40Yeah.
- 46:40Well, and there's cheat sheets all over the internet of how to get around them.
- 46:43It's so everyone knows how to get around them.
- 46:46So, but you can't get around.
- 46:48Well, you're only allowed letters and numbers.
- 46:49It's like, well.
- 46:50Let's keep moving a little bit quickly so that we know that we're, we got time for a little retrospective.
- 46:54So insecure design, that's a fun one.
- 46:57It does not matter how perfectly you follow the plan if the plan is bad.
- 47:02Right.
- 47:03And so this is, this was new on the last time we released the list was the first time it was on there.
- 47:10And I'm really glad because all the other items are implementation.
- 47:14And this is the only one that is design the plan.
- 47:17And so essentially it means, you know, someone designed something and you don't talk about it.
- 47:22You don't analyze it for security.
- 47:24You don't intentionally apply secure design concepts.
- 47:27You don't do a threat model.
- 47:29There's no security review.
- 47:30You YOLO that.
- 47:31You don't even have a list of security requirements usually that you knew you should have added.
- 47:35Like if you're going to do an API and it's, you know, visible from accessible from the internet, to me, it should be behind an API gateway, period.
- 47:44That is my opinion.
- 47:45No, I don't sell one, but I think we all need one.
- 47:47Right.
- 47:48And to me, that should just be a requirement up front.
- 47:51And then when I see your design document and it's there, I'm like, thumbs up, let's go.
- 47:55Right.
- 47:55But if you're not giving clear requirements and then you're not reviewing the design, you are getting a YOLO approach at stuff.
- 48:03And that doesn't mean developers don't care.
- 48:06But if no one's taught them this, no one's asked for this, and then no one checks this.
- 48:09The problem with this one is the code looks fine.
- 48:11It looks like you're doing it right.
- 48:12It's just there's something important that's just not even there.
- 48:15Like examples that I came up with were like no rate limiting would be one.
- 48:19The login looks fine.
- 48:20You're checking the person's not a duplicate that they're there, et cetera, et cetera.
- 48:23Right.
- 48:23Or a client side enforcement and some kind of like Vue.js act.
- 48:27You've got all the validation there, but the API actually just assumes the client is doing it, which is never the way.
- 48:32And there's a lot of business logic issues that will be the way that you're solving the problem.
- 48:40If users do the thing you want, it's fine.
- 48:43But not all users do the thing you want.
- 48:45And some of them are Tanya.
- 48:46And they're like, well, I'm just going to click through your.
- 48:48Exactly.
- 48:49Some of us are curious and we like to click the buttons.
- 48:53We're like, oh, look at that.
- 48:54Oh, there's a next button, even though it says it's the last page.
- 48:57Well, what would happen if we click that?
- 48:58Absolutely.
- 48:59You've got to click that button, right?
- 49:01Authentication failures, number seven.
- 49:03So this is when an attacker can trick the app into thinking they're a different user, usually an admin user.
- 49:09Or if they're not a legitimate user, tricking them into being a legitimate user.
- 49:13But we all want to be admin, Michael.
- 49:15Oh, yeah.
- 49:15This can be caused by lots of things.
- 49:17We wrote our own authentication instead of buying a tried, tested, and true product that will do this for us easier, better, faster, and cheaper in the long run when we count maintenance.
- 49:29That's the biggest mistake.
- 49:31But we don't protect against credential stuffing.
- 49:33We don't protect against brute force.
- 49:35Those are the two super, super huge ones.
- 49:37We let people reuse passwords, use terribly insecure passwords, etc. We don't have multiple forms of authentication.
- 49:43So there's no second factor.
- 49:46Yeah.
- 49:46And there's, Michael, there are ways to do multi-factor that don't, like, have to be awful necessarily.
- 49:54Like, if you don't require the same level of security, like posture.
- 49:57So, for instance, you know, you do have multi-factor authentication for the first time.
- 50:03But then maybe you fingerprint their browser and their device and their network.
- 50:07And if they're going to log in from the same device, the same browser, and the same network, maybe you don't require an MFA challenge very often.
- 50:14A hundred percent.
- 50:15Like, you could say, trust this machine or this browser.
- 50:18And you're like, okay, we'll never ask you 2FA again.
- 50:21Just your username, password.
- 50:23Or we won't, unless you're doing something like deleting your account.
- 50:26There's ways to make this not necessarily always super painful.
- 50:30And I, you know, pass keys are so nice.
- 50:33Those are making things a lot nicer.
- 50:35But I still feel like there's a ways to go.
- 50:38I dream of the day where we trust our devices so well that, like, I can just touch the thing and I know it's okay.
- 50:44Right?
- 50:44And I know that someone can't just, like, XKCD hit me with a wrench until I put the thing in front of my face and then it unlocks.
- 50:52Exactly.
- 50:52That is one of the weakest parts of the security chain there.
- 50:54Mm-hmm.
- 50:55Software or data integrity failures?
- 50:58Number eight.
- 50:58So this is one we fought a lot about.
- 51:01Yeah.
- 51:01Especially me and Neil.
- 51:02Because Neil, I wrote this one and Neil wrote the supply chain one or vice versa.
- 51:08And there's lots of arguments of how to differentiate.
- 51:10So we need to make sure that things we download are exactly what we think they are and that the integrity, it's not been spoofed or tampered with in the meantime.
- 51:20So no one has changed it.
- 51:22And this is for data and for software.
- 51:24So, you know, third-party components that we're getting.
- 51:27Are we getting the thing we thought?
- 51:29Is there a table squat?
- 51:30Is, has someone been able to intercept in between and change it out?
- 51:33Same with data.
- 51:35Like, did someone change the data on the way to us, et cetera.
- 51:39And this is really key, especially for things that require anything medical.
- 51:44Like imagine the insulin pump that gets it wrong sometimes and people have comas.
- 51:48Like that would be so unbelievably bad.
- 51:50That's very bad.
- 51:51Yeah, I worked with a company that did like all the medical devices and instruments and ORs and ERs and security assurance.
- 51:59Hi.
- 52:01It was an awesome project.
- 52:02It was really cool, but it was also like, damn, your job hard.
- 52:06It's tough to sleep at night in that one.
- 52:07Yeah.
- 52:07The thing is, is that private industry tends to really focus on availability.
- 52:11Like if their website's down, they can't sell their thing.
- 52:14Clients call, it costs them money.
- 52:16Right.
- 52:16But integrity is like more silent hurt, if that makes sense.
- 52:21Yeah.
- 52:22So many of these are like this, honestly.
- 52:24Like the whole top 10 is only, it only slows you down and it's sand in the gears until something happens.
- 52:30And then it's your fault for not doing it.
- 52:31But before that, it's like all this stuff is a hassle.
- 52:34And integrity, it comes into play in so many situations because some, it can fail silently.
- 52:42Things that fail silently are more scary for security teams.
- 52:45Does that make sense?
- 52:46People love to use CDNs for their JavaScript and their CSS and so on.
- 52:51And there've been examples where the CDN was taken over or another developer could have been compromised who published a malicious JavaScript.
- 53:02And the danger with this is if you make that hack go through, you don't just take over that app.
- 53:08You take over all the people who use that app and everyone who uses the CDN to pull it out.
- 53:12Like it can be really the knock-on effects are mega.
- 53:16Yeah.
- 53:16And like checking the sub-resource integrity, doing that check, that can help.
- 53:22Sometimes we can do all the right things and we still get hurt.
- 53:26Because like for instance, with SolarWinds, the compromise was so deep in the organization that they were able to not only push in like code that was malicious, have it pass all the security tests in the pipeline, then sign it and then release it.
- 53:43And then not have customers also notice the problem.
- 53:45Like that situation is rare.
- 53:48What we want to do with this one is raise awareness that you should just be checking the integrity of your stuff, period.
- 53:55Right?
- 53:56So the software composition analysis companies, the security researchers, they're on it finding those rare edge case zero day situations.
- 54:06What we need the average developer to do is just check integrity, period.
- 54:10Like the thing you've got is what you think you've got and it's from the right place.
- 54:15And if we could all do that, like life would improve greatly.
- 54:18There's defaults that are not great.
- 54:20For example, check this out.
- 54:21jsDelivr are Tailwind.
- 54:24So here's a real popular CDN delivering a very, very popular library.
- 54:28Here's how it tells me to use it.
- 54:29What's missing here?
- 54:30Sub-resource integrity check.
- 54:32Yes.
- 54:33So if I just say, I want to use this Tailwind and it says, great, source equals such and such.
- 54:38Good to go.
- 54:39You know what I mean?
- 54:39And that's it.
- 54:40So even the really popular CDNs and stuff are just encouraging you to fall, to scramble from the pit of success.
- 54:47You know, it's not that at all.
- 54:48Maybe we should write them and be like, I want you to change this, please.
- 54:52When I worked at Microsoft, I did that all the time.
- 54:54I'd be like, you need to change your readme page.
- 54:56It's wrong.
- 54:57You forgot the security thing.
- 54:59And they'd be like, Tanya, just, it's a demo.
- 55:01I'm like, nope.
- 55:02Two more real quick before we run out of time.
- 55:04Logging and alerting.
- 55:05So security logging and alerting.
- 55:08So developers might be doing lots of logging and they might be doing some alerting for debugging, which is important and you should still do it.
- 55:15But this is more that we're not logging when security controls are called and especially pass or fail.
- 55:21So if someone tries to log in 100 times in one second, I don't want to know the 100th time that they got in.
- 55:28I want to know all 99 times where they failed in the logs.
- 55:32Right.
- 55:32I want to have enough information in those logs that I can do a proper investigation.
- 55:38Like when I worked in AppSec, my job wasn't called incident responder.
- 55:42But every time an app got smashed, they're like, okay, Tanya, do you saying that you do that weird thing?
- 55:49And I would go look at the logs.
- 55:50And I remember a client calling me one day and they're like, Visa called us and 27 of our customers got popped and we need you to go investigate.
- 55:59And turns out they didn't have any logs.
- 56:01They didn't think they needed to log that.
- 56:03And so they had absolutely no application logs for that log for that app.
- 56:08Sorry.
- 56:09And I was like, when am I supposed to investigate walk around the building with like a magnifying glass and just look cool with a hat on?
- 56:15Like there's nothing, there's no evidence.
- 56:16There's probably somebody in the corner with a hoodie, sunglasses looking sort of hacker-ish.
- 56:21Right.
- 56:22Like, I'm just like, what am I supposed to investigate guys?
- 56:24Like you have no logs at all.
- 56:27You got to just let it keep going.
- 56:28Basically, you got to say, well, now we add logging and then we can figure out if there's new stuff happening or something.
- 56:34It's really bad.
- 56:35It turns out it wasn't them.
- 56:36It turned out that there's a sandwich shop downstairs and an employee had swiped cards and everything from our end was fine.
- 56:44But then I was like, we are rewriting this app so that it does security logging and failure.
- 56:48So essentially, you're making it so we can't investigate.
- 56:51You're making it so there's no evidence that a thing happened.
- 56:54We can't press charges in court.
- 56:55There's no chain of custody.
- 56:56We'll never know what happened.
- 56:59And then that means we don't know how to protect ourselves in the future.
- 57:02And we really need these logs.
- 57:04So every time a security thing happens, input validation, output encoding, like anything that is security related, just log that the attempt was made and it worked or it didn't work.
- 57:14And, you know, which user ID, et cetera, things like that.
- 57:17And the timestamp.
- 57:18All right.
- 57:18Last one.
- 57:19Let's round it out real quick with mishandling of exceptional conditions.
- 57:22So this is brand new and this one is related to the other one.
- 57:27So number nine was basically you're not doing logging when you should or your logs suck.
- 57:33They're incomplete.
- 57:34This one is errors happen and you just don't handle them properly.
- 57:38So I'm sure you've reviewed code and seen this where it's like try and it does a thing and then catch and then there's nothing and then end.
- 57:47I'm like, what?
- 57:47You didn't handle anything.
- 57:50Or the handling is just I'm going to print the entire system error to the screen with the stack trace and a mess.
- 57:58Nope, that's gross.
- 57:59I'm just going to not properly recover.
- 58:02Right.
- 58:02And so application resilience is important, but you can't have that at all.
- 58:07If you're not doing this, you can't recover.
- 58:09Yeah.
- 58:10Or you don't use a database transaction and it's data is corrupted, something like that.
- 58:14This is where a lot of business logic flaws, like really unique bugs happen that are harder to find because we are not handling our errors at all or we're handling them very, very poorly.
- 58:27And I was really excited to have this on here because lack of application resilience tied for this one for spot number 10.
- 58:36But if you solve this, you almost always solve lack of application resilience.
- 58:40But if you solve lack of application resilience, you do not solve this.
- 58:45And so I was like, and so that's how I got them to agree to put this one on.
- 58:48And so the other one, having technical discussions with really smart people, it's pretty cool.
- 58:54Absolutely.
- 58:55So I want to take a moment and talk about AI and security and give you a chance to talk about your prompt library and how people can get it.
- 59:04And while you're doing that, I'm going to pull up an example I can kick off.
- 59:07So tell people about it and I'll pull up the example.
- 59:08I give training and I do this bad, better, best thing where I give an example.
- 59:12So I'm like input validation or whatever the topic is, you know, like a brief lecture on it and best practices.
- 59:17Then I give an example of bad code.
- 59:19Then we fix that thing, better code.
- 59:21And then best codes, like layers of defenses.
- 59:23And when I was creating these examples with the AI, Michael, every time the example was bad code, like no security control whatsoever or completely incorrectly done.
- 59:34So like you get the input, you use it and then you validate it.
- 59:38Right.
- 59:39So it has gotten better.
- 59:41So over the past two years, I've seen it go from every time bad to maybe half the time.
- 59:46It's a bad example.
- 59:47Sometimes I have to dumb it down now, which is encouraging.
- 59:49But that's obviously not what we want.
- 59:52And so the AI, I think everyone knows, is not creating great code.
- 59:57And the reason is it was trained on not great code.
- 1:00:02Most code out there is not great code.
- 1:00:03The code specifically it used was demos, examples, things on GitHub, publicly available demos where there's no security team involved.
- 1:00:11Right.
- 1:00:12Right.
- 1:00:12So like if you went and scanned the code inside Microsoft that makes the Microsoft products, you better believe it, that'd probably be pretty darn good code versus some random crap Tanya did five years ago that's on her GitHub.
- 1:00:25That might be really crappy or it might even be intentionally vulnerable.
- 1:00:29Right.
- 1:00:30And it doesn't.
- 1:00:30Yeah.
- 1:00:31No.
- 1:00:31And so as a result, we have this thing that's trained that security just it's optional, it's low priority and it's missing.
- 1:00:40And so it is doing what it was trained to do.
- 1:00:44And developers and non-developers are constantly making apps now.
- 1:00:50We have CEOs making apps because they don't like what the marketing team did.
- 1:00:54And they're like, look what I did over the weekend.
- 1:00:56Boom.
- 1:00:57It's publish, please, because I'm the boss.
- 1:01:00Oh, I've seen it.
- 1:01:01Like literally.
- 1:01:01Yeah.
- 1:01:01Who's going to say no, right?
- 1:01:02Yeah, exactly.
- 1:01:03And so here we have very, very insecure code going onto the internet very, very quickly, often with no time for the security team to go look at it.
- 1:01:13All right.
- 1:01:13So you've got this prompt library that people can go and get from your website for free.
- 1:01:18You gave me an example to say, go find problems in this code.
- 1:01:22I took just some random code that I know has trouble in it and threw it in here.
- 1:01:25So the secure code prompt library, if you want to go, just go securemyvibe.ca and you do have to join my newsletter to get it.
- 1:01:34But I feel that's a reasonable price because my newsletter is awesome and you get memes.
- 1:01:38But anyway, so this is from that.
- 1:01:41So the prompt library has many things, but one of them is to review the code for security.
- 1:01:46So this is a code review prompt.
- 1:01:48So after you've generated the code, you would put this in.
- 1:01:50We have high risk findings.
- 1:01:52That looks like an, and what number was that?
- 1:01:55We got more findings, mass assignment, unvalidated JSON.
- 1:01:59Yeah.
- 1:01:59And look how short your code was.
- 1:02:01I gave it 62 lines of code here.
- 1:02:03And you are going to have more vulnerabilities than you have lines of code.
- 1:02:07Okay.
- 1:02:07So I'm not going to go into the details, but wow, I just gave it a little bit and it pulled up a whole bunch.
- 1:02:11So I think that that is.
- 1:02:13Did this find more than when you just asked it to review for vulnerability?
- 1:02:18Yeah, I think so.
- 1:02:19I think it did actually.
- 1:02:20Because if you put the AI in the right frame of mind, right?
- 1:02:23That's incredible.
- 1:02:24Well, and I gave it specific things that I wanted it to look for.
- 1:02:27So the prompt library has three levels.
- 1:02:29So prompt level one, you would make, you would add it to your memory or make a code skill, but you would make it run 100% of the times that you generate code.
- 1:02:38And it takes most of the first two thirds of my most recent book, Alice and Bob Learn Secure Coding, and it has condensed it into a set of prompts.
- 1:02:47Oh, that's awesome.
- 1:02:48When you build the code, these are the rules for doing so.
- 1:02:52Then, so that runs just every single time.
- 1:02:54And then it tells you all of its security assumptions and it flags any potential security issues for you automatically.
- 1:03:01So every time you generate code, it's like, I need you to know these things.
- 1:03:03And so then you can address them.
- 1:03:05And then level two prompts are, well, I'm going to build an API or I'm going to build a serverless app or I'm going to do this or I'm going to do that.
- 1:03:12And then you fill in the blanks and it helps basically set security requirements before the code's generated.
- 1:03:19So it does the first prompt and then that as like a double check.
- 1:03:23Then after you can run the secure code review check.
- 1:03:26And then level three is like where you want to get nitty gritty.
- 1:03:29Like you're like, I'm doing a user login feature and I want to hash these passwords very securely.
- 1:03:36Like, and then it's very specific about exactly how to do that.
- 1:03:40And it's free.
- 1:03:40Yeah.
- 1:03:40People should definitely check this out.
- 1:03:41That's very cool.
- 1:03:42All right.
- 1:03:42We are out of time, Tanya.
- 1:03:44Thank you so much for being here.
- 1:03:45Final thoughts.
- 1:03:46People want to get going with the new top 10.
- 1:03:49Please go take a look at it.
- 1:03:50So just look up OWASP top 10 and that will be us.
- 1:03:53Like Google's very good at finding us and maybe give it a read and maybe think about it the next time you are building an app.
- 1:04:01Also, maybe consider visiting your local OWASP chapter.
- 1:04:05Next time you want to, you know, search the internet how to do something that is security related, look up OWASP cheat sheets and then authentication, authorization or wherever you're doing.
- 1:04:14There's over 100 cheat sheets.
- 1:04:16We are a community that lives to serve and help you secure your software.
- 1:04:20And come check out me.
- 1:04:21If you look up She Acts Purple, I am all the things, the newsletter, the podcast, the blog, et cetera.
- 1:04:26And I'm also here to help.
- 1:04:28Well, I know you're doing really good stuff.
- 1:04:30I really appreciate your time here.
- 1:04:31Thank you, Tanya.
- 1:04:32Thank you, Michael.
- 1:04:34This has been another episode of Talk Python To Me.
- 1:04:37Thank you to our sponsors.
- 1:04:38Be sure to check out what they're offering.
- 1:04:39It really helps support the show.
- 1:04:41This episode is brought to you by Temporal, durable workflows for Python.
- 1:04:45Write your workflows as normal Python code and Temporal ensures they run reliably, even across crashes and restarts.
- 1:04:52Get started at talkpython.fm/Temporal.
- 1:04:56If you or your team needs to learn Python, we have over 270 hours of beginner and advanced courses on topics ranging from complete beginners to async code, Flask, Django, HTML, and even LLMs.
- 1:05:08Best of all, there's no subscription in sight.
- 1:05:11Browse the catalog at talkpython.fm.
- 1:05:14And if you're not already subscribed to the show on your favorite podcast player, what are you waiting for?
- 1:05:19Just search for Python in your podcast player.
- 1:05:21We should be right at the top.
- 1:05:22If you enjoyed that geeky rap song, you can download the full track.
- 1:05:25The link is actually in your podcast blur show notes.
- 1:05:28This is your host, Michael Kennedy.
- 1:05:30Thank you so much for listening.
- 1:05:31I really appreciate it.
- 1:05:32I'll see you next time.
- 1:05:33и Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би Би
- 1:06:03Thank you.