FOR THE LATEST PROPOSAL SEE MY COMMENT BELOW
Original post
In the forum topic about changing the criteria to gain commit access to LLVM, there has been extensive discussion about how to improve security for the LLVM project in general and how to avoid supply chain attacks on our releases and attached assets. This RFC is my attempt at proposing changes that I think are necessary to become less of a obvious target for these kinds of attacks. This RFC doesn’t try to solve every single problem with security in the LLVM project, it focuses very narrowly on the release binaries and sources and tries to make a dent in that problem, not completely remove the problem.
The current situation
Currently when we make a release of LLVM, a release manager will run an export script that will output the split source archives and sign them with their own PGP key. The public part of these keys can be found on releases.llvm.org. A tag will be created on GitHub, this tag is also signed with one of the keys above.
The release testers will download the source or checkout the tag from GitHub and run the test-release script. This will create a binary distribution of LLVM and this is then signed (not all testers do this) and uploaded to the release on GitHub.
What is a supply chain attack
Most of the discussion around this came out of the recent XZ/LZMA attack, where a long time contributor was able to insert backdoor code into the release source tarballs, the backdoor was not added to Git but just to the release artifacts. It’s not known if the contributor was playing a long game with the result of being able to insert the backdoor or if he was himself compromised in order to gain access to insert the backdoor. I think both scenarios are worth keeping in mind while crafting a proposal to fight an attack like this.
There are many more supply chain attacks and I won’t spend to much time on that here, you can read up on a lot more attacks on Wikipedia.
The problems
Becoming a release tester
Currently there is no process for becoming a release tester, most likely the release testers are people that want to make sure that their platform is tested for each release and they step up in the forum and start running the test script and upload binaries. To upload to a release you only need to have commit access to LLVM. This means that in very very short time someone could start posting (legit or non legit) release binaries directly to LLVM release page without any scrutiny.
GitHub permissions
GitHub offers no ACL or limitations on who can upload or create a release for a repository. This means that anyone with commit access to llvm-project can create a release and upload assets. Not only can they upload new artifacts, they can also overwrite older assets.
To add some insult to this injury - there is no way to disable this functionality in GitHub. I really hope that recent events will make GitHub think about prioritizing these issues. If you work at GitHub or known anyone there, please forward this post to them to stress how important it is for bigger open source communities to have more control over the release assets.
The exotic platform problem
Some of the binaries uploaded to the assets are for “exotic” platforms that are not accessible for the release managers nor the community at wide. This means that verification of these binaries would be almost impossible.
Becoming a release manager
Currently there are two release managers for LLVM: @tstellar and me. While Tom has been around for quite some time in the community, I was invited to do releases by Tom in a private message on Discord and then accepted to be a release manager for every other release. By now I have been at EuroLLVM and meet with people and hopefully shown that I am here for good reasons, it shows that it would be far from impossible for people to get elevated like this with bad intentions.
Proposal
Stop publishing release assets on the main repo
Since GitHub doesn’t allow any ACL for creating assets I think our only option is to remove the assets from the main repository. The release assets should be moved to a new repository on GitHub where we can control who has commit access.
We will continue to publish releases on the main repo, but they will only link people to the second repo in order to do the actual download.
We would need to create github workflow to delete any assets uploaded on the main repo and delete any releases that are not tagged with the release managers PGP keys.
Only publish approved assets
The release assets that are uploaded to the release repo should be created by the CI and the workflow to create these binaries and source packages should only be accessible by the release managers. The repo should be open for PR’s from third parties that want to contribute, but we should apply some heavy scrutiny for accepting updates to these workflows. All assets should be signed with a trusted key.
Third-party binaries should not be published to any official LLVM release page
I think the best solution for third-party binaries would be that each release on the main repo would leave a link to a discourse post where third party binaries could be linked. These posts should make it REAL clear that we can’t verify the validity of these binaries or it’s contents.
Implement a verification routine for Release Managers
Since we remove the “official” status of release testers and not having them upload binaries to the release page anymore, I think we can be liberal in who can do that. The community should report bad / malicious binaries and we can then ban these people from posting to our forums.
But we need some kind of new routine for accepting a release manager, these people will hold the keys to the kingdom so to speak. In person meeting (or Zoom whatever) with current release managers or the foundation board would be a minimum. But I will leave this a bit more open to feedback for now since we don’t accept new release managers that often.
When to implement
The LLVM 18.x release window is soon done and while I think this is an issue we should address hastily, I think it makes more sense to implement the most of the stuff above for LLVM 19. Meanwhile I think all recent release pages should be updated with a disclaimer that the release binaries shouldn’t be trusted and only trust packages signed with the release managers keys.
Alternative if the community feels like this is not enough for the threat, we could delete all release binaries from the release pages and ask people to post third-party binaries to forum post that we can make ready. But I fear this approach will have negative consequences.
Potential downsides
Implementing these changes will lead to some negative consequences:
- People rely on the third-party binaries for their own use of LLVM. We will never be able to serve a the same breath of official binaries as we currently offer with the help of third-parties. But I think relying on these binaries has always been risky.
- More work for release managers. I was worried about this at first, but I think that if we can get the automation to work it shouldn’t add to much to the burden of the RM’s. We would need community help to maintain the workflows on the other hand.
- Confusing that no binaries are available on the official repo. I am not sure we can work around this until GitHub implements ACL for this. When they do, the binaries can migrate back.
All in all - I think the improved security is worth the downsides listed above.
Thanks
Thanks to everyone that have engaged in this topic in various forums. I hope we can reach a consensus on this fast so that we can move forward and make the necessary changes to improve the security.