Skip to content

feat: complete bounded TLS client/server streams - #3

Open
Joshua Tenner (jtenner) wants to merge 18 commits into
agent/tls-release-readinessfrom
agent/tls-full-grid
Open

Joshua Tenner (jtenner) wants to merge 18 commits into
agent/tls-release-readinessfrom
agent/tls-full-grid

Conversation

@jtenner

@jtenner jtenner commented Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator

Goal

Complete the bounded standard-Go TLS client/server stream and listener foundation while preserving the existing outbound release-readiness work. HTTP, HTTPS, and a portable TinyGo cryptographic TLS engine are explicitly outside this checkpoint.

This is a stacked draft on top of agent/tls-release-readiness. It must not be merged or described as completing the broader TLS/HTTPS/TinyGo grid.

Published state

  • branch: agent/tls-full-grid
  • head: eddbfa6
  • base: agent/tls-release-readiness at 138411c76158704b80bc4e930acdfa048d8ee9ec
  • draft status intentionally retained
  • hosted CI run 30184215804 passed every required check for head eddbfa6 on July 26, 2026
  • prior complete hosted evidence: run 30179421788 passed every required check for head 634d471 on July 25, 2026

No existing commits were amended, squashed, reordered, force-pushed, or otherwise rewritten.

What changed

  • adds immutable host-defined TLS server profiles with static certificate/private-key ownership, TLS 1.3 defaults, explicit TLS 1.2 opt-in, optional verified client certificates, host-controlled ALPN, deep cloning, and unsafe callback/session/key-log rejection
  • replaces caller-controlled tls.Config.Time callbacks with immutable tls.ValidationTime; nonnil clock callbacks are rejected before profile publication
  • eagerly parses client and server certificate chains, verifies chain linkage and leaf/private-key correspondence, and accepts only standard in-memory RSA, NIST ECDSA, and Ed25519 private keys; delegated/HSM crypto.Signer callbacks are rejected because they cannot be deterministically canceled
  • generalizes the bounded standard-Go three-worker TLS engine to client and server roles
  • restores exact connection_info_v1 compatibility: offset 68 remains a boolean resumed value of exactly 0 or 1
  • adds additive connection_info_v2 role and peer-authentication flags without exposing certificate chains or private keys
  • requires explicit tls.AllowListeners() authority separately from server-profile storage; raw-TCP authority is never implied and applicable raw-TCP denies still constrain private listeners
  • adds namespace, resource, instance, ABI, binding, quota, storage-plan, lifecycle, and policy support for TLS listen/accept
  • expands wago_net_tls to 14 imports: additive connection_info_v2 plus a fixed 32-byte RFC 9266 channel_binding; accepted streams use the bounded handshake, read, write, shutdown, metadata, channel-binding, close, and poll operations
  • preserves the shared namespace-local TCP port collision domain and private TCP ownership
  • adds deterministic live two-namespace lneto integration for server auth and mTLS, ALPN, bidirectional plaintext, queue backpressure, clean two-way close_notify, abrupt truncation, listener reuse, quota/lease release, close/accept races, and namespace teardown
  • proves immutable static SNI certificate selection and drain-close-relisten certificate rotation with a changed peer SPKI; already accepted streams retain their profile snapshot
  • documents that closing a pinned lneto listener aborts undrained accepted streams; zero-downtime same-port handoff is not claimed
  • fixes the hosted ordinary-Go timeout from Actions run 29757140541, job 88402308965, by pumping the final TLS 1.3 client flight before waiting for the peer handshake
  • hardens deep TLS certificate cloning and finite DHCPv4 server lease expiration
  • bounds every TinyGo-supported package with a ten-minute watchdog and one timeout-only retry, with a regression proving a wedged package cannot consume the six-hour hosted-job limit
  • adds opt-in bounded per-instance client session resumption with exact entry/serialized-byte limits, LRU eviction, quota reservation, deterministic clearing, and 0-RTT forced off
  • adds opt-in stateless server session tickets with one to four explicit ordered keys, including tested [new, old] to [new] rotation
  • exposes only the fixed RFC 9266 tls-exporter channel binding; exporter label, context, and length are not guest-selectable
  • caches successful private-transport establishment instead of re-running TryFinishConnect after TLS has started; this preserves abrupt EOF for crypto/tls truncation classification rather than allowing a retired TCP stream to surface a later connection-refused result

Commits added in this completion pass

  • ba8b247 — fix: flush the final TLS client handshake flight
  • 0a29624 — fix: preserve TLS connection info v1 ABI
  • f5184e6 — feat: require explicit TLS listener authority
  • beac180 — test: exercise live TLS client server lifecycle
  • 0acb287 — docs: record TLS server foundation evidence
  • d1e87c7 — test: preserve TLS metadata output atomicity
  • a99aa77 — docs: record final TLS signoff target count
  • e40fb5e — fix: harden TLS cloning and DHCP leases
  • 27a766f — ci: bound TinyGo package hangs
  • 2f9c2e5 — feat: add bounded TLS session resumption
  • 634d471 — feat: expose fixed TLS channel binding
  • 1d0ebcc — fix: bound TLS profile callbacks
  • 530b011 — test: certify bounded TLS certificate rotation
  • 06b2514 — fix: retain established TLS transport state
  • eddbfa6 — docs: describe bidirectional TLS authority

The earlier PR commits 35b2fcf and 52c9d8d remain unchanged and in their original order.

Local validation

Passed on the current head:

  • go test ./...
  • go test -shuffle=on -count=1 ./...
  • focused TLS race suites for the engine, lneto adapter, bindings, instance layer, and public registration
  • 500 consecutive live lneto TLS lifecycle/truncation runs
  • go vet ./...
  • source-boundary, shell-syntax, and diff checks
  • 17 TLS signoff package profiles resolving 164 named tests
  • TinyGo root composition and internal/namespace/tls targeted tests; the exact five real-TLS packages remain standard-Go-only
  • linux/386 internal/backend/gotls and internal/backend/lneto/tls; the public TLS package remains blocked only by the accepted pinned-Wago runtime.HostCtrlFrameBytes diagnostic
  • linux/arm64 cross-compilation for the standard-Go TLS engine and public TLS registration binaries
  • standard-library interoperability proving full TLS 1.3, resumed handshakes across ticket-key rotation, equal RFC 9266 channel bindings on both peers, static SNI selection, and certificate rotation snapshot behavior

Current hosted run 30184215804 completed the full exact 123-package TinyGo-supported matrix in 37m39s and passed custom test/shuffle/vet/source-boundary, race, standard-Go TLS signoff, and checkptr/386 jobs. Prior retained evidence also covers custom CLI inspection and the four-binary arm64 cross-build.

Hosted CI note

Run 30183264224 on intermediate head 530b011 found one shuffle-only lifecycle race: after the raw TCP peer half-closed without TLS close_notify, a later TryFinishConnect recheck could observe the retired TCP stream before the TLS engine consumed EOF, returning connection-refused instead of TLS protocol truncation. Commit 06b2514 caches the successful transport-establishment transition, adds client/server regression transports that fail any second finish-connect call, passes focused race tests, and passes 500 consecutive live truncation runs. Replacement run 30184215804 passed every required check after the follow-up comment-only authority correction in eddbfa6.

Explicitly incomplete

  • no HTTP request/response API
  • no HTTPS client or server API
  • no portable TinyGo TLS client/server cryptographic engine
  • no 0-RTT, STARTTLS/existing-handle transfer, DTLS, or QUIC transport surface
  • no arbitrary guest exporter labels, dynamic verification/certificate callbacks, delegated/HSM signers, caller clock callbacks, or live mutation of immutable profiles
  • no executed arm64 evidence
  • no strict release adoption or provenance/review-bundle result while the current Wago topology audit remains blocked

TLS remains granular-only and outside aggregate register. No insecure TinyGo stub, plaintext shim, or device-offload-only substitution is included or claimed.

2026-11-02 restack

Rebased onto PR #2 head dd08034bb40e8acf5682450eceda9ad15332f35d; current head is 8b9c9445b08eb510788199d40285f9c971014505. The TLS import/inspection path is ported to the current Wago plugin runtime and Wago 90f2b57dafa7f8c3cc7e3aca38b91148f15e1d1e. Current TLS signoff resolves 164 targets across 17 package runs. Full ordinary, shuffle, vet, source-boundary, race, checkptr, backend-neutral 386, wagodebug, wago_regalloccheck, and three-mode benchmark-compilation gates passed locally. A local TinyGo 0.43.0/Go 1.27.3 run proved real progress past the prior 90-second stop: the root aggregate and the first ten additional supported packages passed before the non-authoritative run was ended to continue restacking; exact hosted TinyGo 0.41.1/Go 1.24.4 evidence remains CI-owned. July benchmark results remain historical; no benchmark timing was executed during this restack. Rewritten commits are unsigned because no desktop signing agent was available.

@jtenner Joshua Tenner (jtenner) changed the title feat: add bounded TLS server foundations feat: complete bounded TLS client/server streams Jul 20, 2026
@jtenner
Joshua Tenner (jtenner) marked this pull request as ready for review November 7, 2026 16:55
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T16:57:25.873859Z 8b9c944 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-07T17:03:02.628025Z 8b9c944 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b9c9445b0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread tls/tls.go
Comment on lines +281 to +284
if uint64(profile.maxClientSessionBytes) > MaximumAggregateRetainedBytes-sessionBytes {
return nil, ErrInvalidProfile
}
sessionBytes += uint64(profile.maxClientSessionBytes)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include stream storage in the aggregate session-cache bound

When session resumption is enabled on multiple profiles, this check allows the caches alone to reserve the entire 64 MiB aggregate retention budget without accounting for stream and listener storage. For example, sixteen profiles with 4 MiB caches pass this check alongside the default stream configuration, although their combined retention exceeds MaximumAggregateRetainedBytes. The backend repeats the separate cache-only and stream-only checks, so it does not reject this configuration either. Validate the checked sum of cache capacities and the storage plan's TotalBytes against the aggregate ceiling.

Useful? React with 👍 / 👎.

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.

1 participant