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

27$: Sign pre-built executables #133

Closed
5 tasks done
strager opened this issue Jan 14, 2021 · 15 comments
Closed
5 tasks done

27$: Sign pre-built executables #133

strager opened this issue Jan 14, 2021 · 15 comments
Assignees
Labels
for hire Get paid for working on this task: https://quick-lint-js.com/hiring.html

Comments

@strager
Copy link
Collaborator

strager commented Jan 14, 2021

Digitally sign the Windows and macOS executables we ship on npm.

  • Linux
  • macOS
  • Windows
  • editor plugins; source repo; etc.
  • redo signing keys
@strager strager added this to the public release (v1.0) milestone Jan 14, 2021
@strager strager added the for hire Get paid for working on this task: https://quick-lint-js.com/hiring.html label Apr 3, 2021
@strager strager changed the title Sign pre-built executables 27$: Sign pre-built executables Apr 3, 2021
@strager
Copy link
Collaborator Author

strager commented May 20, 2021

For macOS, I need an Apple developer account. This requires 2fac on my Apple ID, and I'm having trouble setting up 2fac. =\

@strager
Copy link
Collaborator Author

strager commented May 20, 2021

For Windows, I don't think Microsoft has an option for them to notarize executables. Therefore, I'd need my own CA-signed certificate. Cheap certificates seem to be around 75$: https://cheapcodesign.com/codesigning/authenti-codesigning

@strager
Copy link
Collaborator Author

strager commented May 20, 2021

One use case for code signing on all platforms: editor plugins can verify that ./node_modules/.bin/quick-lint-js is really quick-lint-js and not some malware.

@strager
Copy link
Collaborator Author

strager commented May 20, 2021

macOS

macOS code signing (codesign)

Windows

Windows code signing (signtool)

Linux

Linux has no de-facto executable signing.

Separate PGP signatures are common. We don't need the signature to be embedded into the executable.

For embedded signatures, there are several options, including:

(I didn't audit these solutions.)

@strager
Copy link
Collaborator Author

strager commented May 30, 2021

Goal: Allow Vim plugin to use node_modules/.bin/quick-lint-js.

Problem: Any npm package can create node_modules/.bin/quick-lint-js. Also, any directory a user cds into might have node_modules/.bin/quick-lint-js. node_modules/.bin/quick-lint-js might not refer to a 'real' quick-lint-js.

Linux

Solution: Sign quick-lint-js with GnuPG. Have the Vim plugin verify the signature. The Vim plugin contains the public key.
Problem: Need tools to verify GnuPG signatures. We could ask users to install GPG if they want this feature.

macOS

Solution: Sign with codesign. Verify in Vim plugin.
Problem: Need tools to verify codesign signatures. I don't know what this entails yet.

Windows

Solution: Sign with Authenticode. Verify in Vim plugin.
Problem: Need tools to verify codesign signatures. Microsoft probably provides a C API. Can we access it from a Vim script? Maybe through Python?

@strager
Copy link
Collaborator Author

strager commented May 30, 2021

Windows

Problem: Need tools to verify codesign signatures. Microsoft probably provides a C API. Can we access it from a Vim script? Maybe through Python?

https://docs.microsoft.com/en-us/troubleshoot/windows/win32/get-information-authenticode-signed-executables

@strager
Copy link
Collaborator Author

strager commented May 30, 2021

macOS

Problem: Need tools to verify codesign signatures. I don't know what this entails yet.

I think that codesign is installed on macOS by default. Xcode is not necessary. Therefore, I think we can reliably use codesign to verify signatures.

@strager
Copy link
Collaborator Author

strager commented Sep 17, 2021

macOS

I experimented with macOS code signing.

Question: Which of the following three methods for signing should we implement in the build system?

  • Separate signature file
  • Create and sign quick-lint-js in-place
  • Create a unsigned quick-lint-js (as now) and a signed quick-lint-js.signed

Problem: spctl is rejecting qljs signed with my certificate from a self-signed CA. I don't know why:
Screen Shot 2021-09-17 at 00 52 55

@strager
Copy link
Collaborator Author

strager commented Sep 17, 2021

macOS

Problem: spctl is rejecting qljs signed with my certificate from a self-signed CA.

I did get codesign to verify the signature:

$ codesign -vvv -R="anchor trusted" build/quick-lint-js.signed
$ codesign -vvv -R="$(csreq -r='certificate leaf = "./dist/certificates/apple-dev.cer"' -t)" build/quick-lint-js.signed

(For some reason, I need a .cer, not a .p12, for file-based verification.)

@strager strager self-assigned this Sep 22, 2021
@strager
Copy link
Collaborator Author

strager commented Sep 28, 2021

macOS

I finally have a patch which makes CI sign executables.

However, I don't know how to make the signing secure (e.g. only for master builds). I don't want drive-by PRs to steal the private signing key.

@strager
Copy link
Collaborator Author

strager commented Sep 29, 2021

Perhaps we should sign during the build->release copy. That would fix security problems. But it would mean we're not testing signing on CI. (Maybe we could use a testing cert on CI?)

@strager
Copy link
Collaborator Author

strager commented Oct 29, 2021

In commit 795efd9, I implemented a build post-processing tool which invokes Apple's codesign tool.

@strager
Copy link
Collaborator Author

strager commented Nov 2, 2021

Commit 67358b9 added signing for Windows .exe-s and .dll-s.

@strager
Copy link
Collaborator Author

strager commented Nov 3, 2021

Commit 4158540 added signing for Linux executables and DSOs.

@strager
Copy link
Collaborator Author

strager commented Nov 21, 2021

redo signing keys

Done in commit 455f110.

editor plugins; source repo; etc.

Done in commit 5fa5003.

@strager strager closed this as completed Nov 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for hire Get paid for working on this task: https://quick-lint-js.com/hiring.html
Projects
None yet
Development

No branches or pull requests

1 participant