Support configuring custom CA certificates#687
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #687 +/- ##
============================================
+ Coverage 86.70% 87.62% +0.92%
- Complexity 943 962 +19
============================================
Files 43 43
Lines 2910 2974 +64
Branches 364 371 +7
============================================
+ Hits 2523 2606 +83
+ Misses 229 210 -19
Partials 158 158 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks for your PR. Looks very good so far. I've added copilot review so see if it spots anything |
There was a problem hiding this comment.
Pull request overview
Adds support for configuring custom CA certificates for TLS connections to OCI registries, and introduces test infrastructure + integration tests to validate TLS behaviors against a Zot registry.
Changes:
- Add
withCaFile()/withCaContent()toHttpClient.BuilderandRegistry.Builder, and refactor TLS configuration to be applied consistently at build time. - Introduce shared Zot Testcontainers utilities (
ZotBaseContainer,TestImages) and a TLS-enabled Zot container (ZotTlsContainer). - Add unit tests for TLS configuration validation and integration tests covering CA file/content and skip-verify behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/land/oras/auth/HttpClient.java | Implements CA file/content handling and refactors TLS configuration logic in the client builder. |
| src/main/java/land/oras/Registry.java | Plumbs CA configuration through Registry.Builder into the internal HttpClient. |
| src/test/java/land/oras/auth/HttpClientTest.java | Adds unit tests for CA file/content validation and option incompatibilities. |
| src/test/java/land/oras/RegistryTlsTest.java | Adds integration coverage for connecting to a TLS-enabled Zot registry using CA file/content and skip-verify. |
| src/test/java/land/oras/utils/ZotBaseContainer.java | New shared base for Zot containers (image/port/config copy helpers, logging, registry address). |
| src/test/java/land/oras/utils/ZotContainer.java | Refactors existing auth-enabled Zot container to use ZotBaseContainer. |
| src/test/java/land/oras/utils/ZotUnsecureContainer.java | Refactors unsecure Zot container to use ZotBaseContainer and shared config-writing. |
| src/test/java/land/oras/utils/ZotTlsContainer.java | New TLS-enabled Zot container that generates/copies certs and exposes CA to tests. |
| src/test/java/land/oras/utils/TlsUtils.java | New test utility for generating certificates/keys (BouncyCastle-backed). |
| src/test/java/land/oras/utils/TestImages.java | Centralizes container image references used in tests. |
| pom.xml | Adds test dependency on bcpkix-jdk18on (and manages its version). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b88f914 to
e6bd886
Compare
|
I've just noticed the |
- Introduce .withCaFile() and .withCaContent() method to Registry and HttpClient to provide custom CA certificates to be used for establishing a TLS connection with an OCI registry. - Refactor HttpClient.Builder to ensure correct and consistent state when using multiple TLS-related methods like .withSkipTlsVerify, .withCaFile(), and .withCaContent(). - Add integration tests for TLS-related operations with a Zot OCI registry. Introduce a ZotBaseContainer class to consolidate common logic rather than duplicating code in the newly added ZotTlsContainer for TLS-related tests. Fixes oras-projectgh-670 Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
|
Updated |
Description
.withCaFile()and.withCaContent()method toRegistryandHttpClientto provide custom CA certificates to be used for establishing a TLS connection with an OCI registry.HttpClient.Builderto ensure correct and consistent state when using multiple TLS-related methods like.withSkipTlsVerify(),.withCaFile(), and.withCaContent().ZotBaseContainerclass to consolidate common logic rather than duplicating code in the newly addedZotTlsContainerfor TLS-related tests.Fixes gh-670
Testing done
Submitter checklist
mvn license:update-file-header,mvn spotless:apply,pre-commit run -a,mvn clean installbefore opening the PR