detached dddcd1a

chore: fix lint issues in onboarding handler and ca CLI

commit
dddcd1ae394fa7ffbded57e210892d16abadf3a4
author
brice · · 2026-03-29 17:09 UTC
parent
000e12a
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +5 -5
M internal/adapters/in/cli/ca.go +2 -2
@@ -91,10 +91,10 @@ func runCAExport(out io.Writer, outPath string) error {
9191 rootPEM := ca.RootCertificate()
9292
9393 if outPath != "" {
94- if err := os.MkdirAll(filepath.Dir(outPath), 0755); err != nil {
94+ if err := os.MkdirAll(filepath.Dir(outPath), 0750); err != nil {
9595 return err
9696 }
97- if err := os.WriteFile(outPath, rootPEM, 0644); err != nil {
97+ if err := os.WriteFile(outPath, rootPEM, 0600); err != nil {
9898 return err
9999 }
100100 return cliWriteLine(out, cliRenderSuccess(fmt.Sprintf("Root CA certificate written to %s", outPath)))
@@ -91,10 +91,10 @@ func runCAExport(out io.Writer, outPath string) error {
91 rootPEM := ca.RootCertificate()91 rootPEM := ca.RootCertificate()
92 92
93 if outPath != "" {93 if outPath != "" {
94- if err := os.MkdirAll(filepath.Dir(outPath), 0755); err != nil {94+ if err := os.MkdirAll(filepath.Dir(outPath), 0750); err != nil {
95 return err95 return err
96 }96 }
97- if err := os.WriteFile(outPath, rootPEM, 0644); err != nil {97+ if err := os.WriteFile(outPath, rootPEM, 0600); err != nil {
98 return err98 return err
99 }99 }
100 return cliWriteLine(out, cliRenderSuccess(fmt.Sprintf("Root CA certificate written to %s", outPath)))100 return cliWriteLine(out, cliRenderSuccess(fmt.Sprintf("Root CA certificate written to %s", outPath)))
M internal/adapters/in/http/onboarding/handler.go +3 -3
@@ -30,7 +30,7 @@ func NewHandler(rootPEM, rootDER []byte, rootCN string, cloudflareCIDRs []*net.I
3030 func (h *Handler) ServeCACert(w http.ResponseWriter, _ *http.Request) {
3131 w.Header().Set("Content-Type", "application/x-x509-ca-cert")
3232 w.Header().Set("Content-Disposition", "attachment; filename=gordon-ca.crt")
33- w.Write(h.rootPEM)
33+ _, _ = w.Write(h.rootPEM)
3434 }
3535
3636 // ServeMobileconfig serves an iOS configuration profile with the root CA.
@@ -38,7 +38,7 @@ func (h *Handler) ServeMobileconfig(w http.ResponseWriter, _ *http.Request) {
3838 mc := pkiadapter.GenerateMobileconfig(h.rootDER, h.rootCN)
3939 w.Header().Set("Content-Type", "application/x-apple-aspen-config")
4040 w.Header().Set("Content-Disposition", "attachment; filename=gordon-ca.mobileconfig")
41- w.Write(mc)
41+ _, _ = w.Write(mc)
4242 }
4343
4444 // ServeOnboardingPage serves the CA trust onboarding HTML page.
@@ -49,7 +49,7 @@ func (h *Handler) ServeOnboardingPage(w http.ResponseWriter, r *http.Request) {
4949 host := r.Host
5050 redirectURL := fmt.Sprintf("%s://%s/", scheme, host)
5151
52- fmt.Fprintf(w, `<!DOCTYPE html>
52+ _, _ = fmt.Fprintf(w, `<!DOCTYPE html>
5353 <html lang="en">
5454 <head>
5555 <meta charset="utf-8">
@@ -30,7 +30,7 @@ func NewHandler(rootPEM, rootDER []byte, rootCN string, cloudflareCIDRs []*net.I
30 func (h *Handler) ServeCACert(w http.ResponseWriter, _ *http.Request) {30 func (h *Handler) ServeCACert(w http.ResponseWriter, _ *http.Request) {
31 w.Header().Set("Content-Type", "application/x-x509-ca-cert")31 w.Header().Set("Content-Type", "application/x-x509-ca-cert")
32 w.Header().Set("Content-Disposition", "attachment; filename=gordon-ca.crt")32 w.Header().Set("Content-Disposition", "attachment; filename=gordon-ca.crt")
33- w.Write(h.rootPEM)33+ _, _ = w.Write(h.rootPEM)
34 }34 }
35 35
36 // ServeMobileconfig serves an iOS configuration profile with the root CA.36 // ServeMobileconfig serves an iOS configuration profile with the root CA.
@@ -38,7 +38,7 @@ func (h *Handler) ServeMobileconfig(w http.ResponseWriter, _ *http.Request) {
38 mc := pkiadapter.GenerateMobileconfig(h.rootDER, h.rootCN)38 mc := pkiadapter.GenerateMobileconfig(h.rootDER, h.rootCN)
39 w.Header().Set("Content-Type", "application/x-apple-aspen-config")39 w.Header().Set("Content-Type", "application/x-apple-aspen-config")
40 w.Header().Set("Content-Disposition", "attachment; filename=gordon-ca.mobileconfig")40 w.Header().Set("Content-Disposition", "attachment; filename=gordon-ca.mobileconfig")
41- w.Write(mc)41+ _, _ = w.Write(mc)
42 }42 }
43 43
44 // ServeOnboardingPage serves the CA trust onboarding HTML page.44 // ServeOnboardingPage serves the CA trust onboarding HTML page.
@@ -49,7 +49,7 @@ func (h *Handler) ServeOnboardingPage(w http.ResponseWriter, r *http.Request) {
49 host := r.Host49 host := r.Host
50 redirectURL := fmt.Sprintf("%s://%s/", scheme, host)50 redirectURL := fmt.Sprintf("%s://%s/", scheme, host)
51 51
52- fmt.Fprintf(w, `<!DOCTYPE html>52+ _, _ = fmt.Fprintf(w, `<!DOCTYPE html>
53 <html lang="en">53 <html lang="en">
54 <head>54 <head>
55 <meta charset="utf-8">55 <meta charset="utf-8">

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close