Repository navigation
Conversation
…cated alias The TLS option for extra trusted CA certificates was only read from the misspelled key custom-certifactes, so a config using the correct spelling custom-certificates was silently ignored. Read custom-certificates, keep the old key working with a deprecation warning, and trust certificates from both keys when both are set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
tlsoption that adds extra trusted CA certificates is only read from the misspelled keycustom-certifactes. A config that uses the correct spellingcustom-certificatesloads without any warning, but the certificates are never added to the trust store, so TLS connections that rely on them fail certificate verification, and nothing points back at the config key.Root cause
The YAML/JSON tag of
RawTLS.CustomTrustCertcarries the typo (config/config.go#L401), and the example config documents the same spelling (docs/config.yaml#L61). The key was introduced in b6b6413, whose commit message already calls itcustom-certificates. Unknown keys are ignored by the decoder, so the correct spelling is silently dropped.Fix
RawTLS.CustomTrustCertnow readscustom-certificates.CustomTrustCertDeprecated(custom-certifactes) so existing configs keep working.parseTLS(config/config.go#L869) logs a deprecation warning when it is used.ca.AddCertificatein hub/executor/executor.go#L92 keeps working on the merged list unchanged.docs/config.yamluses the correct spelling.The JSON tag of the field changes in the same way as the YAML tag. If the old spelling should be removed in a future release, only the deprecated field and the warning need to go.
Tests
config/tls_test.goaddsTestParseTLSCustomCertificates, which covers no key, the correct key, the deprecated key, and both keys together. Before the fix the "correct key" and "both keys" cases fail (the certificate undercustom-certificatesis missing); after the fix all cases pass.go test ./config/ ./hub/...,go vet ./config/ ./hub/executor/,go build ./...andgofmt -lare clean.Fixes #3351