Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements signed releases #6490

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Implements signed releases #6490

wants to merge 5 commits into from

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Sep 10, 2024

With those changes, the following files will be generated by the release process; I can also see to make an alias on latest to quickly find the most recent public key:

I used the following commands to generate the private and public keys I added to the repository:

openssl ecparam -genkey -name secp384r1 -noout -out yarn.key
openssl ec -in yarn.key -pubout -out yarn.pem

@arcanis
Copy link
Member Author

arcanis commented Sep 10, 2024

cc @merceyz @aduh95 do you see an issue with that plan?

@aduh95
Copy link
Contributor

aduh95 commented Sep 10, 2024

If the private key gets compromised for whatever reason, you probably want to keep an option to provide more than one signature. Maybe an option would be to provide yarn.js.[key id].sign or [key id]/yarn.js.sign. I would put the public key(s) in a JSON file global to the whole registry, so if/when a key is compromised, or is lost, you can mark it as expired.

- name: 'Store the secrets'
run: |
printf "${{secrets.SIGN_PRIVATE_KEY}}" > /tmp/yarn.key
printf "${{secrets.SIGN_PUBLIC_KEY}}" > /tmp/yarn.pem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't store the public key as secret, it's a better idea to derive it from the private key – or store it in clear.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept it as a secret to make clear both values were linked and needed to be updated should we need to change it (rather than hardcode it in a separate place), but true, it could be derived within the script itself 🤔

@arcanis
Copy link
Member Author

arcanis commented Sep 10, 2024

If the private key gets compromised for whatever reason, you probably want to keep an option to provide more than one signature. Maybe an option would be to provide yarn.js.[key id].sign or [key id]/yarn.js.sign. I would put the public key(s) in a JSON file global to the whole registry, so if/when a key is compromised, or is lost, you can mark it as expired.

Do you mean that in case of compromission we'd reissue new signatures for all files with the new key? Is it a common practice?

@aduh95
Copy link
Contributor

aduh95 commented Sep 10, 2024

I don't know if it's common practice, but what I would do would be to reissue new signatures for supported versions – though I suppose making a new patch release for all supported branches would be the same result.

In any case, IMO having a global registry for public keys would be much much better than "check the previous release key to see if it's the same". And once you have a global registry of private key, it's easy enough to use a naming convention that would allow providing multiple signatures, even though it might never be necessary in practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants