Skip to content

feat: authenticate verified TCP peers with TLS - #7

Merged
seonghobae merged 102 commits into
mainfrom
feat/tls-server-identity
Aug 7, 2026
Merged

feat: authenticate verified TCP peers with TLS#7
seonghobae merged 102 commits into
mainfrom
feat/tls-server-identity

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Buyer-visible problem

OriginWeave can prove that a policy-approved address became the exact operating-system TCP peer, but TCP peer equality does not authenticate the requested HTTPS service. A trusted identity boundary must reject untrusted, expired, future-dated, wrong-name, malformed, or protocol-incompatible peers without reconnecting or weakening WebPKI.

Implemented vertical slice

  • independently reusable originweave-tls crate;
  • rustls 0.23.42 with explicit roots, fixed trusted time, TLS 1.2/1.3, no resumption, no early data, no key logging, no client authentication, and no dangerous verifier;
  • one-shot handshake over an existing DirectTcpConnection with no reconnect, DNS, proxy, PAC, HTTP, or Chromium authority;
  • RFC 9525 DNS and literal-IP service identity with DNS/IP type preservation and no Common Name fallback;
  • a hard total monotonic handshake deadline enforced before and after every TLS I/O operation, with restoration of inherited socket timeouts;
  • bounded ALPN inputs, trust roots, and presented-certificate evidence;
  • exact TCP peer revalidation before, during, and after the handshake;
  • credential-free certificate, SPKI, protocol, cipher-suite, trust-bundle, revocation-configuration, and timing evidence;
  • deterministic public error and source semantics;
  • real loopback TLS integration for valid DNS/IP SANs, wrong-name, Common Name fallback, untrusted, expired, future-dated, TLS 1.2/1.3, required/optional ALPN, origin mismatch, exact-stream binding, and an already elapsed total deadline;
  • ADR, architecture, roadmap, CHANGELOG, quality gates, and APA 7th doctoring.

Exact-head verification

Verified at head 732c85afffc5328270bdac18ea28a008f60f6ecd:

  • CI / Rust contracts: success, including repository contracts, formatting, locked workspace checks, all tests, strict Clippy, and rustdoc warnings-as-errors;
  • CI / Production coverage: success with exact 100% production function, line, region, and branch gates;
  • Security Scan: success;
  • SAST Semgrep: success;
  • CodeRabbit commit status: success;
  • no unresolved review threads.

Standards and evidence

The implementation and doctoring records are grounded in RFC 5280, RFC 9525, RFC 9846, rustls primary documentation, and the repository's authority-boundary threat model. References are recorded in APA 7th form in docs/doctoring.md and ADR 0006.

Out of scope

HTTP request/response parsing, proxy/PAC, QUIC/HTTP3, system trust discovery, OCSP/CRL fetching, client certificates, ECH, Chromium Network Service integration, downloads, MIME validation, and connection pooling remain separate independently reviewable slices.

Closes #6

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 26 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dcaf39f9-57db-4903-b7af-5e4e7a7cf957

📥 Commits

Reviewing files that changed from the base of the PR and between 80708c7 and 732c85a.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (30)
  • .github/workflows/ci.yml
  • AGENTS.md
  • ARCHITECTURE.md
  • CHANGELOG.md
  • CLAUDE.md
  • Cargo.toml
  • README.md
  • crates/originweave-core/src/lib.rs
  • crates/originweave-core/tests/contracts.rs
  • crates/originweave-tls/Cargo.toml
  • crates/originweave-tls/src/error.rs
  • crates/originweave-tls/src/evidence.rs
  • crates/originweave-tls/src/handshake.rs
  • crates/originweave-tls/src/identity.rs
  • crates/originweave-tls/src/lib.rs
  • crates/originweave-tls/src/policy.rs
  • crates/originweave-tls/src/trust.rs
  • crates/originweave-tls/tests/error_contract.rs
  • crates/originweave-tls/tests/handshake_deadline.rs
  • crates/originweave-tls/tests/handshake_integration.rs
  • crates/originweave-tls/tests/policy_contract.rs
  • docs/README.md
  • docs/adr/0006-tls-server-identity.md
  • docs/doctoring.md
  • docs/product-roadmap.md
  • docs/quality-gates.md
  • docs/superpowers/plans/2026-08-06-tls-server-identity.md
  • docs/superpowers/specs/2026-08-06-tls-server-identity-design.md
  • tests/test_repository_contract.py
  • tests/test_tls_governance.py

Comment @coderabbitai help to get the list of available commands.

Comment thread .github/workflows/bootstrap-tls-compile.yml Fixed
@seonghobae
seonghobae marked this pull request as ready for review August 7, 2026 05:47

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review the exact current head 732c85afffc5328270bdac18ea28a008f60f6ecd, including the hard total TLS handshake deadline, DNS/IP reference-identity type preservation, exact peer binding, fail-closed error mapping, and exact 100% production coverage evidence.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

@seonghobae I will review exact head 732c85afffc5328270bdac18ea28a008f60f6ecd. I will examine the requested TLS security boundaries and the reported 100% production coverage evidence.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor Author

@cwl-noema-review @opencode-agent

Please perform an independent exact-head review of 732c85afffc5328270bdac18ea28a008f60f6ecd. Validate the TLS authority boundary, hard total handshake deadline, DNS/IP identity type preservation, no-reconnect invariant, peer binding, typed evidence/errors, least-privilege workflow changes, and exact 100% production coverage. Do not approve or reuse evidence from any other head.

@seonghobae
seonghobae merged commit b228693 into main Aug 7, 2026
28 checks passed

Copy link
Copy Markdown
Contributor Author

/oc

Continue from the exact current head and inspect the latest function/line/region/branch coverage artifact before editing. Close every remaining production TLS path with tests first: handshake write-zero/read-EOF/no-progress/deadline/no-wants arcs; peer inspection and inherited peer mismatch; unsupported protocol, unoffered ALPN, trailing leaf DER; empty/excessive certificate bounds; optional no-application-protocol classification; and the required-empty-ALPN policy branch. Use only a narrow private deterministic test seam where concrete rustls/TcpStream state makes an error path unreachable. Preserve WebPKI, explicit roots/time, TLS 1.2/1.3, exact existing TCP peer, no reconnect/DNS, bounded certificate/ALPN/deadline inputs, credential-free evidence, and public API. Remove measurement/branch-writer workflows and generated diagnostic artifacts from the final tree. Run format, locked check, all tests, strict Clippy, rustdoc warnings-as-errors, exact nightly 100% function/line/region/branch coverage, Security Scan, and SAST. Resolve only addressed threads and keep Draft until the workflow-free exact head is fully green. Do not merge or bypass protection.

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.

[Product Gap] Bind TLS server identity to the verified TCP peer

2 participants