Commit fd6f356
fix: append custom CA to system cert pool instead of replacing it (#227)
## Summary
- PR #212 introduced `ca.crt` support for server certificate
verification but used `x509.NewCertPool()`, which creates an **empty**
CA pool — replacing the system CA bundle entirely
- This breaks connections to Temporal Cloud (public CA) when the mTLS
secret contains a `ca.crt` key from cert-manager (the CA that signed the
**client** cert, not the server cert)
- This fix uses `x509.SystemCertPool()` instead, so the custom CA is
**appended** to the system bundle rather than replacing it
## Why this broke
cert-manager always includes `ca.crt` in TLS secrets (the issuing CA).
When connecting to Temporal Cloud:
1. The controller sees `ca.crt` in the secret (the self-signed client
CA)
2. `NewCertPool()` creates an empty pool with **only** that CA
3. Temporal Cloud's server cert is signed by a public CA (e.g.,
DigiCert)
4. The public CA is no longer trusted → `x509: certificate signed by
unknown authority`
## What this fixes
- `SystemCertPool()` loads the system CA bundle first, then appends the
custom CA
- Both public CAs (Temporal Cloud) and private CAs (self-hosted) are
trusted simultaneously
- Falls back to `NewCertPool()` with a warning log if the system pool
can't be loaded
## Affected versions
- v1.2.1, v1.2.2, v1.2.3 — all contain the regression from PR #212
- Closes #223
## Test plan
- [ ] Deploy against Temporal Cloud with cert-manager mTLS secret (has
`ca.crt`) — verify connection succeeds
- [ ] Deploy against self-hosted Temporal with private CA — verify
connection succeeds
- [ ] Deploy with mTLS secret without `ca.crt` — verify fallback to
system bundle works
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 94bc3b8 commit fd6f356
1 file changed
Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
141 | 142 | | |
142 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
143 | 148 | | |
144 | 149 | | |
145 | 150 | | |
| |||
0 commit comments