-
Notifications
You must be signed in to change notification settings - Fork 2
chore: enable tunnel binary verification #36
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
34793f0
chore: enable tunnel binary verification
deansheather 37d463e
fixup! chore: enable tunnel binary verification
deansheather ee33e47
fixup! fixup! chore: enable tunnel binary verification
deansheather 81e645c
chore: tests for authenticode and version checks
deansheather bc09aa2
fixup! chore: tests for authenticode and version checks
deansheather ecf8260
feat: EV validation
deansheather c0904fb
add asserts
deansheather File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<AssemblyName>Coder.Desktop.Installer</AssemblyName> | ||
<RootNamespace>Coder.Desktop.Installer</RootNamespace> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net481</TargetFramework> | ||
<LangVersion>13.0</LangVersion> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<AssemblyName>Coder.Desktop.Installer</AssemblyName> | ||
<RootNamespace>Coder.Desktop.Installer</RootNamespace> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net481</TargetFramework> | ||
<LangVersion>13.0</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Remove="*.msi" /> | ||
<None Remove="*.exe" /> | ||
<None Remove="*.wxs" /> | ||
<None Remove="*.wixpdb" /> | ||
<None Remove="*.wixobj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Remove="*.msi" /> | ||
<None Remove="*.exe" /> | ||
<None Remove="*.wxs" /> | ||
<None Remove="*.wixpdb" /> | ||
<None Remove="*.wixobj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="WixSharp_wix4" Version="2.6.0" /> | ||
<PackageReference Include="WixSharp_wix4.bin" Version="2.6.0" /> | ||
<PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="WixSharp_wix4" Version="2.6.0" /> | ||
<PackageReference Include="WixSharp_wix4.bin" Version="2.6.0" /> | ||
<PackageReference Include="CommandLineParser" Version="2.9.1" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Coder Desktop for Windows | ||
|
||
This repo contains the C# source code for Coder Desktop for Windows. You can | ||
download the latest version from the GitHub releases. | ||
|
||
### Contributing | ||
|
||
You will need: | ||
|
||
- Visual Studio 2022 | ||
- .NET desktop development | ||
- WinUI application development | ||
- Windows 10 SDK (10.0.19041.0) | ||
- Wix Toolset 5.0.2 (if building the installer) | ||
|
||
It's also recommended to use JetBrains Rider (or VS + ReSharper) for a better | ||
experience. | ||
|
||
### License | ||
|
||
The Coder Desktop for Windows source is licensed under the GNU Affero General | ||
Public License v3.0 (AGPL-3.0). | ||
|
||
Some vendored files in this repo are licensed separately. The license for these | ||
files can be found in the same directory as the files. | ||
|
||
The binary distributions of Coder Desktop for Windows have some additional | ||
license disclaimers that can be found in | ||
[scripts/files/License.txt](scripts/files/License.txt) or during installation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.go | ||
*.pfx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
$errorActionPreference = "Stop" | ||
|
||
Set-Location $PSScriptRoot | ||
|
||
# If hello.go does not exist, write it. We don't check it into the repo to avoid | ||
# GitHub showing that the repo contains Go code. | ||
if (-not (Test-Path "hello.go")) { | ||
deansheather marked this conversation as resolved.
Show resolved
Hide resolved
|
||
$helloGo = @" | ||
package main | ||
|
||
func main() { | ||
println("Hello, World!") | ||
} | ||
"@ | ||
Set-Content -Path "hello.go" -Value $helloGo | ||
} | ||
|
||
& go.exe build -ldflags '-w -s' -o hello.exe hello.go | ||
if ($LASTEXITCODE -ne 0) { throw "Failed to build hello.exe" } | ||
|
||
# hello-invalid-version.exe is used for testing versioned binaries with an | ||
# invalid version. | ||
Copy-Item hello.exe hello-invalid-version.exe | ||
& go-winres.exe patch --in winres.json --delete --no-backup --product-version 1-2-3-4 --file-version 1-2-3-4 hello-invalid-version.exe | ||
if ($LASTEXITCODE -ne 0) { throw "Failed to patch hello-invalid-version.exe with go-winres" } | ||
|
||
# hello-self-signed.exe is used for testing untrusted binaries. | ||
Copy-Item hello.exe hello-self-signed.exe | ||
$helloSelfSignedPath = (Get-Item hello-self-signed.exe).FullName | ||
|
||
# Create a self signed certificate for signing and then delete it. | ||
$certStoreLocation = "Cert:\CurrentUser\My" | ||
$password = "password" | ||
$cert = New-SelfSignedCertificate ` | ||
-CertStoreLocation $certStoreLocation ` | ||
-DnsName coder.com ` | ||
-Subject "CN=coder-desktop-windows-self-signed-cert" ` | ||
-Type CodeSigningCert ` | ||
-KeyUsage DigitalSignature ` | ||
-NotAfter (Get-Date).AddDays(3650) | ||
$pfxPath = Join-Path $PSScriptRoot "cert.pfx" | ||
try { | ||
$securePassword = ConvertTo-SecureString -String $password -Force -AsPlainText | ||
Export-PfxCertificate -Cert $cert -FilePath $pfxPath -Password $securePassword | ||
|
||
# Sign hello-self-signed.exe with the self signed certificate | ||
& "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.19041.0\x64\signtool.exe" sign /debug /f $pfxPath /p $password /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 $helloSelfSignedPath | ||
if ($LASTEXITCODE -ne 0) { throw "Failed to sign hello-self-signed.exe with signtool" } | ||
} finally { | ||
if ($cert.Thumbprint) { | ||
Remove-Item -Path (Join-Path $certStoreLocation $cert.Thumbprint) -Force | ||
} | ||
if (Test-Path $pfxPath) { | ||
Remove-Item -Path $pfxPath -Force | ||
} | ||
} | ||
|
||
# hello-versioned-signed.exe is used for testing versioned binaries and | ||
# binaries signed by a real EV certificate. | ||
Copy-Item hello.exe hello-versioned-signed.exe | ||
|
||
& go-winres.exe patch --in winres.json --delete --no-backup --product-version 1.2.3.4 --file-version 1.2.3.4 hello-versioned-signed.exe | ||
if ($LASTEXITCODE -ne 0) { throw "Failed to patch hello-versioned-signed.exe with go-winres" } | ||
|
||
# Then sign hello-versioned-signed.exe with the same EV cert as our real | ||
# binaries. Since this is a bit more complicated and requires some extra | ||
# permissions, we don't do this in the build script. | ||
Write-Host "Don't forget to sign hello-versioned-signed.exe with the EV cert!" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm understanding this correctly, the
Manager:
prefix corresponds to the section name (ManagerConfigSection
) we bind in Program.cs:But that means we've got this string key coupling between these two sections of the code, which feels fragile if we were to change the name. Is there a way they could be based on the same constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can without creating a new library package or adding this value to a package where it doesn't really belong like
Vpn
.These values should never be changed anyways without some consideration for backwards compatibility. I can add comments to both of these places saying that it's not to be changed.