Skip to content

docs(interceptor): document TLS SNI certificate selection#1609

Open
onthebed wants to merge 2 commits intokedacore:mainfrom
onthebed:clawoss/docs/1600-tls-sni-docs
Open

docs(interceptor): document TLS SNI certificate selection#1609
onthebed wants to merge 2 commits intokedacore:mainfrom
onthebed:clawoss/docs/1600-tls-sni-docs

Conversation

@onthebed
Copy link
Copy Markdown

Documented the interceptor's TLS SNI certificate selection flow and added coverage for the missing fallback edge case.

The docs now spell out that the proxy first looks for an exact SNI/SAN match from KEDA_HTTP_PROXY_TLS_CERT_STORE_PATHS, then falls back to KEDA_HTTP_PROXY_TLS_CERT_PATH/KEDA_HTTP_PROXY_TLS_KEY_PATH, and fails the handshake if no default certificate exists. Added a unit test proving that an SNI-specific certificate is preferred over the default certificate. go test ./interceptor/... ./pkg/... and ./hack/validate-changelog.sh pass.

Checklist

  • Commits are signed with Developer Certificate of Origin (DCO)
  • Changelog has been updated and is aligned with our changelog requirements
  • Any necessary documentation is added, such as:
    • README.md
    • keda-docs

Fixes #1600

Document how the interceptor selects SNI-specific certificates, when it
falls back to the default certificate, and what happens when no match is
configured. Add a unit test proving an SNI match is preferred over the
default certificate and record the change in the changelog.

Fixes kedacore#1600

Signed-off-by: onthebed <1136664562@qq.com>
Copilot AI review requested due to automatic review settings April 24, 2026 13:22
@onthebed onthebed requested a review from a team as a code owner April 24, 2026 13:22
@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented Apr 24, 2026

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

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

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

Copy link
Copy Markdown
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

Updates interceptor documentation and tests to clearly describe and validate TLS certificate selection when SNI is present, including the fallback behavior when no SNI-specific certificate matches.

Changes:

  • Added a unit test ensuring SNI-matched certificates are preferred over the default certificate.
  • Expanded interceptor serving configuration comments to document SNI/SAN selection and fallback behavior.
  • Documented TLS SNI certificate selection flow in developer docs and recorded the change in the changelog.

Reviewed changes

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

File Description
interceptor/tls_config_test.go Adds a unit test for SNI cert preference over the default cert.
interceptor/config/serving.go Documents cert-store based SNI selection and fallback to the default cert paths.
docs/developing.md Adds a “TLS SNI behavior” section describing selection/fallback/handshake failure behavior.
CHANGELOG.md Adds an unreleased Improvements entry for the SNI docs/tests update.

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

Comment thread interceptor/config/serving.go Outdated
Comment thread docs/developing.md Outdated

### TLS SNI behavior

The interceptor can serve more than one certificate from the TLS listener by setting `KEDA_HTTP_PROXY_TLS_CERT_STORE_PATHS` to one or more directories that contain certificate/key pairs. During the TLS handshake it:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done — the docs now call out that KEDA_HTTP_PROXY_TLS_CERT_STORE_PATHS expects a comma-separated list when multiple directories are configured.

Comment thread interceptor/tls_config_test.go Outdated
Comment on lines +85 to +90
writeCert(t, dir, "app", "app.example.com")

opts := TLSOptions{
CertificatePath: filepath.Join(dir, "default.crt"),
KeyPath: filepath.Join(dir, "default.key"),
CertStorePaths: dir,
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done — I moved the additional certificate into a separate temp store directory so the test exercises SNI preference without re-loading the default cert via the store path.

Tighten the TLS SNI docs to mention the comma-separated cert store
format and isolate the SNI preference test so the default certificate is
not loaded through the store path.

Signed-off-by: onthebed <1136664562@qq.com>
@onthebed
Copy link
Copy Markdown
Author

Thanks for the review — I addressed the follow-up comments in ea57577 and verified the interceptor test suite locally.

Changes in this revision:

  • clarified TLSCertStorePaths wording to use "comma-separated" consistently
  • documented the expected comma-separated env var format in docs/developing.md
  • adjusted the SNI preference test to use a separate cert-store directory from the default cert

Verification:

  • go test ./interceptor/...

@onthebed
Copy link
Copy Markdown
Author

I'll get the CLA signed — will follow up once it's done.

1 similar comment
@onthebed
Copy link
Copy Markdown
Author

I'll get the CLA signed — will follow up once it's done.

Copy link
Copy Markdown
Member

@linkvt linkvt left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, I left two comments about the docs though, would be great if you could update that.

Comment thread docs/developing.md
The `PROFILE` variable selects a test profile directory under `test/e2e/` (e.g. `PROFILE=tls` runs `./test/e2e/tls/...`). Each subdirectory in `test/e2e/` is a profile.
The `RUN` variable filters tests by name using Go's `-run` flag (supports regex, e.g. `RUN=TestColdStart` or `RUN="TestHost|TestPath"`).
The `E2E_ARGS` variable passes flags to the [e2e-framework](https://github.com/kubernetes-sigs/e2e-framework) via `-args` (e.g. `--labels`, `--feature`, `--skip-labels`, `--dry-run`).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We moved the docs a few hours before you opened the PR here, could you move it there? https://keda.sh/http-add-on/0.14/operations/configure-tls/ (See the Suggest changes button)

Comment thread docs/developing.md

### TLS SNI behavior

The interceptor can serve more than one certificate from the TLS listener by setting `KEDA_HTTP_PROXY_TLS_CERT_STORE_PATHS` to a comma-separated list of one or more directories that contain certificate/key pairs. During the TLS handshake it:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should probably include more details about the exact file names we expect/support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify and document TLS SNI support

3 participants