Repository navigation
Conversation
The activator only decoded the first PEM block of ca.crt in the routing-serving-certs secret, so any additional CAs (e.g. during a CA rotation or with a bring-your-own CA bundle) were silently ignored. If the field did not contain PEM data at all, pem.Decode returned a nil block and the activator panicked with a nil pointer dereference. Use x509.CertPool.AppendCertsFromPEM to add every CA in the field and log a warning when no valid certificate is found. Fixes knative#13877 Signed-off-by: cvas22 <cvas22@gmail.com>
|
Welcome @cvas22! It looks like this is your first PR to knative/serving 🎉 |
|
Hi @cvas22. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: cvas22 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Fixes #13877
Proposed Changes
ca.crtof therouting-serving-certssecret to its upstream trust pool (viax509.CertPool.AppendCertsFromPEM), instead of only the first PEM block. This allows multiple CAs to be trusted at once, e.g. during CA rotation or with a bring-your-own CA bundle.ca.crtcontained non-PEM data,pem.Decodereturned a nil block andblock.Bytespanicked in the informer handler. Now a warning is logged and the CA is ignored, matching the existing handling of invalid trust-bundle ConfigMaps.TestReconcilecases "Multiple CAs in secret" and "Invalid CA in secret". Both fail without the fix (the first times out because only one CA ends up in the pool; the second panics atcache.go:146) and pass with it.Tests run locally (Windows, Go 1.26):
gofmt -l,go vet ./pkg/activator/certificate/,go test ./pkg/activator/certificate/ -count=1,go build ./pkg/activator/... ./cmd/activator/. Not run locally:-race, the full unit test suite, linters beyondgo vet, and e2e tests; I'm relying on CI for those.Disclosure: I prepared this change with the help of an AI coding assistant. I reviewed the diff and tests and take responsibility for them.
Release Note