Repository navigation
Verify the CLI with the new release key, and bundle signatures for past releases - #391
Conversation
|
@codex review |
|
@codex security review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
ethanndickson
left a comment
There was a problem hiding this comment.
Agent review, written in the style of this repo's past reviews. The prerelease comment is the only one that changes behaviour; the other two are nits.
🤖
| return DownloadResult.NotFound | ||
| } | ||
| val source = javaClass.getResource(BUNDLED_SIGNATURES) ?: return DownloadResult.NotFound | ||
| val signature = bundledSignatures(source)["${semVer.major}.${semVer.minor}.${semVer.patch}"] |
There was a problem hiding this comment.
A prerelease or dev build (v2.33.0-rc.1, v2.32.0-devel+abc1234) is cut down to major.minor.patch here, so it picks up the signature of the stable release. That signature can't match, so the user gets the "Could not verify the authenticity ... it may be tampered with" warning for a CLI that just has no signature. Should we skip the bundle for those versions, like the VS Code extension does in coder/vscode-coder#1194?
🤖
| val source = javaClass.getResource(BUNDLED_SIGNATURES) ?: return DownloadResult.NotFound | ||
| val signature = bundledSignatures(source)["${semVer.major}.${semVer.minor}.${semVer.patch}"] | ||
| ?.get(context.settingsStore.defaultCliBinaryNameByOsAndArch) | ||
| ?: return DownloadResult.NotFound |
There was a problem hiding this comment.
nit: downloadSignature logs when the deployment has no signature, but a miss here is silent. Should we log it too? It would show in the logs why the prompt came up.
🤖
| - Verify the Coder CLI with Coder's new release signing key, using the `.v2.asc` signature next to the binary. The | ||
| previous key is no longer trusted. CLIs from deployments released before the new key are verified with the | ||
| signatures that Coder made for those releases with the new key, which ship with the plugin. Any other CLI asks | ||
| for confirmation before it runs, as a missing signature did. |
There was a problem hiding this comment.
nit: this is a lot for a changelog entry, and I had to read the last sentence a few times. Could we keep it to what the user needs to know? Something like:
- Verify the Coder CLI with Coder's new release signing key. The previous key is no longer trusted. Coder 2.29.0 to
2.39.4 were released before the new key, so the plugin ships with new signatures for them.
🤖
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
ethanndickson
left a comment
There was a problem hiding this comment.
Second round of the agent review, on 2b05d91. The three comments from the first round are addressed. What is left is non-blocking.
🤖
|
|
||
| fun bundledSignature(buildVersion: String): DownloadResult { | ||
| val source = javaClass.getResource(BUNDLED_SIGNATURES) ?: return DownloadResult.NotFound | ||
| val version = buildVersion.trimStart('v').substringBefore('+') |
There was a problem hiding this comment.
Non-blocking: downloadReleasesSignature just above still cuts the version to major.minor.patch. So with the releases.coder.com fallback allowed, an rc build misses the bundle here, then fetches the signature of the stable release, and still ends up with the "may be tampered with" warning, right? That function is unchanged from main, so this could be a follow-up. Should both lookups use the same version key?
🤖
| - Verify the Coder CLI with Coder's new release signing key. The previous key is no longer trusted. Coder 2.29.0 to | ||
| 2.39.4 were released before the new key, so the plugin ships with new signatures for them. |
There was a problem hiding this comment.
nit: a 2.39.4 deployment already serves its own .v2.asc (the PR description says so), so "released before the new key" is not true for the whole range. Maybe just "The plugin ships with new signatures for Coder 2.29.0 to 2.39.4."?
🤖
|
|
||
| listOf( | ||
| "v2.29.0+de07351b8" to "Could not verify the authenticity", | ||
| "v2.29.0-devel+de07351b8" to "No signatures were found", |
There was a problem hiding this comment.
nit: this row checks that a prerelease does not use the bundle, which the test name does not say. Would two small tests read better? Feel free to ignore.
🤖
|
@codex review |
ethanndickson
left a comment
There was a problem hiding this comment.
Third round of the agent review, on 53385c8. The round 2 comments are addressed: both signature lookups now use the same release version, the changelog sentence is corrected, and the test is split in two. No new comments, this looks good to me.
🤖
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Trust only the new release key and fetch the .v2.asc signature. When a release has no signature, accept the CLI if its SHA-256 matches a bundled list of release digests for that version and platform.
Coder signed the 2.29.0 to 2.39.4 releases with the new release key. Ship those signatures in release-signatures.json and verify the CLI with the one for its version and platform. This replaces the release digest list and the workflow that compared it with coder/vscode-coder.
A development build or a release candidate shares its major.minor.patch with a release but not its bytes, so the bundled signature of that release can only fail. Look the signature up by the full version, so such a build has no bundled signature and gets the same prompt as any other CLI without one. Log when no signature is bundled, and shorten the changelog entry.
The fallback cut the build version to major.minor.patch, so a development build or a release candidate fetched the signature of the stable release and failed verification. Use one release version for the bundled signature and for the fallback, so such a build has no signature in either place. Correct the changelog entry: the 2.29.0 to 2.39.4 releases were not all made before the new key.
53385c8 to
bca802a
Compare
Relates to SEC-1419
Relates to coder/vscode-coder#1194
Coder releases are now signed with a new key, and the signature is served as
<binary>.v2.asc. This swaps the bundled public key for the new one and downloads.v2.ascinstead of.asc, so the previous key is no longer trusted.Deployments released before the new key have no
.v2.asc, and would otherwise hit the confirmation prompt on every CLI download. Coder has since signed the 2.29.0 to 2.39.4 releases with the new key, so we'll just ship those signatures with the plugin. When the deployment doesn't serve a signature, we'll use the bundled one for its version and platform, and verify the CLI with it the same way as any other signature. Anything else falls through to the existingreleases.coder.comfallback and prompt.These are the same signatures
releases.coder.comserves for those releases, so bundling them just saves the network call, and it still works when that fallback is turned off. They're all in one file,src/main/resources/META-INF/release-signatures.json, which adds about 0.6 MB to the plugin.I've tested this against two real deployments running locally, by driving the same calls the plugin makes at sign-in from a throwaway test. On 2.39.4 the CLI was verified with the
.v2.ascthe deployment serves, and on 2.29.0, which has no.v2.asc, it was verified with the bundled signature. Neither showed the prompt.