Commit 6817698
security: fix scanner findings from rapid-audit-kit recon pass
Prep work before building the self-serve audit kit — ran govulncheck, gosec,
gitleaks (full history), syft SBOM, pnpm audit, and semgrep against the current
codebase for the first time, then fixed everything real and documented everything
false-positive rather than letting the kit launch against an unverified scan.
Real fixes:
- golang.org/x/image bumped from a 2021 pseudo-version to v0.43.0 — the old pin
carried 11 known CVEs (TIFF/WebP/BMP decode DoS/panic) reachable via the
branding-logo upload path. govulncheck now reports zero vulnerabilities.
- Avatar/branding upload directories created 0750 instead of 0755 (gosec G301).
Noise cleanup (37 gosec G104 "unhandled error" findings, all verified low-risk):
- worker.go job-status/webhook-delivery bookkeeping updates and avatar/logo
temp-file cleanup now log on failure (genuine value — a stuck job or an
orphaned temp file is worth knowing about).
- The rest (rows.Close()/resp.Body.Close() on already-consumed/already-erroring
paths, and a few best-effort exists-checks backed by a DB UNIQUE constraint)
are documented `#nosec G104` with the reasoning inline, not silently ignored.
semgrep (9 findings, all false positives, now inline-documented + suppressed):
- var-in-href on .PrivacyURL/.TermsURL: server-validated to require an http(s)
scheme before storage (validatedLegalURL), so a javascript: URI never reaches
the template.
- unquoted-attribute-var on the intake-question id/name attrs: admin-configured
question IDs, and html/template context-escapes them regardless.
- var-in-script-tag on .BookingLogicJS (book.html + manage.html): a static
go:embed'd JS asset, never request/database data.
Verified false positives left as-is (gosec G202/G701 "SQL injection" — all
parameterized with ? placeholders; G203 "XSS" — goldmark markdown has no
WithUnsafe(), template.JS wraps embedded/JSON-marshaled data; G304 path
traversal — validated + filepath.Base()'d; G124/G101 — cookies do set
Secure/HttpOnly/SameSite, "secret" was a public OAuth endpoint URL).
govulncheck: 0. gosec: 82->43 (all remaining verified false positives).
semgrep: 9->0. gitleaks: clean across 321 commits. go test ./...: all pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent f26a7f3 commit 6817698
22 files changed
Lines changed: 101 additions & 57 deletions
File tree
- frontend
- internal
- booking
- calendar/microsoft
- handler
- templates
- mailer
- webhook
- worker
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
| 54 | + | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | 65 | | |
68 | 66 | | |
69 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
478 | | - | |
| 478 | + | |
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
483 | | - | |
| 483 | + | |
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
| 251 | + | |
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
267 | 267 | | |
268 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
269 | 271 | | |
270 | 272 | | |
271 | 273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
0 commit comments