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

build: Sign windows builds via remote key storage #15718

Merged

Conversation

sfoster1
Copy link
Member

@sfoster1 sfoster1 commented Jul 19, 2024

Integrates code signing with a key stored in digicert one to app build workflows.

There are a couple caveats:

  • You can do this locally if you have a windows machine and if you have the right accounts and permissions. Read: you basically can't do this locally
  • Digicert for some reason charges per signature. We sign a lot of stuff. Therefore, we are only going to produce signed windows builds for releases and if a dev really needs to by pushing a branch that has "as-release" in it (in the same way we only do app builds if you push a branch that has app-build in it - so building and signing both windows apps would require a branch that has app-build-both-as-release in it)
  • This just doesn't work at all with electron-builder, and they don't seem to want to change things to fix it; specifically, you can only configure e-b to pass along a key link and a password, and you basically can't do that anymore. So we have to have a (thankfully simple) custom sign script.

Closes RDEVOPS-128

to leave draft

  • this produces a signed installer that passes smartscreen
  • this only does that on branches with the right kinds of names

@sfoster1 sfoster1 requested a review from y3rsh July 19, 2024 16:48
Integrates code signing with a key stored in digicert one to app build
workflows.

There are a couple caveats:
- You can do this locally if you have a windows machine and if you have
the right accounts and permissions. Read: you basically can't do this
locally
- Digicert for some reason charges per signature. We sign a lot of
stuff. Therefore, we are only going to produce signed windows builds for
releases and if a dev really needs to by pushing a branch that has
"as-release" in it (in the same way we only do app builds if you push a
branch that has app-build in it - so building and signing both windows
apps would require a branch that has app-build-both-as-release in it)
- This just doesn't work at all with electron-builder, and they don't
seem to want to change things to fix it; specifically, you can only
configure e-b to pass along a key link and a password, and you basically
can't do that anymore. So we have to have a (thankfully simple) custom
sign script.

Closes RDEVOPS-128
@sfoster1 sfoster1 force-pushed the RDEVOPS-128-fix-windows-signing-app-build-both-as-release branch from 6ff6c2c to d764028 Compare July 19, 2024 16:58
@sfoster1 sfoster1 marked this pull request as ready for review July 19, 2024 21:38
@sfoster1 sfoster1 requested review from a team as code owners July 19, 2024 21:38
@sfoster1 sfoster1 requested review from brenthagen and removed request for a team July 19, 2024 21:38
@sfoster1
Copy link
Member Author

https://builds.opentrons.com/app/Opentrons-v7.3.1-win-b45460-RDEVOPS-128-fix-windows-signing-app-build-both-as-release.exe Seems to be signed

Copy link
Contributor

@vegano1 vegano1 left a comment

Choose a reason for hiding this comment

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

This is great, thank you!

  • I successfully installed the signed Windows build without issues!
  • Just left one comment on timestamp server rate-limiting.

forceCodeSigning: WINDOWS_SIGN,
rfc3161TimeStampServer: 'https://timestamp.digicert.com',
sign: 'scripts/windows-custom-sign.js',
signDlls: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to take into account timestamp server rate-limiting, per this comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

digicert's timestamp server is rate limited to 100 request/5s and 1000 request/5min which I don't think we would hit unless doing about 8 windows builds at the same time (we sign ~60 files), which should be very rare.

Copy link
Collaborator

@y3rsh y3rsh left a comment

Choose a reason for hiding this comment

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

@sfoster1 sfoster1 merged commit 246efcb into edge Jul 22, 2024
23 checks passed
@sfoster1 sfoster1 deleted the RDEVOPS-128-fix-windows-signing-app-build-both-as-release branch July 22, 2024 16:31
y3rsh pushed a commit that referenced this pull request Jul 22, 2024
Integrates code signing with a key stored in digicert one to app build
workflows.

There are a couple caveats:
- You can do this locally if you have a windows machine and if you have
the right accounts and permissions. Read: you basically can't do this
locally
- Digicert for some reason charges per signature. We sign a lot of
stuff. Therefore, we are only going to produce signed windows builds for
releases and if a dev really needs to by pushing a branch that has
"as-release" in it (in the same way we only do app builds if you push a
branch that has app-build in it - so building and signing both windows
apps would require a branch that has app-build-both-as-release in it)
- This just doesn't work at all with electron-builder, and they don't
seem to want to change things to fix it; specifically, you can only
configure e-b to pass along a key link and a password, and you basically
can't do that anymore. So we have to have a (thankfully simple) custom
sign script.

Closes RDEVOPS-128

## to leave draft
- [x] this produces a signed installer that passes smartscreen
- [x] this only does that on branches with the right kinds of names
y3rsh added a commit that referenced this pull request Jul 22, 2024
## `cherry-pick` 246efcb

Must update `chore_release-7.4.0` so that windows builds work and we may
test an update. To understand the changes see #15718

Co-authored-by: Seth Foster <[email protected]>
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.

3 participants