PyPI has been in the news for a bunch of reasons lately, many of them great, but also some with a
bit of drama or mixed reactions. On this episode, we have Dustin Ingram, one of the PyPI maintainers
and one of the directors of the PSF, here to discuss the whole two-of-a-face story,
securing the supply chain, and plenty more related topics. This is another important episode that
people deeply committed to the Python space will want to hear. This is Talk Python to Me,
episode 377, recorded August 11th, 2022.
Welcome to Talk Python to Me, a weekly podcast on Python. This is your host, Michael Kennedy. Follow
me on Twitter where I'm @mkennedy and keep up with the show and listen to past episodes at
talkpython.fm and follow the show on Twitter via at Talk Python. We've started streaming most of our
episodes live on YouTube. Subscribe to our YouTube channel over at talkpython.fm/youtube to get
notified about upcoming shows and be part of that episode. This episode of Talk Python to Me is brought
to you by Compiler from Red Hat. Listen to an episode of their podcast as they demystify the tech industry
over at talkpython.fm/compiler. It's also brought to you by the IRL podcast, an original
podcast from Mozilla. This season, they're looking at AI in real life. Listen to an episode at talkpython.fm
slash IRL. Transcripts for this and all of our episodes are brought to you by Assembly AI. Do you need a great
automatic speech-to-text API? Get human-level accuracy in just a few lines of code. Visit talkpython.fm
Dustin, welcome back to Talk Python to Me. Yeah, it's great to be back. Good to see you. Yeah, good to
see you as well. It's lovely to have you back. You know, we talked about the Python Packaging Authority.
We talked about PyPI and all these things previously, and we're back to talk about them some more with a
particular focus on security. Yeah, which is like kind of my new focus on my day-to-day, my like job
hat, my PSF hat, all that stuff. It's fantastic when the job that you're paid to do like lines up with
these other things, right? You can kind of learn on the job and then it really applies quickly. So, you know,
maybe let's just start there. You're at Google working on security there. Maybe tell us about what
you're up to and how it ties together. Last time we talked, I was working for Google Cloud as a dev
advocate. And so that was a lot of like, you know, I think people mostly know me from that, a lot of
conference talks and things like that. But since then, I've switched to like a brand new team at Google
that I'm really excited about and I think is just really exciting in general. We're an open source
security team. So, and we don't work just like on Google's open source, you know, libraries or
whatever, but we just generally broadly work on open source security across the entire open source
ecosystem and not just the Python ecosystem, but like every open source ecosystem. So we have our
hand in like a lot of pots and there's like, you know, I think you're probably aware there's like a,
this incredible wave of like focus on software security, but also open source software security.
And so we're kind of riding that wave a little bit, but yeah, it's like, it's a dream team.
Everyone I work with is like super talented and we're working on some really interesting new security
stuff and yeah, really love it.
I bet it's very exciting and it, you also have a chance to make a big impact, right?
I've been working like kind of tangentially on software security ever since I started working
on PyPI and I like cared about it for a long time, but it's like really, I think it's validating to
sort of see that like, oh, now everyone kind of gets it. Like everyone's like, oh, this is,
this is the thing we need to focus and make better. So it's cool to be there and be like ready to do it,
you know, and, and have the tools to like make it happen.
Yeah, absolutely. Have a lot of resources behind you through Google and the team and so on.
Absolutely. Like an incredible amount of resources. Yeah. So nice.
Most people probably don't fully appreciate it, right?
Yeah.
Yeah. So that is fantastic. The other thing that you're doing is working as the director of the PSF,
right?
Well, not the director. So the PSF has a board of directors. So I would, I call myself one of the
directors of the PSF.
So yeah. Tell us about your role at PSF.
Yeah. Yeah. So I joined the board, I think it was about two years ago, because we just had an election.
And so we sit for a three year term. So I've got another year left before I have to run again. But
you know, it's been really nice to sort of like work on the PSF from the inside and do some community
stuff. It's been a really weird time to join the board as well. Like there was like, right,
the start of the pandemic and like the PSF derives most of its income from events like PyCon,
like a lot of its income. And that was always sort of like identified as like kind of an existential
threat to the PSF, but it like very much became a reality very quickly. And so there was a lot of
work done before I joined and like sort of like after I joined as well to adapt to that. And I think
PSF did an amazing job. Like we actually did really well, partly in thanks to like all of our
sponsors and donors that like still continue to step it up, even though we weren't doing an in-person
PyCon. We did a bunch of virtual PyCons. They went pretty well. You know, not as quite,
quite as fun for me. You know, I like to see folks in person, but yeah, we, I think made it through the
other side amazingly. It's been great. We got a really great board now. We just brought on a couple
new folks as well. And I'm really excited to see what we're going to do for the next, you know,
couple of years. I don't know that people fully appreciate how important PyCon is to the existence and
financial wellbeing of the PSF. Maybe elaborate a bit on that.
Yeah. I think the statistic, maybe at its peak, PyCon's revenue was about 85% of the operating
budget of the PSF. So like almost all of the money that the PSF needs to like run and operate, which
means pay staff, pay for infrastructure, all that kind of stuff came from ticket sales for PyCon.
And sponsorship money and things like that.
Yeah. Yeah. It's a little gray because like there are sponsors and they, they like both sponsor PyCon
and sponsor the PSF. And it's like that money sort of just gets used by the PSF. But yeah, I mean,
a lot of that sponsorship was really tied to the in-person event. So one thing we've done recently
is like, if you're not a PSF sponsor, you should go psf.org slash sponsor. And there's, you know,
kind of like a new menu for sponsorship. And we sort of adapted it in a way that's like,
not exactly focused. Like you don't have to show up to PyCon to be a PSF sponsor and still you'll
get a lot of benefit from it, including supporting things like PyPI and other infrastructure projects.
There's a bit of a, it seems like a bit of a wave of large companies coming in and properly sponsoring
the PSF. And I don't know if this is in reaction to what happened with PyCon and COVID, or it just
happens to be the timing and the growth and especially the growth of Python in a more business corporate
sense.
I think it's a couple of things. One is that like PSF very much needs the support,
right? And I think that's made obvious to the organizations that use Python and our infrastructure
like PyPI. The other thing is, I think a lot of organizations are taking open source as like a
dependency a lot more seriously. So making sure that they're like in some way contributing or,
you know, providing support for the infrastructure tools, software that they use. The other thing that
I want to call out here is like the PSF staff is incredible. They've done an amazing job about
making it really an attractive thing to be a sponsor of the PSF and also like following through on our,
you know, commitments and to our organization's commitments to us, our commitments to them,
that kind of thing. And like finding new and interesting ways to like get funding as well.
Right. So like we started doing an interesting thing a couple of years ago where we started
applying for grants for like work on PyPI. And I think that's actually our first podcast was about
like some funded work that I got hired to do as a contractor. And then we kind of like repeated that.
And we like brought in a ton, a ton, a ton of money to fund like really big stuff, big stuff that like
a volunteer would never get, you know, get done in a year of weekends. Right. Like it's just never
going to happen that a volunteer is going to sit down and have the time to do this. So it's been
really successful in terms of like shipping stuff that users need. That's like big, like large scale
stuff. It seems a little bit like in the past, but when you go to PyPI.org, this is still kind of shiny
new. Right. It got rewritten a couple of years ago and polished up and made a lot more modern. Right.
Yeah. Yeah. I think 2018 we launched this and so it hasn't changed really, you know, visually much since
then. A lot of new features and development and like the whole point behind the rewrite was to make it a lot easier
to build on top of. Yeah.
PyPI was like ancient, essentially. It predated everything on PyPI. So like it was, it was kind of wacky, but yeah,
it's super modern. Yeah. That's fantastic. It's like more sustainable now as well. Right. Like we have, we have
better like commitments from, you know, our in-kind donors for infrastructure. Shout out to like Fastly that pays our
entire infrastructure bill and is like an amazing sponsor of PyPI. But also just like we have, we had just hired an
infrastructure engineer to work on PyPI, which is super exciting and PyPI and other PSF infrastructure
as well. And yeah, it's just like, it was a little more sustainable than it used to be. Like we have
better core volunteers, moderators, all that.
We talked back in 2018, I think maybe you and Donald stuffed. I don't remember if you all were on together.
Those were two separate shows, but you were both involved. And one of the challenges was PyPI,
the web app was so bespoken, sort of its own tangled mess that people would want to contribute.
And they'd be like, you know what, now that I see this, maybe not so much. It sounds like it's in a
better place. We have some peps that we're going to talk about, about extending some of its functionality
and those sorts of things, which is probably a spinoff of just making it easier to work with.
We did a full stack rewrite for our reasons, because it's easier to maintain for us. It's easier to
contribute to, for other users, easier to propose new changes. And I think maybe the undertone for
this entire interview is there needs to be progress, right? We can't just get to a point where it's
just, that's it, that's good. There's just going to be, it's a constantly shifting landscape. So if we,
the PSF, we, PyPI, want to continue to be successful and popular, and Python is doing amazing right now,
we have to adapt to that to some extent.
Yeah. It's not the same world it was built for when it first came out. And also this 393,000 packages,
it's probably not something that was expected when this whole idea was put together.
It's scaled like impressively well, I think over the years, like almost 4 million individual releases,
like 6 million individual artifacts. Like that's a lot. That's a lot of stuff.
Let's talk just a bit about the whole infrastructure side, not the tech or anything. We've covered that
before and it was really interesting, but just how much data and expense there is to run this thing.
I wrote a blog post sometime last year, and it was going to be essentially a five-year update from a
previous post that Donald, who's one of the other PyPI maintainers, had written about just like what it
takes to power PyPI. And it has some statistics in it that are at this point out of date. But like,
yeah, we serve like almost, I think at this point, over 2 billion requests a day. We transfer like more than
60 terabytes from PyPI.org. And that doesn't include files. So when we serve the actual files,
actual distributions, that's like almost a thousand terabytes a day, like per day. That's a lot.
A thousand terabytes?
Yeah. If we had to pay like retail costs for our bandwidth from our CDN. So like almost like 99% of PyPI
is served from CDN. It would be in the millions of dollars. Like it's a substantial infrastructure cost
just to like serve the files, serve the requests. So it's not going down. It's not plateauing either.
It's definitely going up, which is good in the sense that like, yeah, we want it to be popular,
but like there's sustainability questions that come with that as well as we grow, just sort of like
unfettered, you know? Yeah. Figuring that out.
Honestly, that kind of blows my mind. I'm just wondering, what would you possibly do if you didn't
have companies like Fastly really supporting?
Honestly, it would be very hard to keep PyPI running if we didn't have the support of all our sponsors.
And like, I think it's really important to make this distinction between PyPI and other indices,
like, like NPM, for example, which is owned by a massive corporation and like run, has a whole
support staff, has a whole like engineering staff. PyPI is like a couple folks and like a bunch of
donated stuff, you know? And it's like on the same scale, you know, it's like as useful as something.
When I think about how PyPI and NPM and RubyGems, and you know, this is not to focus on,
like to call out Python, but just all of these. It reminds me of the early internet back when we're,
not maybe when we didn't have passwords, but when it was kind of like, oh, we'll just,
we don't really need encryption here. And it was just, it was from a time when things were simpler
and it feels like it's getting a little more complicated security wise and so on.
Oh yeah, definitely. I mean, there was a point when me as a PyPI maintainer administrator,
like we never had to respond to takedowns for like malicious stuff. Like it just never happened.
And now it's like my inbox is on fire because I get multiple reports a day. Yeah. Yeah. I mean,
it's, it's like, I think part of it is like people are trying to hit security bounties and do like
research with PyPI, which is not the intended use case for PyPI, but it's a lot. Like it's definitely,
there's an uptick.
Yeah. There's been a lot of talk on the internet about things that might fix it,
like signing packages and whatnot, but we'll, we'll talk about whether that actually has anything to
offer there. Yeah. Yeah. One thing I did want to give a quick shout out to is there's from the open
SF at open SSF. They just gave some big donation to make PyPI a little bit better. Right. So they,
committed $400,000 to, in order to create a new role. Tell us a bit about this. What is this?
Yeah. They're, they're very excited to announce that they're planning to support us with a new role.
So it hasn't been, it hasn't been finalized. Okay. Contract hasn't been signed yet. No, no,
like open SSF, a fairly new organization, bunch of member organizations, including Google, Microsoft,
whatever to essentially support software security. Right. And so they're just kind of getting started
pretty recently. And I think their marketing team kind of outpaced the like legal team here. So we
haven't signed the contract yet, but it's like, you know, I feel confident saying that like, this is
probably almost definitely going to happen. So yeah, they committed, I think $400,000 to doing a
developer in residence that's security focused. And so this is sort of like piggybacking on something
that I helped start two years ago at this point, which is create the CPython developer in residence.
So that was started with funding from Google and, Lucas Schlange became the CPython developer
in residence. And like, I love to see this because like, I'm very happy to say Google is not the
sponsor of CPython developer in residence this year. It's Facebook. And then like, that's great because
like, I think this is something that can be shared by all the PSF sponsors that's, you know, funding it
each year, that kind of thing. So in a similar way, we're going to ideally hire someone that will focus
on just security for Python. That might be security for CPython. It might be security for PyPI. They
also want, I think, to fund a security audit of some like critical tooling for, for Python ecosystem.
That might be PyPI. So, but yeah, this is super cool. And, they've also like announced funding
for some other organizations like Eclipse foundation.
This is fantastic news and it's too bad that it's not signed yet, but I'm, it sounds like it's
definitely going to happen when it becomes official. I'll give it a, another shout out just to say
things because this is going to probably make a big difference. That's a big chunk of money to
contribute to it.
Similar to the CPython developer residence role. Like we're going to do interviews and audit,
uh, and hire someone for that role. So there'll be a job posting if this happens. And then,
I'll be definitely tweeting, sharing that, trying to get people to get interested and apply because,
uh, this is a super cool role.
It sure is.
This portion of talk Python enemy is brought to you by the compiler podcast from red hat.
Just like you, I'm a big fan of podcasts and I'm happy to share a new one from a highly respected
and open source company compiler and original podcast from red hat with more and more of us
working from home. It's important to keep our human connection with technology with compiler.
You'll do just that the compiler podcast unravels industry topics, trends, and things you've
always wanted to know about.
And I'm going to be talking to people who are going to be talking about.
I'm going to be talking to people who are going to be talking about tech through interviews with people
who know it best. These conversations include answering big questions like what is technical debt?
What are hiring managers actually looking for? And do you have to know how to code to get started in open source?
I was a guest on red hat's previous podcast, command line heroes in compiler follows along in that excellent and polished style.
We came to expect from that show. I just listened to episode 12 of compiler. How should we handle failure?
I really valued their conversation about making space for developers to fail so that they can learn and grow without fear of making mistakes or taking down the production website.
It's a conversation we can all relate to. I'm sure. Listen to an episode of compiler by visiting talkpython.fm/compiler.
The link is in your podcast player show notes. You can listen to compiler on Apple podcast, overcast, Spotify, pocketcast, or anywhere you listen to your podcasts.
And yes, of course, you could subscribe by just searching for it in your podcast player, but do so by following talkpython.fm/compiler so that they know that you came from talkpython to me.
My thanks to the compiler podcast for keeping this podcast going strong.
Let's talk about 2FA. That's been a bit of a flashpoint in it. I don't feel like it should have, but it has been.
What's the story of 2FA and critical packages and PyPI?
Yeah. So yeah, flashpoint, like kind of almost unexpected for me, you know, like I think I'm just so close to security space and PyPI and all that stuff that like, I think the reaction was a little stronger than I think everyone expected.
It feels to me like the reaction was if you had set up a rule that said, hey, you can't have the letter A as your password.
And everyone who has the letter A, you have to change it. It's like, it's almost like that level of requirement change to me, it feels like. And yet it just, it just blew up. Right.
Yeah. Let me give some background and then like we can talk about like realistically what it means.
So yeah, we, we made an announcement and basically that we were going to designate some projects on PyPI as critical. And essentially we determined this based on download count because that's kind of like, it's not a great metric, but it's kind of the best metric we have for determining like if this project was compromised.
And I'll talk about like how that might happen, you know, how many people would be affected. And it's like, if we measure the amount of times that this is getting downloaded a day, that's a pretty good proxy for like impact in terms of something being compromised.
Right.
So yeah, we, we made this designation and we sort of announced that like at some point in the future, did not announce a date, did not like enforce a requirement at this point.
We're going to ask those maintainers to require that two FAs enabled for their account.
And so we did that and then we sort of paired this with an incentive.
We, my team at Google actually funded the purchase of a bunch of Titan security keys.
These are like hardware keys for two factor authentication that Google manufactures, but we just, you know, essentially we give away discount codes to these maintainers of projects that have been designated as critical and they can get not one, but two for free.
So if they're one of these maintainers.
So yeah, we did that and the designation was 1%.
We decided the top 1% of projects would be this point designated as, as critical.
Right. I feel like there was a bit of a confusion when people saw this announcement.
They saw, wait a minute, you're making me adopt hardware based 2FA because I have a PyPI package.
The requirement is not that you have to use the hardware keys if you have a critical package, is it?
And like, I would love if everyone used hardware keys because I think they're generally considered to be a little bit more secure, but no, the, the idea is that everyone should turn on 2FA and that's, PyPI supports, you know, TOTP, which is like what you're used to.
Yeah. Like the free applications on the phone or other device and security keys.
So like, and security keys is pretty broad now that, that doesn't just include the like USB devices, but also like you can do web auth and via like phones and like other physical hardware.
Like it's pretty, you know, the integration with browsers is pretty good now.
So there's a lot of support.
Yeah. And just like the audience out there, Michael is asking, do they need to be hardware keys or just regular auth?
It's just regular auth, right?
And, and that's why I said, I don't feel like it's that big of a deal.
It's like, well, you have to have a secure password or you have to have 2FA or whatever.
Like kind of immediate reaction from some folks with like really big megaphones essentially was that this is a slippery slope.
Like PyPI is asking something of its users.
We don't do that very often.
Like we sort of like let users do whatever they want.
And we have some sort of like baseline requirements for like how to use PyPI, but we don't like often ask people to do extra stuff.
There's a good reason why we're interested in asking people to do 2FA.
And it's not because like Google has secretly conspired to like do it so that it's own open source security.
You know, like it, there's, there's like a very good reason.
There's a whole undercurrent, a whole thread of, well, it's these big corporate companies that are adopting Python that are making us do different security to support them.
And that wasn't it at all, was it?
Here's the main reason, right?
And like that is valid, right?
Like there are big corporations that consume stuff from PyPI.
They would love to have more assurances about like that their projects haven't been compromised.
I don't think 2FA is like exactly the right way to do that.
At the end of the day, 2FA, like it protects against like two kind of critical attacks that could happen on a Python package.
One is just like phishing, right?
Like 2FA is essentially it completely eliminates the potential to get phished.
I've never seen someone get phished on PyPI.
I've never heard about phishing attack.
But like PyPI is as susceptible as like a bank or anything else for phishing.
Like it could happen to anybody.
So that's one thing.
The other thing is maybe like more specific to PyPI itself, which is what we call like domain resurrection attacks.
So developers like really love their vanity domains, their personal domains, their personal email addresses.
And so unlike maybe your bank, like you're the users on PyPI are more likely to have these like one off domains.
And those domains like expire.
People forget about they lose access to them.
They get, you know, registered by someone else.
And when that email address has the ability to reset a password on a PyPI account, an attacker can like keep an eye on your domain, watch when it expires, go and register it, do a password reset, and then take over your account and publish whatever they want.
And so 2FA in similar way to phishing protects against that attack as well.
I had never really thought about that.
That's almost like the SIM card equivalent.
Yeah, a little bit.
But for email.
So, you know, the SIM card problem is I could call up, you know, my, I could call up, I could call up someone else's phone provider and say, I lost my SIM card.
Please issue me a new one.
And then you start getting their SMS for like SMS authentication and stuff.
This is, you've taken over their domain, not maliciously.
They just decided to, you know, a credit card expired or something.
And then you snatch it up, set up some MX records and off you go.
Okay.
Our ultimate goal, like PyPI's administrators, I'd love to protect all users from attacks that could be prevented from 2FA, but it's a little bit more like, like it's actually for our own benefit, right?
Those kind of attacks.
So one has happened recently, the CTX package had a domain takeover and a malicious release published.
And we wrote a very long incident about it.
It took a lot of our time.
And we essentially like, it's not sustainable for these to happen.
We can't, we don't have a support team.
We can't do, you know, manually remove these packages and monitor things for, like, we just can't, we just can't handle it.
So 2FA is like the folks that maintain PyPI asking users like, hey, help us out a little bit.
Just do this thing for us to like kind of cut down on the potential for this and make it easier for us to do things that like we actually want to do to PyPI and not just like respond to security incidents.
Right. Because there's only a couple of you.
And if you're spending all your time putting out these fires, you're not adding JSON endpoints and other beneficial things.
Yeah. All sorts of stuff.
Like, yeah, the more time we spend putting out fires, the less we can do like useful and interesting things to PyPI.
Yeah. So why 1% of the top packages? Why is that critical? And also what's the designation over time?
The designation is if at any point it was in the top 1%. And I think we recompute this every day. So, you know, projects have since we announced this, they've moved into the 1% because it's constantly shifting.
But yeah, why 1%? So that's a question that like was coming up a lot in the discussion after we made this announcement. And the like secret to the 1% is that in reality, if you were to go and figure out like, okay, how much traffic, how many downloads does this 1% of packages actually represent for PyPI?
It's like over 95%. It's close to 99%. It's like most of what people are using from PyPI is in this 1%. So by saying 1%, we also essentially said like for the long tail of PyPI that people aren't using, we care a little bit less about that.
We're going to cover like the majority of these, like I said, the potential for impact if something was compromised, we sort of maximize that. And we also kind of had to minimize that 1% too, because I think the thing, another thing that folks didn't really realize about
what it takes to support 2FA is that there's an incredible maintenance burden for 2FA. Like we have to handle account recovery requests because people like they lose their phones, they lose their hardware keys, people are humans, right? And so this happens all the time. And it's expensive for us to handle this, right? And we can't just say, all right, great, you like you lost 2FA, I turned it off for your account, go wild, because that's essentially like a perfect way to circumvent 2FA. Instead, we have to do this like very manual process where we like verify other identities,
emails, like if you have a GitHub associated, we ask you to do something on GitHub, just like prove that you own that account. And even then it's like, it's really not perfect. Like there is potential for someone to be compromised who did have 2FA enabled by someone who, you know, could take over this account or that account and like pretend like they need an account recovery. But yeah, this is a huge maintenance burden. So like, we actually like can barely handle account recovery requests right now. And I'm a little wary of how many we're going to get now that folks have started really turning on 2FA, but we think it's worthwhile.
And maybe that's probably why 1% and not 100%, right?
Oh, yeah. Like there's just zero chance we could handle 100% of like everyone on PyPI with 2FA enabled. Like we just couldn't handle it. I would love that. Like that would be great. But yeah, unfortunately, like the amount of people losing their stuff and having to come to us for resets, it's just, it's the burden is really high.
Sure. For me, I used Authy for my 2FA, which syncs across devices. So at least if I lose one, I get it back.
Yeah. And like Google Authenticator works really well for TOTP as well. And I think you can like download the codes or store them externally as well. So if you lose your phone, you can regain access to those TOTP codes as well. And there's a bunch, like, there's also like emulated TOTP stuff where you can like run it on your laptop. And it's not like maybe not technically true factor, but like a lot of people use that because it's more convenient.
It's way better than nothing, right?
All better than nothing. Exactly.
Let's talk about James Bennett and opinions. You called out this article and I also read this. I think this is really good. What are some of your takeaways here?
Yeah. James absolutely nailed the response here. And actually, like, you know, when we got a lot of feedback, I'm not going to say that it was bad feedback. You know, it was maybe somewhat uninformed feedback or it was somewhat sensational feedback, but we got a lot of feedback after this. And some of it was totally valid. Like, you know, at the end of the day, we are asking users to take a little
more effort and some people, you know, they don't want to do that. And, you know, I like none of the PyPI administrators actually like explicitly responded to a lot of this. I think we were all like a little bit depressed about how upset some people were about the 2FA requirement that didn't even exist yet.
But yeah, James, like really shout out to James, because I read this and I was like, I could really could not have written it better than he did. He really called out.
There's a lot there. And it's I think it's very well thought. Yeah, I thought out. Yeah.
Yeah. Shout out to James. You know, there was kind of like two arguments that he was making, which is that, like, you know, a lot of people were concerned this would be a slippery slope. And I think I don't really foresee PyPI making too many more mandates about stuff like this. Not because of the feedback, but because, you know, like we're never going to.
I don't think we're ever going to mandate signing, for example, like that's always going to be the option of the maintainer. But, you know, things like 2FA for certain high profile stuff like, yeah, it really helps out helps PyPI continue to exist. Right. Like that's actually the motivation here.
I definitely want to echo the message that you said about the overhead. Yeah. Like you have to deal the people who would otherwise be constructively working on this have to deal with these problems.
Yeah. Every day. I mean, it's like I don't get paid to do it. I do it out of love, but it becomes larger and larger every day. And yeah.
We're keeping our head above water right now. But yeah, there's plans also to make that better. But yeah.
How much do you think the reaction, the I'll put it out of the way, I think the overreaction was of how much do you think that was perceived as it's got to be a hardware key versus it's just straight 2FA?
Do you think people really rejected it being 2FA or did it seem like a bigger burden than just adding it to your Google Authenticator?
If I were to say that whether we made some sort of failure here when we announced it, I would say like we didn't message this super well. Right.
And that's because I'm a software engineer. I'm not a marketer or, you know, I'm an OK communicator.
And the same is true for the rest of us. We don't have copywriters, anything like that.
We don't have a PR team. So, you know, there was some stuff that people kind of missed.
And I think one of the things was missed was like the mandate doesn't exist right now.
We're just talking about enforcing it in the future.
The other was like, what is actually being required of you today?
Which for most folks, it was it was nothing.
It was like, if you want to get a pair of free security keys, you have to do this today.
And by the way, those are still available.
I'm sure you all saw this as a positive, like, hey, we got this cool thing for people that they can get if they want or they just do 2FA.
But like people are like, what is this?
Yeah. And you're saying there's still some available for folks who want to get it. Right.
Yeah. So through October 1st. So, yeah, if you this might be my call at the end as well.
But yeah, if you go to pypi.org slash security dash key dash giveaway, you can check if you're a critical maintainer and you can get a key, get a pair of keys, actually.
Yeah. So the pair of keys thing also, people weren't really sure why we were doing that.
But the main reason is to help you not lose both of them, like lose all access.
So if you have two keys and you've used both of them, you have some redundancy.
You can stick someone, stick it in the garage or stick it somewhere else.
You know, hand it to a friend.
You put your brain in your backyard.
Yeah, exactly. Exactly.
This episode of Talk Python to Me is brought to you by the IRL podcast, an original podcast from Mozilla.
If you're like me, you care about the ideas behind technology, not just the tech itself.
We know that tech has an enormous influence on society.
Many of these effects are hugely beneficial.
Just think about how much information we carry with us every day through our cell phones.
Other tech influences can be more negative.
I really appreciate that Mozilla is always on the lookout for and working to mitigate negative influences of tech for all of us.
If those kinds of ideas resonate with you, you should definitely check out the IRL podcast.
It's hosted by Bridget Todd, and this season of IRL looks at AI in real life.
Who can AI help?
Who can it harm?
The show features fascinating conversations with people who are working to build a more trustworthy AI.
For example, there's an episode on how the world is mapped with AI.
But it's the data that's missing from those maps that tells as much of the story as the data that's there.
Another episode is about gig workers who depend on apps for their livelihood.
It looks at how they're pushing back against algorithms that control how much they get paid,
and how they're seeking new ways to gain power over data and create better working conditions for all of them.
And for you political junkies, there's even an episode about the role that AI plays when it comes to the spread of disinformation around elections.
Obviously, a huge concern for democracies around the world.
I just listened to The Tech That We Won't Build, which explores when developers and data scientists should consider saying no to projects
that can be harmful to society, even though we do have the tech to build them.
Does this sound like an interesting show?
Please use the link talkpython.fm/IRL to subscribe.
Yes, you could search for it in your podcast player, but use the link talkpython.fm/IRL
to let them know that you came from us.
The link is in your podcast player show notes.
Thank you to IRL and Mozilla for supporting Talk Python to Me.
I guess part of the reason this is so much in the public awareness is because of this project called Atomic Rights.
Yes.
Want to give us all the rundown of why we're talking about this package?
Let me just give people a really quick background.
Atomic Rights is a package that lets you, within a with block, like you would do open file,
but instead you say atomic write and it will write to a temporary file and only commit those
changes to the real file, like at the very end, all in one shot.
Pretty useful.
Not super hard to do your own version of with a couple of built-in things in Python, like the temp files and what, but still.
Kind of no longer necessary for modern Python is my understanding.
Like this is a couple of lines of like modern Python.
You don't have to worry about it.
But it used to be, you know, something that you would use.
Right.
Exactly.
How does this relate to 2FA?
That has nothing to do with 2FA, does it?
There's this thing that happens all the time, right?
Like so IPI has this policy that everything on PyPI is essentially immutable.
And that means that like individual files, file names, which can include a project name, a version and like a distribution type.
Those are immutable.
So if you upload something to PyPI that is like source distribution for some version or whatever, you publish that.
It's there.
You can't overwrite it.
Right.
So you can't surreptitiously like change what that points to.
So like anyone installing it is always going to get the same thing, same SHA, everything.
But that also means like if you want to delete something, you delete it and it's gone forever.
You can't come back and overwrite it with something else.
And so, you know, when and I don't encourage people to delete stuff from PyPI generally because, you know, you're almost definitely going to break somebody.
There's better methods for, you know, kind of marking something as not useful and telling pip to not install it.
That's our yanking, which is a whole weapon to itself.
But yeah, so this thing happens all the time, though.
Like we have a huge warning banner, big red button, like everything telling you if you're going to delete this thing.
You're not going to be able to get it back.
And so what happened here is like this maintainer didn't want to comply with 2FA.
Their project was marked as critical because a lot of people were using it like a lot of people were using it still.
And they thought that it would be a cool.
They thought they'd discovered a cool hack where if they deleted it and then recreated it later that the mandate would no longer apply.
And like that was kind of true because, like I said, our computation for critical projects runs once a day.
So when they brought it back, like it didn't have that flag within 24 hours, that flag was added back to the project, essentially.
But for a brief period of time, yeah, it was not marked as critical.
But what happened was, you know, all these versions went away.
And like a lot of people, I think, were depending on them, you know, like actual users of this project.
And so, yeah, like there's a long discussion happening now about whether like it should even be possible to delete stuff from PyPI.
And there's good arguments on both sides of the coin, right?
Yeah, well, that was one of my first thoughts is like, wait, you can delete the releases?
I knew they were immutable.
You can't update them, but deleting.
So what's the tradeoff there?
Why can you delete them now?
And maybe why wouldn't you in the future?
This is like NPM's left pad incident, essentially.
Like we right now there's potential for a high profile enough.
And this package wasn't super high profile, but like it was in the critical list.
It was in the top 1%.
There's potential for some maintainer to decide, you know, you know, and it's their prerogative right now, right?
Like there's no guarantees that these things continue to exist on PyPI.
No one's necessarily paying for this.
So like, yeah, maintainer absolutely has the ability now to just wipe something super popular and necessary off the face of PyPI.
And that's the current status quo.
It's not the same in a lot of other ecosystems.
Some of them don't have that policy.
Some of them do.
But yeah, so there's a bit of debate about whether that should be necessary, especially when we have stuff like yanking, which actually is a more meaningful way to remove something.
So let's suppose somebody, a pallets org or whatever, erases flask tomorrow.
David, don't do it.
David, please keep going, man.
Is there a way to get a hold of the actual wheels and stuff as a community and put it back up under potentially a different name?
Or is it just gone?
How seriously gone is it when it's gone?
Yeah, nothing published to PyPI is actually gone.
So we don't actually, unless we're like legally required to, we don't delete any actual files off of our data store.
So like the bucket that everything goes into, everything that's ever been published to PyPI is still there.
So this actually played out.
It's good that we have this in a couple instances because this is what exactly we used in this case of atomic writes.
Because the maintainer was like, oh, I made a mistake.
And they were like kind of humble.
They were like, yeah, okay, this is a mistake.
I shouldn't have done this.
And then asked us to essentially restore the project from scratch.
And like, we don't really have mechanisms to do that, right?
That's not, that's not something that we do often.
I think I can only remember maybe once when we've done that before.
Maybe not even once.
We generally just don't do this.
Like if you delete something, we say it's gone.
Like you need to publish a new version.
But in this case, like we did decide to take the time.
I think it took Donald like almost an hour to do this because it's a super manual process.
But yeah, the files are still there.
Something you don't do very often, right?
No, no, like almost never.
How can I even do this?
The files are still there and they're still like externally addressable too.
So they're, you know, they're always going to be available.
And like, if, if something like that happened, David, don't do it.
But like, if something like that happened, I think folks would probably be okay.
We'd find ways around it.
But yeah, I mean, it's a strong argument for not allowing it to happen.
And, you know, when, when people publish stuff to PyPI, like RTOS is essentially,
you give us the right to distribute this as we see fit forever.
So, you know, PyPI is within its right.
But there's, there's arguments for, you know, giving maintainers the ability to do it for various reasons.
Has there been any thoughts to putting like levels of what pip will install?
For example, I'm thinking like, I want to set up my pip though.
It will only accept things that have 2FA set up, or it will only accept things with a certain number of downloads.
Like I can only pip install something with 10,000 or more downloads.
So, because maybe I'm trying to avoid typosquatting for very edge case things.
In that general realm, have you all thought about this?
Probably you have.
Yeah, definitely.
What are some of the thoughts?
I think we have it on our list to talk about later.
But yeah, I mean, there's definitely potential, right?
There's all sorts of signals that you could potentially take into account here.
TBD, like how meaningful some of them actually will be or how much that will actually protect you.
But yeah, people have talked about like essentially defining a policy for what they'll consume and either having that be part of pip or something external.
So yeah, it's definitely been discussed.
Okay.
You know, for example, like the web browsers, you can have no blocking.
You can have blocked third-party cookies.
You can block third-party cookies and trackers.
And you can decide like how broken do I want my web to be versus how safe do I want my web to be?
I feel like there might be something like that in the pip world.
I think the reality, at least right now, is that any kind of policy like that would not be enforceable.
Because there's going to be some edge case, some dependency that's super old or whatever.
Like, you know, Python is not nearly as bad as an ecosystem like NPM in terms of like breadth of dependencies for a given thing.
Right.
Yeah.
Usually the dependencies are like thicker.
Right.
You don't have like three lines of code you're depending on.
You just put that in your code.
It does exist, but yeah, generally no.
But so that's sort of like, but even still, like, I think you'd have a hard time saying like, I'm going to only consume packages that have 2FA enabled because there's so few of them right now.
If all that's, you know, the tooling and stuff for that existed.
Yeah.
Sure.
Okay.
Interesting.
So this Atomics Right story is everything was put back, but it just, it shows unintended consequences.
And kind of ironic too, actually, because like PyPI is an open source project as well.
And like, you know, people were upset.
We were making demands of users to do a certain thing.
But like at the end of the day, someone's making demands of us to use our time in ways that we don't necessarily want to.
Again, see James Bennett's article, right?
A lot of those ideas were really well spelled out there.
Absolutely.
People forget that it's a volunteer open source project and not like run by some corporation.
I thought it was this conglomerate of corporate overlords.
So this is what I got from Reddit.
Shadowy Cabal.
Yeah.
What's this PyPI 2FA dashboard here?
This looks pretty cool.
Tell us about this project.
I'll link to it in the show notes, of course.
Switch to like in the top right, switch to like past three months or something like that.
Yeah.
Okay.
You can really see the bump there.
So yeah, this is the dashboard we put together essentially for us to monitor how the rollout for 2FA and security key giveaway was going.
But we made it public.
So like anyone can check this out.
And I think we'll put link in the show notes.
But yeah, the numbers are great.
The one thing this isn't actually showing is how many security keys we've given away.
So we've at this point, like I just checked earlier, we've given away more than 500 keys, which is awesome.
And it's only a fraction of what we have to give away.
So I would really like anyone listening wants a key and has a critical project like go and get the keys.
And then, you know, this will find something to do with those keys.
We don't give them all away by the time they expire in October.
But yeah.
So a bunch of keys given away.
We also I didn't mention this, but like as part of this, we also turned on a feature that allowed any project to manually require 2FA for all their maintainers.
So like anyone that just wasn't critical and wanted to opt into this, they could do that, too.
So I think 300, almost 300 projects have done that.
And then we're almost like we're so close to hitting 30,000 users on PyPI with two-factor enabled, which is huge.
And that's up from like 27,000 before we did the giveaway.
Cool.
Well, I was one of the 27,000 before because my packages on PyPI are not super significant, but they are there.
And so I definitely put 2FA on there and just have it running through my phone, basically.
Appreciate that.
Yeah.
So people can go and see the progress here of how it's coming along.
Yeah.
And, you know, how many projects we've classified is critical, right?
Like how many is 1%?
Well, right now it's like almost 4,000 projects, which, you know, it's not a ton, but there's a lot of maintainers of those projects.
Well, two things that are interesting.
One is I think I can go to pypi.org and see 393,000 and say, well, 3,930 are probably critical, right?
As that designation.
But as you said, it's computed over time.
So maybe there's something that was critical, but is no longer or something becomes critical, right?
So this number could sort of outpace the actual number of just 1% of the total projects.
Yeah.
It will grow above 1% over time because, yeah, if something's been designated as critical, it just retains that designation indefinitely.
And the other thing that we kind of snuck in here is that like anything that's a dependency of PyPI itself is also critical.
So we just figured that would be a good idea for us.
So, yeah, there's a couple of projects that maybe wouldn't normally be included, but we include them because like we personally care.
Is that like maybe pyramid or stuff like that?
Yeah.
I don't know what the difference between those two sets is necessarily, but it would be interesting to figure out.
If there's anything that potentially wasn't, then it is because of that.
Okay.
Yeah.
The other thing that's interesting is there's 8,400 users identified as critical, even though there's 3,900 packages.
So I guess because multiple people can be designated as a maintainer, huh?
Yeah, exactly.
So like it looks like the average is about two maintainers per critical project, which is a little scary.
I think in that reality, there's a lot that just have one and a lot that have a lot more.
Yeah.
It's a bimodal sort of distribution, right?
There's a whole bunch by the one maintainer than these groups of people.
Yeah.
Yes.
Interesting.
Okay.
This is cool.
So people can check this out and see how it's going.
This whole idea of critical and requiring 2FA, this NPM is also doing something like this,
right?
So it's not completely out of the blue.
Yeah.
I mean, a lot of organizations are doing it.
I think RubyGems said that they were working on a mandate or had proposed one as well.
And yeah, NPM, they started with a pretty small cohort.
It's only the top 100 projects, but they're going to expand that.
And then the big one is, I think a lot of people aren't aware of this, but like GitHub
announced that they are going to require 2FA for anyone that contributes code on GitHub,
which is like, I guess everyone that uses GitHub.
I don't know.
I don't know what the user is that doesn't contribute code on GitHub, but like, yeah, everyone's
going to have to have 2FA enabled, which is huge by the end of 2023.
So they have some time, but like, I can't comprehend the size of the support team they
must be hiring right now to satisfy that.
Because that's like, it's crazy.
Well, probably a lot of support team and a lot of automation that they're trying to get
in place to, okay, here's what you got to do.
But yeah.
Yeah.
The kind of, the secret here is that like, we have a, so via the OpenSF, it has a bunch
of work groups and we have a new one that's pretty fun for me because it's about securing
software repositories.
But essentially, you know, like everyone that maintains a software repository, including folks from
NPM, crates, RubyGems, like Maven Central, all that stuff.
They all, we all come and talk twice a week or once every two weeks and, you know, talk
about this kind of stuff.
So like, we've been all talking about like 2FA mandates for a while now and like kind of
working on our plans together and sharing notes and that kind of thing.
Yeah.
Fantastic.
I only think that there's probably some users who just clone repos and post issues, but
don't really, don't do any check-ins.
They're just there to.
Yeah.
Just to save a copy.
Yeah.
That's actually probably not the main use, right?
Probably the main use is people contributing to their private repos or to maybe even less
sort of public repos, probably mostly private repos, I would guess.
Okay.
But yeah, that's going to be a big, big deal.
And it also, I guess it leads us into the whole supply integrity side of things, right?
Because it's one thing to say, your account on PyPI has to be secured with 2FA and better
security.
But if somebody can just put in bad code through a very complex PR that happens to sneak, you
know, a less than where there used to be a greater than, you know, some weird, weird little
edge case into a PR or take over somebody's GitHub account, change the code and they don't
realize it, right?
These, that's probably more likely because there's no notification that you did your own
commit in a significant way, right?
So locking down GitHub will have really important knock-on effects for Python and all the other
open source package locations, right?
And there's a lot of work being done here just in terms of like making your source depository
more secure and making your builds, you know, if you're building artifacts on GitHub, making
those more secure, you know, making your publishing method more secure, like all of it is getting
a ton of improvement right now.
Yeah.
I mean, you don't want something sneaking into mixing some code in a CI step or any of those
types of things.
Yeah.
So there's so many insertion points, right?
Yes, exactly.
There's a lot of spots.
Exactly.
So I guess, what are some of the thoughts on what can be done?
You know, like this is kind of what I was going back to, like, oh, there should be this world
with no encryption and like lacks or no passwords.
And now all of a sudden we need all this junk.
And I feel like there's a little bit of that with people going, well, let's, let's just try
to abuse PyPI.
Let's try to abuse NPM and sneak in what we can.
And you maybe talk about some of the steps you all have taken to mitigate that and, you know,
what you think can be done.
There's a lot of talk about package signing, which I'm not so sure.
Straight up signing is how useful that is.
But yeah, maybe let's start at like whatever you thought about.
The thing I want to start with is just like, none of these is a pancia, right?
Like, so I think one of the arguments that was raised with the two factor stuff was just
like, well, this isn't going to protect like us from a vulnerability or like a maintainer
going rogue.
It's like, yeah, no, obviously not.
Like there's not one thing that's going to protect you from that.
It's like we, there's a combination of features that are going to protect you from a combination
of threat actors or vectors.
And we have to use all of them if you want to like feel fully protected.
So yeah, I think like we just spent a lot of time talking about 2FA, but like, like I
said, it eliminates entire classes of attacks.
So like, please turn on 2FA.
Yeah.
Another one, like since we're talking about GitHub, an interesting one is the security hardening
with OIDC.
If you've heard of OIDC, it's OpenID Connect.
It's kind of built on OAuth protocol.
But essentially like it allows you to give things identity.
So like each individual GitHub Action workflow, like each run of the workflow actually gets
its own identity.
And that identity is like cryptographically verifiable.
So IPIs, we're working on implementing support right now and it will exist very soon for what's
essentially going to be credentialist publication from a GitHub Actions workflow.
Okay.
So that means like no password, no API token, nothing.
You essentially say, okay, I trust this workflow and it has the ability to publish directly
in a secure way.
It's super cool.
And then like a lot of other CI providers will hopefully support for OIDC as well.
So yeah, we'll probably see this in a bunch of places.
All right.
So short-lived tokens directly from your cloud provider.
Yeah, essentially.
It works for like Google Cloud right now as well and a couple other things.
But yeah, it's essentially like a way to verify the identity of like a really tightly
scoped thing, like an actions run.
And then, you know, verify it and authenticate it and give it the permission to like do something
like publish to PyPI.
This looks useful.
I mean, handing out API keys or embedding username passwords into CI, CD doesn't sound like a
great idea.
Yeah, no.
Especially with stuff like CodeCoveAttack or Travis CI had a similar attack where like all
environment variables were exposed.
Like everyone's got to just go and roll everything at that point.
It's like such a mess.
So yeah.
Well, and it's one thing to say, okay, we've got to go reset your password.
Fine.
There is a race.
I mean, as soon as that happens, there's a race from people looking to use those credentials
and you looking to not have them used by other than you.
The real problem, I think, is not the people who are paying attention.
It's probably the maintainer who set up some project and hasn't touched it in a year and
hasn't checked their email.
They're just kind of not super engaged.
That could stay open for a super long time in a bad way.
Exactly.
All right.
Package signing.
Donald Stuff talked about package signing and said, why package signing is not the holy
grail.
People just say it's a little bit like the 2FA stuff.
Like if you just sign your packages to prove they come from you, everything is going to be
fine unless the person just goes rogue.
Like you can't protect from crazy.
There was one of the packages that got messed up.
I think it was on PyPI.
That same person was arrested for like bomb making materials in New York.
I don't know about this.
Let's see if I can find the article.
It's like, clearly that's not a well-functioning sort of person.
And it doesn't matter if they sign the package, if they just go bonkers, you know?
Yeah.
It's not the attack that we're trying to protect against with signing.
But yeah.
What can signing help with and what is it not going to help us with?
Yeah.
Donald wrote this post that's kind of like canon at this point for why package signing is not
the holy grail.
But he's really talking about GPG.
Well, why GPG signing is not the holy grail.
There's good points in here, right?
Like so, like you said, package signing doesn't protect against an actual account compromise.
If someone compromised your GPG key, like they can sign whatever they want.
So there's no protections there.
And then there's other problems with GPG as well.
Like there's UX and usability issues.
There's issues with web of trust, like actually establishing, okay, great.
Like you sign this thing, but how do I establish that the person that signed it is actually a
person that I trust and not someone's provided me with a malicious public key, right?
Like how do you actually do that?
Sorry.
It's a little equivalent to people saying, well, just check that it's HTTPS for the URL.
Like, well, that's not identity.
That's just like encryption.
Yeah.
You can still serve crap over HTTPS.
Yeah.
I think a lot of people also, they don't realize that like PyPI has supported uploading
GPG signatures for like a very long time, still does, hasn't gone away.
And nobody does it.
It's just like, it's just not used.
Nobody does it.
It's too hard.
Tooling doesn't work right.
Or it's just like not worth doing.
So I think Donald's post is right in the context of a world.
And this is written in 2013.
So a world where like only GPG is the only signing feature or signing tooling that you
have available.
But that's not true anymore.
And I'm really excited about this new tech called SigStore, partly because I like, I work
with it.
People on my team work on it.
It's like really interesting technology.
But SigStore is essentially like a new way to sign things.
And it's not necessarily based on long-lived maintained keys.
It actually uses ephemeral keys.
Like when you sign something with SigStore, you generate a public private key pair, you
sign it very quickly, and then you throw those away.
Like you don't actually maintain them.
They can't get leaked.
They don't ever get rid of the disk.
Like nothing.
They don't exist.
That's interesting.
This is also based on OIDC.
The chain of ownership of those keys, the keys like provided by some other trusted key
or something that really is tied to you, something like that?
No, no, no.
It's just literally just a key that you generate out of thin air, you sign it, and then you throw
it away.
So the way that SigStore works, which is it's also built on top of OIDC.
So you have these identities, right?
You have like your email, your Gmail account, your GitHub account, that kind of thing.
And they all offer like essentially an online identity.
You essentially sign with these identities instead.
So like you sign into something like Gmail, sign in something like GitHub.
You share this identity with a certificate authority that SigStore runs.
And this binds the identity to this like one time ephemeral private public key pair that
you generated.
Then that certificate is published on a transparency log.
So it's there forever.
There's a record of everything that gets signed.
But then the thing that you have to trust is not like some however many digit long alphanumeric
like public key ID.
It's like an email address.
It's like di at python dot org.
You can like be pretty sure that someone hasn't, you know, and someone can still lose access
to that identity via like compromise of that account.
But it's like a little, it's much, much easier to use, sign, and maintain.
And it's a little bit less likely that that actual identity is going to get compromised.
Okay.
Here's the one that I was thinking of.
Sorry.
It was NPM, not PyPI.
Oh.
NPM libraries, colors and fakers, sabotage, sabotage and protest by maintainer, a person
named Mark Squires.
And follow it up quickly from that.
We have the resident of Queens home suspected in bomb making materials, arrested Mark Squires
and so on.
So like, this is what I was talking about when I'm saying like the no amount of signing
or, you know, 2FA is going to help against this.
And it's, it's just something, I mean, it's just, I think it's part of the deal.
If you accept code from people, you got to vet that, you know?
I've essentially like always said, you know, PyPI makes no guarantees.
You can't trust anything that's on it.
You need to like take your own steps to learn and build trust and things that are on there.
We can give you some tools to help you do that.
But like, yeah, essentially you're giving someone commit access to your project, your
application, whatever.
Like you're allowing them to introduce code into your project and run alongside your application
or.
What are your thoughts on private hosted package systems like PyPI dev server or whatever
those, those, those where you can create the local ones and maybe even mirror stuff from
PyPI.
Yeah.
I mean, if you're going to do like a really robust, like auditing pipeline where you pull
stuff from public PyPI, you spend some time looking at it.
You maybe run it through some tests and then you introduce it to your private server.
That's a really good way to like insulate yourself from a couple of different types of attacks,
like dependency confusion attacks, typosquatting, that kind of thing.
Like if you're pointing your install at private server that just doesn't have any of that stuff
on it because you have manually curated it, then yeah, I mean, that's, that's a pretty good
practice.
And so like a lot of people like Artifactory, Google Cloud, Artifact Registry, all those things,
like they're all sort of similar in that regard.
I guess related to that is if you automatically install the latest continuously, that maybe
puts you at a higher level of risk than if you choose to upgrade at some point to a package,
like pinning versus not pinning.
Yeah, exactly.
Yeah.
We're getting pretty short on time here, Dustin.
Yeah.
What else can we cover?
I know maybe pip on it or scorecard or what do you want to focus on for a couple of minutes
here?
Well, yeah, let me just quickly say that like 6door, we built a Python client, so you can
pip install 6door and then sign, verify, do whatever from there.
And I'm super excited to say that like the upcoming Python 3.11 release is, the releases
are usually signed with GPG, but we're going to start signing it with 6door as well.
The release maintainer.
Oh, nice.
Pablo is going to sign it.
Can it be signed with two things at once?
I guess it can, yeah.
Yeah, multiple people can sign it.
So we're just going to have their release manager sign it.
But yeah, that's super exciting.
Yeah.
So another like area that we've been working on a lot lately, I've been working on is vulnerability
auditing or remediation.
So we have a new tool called pip audit.
It's not part of pip right now.
And there's some discussion about whether it should be or not.
But essentially, this is a tool that allows you to audit your local environment, your Docker
container requirements file, whatever for known vulnerabilities, not like unknown vulnerabilities,
but stuff that's been known, reported and either fixed or upgraded.
So it'll tell you like essentially if it finds a CD or something like that.
But this also uses like a Python specific advisory database that we built that pairs with the open
source vulnerability service and works pretty well.
I'm pretty pleased with it.
I would like encourage everyone to just like run it on their machine and see what vulnerabilities
you have like lurking about right now.
But also like integrate it into your CI pipeline, like run an audit, just make sure that, you
know, your application is not going to like have a vulnerability introduced.
It pairs really nicely with like depend about things as well.
Yeah, there's a bunch of other stuff like working on Salsa.
If you're not familiar with Salsa, it's essentially like a framework for thinking about how secure
your build pipeline is when you're producing publishing artifacts.
So if you're a maintainer, you might think about whether, you know, tampering is possible,
that kind of thing.
It's a sort of a way just to sort of think about how good of a job the build pipeline is
doing in that regard.
Yeah.
Build pipelines are a little scary.
I mean, they have a huge value, but they're also, you could sneak stuff in without even
actually changing the code of the original repo and all sorts of stuff.
Yeah.
I saw this is managed by, or like in collaboration with Trail of Bits and also you're a maintainer.
What's the, what's the origin story of pip Audit?
Yeah.
So Trail of Bits is a security consultancy.
They've done a lot of work in the Python space and software security space for a long
time now.
Folks like William Woodruff were actually involved in like way back when implementing two
factor and some other stuff on PyPI.
So my team, open source security team at Google, we've hired them as contractors to
do some of this work, do some maintenance, build these open source projects, that kind
of thing.
So you'll see William and Alex and some other folks all over these projects because they've
been working really hard to make them really useful and work really well and be really secure.
Yeah.
Fantastic.
Let's maybe just round things out with the stuff on the PEP, the various PEPs.
Oh yeah.
Maybe the API.
Yeah.
Let's go through the PEPs real quick.
Then we'll probably have covered enough.
Yeah.
I stuck my name on a couple of PEPs recently.
Or as much we have time for.
Yeah.
I think most of these are, you know, I've like provided some like minimal input into
them.
I don't, can't say I claim that I authored them myself, but what I'm super excited about
is PEP 621.
So this is a way to do essentially static metadata for Python packages.
So this includes source distributions, which means that like you don't have to use setup.py
anymore.
You don't know why you don't need to use setup.py anymore.
It's essentially arbitrary code execution at install time, which is super scary and should not
happen.
So yeah.
621.
I compare that thought with this resident of Queens for bomb making.
Like, do you want to have that person running arbitrary code on your machine?
Probably no, is the answer.
At install time too.
In production.
Not at run time.
Yeah, yeah.
Yeah, exactly.
So I actually just saw, like right before I joined this, I saw a tweet from Prajan that
like setup tools has full support for this.
There's a bunch of folks been working really hard on it.
So yeah, it's essentially like you don't need to use setup.py anymore, which is really nice.
And like a lot of tools have sort of converged on highproject.toml as the sort of best standard
for metadata and configuration.
So like, it's nice to see that conversions.
Yeah, it's great.
Shout out to like Brett.
I think mostly led this pep.
He did an amazing job.
Yeah.
Very cool.
And then PEP 691 is exciting as well.
So my API has a couple of different APIs.
Most of them are not standardized.
One of them that is standardized is a simple API, which is essentially just an HTML page
and tools like pip.
It's kind of insane.
But if you go to a simple.
Are you really going to do it?
Yeah, that's going to blow up your browser for sure.
Because like essentially, yeah.
So tools don't actually use this page.
They use the individual pages for these projects.
But tools like pip essentially have to parse HTML to like interact with PyPI.
And that's not great.
Like it used to work.
Okay, it doesn't scale well now.
So we're in the process of like standardizing a lot of our JSON APIs.
And one of them that we sort of did, and Donald led this path with some input from Pragen
and Cooper and myself, essentially like the same data, the same API, same files, everything
that pip needs.
That's not HTML.
It's just JSON.
So they can use standard library JSON parser to request and get this and do the stuff that
pip needs to do to be pip.
Yeah, probably make it a little more efficient, easier for other people to consume, right?
Yeah.
Is that something that you encourage other applications to go mess with PyPI APIs?
Or is it, it's public, but you know, we'd rather you don't mess with it.
What are your thoughts there?
Like the stuff that we have standardized, definitely you can depend on it, right?
Like it will continue to exist.
And by standardizing it, we've said like, this is what you should expect.
And this, you know, unless we change the standard, it's what it's going to continue to do.
We have other APIs that existed before we were standardizing stuff.
Like there's a legacy JSON API.
There's this XML RPC API that's like such a nightmare to maintain.
We've kept them running just because a lot of people use them.
Like for example, Poetry uses this like kind of our unofficial JSON API.
And yeah, I mean, there's times when we need to do stuff to that because it like isn't scaling,
right?
Or there's trade-offs that we need to make.
And it's like, well, like we're probably going to have to break someone in order to like
keep this afloat.
But like with things like these standard APIs, like we've spent a lot of time designing
them, planning them, standardizing them.
Like those are definitely 100% cool to integrate against.
Okay.
Fantastic.
Traditionally on these peps, you'll see it's accepted and planned for this version of, this
one doesn't have that, right?
Because it just goes against the web app, right?
This is a packaging pep.
So we use the same process as CPython for their Python enhancements.
But yeah, this is about packaging.
So it doesn't necessarily tie to an individual Python release.
You don't ship it to a binary that people get, right?
Well, in a way we do.
Like pip, you know, ships support for it in a binary.
So, and it's implemented.
Like this exists on PyPI now.
Pip uses this now.
So if I have the latest pip on my machine and I pip install something or do pip actions,
which does it hit the old symbol or does it hit this new one now?
If I'm remembering correctly, the support's been added to pip.
It might not.
I think it's been released.
Yeah.
I'm pretty sure.
I could be wrong.
I'm not a pip maintainer, but yeah.
Yeah, sure.
Okay, cool.
And we have one more, one more to touch on.
Oh yeah.
I mean, this is, you only really care about this if you're like really working with PyPI,
but we're going to have a new, like I said, we're standardizing all our APIs.
So there's going to be a new upload API.
The existing upload API has a lot of problems.
It's fairly old.
It's essentially just a big post request with like a metadata in it.
So this should be a little bit better.
And also enable things like draft releases where you can like publish something to PyPI
that's in draft state.
You can review it, practice installing it before you actually like publish it.
And when it's in draft, it'll allow you to overwrite it, you know, like do things that
we don't.
To fix the problem.
Yeah.
Okay.
Exactly.
Is this an alternative replacement or just another safety net compared to say like the
test PyPI versus production PyPI?
You mean like the draft stuff?
Yeah.
I think it would be the preferred.
Like would stuff automatically upload and draft and you got to flip it so that you don't
accidentally publish something that's not ready or first because you forgot to use the test
PyPI.
Yeah.
Test PyPI is kind of weird because like it actually existed to be our test environment for
PyPI.
Like because we didn't have a great test suite with the old PyPI.
And now it sort of hangs around as like a playground sandbox.
Yeah.
We don't care.
But yeah, some people do like have it in their production, in their like release flow, like
upload here first, make sure that it works and then like go to.
So I think this will be a better use case and sort of consolidate folks to use PyPI for
everything.
And we can eventually shut down test PyPI because it's not as useful as it could be.
All right.
Well, I think that's probably all the time we got to talk about this.
We could go on and on.
We only touched on some of the stuff that we're thinking about talking about.
But before we're done, maybe answer the final two questions.
If you're going to write some code, yeah, what editor do you use?
I do almost everything in BI and have since I sort of started doing any kind of development
work.
That said, I like I kind of try to do as much as I can in the browser in the like GitHub
UI.
Okay.
I hit, you know, speed bumps there.
Sometimes it can't be quite as fast, but like for little stuff I like, yeah, I kind of
like, I kind of like seeing what I can do there.
Yeah.
Right on.
Do you ever press the dot in GitHub?
Yeah.
All the time.
Love the dot.
Yeah.
The dot converts it to like hosted VS Code basically.
Yeah.
And then a package you want to give a shout out to?
So my biased answer to this is check out the SIG store package on PyPI and the pip dash
audit package.
Those are both stuff that I've been working on.
My team has been working on.
I'm really proud of the way that they work.
And we're going to be working on integrating those into like more use cases, more patterns.
Check them out.
Like try them out.
I'd love to get feedback on them.
Yeah.
Fantastic.
They seem to fill like a super big, a super important hole that sort of backfill some
of the security and supply chain stability and so on.
And then I think my unbiased answer, I did want to give a shout out to the pip-tools, pip dash
tools project on PyPI.
That's maintained by the jazz band team.
So that's just like a roving revolving door of maintainers.
But they do a good job keeping it up and running.
It satisfies this really, I think, important use case that a lot of people don't do with
their Python dependencies, which is like essentially allows you to compile your dependencies into
a requirements file that has all the versions pinned, all the sub dependencies there.
Hashes, which is like, please like use tips, hash checker, hash all your dependencies.
It definitely protects you against another whole class of attacks.
But yeah, pip-tools is great for that.
I would love a future where that was part of pip.
I don't know if that's going to exist or not up to the maintainer.
But yeah, it's super cool.
I have switched to using pip-tools for all of my packages and I love it.
It's fantastic.
Yeah, me too.
We use it for PyPI.
We use it for a bunch of other stuff.
Yeah.
Indeed.
All right.
Final call to action.
People want to get more involved, maybe make their things more secure.
I'd say call to action is go to pipi.org slash security dash key dash giveaway.
See if you're eligible as a critical maintainer for security keys.
If not, please just turn on 2FA anyway while you're there.
As a maintainer, I'd really appreciate that.
Keep your eye on the security space.
I think like there's a lot of interesting stuff happening, a lot of focus, a lot of resources
going into it right now.
It's a good time to like try and adopt some additional security, both to protect yourself,
your users, everything.
So yeah.
Yeah, I definitely second that.
Dustin, thanks so much for coming and sharing all this.
This has been great to talk about, get an insight and some of the ideas and thoughts
behind all these decisions.
It's great.
For sure.
Michael, it's always really great to talk to you.
So glad to be here.
You too.
Thanks again.
See ya.
This has been another episode of Talk Python to Me.
Thank you to our sponsors.
Be sure to check out what they're offering.
It really helps support the show.
Listen to an episode of Compiler, an original podcast from Red Hat.
Compiler unravels industry topics, trends, and things you've always wanted to know about
tech through interviews with the people who know it best.
Subscribe today by following talkpython.fm/compiler.
You care about the ideas behind technology, not just the tech itself.
And you know that tech has an enormous influence on society.
So check out the IRL podcast.
It's hosted by Bridget Todd.
And this season of IRL looks at AI in real life.
Listen to an episode at talkpython.fm/IRL.
Want to level up your Python?
We have one of the largest catalogs of Python video courses over at Talk Python.
Our content ranges from true beginners to deeply advanced topics like memory and async.
And best of all, there's not a subscription in sight.
Check it out for yourself at training.talkpython.fm.
Be sure to subscribe to the show, open your favorite podcast app, and search for Python.
We should be right at the top.
You can also find the iTunes feed at /itunes, the Google Play feed at /play,
and the direct RSS feed at /rss on talkpython.fm.
We're live streaming most of our recordings these days.
If you want to be part of the show and have your comments featured on the air,
be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
This is your host, Michael Kennedy.
Thanks so much for listening.
I really appreciate it.
Now get out there and write some Python code.
I'll see you next time.