Skip to content

Commit 2fe6f49

Browse files
committed
v0.0.29: fix setup crash and add windows key thumbprint display
1 parent e4ca5ed commit 2fe6f49

File tree

6 files changed

+40
-10
lines changed

6 files changed

+40
-10
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020
runs-on: ${{ matrix.os }}
2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2424
with:
2525
fetch-depth: 0
2626
- name: Set up Go
27-
uses: actions/setup-go@v4
27+
uses: actions/setup-go@v5
2828
with:
2929
cache: true
3030
go-version-file: go.mod
@@ -56,7 +56,7 @@ jobs:
5656
shell: bash
5757
run: echo 'flags=--skip homebrew' >> $GITHUB_ENV
5858
- name: Run GoReleaser
59-
uses: goreleaser/goreleaser-action@v4
59+
uses: goreleaser/goreleaser-action@v5
6060
with:
6161
distribution: goreleaser-pro
6262
version: latest
@@ -70,11 +70,11 @@ jobs:
7070
needs: prepare
7171
steps:
7272
- name: Checkout
73-
uses: actions/checkout@v3
73+
uses: actions/checkout@v4
7474
with:
7575
fetch-depth: 0
7676
- name: Set up Go
77-
uses: actions/setup-go@v4
77+
uses: actions/setup-go@v5
7878
with:
7979
go-version-file: go.mod
8080

@@ -97,7 +97,7 @@ jobs:
9797
enableCrossOsArchive: true
9898

9999
- name: Run GoReleaser
100-
uses: goreleaser/goreleaser-action@v4
100+
uses: goreleaser/goreleaser-action@v5
101101
with:
102102
distribution: goreleaser-pro
103103
version: latest
@@ -112,7 +112,7 @@ jobs:
112112
needs: prepare
113113
steps:
114114
- name: Checkout
115-
uses: actions/checkout@v3
115+
uses: actions/checkout@v4
116116
with:
117117
fetch-depth: 0
118118

cert/models/provision.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (m *Provision) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
3232
m.chainFile = msg[1]
3333
m.keyFile = msg[2]
3434

35-
return m, tea.Quit
35+
return m, nil
3636
default:
3737
var cmd tea.Cmd
3838
m.spinner, cmd = m.spinner.Update(msg)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"dependencies": {},
55
"scripts": {},
66
"devDependencies": {
7-
"@stoplight/prism-cli": "5.7.0"
7+
"@stoplight/prism-cli": "5.8.1"
88
}
99
}

trust/models/clean.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package models
22

33
import (
44
"fmt"
5+
"runtime"
56
"strings"
67

78
"github.com/charmbracelet/bubbles/spinner"
@@ -159,6 +160,14 @@ func (m *TrustCleanCA) View() string {
159160
}
160161

161162
if m.cleaning != nil {
163+
// present thumbprint for comparison with pop up prompt
164+
if runtime.GOOS == "windows" {
165+
fmt.Fprintln(&b, ui.StepHint(fmt.Sprintf("\"%s\" Thumbprint (sha1): %s",
166+
m.CA.Subject.CommonName,
167+
m.CA.WindowsThumbprint(),
168+
)))
169+
}
170+
162171
fmt.Fprintln(&b, ui.StepInProgress(fmt.Sprintf("Cleaning %s %s: removing from %s…%s",
163172
ui.EmphasizeUnderline(m.CA.Subject.CommonName),
164173
ui.Emphasize(m.CA.PublicKeyAlgorithm.String()),

trust/models/trust.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package models
22

33
import (
44
"fmt"
5+
"runtime"
56
"strings"
67

78
"github.com/anchordotdev/cli"
@@ -116,7 +117,7 @@ func (m *TrustPreflight) View() string {
116117
fmt.Fprintln(&b, ui.StepAlert(fmt.Sprintf("%s to install %d missing certificates. (%s)", ui.Action("Press Enter"), len(m.auditInfo.Missing), ui.Accentuate("requires sudo"))))
117118
}
118119
case noSync:
119-
fmt.Fprintln(&b, ui.StepDone(fmt.Sprintf("Compared local and expected CA certificates: found matching certificates.")))
120+
fmt.Fprintln(&b, ui.StepDone("Compared local and expected CA certificates: found matching certificates."))
120121
default:
121122
panic("impossible")
122123
}
@@ -185,6 +186,14 @@ func (m *TrustUpdateStore) View() string {
185186
}
186187

187188
if m.installing != nil {
189+
// present thumbprint for comparison with pop up prompt
190+
if runtime.GOOS == "windows" {
191+
fmt.Fprintln(&b, ui.StepHint(fmt.Sprintf("\"%s\" Thumbprint (sha1): %s",
192+
m.installing.Subject.CommonName,
193+
m.installing.WindowsThumbprint(),
194+
)))
195+
}
196+
188197
fmt.Fprintln(&b, ui.StepInProgress(fmt.Sprintf("Updating %s: installing %s %s.",
189198
ui.Emphasize(m.Store.Description()),
190199
ui.Underline(m.installing.Subject.CommonName),

truststore/truststore.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
package truststore
22

33
import (
4+
"crypto/sha1"
45
"crypto/subtle"
56
"crypto/x509"
7+
"encoding/hex"
68
"fmt"
79
"io/fs"
810
"os"
11+
"regexp"
912
"strings"
1013
)
1114

@@ -31,6 +34,15 @@ func (c *CA) Equal(ca *CA) bool {
3134
return c.UniqueName == ca.UniqueName && subtle.ConstantTimeCompare(c.Raw, ca.Raw) == 1
3235
}
3336

37+
var reWindowsThumbprintSpacer = regexp.MustCompile(".{8}")
38+
39+
func (c *CA) WindowsThumbprint() string {
40+
certSha := sha1.Sum(c.Raw)
41+
certHex := strings.ToUpper(hex.EncodeToString(certSha[:]))
42+
thumbprint := strings.TrimRight(reWindowsThumbprintSpacer.ReplaceAllString(certHex, "$0 "), " ")
43+
return thumbprint
44+
}
45+
3446
func fatalErr(err error, msg string) error {
3547
return fmt.Errorf("%s: %w", msg, err)
3648
}

0 commit comments

Comments
 (0)