Fail fast when mTLS cert / key PEMs are missing or only one is set#94
Merged
jajreidy merged 2 commits intokonflux-ci:mainfrom Mar 30, 2026
Merged
Fail fast when mTLS cert / key PEMs are missing or only one is set#94jajreidy merged 2 commits intokonflux-ci:mainfrom
cert / key PEMs are missing or only one is set#94jajreidy merged 2 commits intokonflux-ci:mainfrom
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #94 +/- ##
==========================================
+ Coverage 95.53% 97.09% +1.55%
==========================================
Files 70 74 +4
Lines 3946 5400 +1454
==========================================
+ Hits 3770 5243 +1473
+ Misses 176 157 -19
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 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.
What
PulpClientnow validates mutual-TLS configuration before building HTTP sessions. If eithercertorkeyis set in config, both must be set; resolved paths must exist and be regular files. Otherwise the client raises a clearValueError(with error logging) instead of creating a TLS context without a client certificate. The same check runs for sync and async session setup.create_session_with_retryalso logs an error if it receives acerttuple but the files are missing, as a defensive layer for callers other thanPulpClient.Why
Misconfigured paths (for example host-only paths in
cli.tomlinside Konflux/Tekton pods, or unmounted secrets) previously led to silent omission of the client cert and confusing HTTP 403 responses. Failing at startup with an explicit message about missing PEMs and environment path expectations makes the failure obvious and actionable.How to test
git fetch origin make lint make format pre-commit run --all-files make test make test-diff-coverageManually: point
cert/keyat non-existent files (or set only one of them) and confirm the process exits immediately with the new validation error instead of succeeding at client construction and failing later with 403 on the wire.Notes for reviewers
Tests use
opensslin the sharedmock_configfixture to generate a short-lived self-signed PEM pair sossl.load_cert_chainsucceeds under the same rules as production. CI runners needopensslonPATH(standard onubuntu-latest).CHANGELOG.mdunder[Unreleased]→ Fixed now has two lines: the existingPulpClientbehavior plus thecreate_session_with_retrylogging note. If you prefer the test harness called out in the changelog too, say so and we can add a single maintainer-oriented bullet.