Commit f61b35e
fix(compat): skip dev-*.pem roots in production builds (PILOT-284) (#194)
* fix(compat): skip dev-*.pem roots in production builds (PILOT-284)
The daemon's WSS compat layer uses //go:embed roots/*.pem to embed
trusted root CAs. This glob picks up dev-2026.pem unconditionally,
shipping a development root cert in every production binary.
This commit adds a skipDevPems flag (default true) that excludes
files starting with "dev-" from the trust pool. In dev builds
(-tags dev), roots_dev.go sets skipDevPems via init() so the
development root is still available for local testing.
The existing TestPinnedRoots_LoadsEmbeddedRoots is adjusted to skip
gracefully when no production roots are embedded (transitional state
until a prod root is minted via pilot-ca init-root).
Closes PILOT-284
* fix(tests): skip TLS pinned-roots coverage tests when no prod roots embedded
This PR's compat/roots.go change excludes dev-*.pem from the trust pool
in production builds. Once that filter is on, PinnedRoots() returns
'no embedded Pilot Protocol roots found' because no prod root has been
minted yet. The authoring PR already skips compat.TestPinnedRoots_LoadsEmbeddedRoots
on that error, but missed the two pkg/daemon coverage tests that wrap
buildCompatTLSConfig and ultimately hit the same path.
Apply the same string-match guard to:
- TestBuildCompatTLSConfigDefaultPinned (trust='', defaults to pinned)
- TestBuildCompatTLSConfigPinnedExplicit (trust='pinned')
system and invalid-rejected tests don't load the pool and stay unchanged.
---------
Co-authored-by: Calin Teodor <t.calin@student.vu.nl>1 parent bb619e7 commit f61b35e
4 files changed
Lines changed: 39 additions & 0 deletions
File tree
- internal/transport/compat
- pkg/daemon
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
36 | 41 | | |
37 | 42 | | |
38 | 43 | | |
| |||
50 | 55 | | |
51 | 56 | | |
52 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
53 | 63 | | |
54 | 64 | | |
55 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
1070 | 1071 | | |
1071 | 1072 | | |
1072 | 1073 | | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
1073 | 1082 | | |
1074 | 1083 | | |
1075 | 1084 | | |
| |||
1081 | 1090 | | |
1082 | 1091 | | |
1083 | 1092 | | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
1084 | 1097 | | |
1085 | 1098 | | |
1086 | 1099 | | |
| |||
0 commit comments