Skip to content

Add TLS listener config and SPIFFE X.509 authority capability - #6760

Merged
jhrozek merged 1 commit into
mainfrom
spiffe-v2-02-tls-listener-core
Oct 15, 2026
Merged

jhrozek merged 1 commit into
mainfrom
spiffe-v2-02-tls-listener-core

Conversation

@jhrozek

@jhrozek jhrozek commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • SPIFFE X.509-SVID client authentication needs the client certificate from a TLS handshake, and the auth server's routes cannot see it over plain HTTP. This adds the groundwork: the RunConfig shape for a dedicated auth server TLS listener (cert and key file paths), and the SPIFFE bundle source wired into server construction.
  • The bundle source feeds the existing, currently unpopulated SPIFFEX509BundleSource / SPIFFEJWTBundleSource dispatch fields, so the listener will have real trust anchors to hint at handshake time once it is wired in.
  • Adds HasSPIFFEX509ClientAuth, so later validation and wiring can check whether any association needs the listener without repeating the association scan.
  • RunConfig.Validate() still hard-rejects any non-empty spiffe_trust_domains (validateSPIFFENotYetEnforced). No code verifies a presented X.509-SVID against the bundle yet, so that gate stays until the verification strategy lands.

Part of #6199. Related: #6202.

Stacked on #6759. The base is spiffe-v2-01-bundle-file-source, so the diff shows only this change. Retarget to main once that PR merges.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

Built and vetted this commit (task build, go vet on pkg/authserver and cmd/thv-operator). task gen and task docs leave no diff. New config and server tests are in the diff and run in CI.

Does this introduce a user-facing change?

No. Configuring SPIFFE trust domains is still rejected at startup.

Special notes for reviewers

  • About 250 of the added lines are non-generated Go and tests. The remainder is generated swagger and SDK output.
  • The listener itself is not started here. Runner and operator wiring come in later PRs of the stack.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the size/M Medium PR: 300-599 lines changed label Oct 7, 2026
@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.83333% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.63%. Comparing base (14c6066) to head (3aa1109).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
pkg/authserver/server_impl.go 59.37% 13 Missing ⚠️
pkg/authserver/server.go 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6760      +/-   ##
==========================================
+ Coverage   79.62%   79.63%   +0.01%     
==========================================
  Files         815      816       +1     
  Lines       82955    83168     +213     
==========================================
+ Hits        66056    66234     +178     
- Misses      16894    16929      +35     
  Partials        5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jhrozek
jhrozek force-pushed the spiffe-v2-01-bundle-file-source branch from 351e5b5 to 38b57a1 Compare October 7, 2026 19:06
@jhrozek
jhrozek force-pushed the spiffe-v2-02-tls-listener-core branch from 639e78a to 9a5e056 Compare October 7, 2026 19:06
@github-actions github-actions Bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Oct 7, 2026
@jhrozek
jhrozek force-pushed the spiffe-v2-02-tls-listener-core branch from 9a5e056 to 9420b4d Compare October 7, 2026 19:48
@jhrozek
jhrozek force-pushed the spiffe-v2-01-bundle-file-source branch from 38b57a1 to 3ef4f21 Compare October 7, 2026 19:48
@github-actions github-actions Bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Oct 7, 2026
@jhrozek
jhrozek force-pushed the spiffe-v2-01-bundle-file-source branch from 3ef4f21 to c703e55 Compare October 7, 2026 20:08
@jhrozek
jhrozek force-pushed the spiffe-v2-02-tls-listener-core branch from 9420b4d to 2080af6 Compare October 7, 2026 20:08
@github-actions github-actions Bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Oct 7, 2026

@ChrisJBurns ChrisJBurns left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Multi-agent consensus review

The bundle-source wiring and lifecycle handling look solid overall. I found one behavioral issue and one documentation mismatch that should be addressed before this stack is treated as providing the described capability.

Finding Consensus Severity
Do not accept a TLS listener configuration that is ignored 9/10 Medium
Update the SPIFFE architecture docs for the wiring added here 10/10 Low

[Low] Update the SPIFFE architecture docs for the wiring added here (Consensus: 10/10)

docs/arch/18-spiffe-association-declarations.md still says that the file-bundle loader is isolated and that newServer does not wire a JWT bundle source. This PR now constructs the source and passes both the X.509 and JWT sources into the authorization server, so those statements are stale in the resulting stacked branch. The related summaries in docs/arch/09-operator-architecture.md and docs/arch/README.md make the same claim.

Please update the docs to distinguish the source wiring added here from what remains unavailable: startup validation still rejects SPIFFE configuration, and the TLS listener/X.509 verification path is not yet implemented.

Raised by: architecture/operator review

Comment thread pkg/authserver/config.go Outdated
@jhrozek
jhrozek force-pushed the spiffe-v2-01-bundle-file-source branch from c703e55 to c9a00f2 Compare October 13, 2026 08:53
@jhrozek
jhrozek requested review from blkt and jerm-dro as code owners October 13, 2026 08:53
@jhrozek
jhrozek force-pushed the spiffe-v2-01-bundle-file-source branch from c9a00f2 to 0e4e08b Compare October 13, 2026 09:49
Base automatically changed from spiffe-v2-01-bundle-file-source to main October 14, 2026 13:49
@jhrozek
jhrozek force-pushed the spiffe-v2-02-tls-listener-core branch from 2080af6 to a15864a Compare October 15, 2026 12:04
@github-actions github-actions Bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Oct 15, 2026
JAORMX
JAORMX previously approved these changes Oct 15, 2026

@JAORMX JAORMX left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed a15864a with a four-perspective panel covering authentication/security, lifecycle, operator/API compatibility, and SDK/test contracts. No remaining merge-blocking defect found in this gated groundwork change. The previous ignored-TLS-setting issue is fixed: every non-nil listener configuration now fails explicitly, and both SPIFFE startup gates remain intact. Source ownership, cleanup, nil-interface handling, and the optional authority capability look sound.

Two nonblocking suggestions are attached inline: regenerate the stale TLS documentation/SDK descriptions and strengthen boundary/lifecycle regression coverage. CI now confirms the documentation drift: Docs / Verify Swagger Documentation fails on the old TLSListener description. This is reported separately from the code approval; other checks are still running.

Separate enablement follow-up, not introduced by this PR: the existing file loader rejects valid empty revocation bundles and retains previous authorities. That loader is unchanged from the merge base and remains gated, but its revocation behavior should be corrected before SPIFFE is enabled.

No local tests or linters were run; verification used source inspection and published CI.

Comment thread docs/server/swagger.yaml
Comment thread pkg/authserver/server_impl.go
SPIFFE X.509-SVID client authentication needs the client certificate
from a TLS handshake, which the auth server's routes cannot see over
plain HTTP. Introduce the RunConfig shape for a dedicated auth server
TLS listener (cert/key file paths) and give the server construction
its SPIFFE bundle source, so a way to read the current SPIFFE X.509
trust anchors exists ahead of wiring the listener itself into the
runner and operator.

The bundle source is wired into server construction now (feeding the
existing, currently-unpopulated SPIFFEX509BundleSource/
SPIFFEJWTBundleSource dispatch fields) so the listener has real
authorities to hint at TLS handshake time. RunConfig.Validate still
hard-rejects any non-empty spiffe_trust_domains
(validateSPIFFENotYetEnforced): no code yet verifies a presented
X.509-SVID against this bundle, so that gate stays in place until the
verification strategy lands.

HasSPIFFEX509ClientAuth also lets later validation and wiring code
check, without duplicating the association scan, whether any
configured association actually needs the listener.
@jhrozek
jhrozek force-pushed the spiffe-v2-02-tls-listener-core branch from a15864a to 3aa1109 Compare October 15, 2026 13:41
@github-actions github-actions Bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Oct 15, 2026
@jhrozek
jhrozek merged commit 107c4a9 into main Oct 15, 2026
51 checks passed
@jhrozek
jhrozek deleted the spiffe-v2-02-tls-listener-core branch October 15, 2026 14:34
@github-actions github-actions Bot mentioned this pull request Oct 19, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Medium PR: 300-599 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants