Skip to content

feat: validate http custom ca#8992

Merged
pkoutsovasilis merged 7 commits intoelastic:mainfrom
pkoutsovasilis:fix/validate_http_custom_ca
Jan 20, 2026
Merged

feat: validate http custom ca#8992
pkoutsovasilis merged 7 commits intoelastic:mainfrom
pkoutsovasilis:fix/validate_http_custom_ca

Conversation

@pkoutsovasilis
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis commented Jan 7, 2026

Summary

This PR addresses #8990 by implementing validation for user-supplied CA certificates in the Elasticsearch HTTP layer, closing the behavioral gap identified in #8953.

Previously, when users configured expired or invalid CA certificates via HTTP TLS configuration, the operator would silently fail without alerting them to the problem. This PR adds validation logic similar to what was implemented for the Elasticsearch transport layer, ensuring consistent certificate handling across both communication layers.

Changes

Added Validation Logic

  • Implements validation for custom HTTP CA certificates to check:
    • Certificate presence and well-formedness
    • Certificate expiration dates (not expired, not not-yet-valid)
    • Certificate and private key matching

Error Reporting

  • Reports clear error events when HTTP CA validation fails
  • Provides transparency about CA validity issues through Kubernetes events
  • Prevents the operator from attempting to use expired/invalid certificates

Test Coverage

  • Adds unit tests for HTTP CA certificate validation

Related Issues

@pkoutsovasilis pkoutsovasilis self-assigned this Jan 7, 2026
@pkoutsovasilis pkoutsovasilis added the >enhancement Enhancement of existing functionality label Jan 7, 2026
@prodsecmachine
Copy link
Collaborator

prodsecmachine commented Jan 7, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@pkoutsovasilis pkoutsovasilis force-pushed the fix/validate_http_custom_ca branch 2 times, most recently from ba2e3ee to 9734230 Compare January 12, 2026 10:10
@pkoutsovasilis pkoutsovasilis force-pushed the fix/validate_http_custom_ca branch from 9734230 to e58d046 Compare January 12, 2026 10:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements validation for user-supplied CA certificates in the Elasticsearch HTTP layer, addressing a gap where expired or invalid certificates would silently fail without alerting users.

Changes:

  • Adds validation logic for custom HTTP CA certificates (checking expiration, validity period, and key matching)
  • Implements error reporting through Kubernetes events when validation fails
  • Adds comprehensive unit tests for HTTP CA certificate validation scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/controller/common/certificates/reconcile.go Adds validation call and requeue logic for custom HTTP CA certificates
pkg/controller/common/certificates/reconcile_test.go Adds comprehensive test cases covering valid, expired, not-yet-valid, and mismatched key scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pkoutsovasilis pkoutsovasilis force-pushed the fix/validate_http_custom_ca branch from e58d046 to 1464f72 Compare January 12, 2026 10:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@pebrc pebrc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pkoutsovasilis pkoutsovasilis merged commit 18e001c into elastic:main Jan 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement Enhancement of existing functionality v3.4.0 (next next)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add validation for user-supplied CA certificates in Elasticsearch HTTP layer

4 participants