Repository navigation
Fix: read the TLS secret given as namespace/name in vela/http - #278
Open
sarankumar1325 wants to merge 1 commit into
Open
sarankumar1325 wants to merge 1 commit into
sarankumar1325 wants to merge 1 commit into
Conversation
getTransport supports a tls_config secret given as <namespace>/<name>, but the split was off by one: "vela-system/certs" was looked up as secret "/certs" in namespace "vela-syste". The lookup failed, and since the error is dropped by the caller, the request went out without the configured CA and client certificate. Split on the first "/" with strings.Cut in both the current and the legacy http provider. Assisted-by: AI coding assistant Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
sarankumar1325
requested review from
FogDong,
Somefive,
anoop2811,
briankane,
jerrinfrancis,
jguionnet,
leejanee,
roguepikachu and
wonderflow
as code owners
October 31, 2026 09:25
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #278 +/- ##
===========================================
+ Coverage 62.49% 80.32% +17.82%
===========================================
Files 62 83 +21
Lines 4415 6484 +2069
===========================================
+ Hits 2759 5208 +2449
+ Misses 1324 1276 -48
+ Partials 332 0 -332
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Description of your changes
getTransportin thevela/httpprovider (and the legacyop.#HTTPDoprovider) accepts atls_config.secretgiven as<namespace>/<name>, but the split was off by one:So the secret lookup always failed for that form. The caller drops the error from
getTransport, so the request then went out with the default transport, without the configured CA and client certificate, and usually failed later with a TLS error that didn't mention the secret.This splits on the first
/withstrings.Cutin both providers. A plain secret name still uses the namespace fromtls_config.namespace(or the workflow namespace), and a leading/is still ignored as before.I found this while reading the code. I couldn't find an existing issue or PR for it.
I have:
make reviewableto ensure this PR is ready for review. (I ran gofmt, go vet and golangci-lint on the changed packages instead, see below.)backport release-x.ylabels to auto-backport this PR if necessary.How has this code been tested
TestGetTransportSecretKeyin bothpkg/providers/httpandpkg/providers/legacy/http. It checks the secret key used forcerts+ namespacedefaultand forvela-system/certs. On the currentmainthe second case fails withNamespace:"vela-syste", Name:"/certs".go test ./pkg/providers/http/ ./pkg/providers/legacy/http/...passes.gofmt,go vetandgolangci-lint run --new-from-rev=HEADon the changed packages are clean.Special notes for your reviewer
getTransporterrors are still ignored by the callers (err == nil && tr != nil). I left that as is, since returning the error would change behaviour for workflows that set atls_configwith a missing secret today.I used an AI assistant to help with this change (see the
Assisted-bytrailer). I reviewed and tested the change.Summary by cubic
Fixes parsing of
tls_config.secretgiven as<namespace>/<name>in thevela/httpand legacyop.#HTTPDoproviders. Previouslyvela-system/certswas split off by one, looking up secret/certsin namespacevela-syste; the lookup failed and, because the caller dropped the error, requests went out with the default transport, without the configured CA and client certificate./withstrings.Cutin both providers.tls_config.namespaceor the workflow namespace; a leading/is still ignored.TestGetTransportSecretKeyin both providers covering plain and<namespace>/<name>secret references.Written for commit 4deca7a. Summary will update on new commits.