|
|
Log in / Subscribe / Register

Eliminating long-lived credentials with trusted publishing

By Joe Brockmeier
June 9, 2026

OSSNA

Trusted publishing is an authentication mechanism that relies on short-lived credentials to reduce the risk of supply-chain attacks. At the 2026 Open Source Summit North America, Mike Fiedler walked the audience through why trusted publishing exists, how it works, and made the case for its adoption. It is not a silver bullet against all attacks, but it does offer protection against theft of long-lived credentials used to publish to package registries.

Fiedler is employed by the Python Software Foundation (PSF) as the safety and security engineer for the Python Package Index (PyPI). This is a role, he said, that did not exist before he took the job three years ago. It exists thanks to funding from the Linux Foundation's Alpha-Omega initiative. Everything he would be covering in his talk, he said, exists "pretty much because somebody is paid full time to think about these things".

He asked whether the audience was familiar with PyPI, or if they had ever installed anything using pip. Most, if not all, of the hands in the room were raised at that point. Fiedler said that he had asked if anyone knew about PyPI at a data-science conference and got blank faces; but when he asked if they had ever used pip install, everyone raised their hand.

Scale

[Mike Fiedler]

They are not alone. PyPI serves more than 13 billion requests per day, Fiedler said, adding "which is a lot" with a smile. More than 900 projects are created on PyPI each day; that number does not include all of the existing projects that publish releases each day. The site serves 10 petabytes of traffic a day, with a peak of 1TB per second. There are more than one million user accounts on the site, as well, to support publishing packages. "The blast radius here is kind of big, right?"

He said that "everybody depends on some other dependency, and that dependency depends on another dependency", which meant that even small, incremental improvements in any part of the PyPI ecosystem meant it would have a major impact on the rest of the ecosystem. "Every little step counts". Trusted publishing is, he said, one of the more materially useful steps that one can do.

More than 2.2 million files have been published using the trusted publishing method since it was first offered to PyPI package maintainers in April 2023. He said that trusted publishing was used for about 10% of all new uploads in February 2024, and for more than 36% of new uploads as of May 2026. "So it's not a hockey stick directly into, like, 80% or 90%. It is more of a slow roll because a lot of people are unfamiliar with this new idea, and their old systems still work." It will require educating people, he said, on why they should want to use trusted publishing, make it easy to adopt, "and then see the benefits echo through the ecosystem."

"Password with a nice hat"

"Let's start with the release-day ritual", Fiedler said. To publish a project to the package registry, a user needs to have an have an API token to authenticate and upload packages to PyPI. That token may be stored on someone's laptop in a .pypirc file, if they run the release from that computer. The token might be stored on GitHub so that the user can use GitHub Actions to publish to PyPI, or it may be stored with another continuous-integration/continuous-delivery (CI/CD) provider. The common thread, he said, was that these tokens "live forever until you decide to delete them" and they will continue to live on disk somewhere indefinitely.

A long-lived API token "is basically a password with a nice hat", he said. "Nothing about the word 'token' is particularly protecting you. It's just a password." And, because people make mistakes, it can be exfiltrated, phished, logged, or committed to code—just like a password can be.

A token could be exposed in any number of ways; it might be accidentally committed to a Git repository, or it might show up in CI/CD logs. People are targeted with phishing attacks all the time, he said, "and some people fall for it. It happens, right?" Maintainers click links that they are told to click "because they trust the ecosystems that are sending them those links", and because they are often overburdened and just trying to do their work.

15 minutes of trust

With trusted publishing the token is issued at publication time, rather than being stored somewhere. Users first have to set up a trusted publisher for their project. They have to supply the names of the GitHub owner (organization or user), repository, and workflow file (e.g., release.yml), and (optionally) an environment name. Fiedler described environment as "an extra security gate" that allowed a project to configure, for instance, which people are allowed to trigger a release.

Then, when a user starts the publishing process, their CI (such as GitHub Actions) asks for an OpenID Connect (OIDC) identity token from GitHub's OIDC provider. Then GitHub grants a signed JSON Web Token (JWT) with the four strings that indicate the owner of the project, the repository it is coming from, the workflow file, and environment if it's configured.

PyPI only issues a token if all four match. For example, if a package is configured for trusted publishing by user "jzb" on GitHub, PyPI will not issue a token if the publishing process is initiated by a different user—even if it is still coming from the same repository and workflow file. If someone forks a repository, or renames it, then no token will be issued because the repository won't match.

The GitHub Actions job then sends the JWT token to PyPI. If it has a matching record for the token, PyPI will then issue an API token that is set to expire in 15 minutes. Why 15 minutes? Fiedler said that duration was chosen because some larger projects may have multi-step release flows, have a lot of data to upload to PyPI, or may be building for a number of different platforms. "Your build process takes the API token, performs the upload. Everything is copacetic. The token disappears."

The token is not stored long-term and "isn't a ticking time bomb that's just sitting around waiting for somebody to consume it". Before trusted publishing, the token lived forever just waiting to be exposed somehow. Some organizations may have security policies that require changing tokens at a regular interval, but that still happens more slowly and might be forgotten. Trusted publishing does not depend on manual processes: "Once you set it up, you literally can forget this, and the system will continue to operate in the manner so far that we have found secure."

He noted that some of the error messages when trusted publishing fails are "a little opaque", and encouraged people to open an issue if they run into problems. "We'll try to live debug it, so that way we can improve these error messages and workflows for folks in the future."

Fiedler used a GitHub project as an example during the talk, but PyPI's trusted publishing currently supports four identity providers: GitHub, GitLab, Google Cloud, and ActiveState. Support for self-managed GitLab instances is in beta, and he said that work is underway to support CircleCI as a provider as well. He said that PyPI pioneered trusted publishing, but there are now six package repositories that enable trusted publishing: crates.io, npm, NuGet, Packagist, and RubyGems also have support for the feature. "We've seen a massive adoption. We've showed the community. We share. We work with other communities. And they followed suit."

Case studies

Fiedler said that he would walk through some recent attacks that took advantage of long-lived tokens. He began with the Ultralytics project, which suffered a supply-chain attack in December 2024. A malicious pull request, he said, contained code that tricked GitHub Actions into running attacker-controlled code with a privileged secret, using pull_request_target. Ultralytics was using trusted publishing, but the project was not using the environment feature that could have required approval from a designated GitHub maintainer prior to publishing.

He advised people to audit their GitHub Actions workflows and see if they were using pull_request_target. If so, they should stop; it was meant for behind-the-firewall enterprise usage, rather than for open-source projects, and he said most people who were using it were doing so insecurely. "It's a very sharp tool that will, if you pick it up, it will cut you. So try to avoid using that if you can."

That was the case with Ultralytics, and it allowed attackers to publish several releases with crypto-mining malware. The silver lining, he said, was that Ultralytics was using trusted publishing so researchers and PyPI staff were able to find the exploit quickly. Another example that people may have heard of, he said, is the Shai-Hulud worm. He was upset that the attackers used the name, "because I love Dune, and they've co-opted the most majestic sandworm into an annoying malicious attack". It is a self-propagating worm that compromised hundreds of npm packages within hours of its launch.

PyPI sidestepped it for a long time, Fiedler said, because it was not the target for the attackers. However, there were repositories that had projects that publish to both npm and PyPI. While the attackers were targeting npm tokens, they also picked up a long-lived PyPI token "and then we saw some lateral movement into the PyPI ecosystem". Because it happened to PyPI at a smaller scale than npm, Fiedler said, he was able to work directly with affected maintainers to help them with recovery and notifying the world that they'd been exploited. "I could not do that at the scale that they had attacked the npm ecosystem."

Fiedler also spoke about the LiteLLM and Telnyx supply-chain attacks. These projects were compromised through a dependency on the Trivy vulnerability scanner, which is provided as an npm package, that was exploited and used to attack a number of other open-source repositories. That exploit chain allowed attackers to exfiltrate long-lived tokens from LiteLLM and Telnyx. He said that attackers may not go directly for popular projects: they will attack the dependencies of the popular projects. Developers should pin their dependencies so that compromised versions are not pulled in automatically as an accidental upgrade.

Attack categories disappear

The pattern is clear in each attack: "somebody had a long-lived token, somebody else got it". The answer to that is to use trusted publishing to do away with long-lived tokens. With trusted publishing, the credential does not exist outside of the provider (such as GitHub), and there is no long-lived token to be stored. "So trust the pipeline, not the password."

When a project is using trusted publishing, he said, "the threat model changes completely". An entire class of problems goes away. There is no token to commit to Git. The token will be obfuscated in any CI log, as well, Fiedler said. It's possible that it could accidentally be sent to a log, but "because GitHub and GitHub Actions now know the format of our token, they will obfuscate that by default. They'll redact it." People can still be subjected to phishing attacks, he said, but the tokens are removed from the equation. "So entire attack categories just fall off the map, and we can worry about this particular vector less."

If Ultralytics had been using trusted publishing [with the environment feature], he said, the publishing workflow would have still run; however, the pull-request branch would not match the workflow reference, so PyPI would not have issued a token. "There's a publisher record on PyPI. You can't steal that."

Artifacts published with trusted publishing also include a provenance receipt in the form of a Sigstore signature. That, Fiedler said, can be used to validate whether a package went through the trusted publishing path or if it was tampered with along the way. There is a project called pypi-attestations that can be used to verify packages, but verification is not built into the package managers yet. "They're still talking about how that should happen." He encouraged those with ideas and time to contribute to pitch in, or to help fund work so that downstream users could easily validate the attestations. Homebrew, he said, already validates Sigstore attestations.

Attestation is a hard concept for most people who aren't security experts to wrap their heads around, he said. PyPI is working through how to display attestation information to users in a way that is "not too scary, not too promising that this is 100% secure, because all we're saying is that this was not tampered with in flight". There could still be code that users do not want in a package, "we're not saying what's inside is good for you", but that is a different problem. Attestations merely show that no one has messed with the publishing pipeline; they do not guarantee that something hasn't gone awry at another stage.

Delete the old token

Even if a project has set up trusted publishing, there is one step that remains: delete the old token. "It is still just as viable as the day that it was minted." There are still some instances when an API token is the right call, he said, such as brand-new releases from new projects. "You haven't set up CI/CD yet. You're just piloting something out on your project. You don't have any users." In that case, it's reasonable to publish something from a laptop. Once it is done and people are downloading it, though, it is time to increase the security of the project.

Another scenario where API tokens are still useful is if a project is not using a registry or ecosystem that has trusted publishing support. "But you should be asking your registries, or your CI/CD providers, how come you don't support this? Please support a more secure methodology."

Fiedler said that it might also make sense to use an API token when there is a need to do a manual release or a rush release, such as a hotfix or a critical security release. If a project has been using trusted publishing, "you will set off every security scanner that has been monitoring the project", but it might be necessary in some cases. However, if a project does create a regular API token, he asked that the project please invalidate it immediately after use. "Try to kill it as soon as you can."

He encouraged people who maintain projects to start adopting trusted publishing. "Delete one [token] this week. Try it. If it doesn't work for you, please let us know. But kill off one token this week." He also reiterated that his role was funded by Alpha-Omega, which takes donations. "If you work for a company that enjoys using Python, please help the world by funding us."

Questions

During the Q&A, I noted that all of the providers that are supported are corporate entities, and asked whether there were plans to support community projects such as Forgejo which do not have the same kind of funding and resources. Fiedler said that they had gotten a lot of that kind of request lately, "like, how do we support Forgejo?" He noted that there is an open thread on the Python forum that talks about providers like Forgejo, and the steps that they would need to take "in order for us to be comfortable with their security stance and posture, to be able to onboard [them]".

The ecosystems that are supported are well-funded and have time to work on supporting trusted publishing. "When Forgejo gets to that point where they have enough security operations done, I think we would love to entertain bringing them in because a lot of people want to use that, and we want to support them." Until then, users on Forgejo and other platforms will have to continue using long-lived tokens.

Another attendee asked "what happens when you want to transfer the project to somebody else or when you want to rename the project?" The right way to handle that, he said, was to remove the existing trusted publishing configuration and re-enroll with the new data.

Fiedler's slides have been published on his web site. The video for the session is available on the Linux Foundation's YouTube channel.

[Thanks to the Linux Foundation, LWN's travel sponsor, for funding my travel to Minneapolis to attend the Open Source Summit.]



to post comments

A better summary.

Posted Jun 9, 2026 19:09 UTC (Tue) by ballombe (subscriber, #9523) [Link] (23 responses)

Trusted publishing is an authentication mechanism that relies on GitHub, GitLab, Google Cloud, or ActiveState to identify you.

A better summary.

Posted Jun 9, 2026 22:41 UTC (Tue) by LtWorf (subscriber, #124958) [Link] (21 responses)

Yup. So that github can take care of blocking developers from the countries that the USA doesn't like this week. I've mentioned it in my talk 2 years ago.

I doubt it even increases security at all since if my computer is compromised an attacker can get my private SSH key and publish and tag whatever they want on github. And SSH keys last much longer than 15 minutes, and they're also much easier to find on the disk!

They've also removed support for GPG signatures… the one private key that cannot readily be accessed because of the passphrase…

I can't understand how they can go on telling these things for years basically unchallenged.

A better summary.

Posted Jun 10, 2026 7:43 UTC (Wed) by Karellen (subscriber, #67644) [Link] (5 responses)

They've also removed support for GPG signatures… the one private key that cannot readily be accessed because of the passphrase…

I thought SSH keys could be passphrase-protected?

A better summary.

Posted Jun 10, 2026 8:03 UTC (Wed) by mjg59 (subscriber, #23239) [Link] (4 responses)

Yes. But they're also typically loaded into an SSH agent at either login or first use, and if an attacker has the ability to compromise that agent (either by just ptracing it, or LD_PRELOADing something into it on next login, or any number of other ways) then they can extract the private keys.

Of course, if an attacker is in a position to do those things, they're also in a position to grab your GPG passphrase the next time you type it in, so the distinction is basically irrelevant. The only real way to protect private keys on a compromised system is for them to be hardware backed, and you can do that just as well with SSH keys as you can with GPG ones.

A better summary.

Posted Jun 10, 2026 8:36 UTC (Wed) by taladar (subscriber, #68407) [Link] (3 responses)

GPG keys are also typically loaded into a GPG agent.

A better summary.

Posted Jun 10, 2026 8:37 UTC (Wed) by mjg59 (subscriber, #23239) [Link] (2 responses)

At login time, or after first use in a session? It's pretty common for SSH keys to be automatically loaded when you log in, which means they're exposed even if you haven't used them. I don't think this is a terribly important distinction, but it is a distinction.

A better summary.

Posted Jun 10, 2026 14:54 UTC (Wed) by mbunkus (subscriber, #87248) [Link]

Personally I use KeepassXC & store the important, root-/admin-level access giving keys there. I have it set to auto-remove those keys from the agent after 2 hours. When I need to use them I add them manually via KeepassXC.

Though that leaves the question if that's actually meaningfully different from having it in the agent all the time — if an attacker can trace my running ssh-agent, it can trace my running KeepassXC.

A better summary.

Posted Jun 12, 2026 22:50 UTC (Fri) by jengelh (subscriber, #33263) [Link]

gpg-agent has `default-cache-ttl` and `max-cache-ttl` (default: 10min/2h). ssh-agent/ssh-add only has -t (equivalent to max-cache-ttl), with a time-unlimited default. That's quite the difference.

A better summary.

Posted Jun 10, 2026 8:47 UTC (Wed) by kleptog (subscriber, #1183) [Link] (6 responses)

> I doubt it even increases security at all since if my computer is compromised an attacker can get my private SSH key and publish and tag whatever they want on github. And SSH keys last much longer than 15 minutes, and they're also much easier to find on the disk!

That's not the threat model being protected against here. We're talking about long lived credentials that are stored in GitHub (et al) being stolen to automatically upload the artifacts. These creds can then be used forever. This solution removes the need for long lived stored tokens in the CI/CD.

Protecting against compromises of developer laptops is a completely different problem. The approach here is to make sure that having a developer's SSH key doesn't give you access to upload artifacts to PyPI. You can't bypass the commit workflow that way.

And yes, this is all done by building a trust relationship between the CI/CD and PyPI. So there are still auth tokens in the background, but they're somewhere were users can't see or access them.

A better summary.

Posted Jun 10, 2026 12:09 UTC (Wed) by alx.manpages (subscriber, #145117) [Link] (2 responses)

I don't see why one would need any tokens at all.

For example, I sign my releases with GPG manually, and since the builds are reproducible, a build server could build and publish the release from source, without signing them. A user could check the build from the server with my manual GPG signature.

If you have reproducible builds, you don't need this. And if you don't have them, you should fix that instead of trying to fix the signing.

A better summary.

Posted Jun 10, 2026 17:45 UTC (Wed) by mathstuf (subscriber, #69389) [Link] (1 responses)

How is that build server going to make an environment suitable for building your project available? Arbitrary Docker images is probably the solution, but that is just moving the problem under a different rug. I know you tend to work on lower-level utilities, but there are projects that have dozens of dependencies that may not be reproducible themselves. Not to mention you're limited in the set of platforms supported by that build service. Also that reproducibility is a per-target property and not determinate a priori a lot of time.

A "I have a reproducible build and only really care about Linux (x86_64, maybe aarch64 too)" might be a fine alternate trusted publisher of binary artifacts given a GPG-signed tarball like you have, but I suspect its use would be by a tiny portion of projects.

A better summary.

Posted Jun 10, 2026 19:36 UTC (Wed) by LtWorf (subscriber, #124958) [Link]

If Debian can be reproducible, i suspect that most .py and .js projects can be as well.

Github actions are a mess. Builds should run without network access as a minimum condition. And PyPI should probably require projects to be able to build.

That's not what happens at all.

I agree that a long lived token sitting on a developer's machine can be compromised.

However it can happen to their ssh keys too. But we wouldn't necessarily care if the github action to build a package was standardised and ran without network access at the very least.

We are defending against a very minor attack and ignoring all the rest. If this wasn't in the threat modelling… perhaps the threat modelling was bad as well?

A better summary.

Posted Jun 11, 2026 7:17 UTC (Thu) by LtWorf (subscriber, #124958) [Link] (2 responses)

I think threat models have to be somewhat realistic to be useful.

As we have seen, developer machine compromise is a major source of malware.

Long lived upload tokens were never as problematic, to the best of my knowledge. The problem is doing uploads from a CI that runs god knows what.

A better summary.

Posted Jun 11, 2026 11:11 UTC (Thu) by kleptog (subscriber, #1183) [Link] (1 responses)

> Long lived upload tokens were never as problematic, to the best of my knowledge. The problem is doing uploads from a CI that runs god knows what.

So all the creds stolen in the Trivy compromise weren't a problem? Stolen Cisco code for example.

Doing uploads from CI/CD is very common. Even Debian publishes packages built from a build server. No-one has vetted all that code. Not relying on such tokens for common actions is an improvement.

A better summary.

Posted Jun 11, 2026 16:10 UTC (Thu) by mathstuf (subscriber, #69389) [Link]

The issue, AIUI, is that folks just "add secrets" to their pipelines willy-nilly. Even though we run our own CI infra, we still:

- restrict secrets to protected refs (so MR pipelines don't get them)
- only provided to named environments (so that build jobs don't get upload tokens)

These secret-using jobs tend to be of the "install rsync, run rsync"-level of complexity to keep even what runs with access to the secrets to a minimum.

A better summary.

Posted Jun 10, 2026 9:55 UTC (Wed) by anselm (subscriber, #2796) [Link] (6 responses)

And SSH keys last much longer than 15 minutes, and they're also much easier to find on the disk!

The answer to this is to use short-lived SSH certificates instead of public SSH keys. I don't know whether it will work with Github, but internally we use SSH certificates that last for only 10 hours (or so), issued by a certificate server which authenticates users with OpenID Connect. This means you don't need to copy your public SSH key all over the place, and the corresponding private keys (which users never need to touch) also only last for 10 hours before they become useless to a potential attacker.

A better summary.

Posted Jun 11, 2026 13:34 UTC (Thu) by taladar (subscriber, #68407) [Link] (5 responses)

The problem with that approach is of course that you then have an easy single-point of failure added to your system and all to move the credentials the attacker has to steal from the SSH key to the OIDC credentials.

A better summary.

Posted Jun 11, 2026 13:34 UTC (Thu) by taladar (subscriber, #68407) [Link] (4 responses)

Well, or the private signing key of your CA of course, that is another point they could attack to get access to everything.

A better summary.

Posted Jun 12, 2026 7:11 UTC (Fri) by anselm (subscriber, #2796) [Link] (3 responses)

The private signing key of our CA is a lot more difficult to get at than private SSH keys on random developers' laptops, so that's a net win.

Also, access to the OIdC IdP can be straightforwardly made more secure using MFA (e.g., with a USB FIDO2 device). This could of course also be done for standard SSH keys, but it is more of a hassle to set up, it wouldn't solve the problem of having to maintain potentially many copies of the corresponding public SSH keys all over the place, and the USB FIDO2 device works for other web-based services, too.

A better summary.

Posted Jun 12, 2026 7:49 UTC (Fri) by Cyberax (✭ supporter ✭, #52523) [Link]

BTW, and you also can combine both approaches. Nothing stops you from issuing SSH CA certs for token-based keys.

A better summary.

Posted Jun 12, 2026 16:01 UTC (Fri) by LtWorf (subscriber, #124958) [Link] (1 responses)

I think it's extremely funny that instead of forcing people to use 2FA to do uploads, they forced 2FA to login, and then you create a long lived all-powerful token and forget about 2FA.

I was doing uploads by typing in my password (not stored in any password manager), and now the only way I can do uploads (without moving my projects on a corporate-owned forge) is via a token which sits on my disk, ready to be stolen.

Google gave me an hardware token for free, but it only works for web login.

All of this effort and I'm now less secure than I was a few years ago. Which makes me strongly suspect that ballombe's take is the right one. USA is adding constraints to foreign companies forcing them to avoid any chinese software to be able to sell anything in USA…

A better summary.

Posted Jun 15, 2026 1:27 UTC (Mon) by mathstuf (subscriber, #69389) [Link]

For services with these kinds of things that they're "important" *and* require unencrypted passwords (I've migrated most everything else over to systemd-creds instead now), I instead store the relevant config file as a symlink to an automounted drive that is named through udev/udisks to a stable `/dev/mapper` name.

So, yes, still long-lived, but it doesn't need to be accessible just because I'm logged in (or even just booted as the common case may be).

A better summary.

Posted Jun 11, 2026 6:31 UTC (Thu) by hailfinger (subscriber, #76962) [Link]

There is the (very relevant) geopolitical angle you mentioned. However, this is also a problem concerning:
- control: a third party not under your control has both the ability to impersonate you and the ability to block you from publishing your own code
- gatekeeping: the list of allowed identity providers covers most of the commercial market, but if you want to host something on your own, you only have a "beta" integration for self-hosted Gitlab and nothing else

A better summary.

Posted Jun 11, 2026 3:49 UTC (Thu) by pavon (subscriber, #142617) [Link]

What about using these as a form of two-factor authentication, so they don't have to trust the provider, and can accept anyone who implements OIDC? PyPI currently accept deployments from Forgejo (or anywhere) that use a traditional token. If you were to add an optional field to the JWT token which was populated with the traditional token, then for "untrusted" providers PyPI could verify that the JWT token and the traditional token were valid before publishing the package. That way I can choose which OIDC provider I trust, and still have some addition comfort that a simple mistake handling a token won't be immediately exploitable.

There are more kinds of tokens than dreamt of in userland's philosophy

Posted Jun 9, 2026 20:17 UTC (Tue) by quotemstr (subscriber, #45331) [Link] (1 responses)

> "Nothing about the word 'token' is particularly protecting you. It's just a password." And, because people make mistakes, it can be exfiltrated, phished, logged, or committed to code—just like a password can be.

This dire conclusion applies only to *bearer* tokens. The word "bearer" means that, like cash, anyone bearing one can use it. Not all tokens are bearer tokens!

We have the technology to mint hardware-bound tokens for which exfiltration is impossible or useless. We can, for example, create public-private keypairs in which the private key lives in a machine's TPM (or equivalent) *and never leaves it*. You create a hardware-bound token by telling the TPM itself to generate a private key, a public key, and a CSR. You send the CSR to some other party, which checks that the CSR cryptographically attests "my private key live in hardware", and, if true, signs your CSR and gives you a certificate. You then use your certificate to attest your idenity remotely via mTLS, use the keypair to sign PyPI releases, or whatever else you want. The token is forever bound to your specific hardware. Short of breaking your secure execution environment, nobody is going to exfiltrate it or bypass your rate limits or usage restraints.

Hell, a sufficiently powerful TEE could enforce the invariant that it signs only releases themselves attested end-to-end, SLSA-4 style.

While I'm glad we're paying attention to token exfiltration in this era of credential-stealing worms and LLM-accelerated exploits, we should be thinking about more than tweaking TTLs. Hardware-bound tokens resist attacks that no pure-software scheme can ever fully mitigate.

There are more kinds of tokens than dreamt of in userland's philosophy

Posted Jun 9, 2026 22:44 UTC (Tue) by LtWorf (subscriber, #124958) [Link]

But doing like that wouldn't lock your project into using github actions.

Funnily enough, github actions is often at the centre of most malware on these platforms.

Contradiction?

Posted Jun 10, 2026 6:27 UTC (Wed) by hailfinger (subscriber, #76962) [Link] (5 responses)

> Ultralytics was using trusted publishing, but the project was not using the environment feature that could have required approval from a designated GitHub maintainer prior to publishing.

> If Ultralytics had been using trusted publishing, he said, the publishing workflow would have still run; however, the pull-request branch would not match the workflow reference, so PyPI would not have issued a token. "There's a publisher record on PyPI. You can't steal that."

So which is it? No trusted publishing or just trusted publishing without environment feature?

Contradiction?

Posted Jun 10, 2026 12:26 UTC (Wed) by jzb (editor, #7867) [Link] (4 responses)

My notes say that he didn't specify "with the environment feature", but either I missed it or maybe he meant that and wasn't specific enough. I know it's easy enough to skip over a detail like that when giving a talk. I did follow up for clarification after the talk and he did say specifically that using the environment feature would've prevented it.

FWIW for anybody using trusted publishing, it almost seems like that should be a mandatory feature.

Contradiction?

Posted Jun 10, 2026 14:44 UTC (Wed) by hailfinger (subscriber, #76962) [Link]

> FWIW for anybody using trusted publishing, it almost seems like that should be a mandatory feature.

Indeed. Thank you for the clarification.

Contradiction?

Posted Jun 10, 2026 18:26 UTC (Wed) by samlh (subscriber, #56788) [Link] (2 responses)

Also of note:
In response to a similar (the same?) attack, crates.io's implementation now proactively blocks usage with the pull_request_target trigger server-side, so that particular footgun is defanged for Rust crates.
Perhaps PyPI could do the same?

Reference:
https://github.com/rust-lang/crates.io/blob/c61947f573026...

Contradiction?

Posted Jun 15, 2026 14:09 UTC (Mon) by miketheman (guest, #184536) [Link] (1 responses)

PyPI has been blocking `pull_request_target` for 4 months https://github.com/pypi/warehouse/pull/19601

Contradiction?

Posted Jun 16, 2026 8:07 UTC (Tue) by samlh (subscriber, #56788) [Link]

Ah, great - thanks for the link


Copyright © 2026, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds